Skip to content

Commit

Permalink
Merge pull request #247 from S-Dafarra/feature/cmake_install_check
Browse files Browse the repository at this point in the history
Check on if the install and build paths coincide
  • Loading branch information
GiulioRomualdi authored Mar 23, 2021
2 parents bb27200 + 8aef41e commit 5b080e4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ All notable changes to this project are documented in this file.
- Implement `realsense-test` utility application. (https://github.com/dic-iit/bipedal-locomotion-framework/pull/165)
- Implement the inverse kinematics component (https://github.com/dic-iit/bipedal-locomotion-framework/pull/229)
- Implement LinearizedFrictionCone class (https://github.com/dic-iit/bipedal-locomotion-framework/pull/244)
- Added a check on whether the installed public headers have the correct folder structure (https://github.com/dic-iit/bipedal-locomotion-framework/pull/247)

### Changed
- Move all the Contacts related classes in Contacts component (https://github.com/dic-iit/bipedal-locomotion-framework/pull/204)
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ add_subdirectory(devices)
#By including the file "BipedalLocomotion/Framework.h" it is possible to include all the headers automatically.
include(AddBipedalLocomotionFrameworkTarget)

set(FRAMEWORK_PUBLIC_DEPENDENCIES "iDynTree 1.1.0" "Eigen3 3.2.92")
set(FRAMEWORK_PUBLIC_DEPENDENCIES "iDynTree 1.1.0" "Eigen3 3.2.92" spdlog)

if (FRAMEWORK_USE_YARP)
list(APPEND FRAMEWORK_PUBLIC_DEPENDENCIES YARP)
Expand Down
15 changes: 14 additions & 1 deletion cmake/AddBipedalLocomotionLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

function(add_bipedal_locomotion_library)

set(options IS_INTERFACE)
set(options IS_INTERFACE SKIP_INSTALL_CHECK)
set(oneValueArgs NAME INSTALLATION_FOLDER)
set(multiValueArgs
SOURCES
Expand All @@ -25,6 +25,7 @@ function(add_bipedal_locomotion_library)
set(name ${${prefix}_NAME})
set(installation_folder ${${prefix}_INSTALLATION_FOLDER})
set(is_interface ${${prefix}_IS_INTERFACE})
set(skip_install_check ${${prefix}_SKIP_INSTALL_CHECK})
set(sources ${${prefix}_SOURCES})
set(public_headers ${${prefix}_PUBLIC_HEADERS})
set(private_headers ${${prefix}_PRIVATE_HEADERS})
Expand Down Expand Up @@ -108,6 +109,18 @@ function(add_bipedal_locomotion_library)
endforeach()
set_property(GLOBAL PROPERTY umbrella_includes "${umbrella_includes_list}")

if (NOT ${skip_install_check})
foreach(header ${public_headers})
get_filename_component(header_name ${header} NAME)
get_filename_component(header_path ${header} DIRECTORY)
string(REPLACE "include/BipedalLocomotion/" "" header_path_cleaned ${header_path})
if (NOT(${header_path_cleaned} STREQUAL ${installation_folder}))
string(REPLACE "include/" "" header_no_include ${header})
message(FATAL_ERROR "The file ${header_no_include} will have a different path when installed (it will become BipedalLocomotion/${installation_folder}/${header_name}), possibly causing issues in the client libraries.")
endif()
endforeach()
endif()

# add alias
add_library(BipedalLocomotion::${name} ALIAS ${name})

Expand Down
3 changes: 2 additions & 1 deletion src/AutoDiff/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if(FRAMEWORK_COMPILE_AutoDiffCppAD)
PUBLIC_HEADERS include/BipedalLocomotion/AutoDiff/CppAD.h
PUBLIC_LINK_LIBRARIES Eigen3::Eigen cppad
IS_INTERFACE
SUBDIRECTORIES tests)
SUBDIRECTORIES tests
INSTALLATION_FOLDER AutoDiff)

endif()

0 comments on commit 5b080e4

Please sign in to comment.