-
Notifications
You must be signed in to change notification settings - Fork 810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] TravisCI: fix and improve MacOS build #353
Changes from all commits
c56aa62
17b67f5
9cd990b
33e6182
c73fe25
9f7d22f
da3131f
6d16e03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,9 +79,25 @@ matrix: | |
env: | ||
- PX4_DOCKER_REPO=px4io/px4-dev-simulation-bionic:2019-10-04 | ||
- BUILD="source ./scripts/validate_sdf.bash" | ||
- name: MacOSX 10.14 (Xcode 11.0) build with Gazebo 9 | ||
- name: MacOSX Sierra (Xcode 9.2) build with Gazebo 7 | ||
os: osx | ||
osx_image: xcode11 | ||
osx_image: xcode9.2 | ||
language: cpp | ||
cache: | ||
ccache: true | ||
env: | ||
- GAZEBO_VERSION="gazebo7" | ||
- name: MacOSX High Sierra (Xcode 10.1) build with Gazebo 9 | ||
os: osx | ||
osx_image: xcode10.1 | ||
language: cpp | ||
cache: | ||
ccache: true | ||
env: | ||
- GAZEBO_VERSION="gazebo9" | ||
- name: MacOSX Mojave (Xcode 11.2) build with Gazebo 9 | ||
os: osx | ||
osx_image: xcode11.2 | ||
language: cpp | ||
cache: | ||
ccache: true | ||
|
@@ -90,40 +106,49 @@ matrix: | |
|
||
before_install: | ||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then | ||
brew update; | ||
curl https://gstreamer.freedesktop.org/data/pkg/osx/1.0.10/gstreamer-1.0-1.0.10-universal.pkg -LO /tmp/gstreamer-1.0-1.0.10-universal.pkg; | ||
curl https://gstreamer.freedesktop.org/data/pkg/osx/1.0.10/gstreamer-1.0-devel-1.0.10-universal.pkg -LO /tmp/gstreamer-1.0-devel-1.0.10-universal.pkg; | ||
git clone --depth 1 https://github.com/mavlink/c_library_v2.git /usr/local/include/mavlink/v2.0; | ||
rm -rf /usr/local/include/mavlink/v2.0/.git; | ||
git clone https://github.com/google/googletest; | ||
pushd googletest; | ||
mkdir build; | ||
pushd build; | ||
cmake ..; | ||
make; | ||
make install; | ||
popd; | ||
popd; | ||
brew update; | ||
git clone https://github.com/google/googletest; | ||
git clone --depth 1 https://github.com/mavlink/c_library_v2.git /usr/local/include/mavlink/v2.0; | ||
curl https://gstreamer.freedesktop.org/data/pkg/osx/1.0.10/gstreamer-1.0-1.0.10-universal.pkg -vlo gstreamer-1.0-1.0.10-universal.pkg; | ||
curl https://gstreamer.freedesktop.org/data/pkg/osx/1.0.10/gstreamer-1.0-devel-1.0.10-universal.pkg -vlo gstreamer-1.0-devel-1.0.10-universal.pkg; | ||
fi | ||
|
||
install: | ||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then | ||
brew tap PX4/px4; | ||
brew install px4-dev pkg-config; | ||
installer -allowUntrusted -verboseR -pkg /tmp/gstreamer-1.0-1.0.10-universal.pkg -target /; | ||
installer -allowUntrusted -verboseR -pkg /tmp/gstreamer-1.0-devel-1.0.10-universal.pkg -target /; | ||
export PKG_CONFIG_PATH="/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"; | ||
brew tap osrf/simulation; | ||
brew install opencv ${GAZEBO_VERSION}; | ||
brew cask reinstall xquartz java; | ||
sudo -H pip2 install --upgrade pip setuptools; | ||
sudo -H pip2 install rospkg pyserial empy toml numpy pandas jinja2; | ||
sudo -H pip2 install --upgrade --force-reinstall numpy; | ||
pushd googletest; | ||
mkdir build; | ||
pushd build; | ||
cmake ..; | ||
make; | ||
make install; | ||
popd; | ||
popd; | ||
brew tap PX4/px4; | ||
brew install px4-dev; | ||
brew tap osrf/simulation; | ||
brew install opencv ${GAZEBO_VERSION}; | ||
sudo -H pip2 install --upgrade pip setuptools; | ||
sudo -H pip2 install rospkg pyserial empy toml numpy pandas jinja2; | ||
sudo installer -allowUntrusted -verboseR -pkg gstreamer-1.0-1.0.10-universal.pkg -target /; | ||
sudo installer -allowUntrusted -verboseR -pkg gstreamer-1.0-devel-1.0.10-universal.pkg -target /; | ||
fi | ||
|
||
after_install: | ||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then | ||
brew cleanup; | ||
rm -rf /usr/local/include/mavlink/v2.0/.git googletest/.git; | ||
rm gstreamer-1.0-1.0.10-universal.pkg gstreamer-1.0-devel-1.0.10-universal.pkg; | ||
fi | ||
|
||
before_script: | ||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then | ||
export PKG_CONFIG_PATH="/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"; | ||
fi | ||
|
||
script: | ||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then | ||
mkdir Build; | ||
cd Build && cmake -DENABLE_UNIT_TESTS=On .. && make -j$(sysctl -n hw.physicalcpu) -l$(sysctl -n hw.physicalcpu); make test; | ||
else docker run -it --rm -w ${TRAVIS_BUILD_DIR} --env=CCACHE_DIR="${CCACHE_DIR}" --volume=${CCACHE_DIR}:${CCACHE_DIR}:rw --volume=${TRAVIS_BUILD_DIR}:${TRAVIS_BUILD_DIR}:rw ${PX4_DOCKER_REPO} /bin/bash -e -c "${BUILD}"; | ||
mkdir Build; | ||
cd Build && cmake -DENABLE_UNIT_TESTS=On .. && make -j$(sysctl -n hw.physicalcpu) -l$(sysctl -n hw.physicalcpu); make test; | ||
else | ||
docker run -it --rm -w ${TRAVIS_BUILD_DIR} --env=CCACHE_DIR="${CCACHE_DIR}" --volume=${CCACHE_DIR}:${CCACHE_DIR}:rw --volume=${TRAVIS_BUILD_DIR}:${TRAVIS_BUILD_DIR}:rw ${PX4_DOCKER_REPO} /bin/bash -e -c "${BUILD}"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @TSC21 what do we use docker for here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To build on the Linux distros. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But that's inside the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, there is the else 🙈 |
||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR) | |
cmake_policy(SET CMP0042 NEW) | ||
cmake_policy(SET CMP0048 NEW) | ||
cmake_policy(SET CMP0054 NEW) | ||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0") | ||
cmake_policy(SET CMP0071 NEW) | ||
endif() | ||
|
||
if (NOT CMAKE_INSTALL_PREFIX) | ||
set(CMAKE_INSTALL_PREFIX "/usr" CACHE STRING "install prefix" FORCE) | ||
|
@@ -37,16 +40,30 @@ find_program(px4 REQUIRED) | |
find_package(PythonInterp REQUIRED) | ||
find_package(OpenCV REQUIRED) | ||
find_package(TinyXML REQUIRED) | ||
if (BUILD_GSTREAMER_PLUGIN) | ||
if(BUILD_GSTREAMER_PLUGIN) | ||
set(GStreamer_FIND_VERSION "1.0") | ||
find_package(GStreamer) | ||
if (GSTREAMER_FOUND) | ||
find_package(GStreamer REQUIRED) | ||
if(GSTREAMER_FOUND) | ||
# Set AUTOMOC, AUTOGEN and AUTOUIC | ||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTOGEN ON) | ||
set(CMAKE_AUTOUIC ON) | ||
if("${GAZEBO_VERSION}" VERSION_LESS "8.0") | ||
find_package (Qt4) | ||
include (${QT_USE_FILE}) | ||
find_package(Qt4) | ||
include(${QT_USE_FILE}) | ||
else() | ||
find_package(Qt5Widgets REQUIRED) | ||
find_package(Qt5Core REQUIRED) | ||
# In order to have Qt5 found in MacOS/MacOSX, the Qt5 path needs to be | ||
# added to the CMake prefix path | ||
if(APPLE) | ||
execute_process(COMMAND export Qt5_DIR=$(brew --prefix qt5)) | ||
execute_process(COMMAND brew --prefix qt5 | ||
ERROR_QUIET | ||
OUTPUT_VARIABLE QT5_PREFIX_PATH | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, actually this one is nicer than my solution. |
||
) | ||
list(APPEND CMAKE_PREFIX_PATH "${QT5_PREFIX_PATH}") | ||
else() | ||
find_package(Qt5 COMPONENTS Core Widgets REQUIRED) | ||
endif() | ||
endif() | ||
endif() | ||
endif() | ||
|
@@ -365,25 +382,23 @@ if (GSTREAMER_FOUND) | |
${plugins} | ||
gazebo_gst_camera_plugin | ||
) | ||
message(STATUS "Found GStreamer: adding gst_camera_plugin") | ||
message(STATUS "Adding gst_camera_plugin") | ||
if("${GAZEBO_VERSION}" VERSION_LESS "8.0") | ||
QT4_WRAP_CPP(headers_MOC include/gazebo_video_stream_widget.h) | ||
add_library(gazebo_video_stream_widget SHARED ${headers_MOC} src/gazebo_video_stream_widget.cpp) | ||
target_link_libraries(gazebo_video_stream_widget ${GAZEBO_LIBRARIES} ${QT_LIBRARIES} ${PROTOBUF_LIBRARIES}) | ||
set(plugins | ||
${plugins} | ||
gazebo_video_stream_widget | ||
) | ||
message(STATUS "Found GStreamer: adding gst_video_stream_widget") | ||
message(STATUS "Adding gst_video_stream_widget") | ||
else() | ||
QT5_WRAP_CPP(headers_MOC include/gazebo_video_stream_widget.h) | ||
add_library(gazebo_video_stream_widget SHARED ${headers_MOC} src/gazebo_video_stream_widget.cpp) | ||
target_link_libraries(gazebo_video_stream_widget ${GAZEBO_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${PROTOBUF_LIBRARIES} ${Qt5Test_LIBRARIES}) | ||
set(plugins | ||
${plugins} | ||
gazebo_video_stream_widget | ||
) | ||
message(STATUS "Found GStreamer: adding gst_video_stream_widget") | ||
message(STATUS "Adding gst_video_stream_widget") | ||
endif() | ||
endif() | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would drop this version. Supporting 2 and with Catalina 3 is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am adding this one so we can have a build pipe for Gazebo 7 also in MacOSX.