Skip to content
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

Fix dependencies on macOS #354

Merged
merged 9 commits into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 46 additions & 34 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand Down Expand Up @@ -79,51 +82,60 @@ 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: macOS High Sierra (Xcode 10.1)
os: osx
osx_image: xcode11
osx_image: xcode10.1
language: cpp
cache:
ccache: true
- 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
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;
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 install gstreamer gst-plugins-base gst-plugins-good glib;
brew tap PX4/px4;
brew install px4-dev;
brew tap osrf/simulation;
brew install opencv gazebo9;
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
18 changes: 13 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -39,14 +37,22 @@ 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)
# 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
OUTPUT_STRIP_TRAILING_WHITESPACE
)
list(APPEND CMAKE_PREFIX_PATH "${QT5_PREFIX_PATH}/lib/cmake")
endif()
find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
endif()
endif()
endif()
Expand Down Expand Up @@ -176,6 +182,8 @@ link_libraries(
if (GSTREAMER_FOUND)
link_libraries(
${GSTREAMER_LIBRARIES}
glib-2.0
gobject-2.0
)
endif()

Expand Down
15 changes: 0 additions & 15 deletions cmake/FindGStreamer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down Expand Up @@ -143,5 +130,3 @@ mark_as_advanced(
GSTREAMER_VIDEO_INCLUDE_DIRS
GSTREAMER_VIDEO_LIBRARIES
)

endif()
24 changes: 7 additions & 17 deletions models/realsense_camera/model.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<sdf version="1.6">
<model name="realsense_camera">
<plugin name="realsense_plugin" filename="libRealSensePlugin.so"/>
<pose frame="">0 0 0.015 0 0 0</pose>
<pose>0 0 0.015 0 0 0</pose>
<link name="link">
<inertial>
<mass>0.0615752</mass>
Expand All @@ -14,10 +14,9 @@
<iyz>0</iyz>
<izz>8.931e-05</izz>
</inertia>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
</inertial>
<self_collide>0</self_collide>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
<gravity>1</gravity>
<visual name="visual">
Expand All @@ -30,7 +29,7 @@
<collision name='collision'>
<laser_retro>0</laser_retro>
<max_contacts>10</max_contacts>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<box>
<size>0.0078 0.130 0.0192</size>
Expand All @@ -45,15 +44,6 @@
<slip1>0</slip1>
<slip2>0</slip2>
</ode>
<torsional>
<coefficient>1</coefficient>
<patch_radius>0</patch_radius>
<surface_radius>0</surface_radius>
<use_patch_radius>1</use_patch_radius>
<ode>
<slip>0</slip>
</ode>
</torsional>
</friction>
<bounce>
<restitution_coefficient>0</restitution_coefficient>
Expand Down Expand Up @@ -83,7 +73,7 @@
</surface>
</collision>
<sensor name="color" type="camera">
<pose frame="">0 -0.046 0.004 0 0 0</pose>
<pose>0 -0.046 0.004 0 0 0</pose>
<camera name="__default__">
<horizontal_fov>1.047</horizontal_fov>
<image>
Expand All @@ -106,7 +96,7 @@
<visualize>1</visualize>
</sensor>
<sensor name="ired1" type="camera">
<pose frame="">0 -0.06 0.004 0 0 0</pose>
<pose>0 -0.06 0.004 0 0 0</pose>
<camera name="__default__">
<horizontal_fov>1.047</horizontal_fov>
<image>
Expand All @@ -129,7 +119,7 @@
<visualize>0</visualize>
</sensor>
<sensor name="ired2" type="camera">
<pose frame="">0 0.01 0.004 0 0 0</pose>
<pose>0 0.01 0.004 0 0 0</pose>
<camera name="__default__">
<horizontal_fov>1.047</horizontal_fov>
<image>
Expand All @@ -152,7 +142,7 @@
<visualize>0</visualize>
</sensor>
<sensor name="depth" type="depth">
<pose frame="">0 -0.03 0.004 0 0 0</pose>
<pose>0 -0.03 0.004 0 0 0</pose>
<camera name="__default__">
<horizontal_fov>1.047</horizontal_fov>
<image>
Expand Down