From 529947bdc805f587faa0167ad61b705bcd2cac0a Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 14 Oct 2019 10:48:16 +0200 Subject: [PATCH 1/9] cmake: fix GStreamer and Qt deps for macOS --- CMakeLists.txt | 27 ++++++++++++++++++++++----- cmake/FindGStreamer.cmake | 15 --------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d7e854a86..c2198cf970 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,8 +16,6 @@ include(GNUInstallDirs) ## Find Dependencies ## ####################### -# Add search directory for CMake on OS X -list(APPEND CMAKE_MODULE_PATH /usr/local/share/cmake/Modules) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") option(BUILD_GSTREAMER_PLUGIN "enable gstreamer plugin" ON) @@ -39,14 +37,33 @@ find_package(OpenCV REQUIRED) find_package(TinyXML REQUIRED) if (BUILD_GSTREAMER_PLUGIN) set(GStreamer_FIND_VERSION "1.0") - find_package(GStreamer) + find_package(GStreamer REQUIRED) if (GSTREAMER_FOUND) if("${GAZEBO_VERSION}" VERSION_LESS "8.0") find_package (Qt4) include (${QT_USE_FILE}) else() - find_package(Qt5Widgets REQUIRED) - find_package(Qt5Core REQUIRED) + if (APPLE) + # We need to find the path of the Qt libs and cmake config installed by brew, + # e.g. /usr/local/Cellar/qt/5.13.1/lib/cmake/Qt5Core + execute_process(COMMAND /usr/local/opt/qt/bin/qtpaths --install-prefix + OUTPUT_VARIABLE qt_install_path + OUTPUT_STRIP_TRAILING_WHITESPACE) + message(STATUS "QT install path: ${qt_install_path}") + find_package(Qt5Core + CONFIG + PATHS "${qt_install_path}/lib/cmake/Qt5Core" + NO_DEFAULT_PATH + REQUIRED) + find_package(Qt5Widgets + CONFIG + PATHS ${qt_install_path}/lib/cmake/Qt5Widgets + NO_DEFAULT_PATH + REQUIRED) + else() + find_package(Qt5Core REQUIRED) + find_package(Qt5Widgets REQUIRED) + endif() endif() endif() endif() diff --git a/cmake/FindGStreamer.cmake b/cmake/FindGStreamer.cmake index 37cf43ab06..a9d4e23a6e 100644 --- a/cmake/FindGStreamer.cmake +++ b/cmake/FindGStreamer.cmake @@ -48,19 +48,6 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -if (APPLE) - find_library(GSTREAMER NAMES GStreamer) - if (NOT GSTREAMER) - message(FATAL_ERROR "GStreamer not found") - else() - message(STATUS "GStreamer found") - endif() - - SET(GSTREAMER_INCLUDE_DIRS ${GSTREAMER}/Headers) - SET(GSTREAMER_LIBRARIES "-framework GStreamer") - SET(GSTREAMER_FOUND true) - -else() find_package(PkgConfig) @@ -143,5 +130,3 @@ mark_as_advanced( GSTREAMER_VIDEO_INCLUDE_DIRS GSTREAMER_VIDEO_LIBRARIES ) - -endif() From cd1041425bf8e4cf96547c99930bfd9dd96380e9 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 14 Oct 2019 10:48:46 +0200 Subject: [PATCH 2/9] cmake: link to glib-2.0 and gobject-2.0 This is needed in the video streaming plugin. This needs to be made explicit on macOS. --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2198cf970..2b6190febe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,6 +193,8 @@ link_libraries( if (GSTREAMER_FOUND) link_libraries( ${GSTREAMER_LIBRARIES} + glib-2.0 + gobject-2.0 ) endif() From 059649af0162be1bdd800129a77c980679ba07b1 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 14 Oct 2019 11:09:37 +0200 Subject: [PATCH 3/9] travis: install GStreamer using brew --- .travis.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6cfc3ad567..a436e0f706 100644 --- a/.travis.yml +++ b/.travis.yml @@ -91,8 +91,6 @@ 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; @@ -109,10 +107,7 @@ before_install: 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 install px4-dev pkg-config gstreamer gst-plugins-base gst-plugins-good glib; brew tap osrf/simulation; brew install opencv ${GAZEBO_VERSION}; brew cask reinstall xquartz java; From 07f76b5e7bd2e6810e3c3d64931befd2db82daac Mon Sep 17 00:00:00 2001 From: TSC21 Date: Sun, 6 Oct 2019 00:10:16 +0100 Subject: [PATCH 4/9] CMake: fix Qt5 find in MacOS --- CMakeLists.txt | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b6190febe..c899770f97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,27 +43,15 @@ if (BUILD_GSTREAMER_PLUGIN) find_package (Qt4) include (${QT_USE_FILE}) else() - if (APPLE) - # We need to find the path of the Qt libs and cmake config installed by brew, - # e.g. /usr/local/Cellar/qt/5.13.1/lib/cmake/Qt5Core - execute_process(COMMAND /usr/local/opt/qt/bin/qtpaths --install-prefix - OUTPUT_VARIABLE qt_install_path - OUTPUT_STRIP_TRAILING_WHITESPACE) - message(STATUS "QT install path: ${qt_install_path}") - find_package(Qt5Core - CONFIG - PATHS "${qt_install_path}/lib/cmake/Qt5Core" - NO_DEFAULT_PATH - REQUIRED) - find_package(Qt5Widgets - CONFIG - PATHS ${qt_install_path}/lib/cmake/Qt5Widgets - NO_DEFAULT_PATH - REQUIRED) - else() - find_package(Qt5Core REQUIRED) - find_package(Qt5Widgets REQUIRED) + # In order to find Qt5 in macOS, the Qt5 path needs to be added to the CMake prefix path. + if(APPLE) + execute_process(COMMAND brew --prefix qt5 + ERROR_QUIET + OUTPUT_VARIABLE QT5_PREFIX_PATH + ) + list(APPEND CMAKE_PREFIX_PATH "${QT5_PREFIX_PATH}") endif() + find_package(Qt5 COMPONENTS Core Widgets REQUIRED) endif() endif() endif() From 086254e0ea4295703c8bb94cd326ba7ccfc93451 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 21 Oct 2019 13:57:08 +0200 Subject: [PATCH 5/9] cmake: fix Qt prefix path for macOS --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c899770f97..83ac544712 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,8 +48,9 @@ if (BUILD_GSTREAMER_PLUGIN) execute_process(COMMAND brew --prefix qt5 ERROR_QUIET OUTPUT_VARIABLE QT5_PREFIX_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE ) - list(APPEND CMAKE_PREFIX_PATH "${QT5_PREFIX_PATH}") + list(APPEND CMAKE_PREFIX_PATH "${QT5_PREFIX_PATH}/lib/cmake") endif() find_package(Qt5 COMPONENTS Core Widgets REQUIRED) endif() From 7814f38215c795bc08d62be952dcb61b8ac87046 Mon Sep 17 00:00:00 2001 From: TSC21 Date: Fri, 11 Oct 2019 13:18:37 +0100 Subject: [PATCH 6/9] Travis CI: Cleanup scripts and add more MacOSX build pipelines --- .travis.yml | 82 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index a436e0f706..af76985c1a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,11 @@ env: global: - CCACHE_DIR=$HOME/.ccache - CMAKE_BUILD="mkdir Build; cd Build; cmake ..; make -j$(nproc) -l$(nproc)" - - CMAKE_UNIT_TEST_BUILD="mkdir Build; cd Build; cmake -DENABLE_UNIT_TESTS=On ..; make -j$(nproc) -l$(nproc); make -j$(nproc) test" - - CATKIN_BUILD="mkdir -p ~/catkin_ws/src; cd ~/catkin_ws; catkin init; ln -s ${TRAVIS_BUILD_DIR} src; catkin build -j$(nproc) -l$(nproc) -DBUILD_ROS_INTERFACE=ON; cd build/mavlink_sitl_gazebo/; catkin run_tests" + - CMAKE_UNIT_TEST_BUILD="mkdir Build; cd Build; cmake -DENABLE_UNIT_TESTS=On ..; + make -j$(nproc) -l$(nproc); make -j$(nproc) test" + - CATKIN_BUILD="mkdir -p ~/catkin_ws/src; cd ~/catkin_ws; catkin init; + ln -s ${TRAVIS_BUILD_DIR} src; catkin build -j$(nproc) -l$(nproc) -DBUILD_ROS_INTERFACE=ON; + cd build/mavlink_sitl_gazebo/; catkin run_tests" - KINETIC="source /opt/ros/kinetic/setup.bash; ${CATKIN_BUILD}" - MELODIC="source /opt/ros/melodic/setup.bash; ${CATKIN_BUILD}" @@ -79,9 +82,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,35 +109,44 @@ matrix: before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew update; - 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; fi install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew tap PX4/px4; - brew install px4-dev pkg-config gstreamer gst-plugins-base gst-plugins-good glib; - 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; + fi + +after_install: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + brew cleanup; + rm -rf /usr/local/include/mavlink/v2.0/.git googletest/.git; 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}"; fi From 40eef455c0dda48c075b307e59b51a4fe077a3cc Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 21 Oct 2019 14:13:50 +0200 Subject: [PATCH 7/9] models: fix reported validation errors --- .travis.yml | 12 ++++++------ models/realsense_camera/model.sdf | 24 +++++++----------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index af76985c1a..b8b2f626e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -141,12 +141,12 @@ after_install: 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; + (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 \ + 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}"; fi diff --git a/models/realsense_camera/model.sdf b/models/realsense_camera/model.sdf index ee76e7ec2a..72f846f26b 100644 --- a/models/realsense_camera/model.sdf +++ b/models/realsense_camera/model.sdf @@ -2,7 +2,7 @@ - 0 0 0.015 0 0 0 + 0 0 0.015 0 0 0 0.0615752 @@ -14,10 +14,9 @@ 0 8.931e-05 - 0 0 0 0 -0 0 + 0 0 0 0 -0 0 0 - 0 0 1 @@ -30,7 +29,7 @@ 0 10 - 0 0 0 0 -0 0 + 0 0 0 0 -0 0 0.0078 0.130 0.0192 @@ -45,15 +44,6 @@ 0 0 - - 1 - 0 - 0 - 1 - - 0 - - 0 @@ -83,7 +73,7 @@ - 0 -0.046 0.004 0 0 0 + 0 -0.046 0.004 0 0 0 1.047 @@ -106,7 +96,7 @@ 1 - 0 -0.06 0.004 0 0 0 + 0 -0.06 0.004 0 0 0 1.047 @@ -129,7 +119,7 @@ 0 - 0 0.01 0.004 0 0 0 + 0 0.01 0.004 0 0 0 1.047 @@ -152,7 +142,7 @@ 0 - 0 -0.03 0.004 0 0 0 + 0 -0.03 0.004 0 0 0 1.047 From 9a1730e29a31fe9c032523c47934645fb0f8e15a Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Tue, 22 Oct 2019 08:53:42 +0200 Subject: [PATCH 8/9] travis: install gstreamer using brew --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b8b2f626e8..b00f2b6888 100644 --- a/.travis.yml +++ b/.travis.yml @@ -124,6 +124,7 @@ install: make install; popd; popd; + brew install gstreamer gst-plugins-base gst-plugins-good glib; brew tap PX4/px4; brew install px4-dev; brew tap osrf/simulation; From b5fbcebd51eb2c1b01658778dc84d74d497fee95 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Tue, 22 Oct 2019 11:00:44 +0200 Subject: [PATCH 9/9] travis: let's not bother about macOS Sierra --- .travis.yml | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index b00f2b6888..e429ee3028 100644 --- a/.travis.yml +++ b/.travis.yml @@ -82,30 +82,18 @@ matrix: env: - PX4_DOCKER_REPO=px4io/px4-dev-simulation-bionic:2019-10-04 - BUILD="source ./scripts/validate_sdf.bash" - - name: MacOSX Sierra (Xcode 9.2) build with Gazebo 7 - os: osx - osx_image: xcode9.2 - language: cpp - cache: - ccache: true - env: - - GAZEBO_VERSION="gazebo7" - - name: MacOSX High Sierra (Xcode 10.1) build with Gazebo 9 + - name: macOS High Sierra (Xcode 10.1) 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 + - name: macOS Mojave (Xcode 11.2) os: osx osx_image: xcode11.2 language: cpp cache: ccache: true - env: - - GAZEBO_VERSION="gazebo9" before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then @@ -128,7 +116,7 @@ install: brew tap PX4/px4; brew install px4-dev; brew tap osrf/simulation; - brew install opencv ${GAZEBO_VERSION}; + brew install opencv gazebo9; sudo -H pip2 install --upgrade pip setuptools; sudo -H pip2 install rospkg pyserial empy toml numpy pandas jinja2; fi