Skip to content

Commit

Permalink
Do not quietly search for ASSIMP to decide if enable it or not (#600)
Browse files Browse the repository at this point in the history
Add DO_NOT_SILENTLY_SEARCH option to avoid the initial find_package QUIET call to decide the initial default value of the option to enable a dependency.

Enable it for Assimp as a workaround for #599 .

Assimp was added to GitHub Actons CI to validate that the solution is working.
  • Loading branch information
traversaro authored Nov 26, 2019
1 parent d5b1330 commit 36307d6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ jobs:
if: matrix.os == 'windows-latest'
run: |
git clone https://github.com/robotology-dependencies/robotology-vcpkg-binary-ports C:/robotology-vcpkg-binary-ports
vcpkg.exe --overlay-ports=C:/robotology-vcpkg-binary-ports install --triplet x64-windows ace libxml2 eigen3 ipopt-binary
vcpkg.exe --overlay-ports=C:/robotology-vcpkg-binary-ports install --triplet x64-windows ace assimp libxml2 eigen3 ipopt-binary
- name: Dependencies [macOS]
if: matrix.os == 'macOS-latest'
run: |
brew install ace boost eigen swig qt5 orocos-kdl
brew install ace assimp boost eigen swig qt5 orocos-kdl
- name: Dependencies [Ubuntu]
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install git build-essential cmake libace-dev coinor-libipopt-dev libboost-system-dev libboost-filesystem-dev \
libboost-thread-dev liborocos-kdl-dev libeigen3-dev swig qtbase5-dev qtdeclarative5-dev qtmultimedia5-dev \
libxml2-dev liburdfdom-dev libtinyxml-dev liburdfdom-dev liboctave-dev python-dev valgrind
libxml2-dev liburdfdom-dev libtinyxml-dev liburdfdom-dev liboctave-dev python-dev valgrind libassimp-dev
- name: Source-based Dependencies [Windows]
if: matrix.os == 'windows-latest-disable-until-issue-569-is-solved'
Expand Down Expand Up @@ -117,19 +117,21 @@ jobs:
mkdir -p build
cd build
# ipopt disabled until https://github.com/robotology/idyntree/issues/274 is fixed
# assimp disabled until https://github.com/robotology/idyntree/issues/601 is fixed
cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install \
-DIDYNTREE_COMPILE_TESTS:BOOL=ON -DIDYNTREE_USES_YARP:BOOL=OFF -DIDYNTREE_USES_ICUB_MAIN:BOOL=OFF -DIDYNTREE_RUN_VALGRIND_TESTS:BOOL=ON \
-DIDYNTREE_USES_PYTHON:BOOL=OFF -DIDYNTREE_USES_OCTAVE:BOOL=OFF -DIDYNTREE_USES_IPOPT:BOOL=OFF \
-DIDYNTREE_USES_PYTHON:BOOL=OFF -DIDYNTREE_USES_OCTAVE:BOOL=OFF -DIDYNTREE_USES_IPOPT:BOOL=OFF -DIDYNTREE_USES_ASSIMP:BOOL=OFF \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install ..
- name: Configure [Ubuntu/macOS]
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macOS-latest'
shell: bash
run: |
mkdir -p build
cd build
cd build
# IDYNTREE_USES_ASSIMP set to OFF as a workaround for https://github.com/robotology/idyntree/issues/599
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DIDYNTREE_COMPILE_TESTS:BOOL=ON -DIDYNTREE_USES_YARP:BOOL=ON \
-DIDYNTREE_USES_ICUB_MAIN:BOOL=ON -DIDYNTREE_USES_Qt5:BOOL=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DIDYNTREE_USES_ICUB_MAIN:BOOL=ON -DIDYNTREE_USES_Qt5:BOOL=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DIDYNTREE_USES_ASSIMP:BOOL=OFF \
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install ..
- name: Enable additional Ubuntu options (Valgrind, Octave, Python, legacy KDL) [Ubuntu]
Expand Down
22 changes: 16 additions & 6 deletions cmake/iDynTreeDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@

#########################################################################
# Enable/disable dependencies
# DO_NOT_SILENTLY_SEARCH: Do not search for the package to set the default
# value of IDYNTREE_USES_<dep> option, but just set
# it to OFF
macro(idyntree_handle_dependency package)
set(options DO_NOT_SILENTLY_SEARCH)
set(singleValueArgs MINIMUM_VERSION)
set(multiValueArgs COMPONENTS)
cmake_parse_arguments(IHD "" "${singleValueArgs}" "${multiValueArgs}" ${ARGN})
if (IHD_COMPONENTS)
find_package(${package} ${IHD_MINIMUM_VERSION} QUIET COMPONENTS ${IHD_COMPONENTS})
string(TOUPPER ${package} PKG)
if (IHD_DO_NOT_SILENTLY_SEARCH)
if (IHD_COMPONENTS)
find_package(${package} ${IHD_MINIMUM_VERSION} QUIET COMPONENTS ${IHD_COMPONENTS})
else ()
find_package(${package} ${IHD_MINIMUM_VERSION} QUIET)
endif ()
set(IDYNTREE_USES_${PKG}_DEFAULT ${${package}_FOUND})
else ()
find_package(${package} ${IHD_MINIMUM_VERSION} QUIET)
set(IDYNTREE_USES_${PKG}_DEFAULT FALSE)
endif ()
string(TOUPPER ${package} PKG)
option(IDYNTREE_USES_${PKG} "Build the part of iDynTree that depends on package ${package}" ${${package}_FOUND})
option(IDYNTREE_USES_${PKG} "Build the part of iDynTree that depends on package ${package}" ${IDYNTREE_USES_${PKG}_DEFAULT})
if (IDYNTREE_USES_${PKG})
if (IHD_COMPONENTS)
find_package(${package} ${IHD_MINIMUM_VERSION} COMPONENTS ${IHD_COMPONENTS} REQUIRED)
Expand Down Expand Up @@ -57,4 +66,5 @@ idyntree_handle_dependency(Qt5 COMPONENTS Qml Quick Widgets)
idyntree_handle_dependency(OsqpEigen)
idyntree_handle_dependency(ALGLIB 3.14.0)
idyntree_handle_dependency(WORHP)
idyntree_handle_dependency(ASSIMP)
# Workaround for https://github.com/robotology/idyntree/issues/599
idyntree_handle_dependency(ASSIMP DO_NOT_SILENTLY_SEARCH)

0 comments on commit 36307d6

Please sign in to comment.