diff --git a/.github/workflows/conda/environment_macos_linux.yml b/.github/workflows/conda/environment_macos_linux.yml index 34a295bad..7180679c5 100644 --- a/.github/workflows/conda/environment_macos_linux.yml +++ b/.github/workflows/conda/environment_macos_linux.yml @@ -7,7 +7,8 @@ dependencies: - octomap - assimp - numpy - - boost + - libboost-devel + - libboost-python-devel - eigenpy - python - doxygen<1.9.8|>=1.11 diff --git a/.github/workflows/conda/environment_windows.yml b/.github/workflows/conda/environment_windows.yml index febe634ee..c1c99096a 100644 --- a/.github/workflows/conda/environment_windows.yml +++ b/.github/workflows/conda/environment_windows.yml @@ -7,7 +7,8 @@ dependencies: - octomap - assimp - numpy - - boost + - libboost-devel + - libboost-python-devel - eigenpy - python - doxygen<1.9.8|>=1.11 diff --git a/.github/workflows/windows-conda-clang.yml b/.github/workflows/windows-conda-clang.yml index 7d7a8d87a..2c76d7dcf 100644 --- a/.github/workflows/windows-conda-clang.yml +++ b/.github/workflows/windows-conda-clang.yml @@ -65,7 +65,7 @@ jobs: if errorlevel 1 exit 1 :: Build and Install - cmake --build . --config Release --target install + cmake --build . --config Release --target all if errorlevel 1 exit 1 :: Testing @@ -73,8 +73,7 @@ jobs: if errorlevel 1 exit 1 :: Test Python import - cd .. - python -c "import coal" + cmake -E env PYTHONPATH=%cd%\python python -c "import coal" if errorlevel 1 exit 1 check: diff --git a/.github/workflows/windows-conda-v142.yml b/.github/workflows/windows-conda-v142.yml index e1191d014..d4dddab19 100644 --- a/.github/workflows/windows-conda-v142.yml +++ b/.github/workflows/windows-conda-v142.yml @@ -62,7 +62,7 @@ jobs: if errorlevel 1 exit 1 :: Build and Install - cmake --build . --config Release --target install + cmake --build . --config Release --target all if errorlevel 1 exit 1 :: Testing @@ -70,8 +70,7 @@ jobs: if errorlevel 1 exit 1 :: Test Python import - cd .. - python -c "import coal" + cmake -E env PYTHONPATH=%cd%\python python -c "import coal" if errorlevel 1 exit 1 check: diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e64dcf11..0b32cbe06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Fixed +- Remove CMake CMP0167 warnings ([#630](https://github.com/coal-library/coal/pull/630)) +- Allow to run test in the build directory on Windows ([#630](https://github.com/coal-library/coal/pull/630)) + ## [3.0.0] - 2024-11-20 ### Added diff --git a/CMakeLists.txt b/CMakeLists.txt index 71c75c52a..3bbc7eb11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,6 +90,18 @@ else() endif() endif() +# Use BoostConfig module distributed by boost library instead of using FindBoost module distributed +# by CMake. +# There is one unresolved issue with FindBoost and clang-cl so we deactivate it in this case. +IF(NOT WIN32 OR NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") + IF(POLICY CMP0167) + CMAKE_POLICY(SET CMP0167 NEW) + # Set a default value to this policy to avoid issue with find_dependency + # macro redefinition with different policy in some modules. + SET(CMAKE_POLICY_DEFAULT_CMP0167 NEW) + ENDIF() +ENDIF() + include("${JRL_CMAKE_MODULES}/boost.cmake") include("${JRL_CMAKE_MODULES}/python.cmake") include("${JRL_CMAKE_MODULES}/hpp.cmake") @@ -101,6 +113,16 @@ SET(CMAKE_MODULE_PATH ${JRL_CMAKE_MODULES}/find-external/assimp/ ${CMAKE_MODULE_PATH}) +FUNCTION(set_standard_output_directory target) + SET_TARGET_PROPERTIES( + ${target} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin + LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib + ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib + ) +ENDFUNCTION() + set_default_cmake_build_type("RelWithDebInfo") # If needed, fix CMake policy for APPLE systems @@ -112,19 +134,6 @@ PROJECT(${PROJECT_NAME} ${PROJECT_ARGS}) OPTION(BUILD_PYTHON_INTERFACE "Build the python bindings" ON) CMAKE_DEPENDENT_OPTION(GENERATE_PYTHON_STUBS "Generate the Python stubs associated to the Python library" OFF BUILD_PYTHON_INTERFACE OFF) -#IF(WIN32) -# # Set default Windows build paths -# SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY -# ${PROJECT_BINARY_DIR}/Bin -# CACHE PATH "Single directory for all libraries") -# SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY -# ${PROJECT_BINARY_DIR}/Bin -# CACHE PATH "Single directory for all executables") -# SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY -# ${PROJECT_BINARY_DIR}/Bin -# CACHE PATH "Sing$le directory for all archives") -#ENDIF(WIN32) - ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES "eigen3 >= 3.0.0") if(BUILD_PYTHON_INTERFACE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f1dfb892a..faad32daf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -188,6 +188,7 @@ add_library(${LIBRARY_NAME} ${${LIBRARY_NAME}_SOURCES} ) add_library(${LIBRARY_NAME}::${LIBRARY_NAME} ALIAS ${LIBRARY_NAME}) +SET_STANDARD_OUTPUT_DIRECTORY(${LIBRARY_NAME}) if(COAL_BACKWARD_COMPATIBILITY_WITH_HPP_FCL) add_library(hpp-fcl ALIAS ${LIBRARY_NAME}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c85077bb0..4d4e3c08b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,6 +6,7 @@ config_files(fcl_resources/config.h) function(add_coal_test test_name source) set(target_name ${PROJECT_NAME}-${test_name}) ADD_UNIT_TEST(${target_name} ${source}) + SET_STANDARD_OUTPUT_DIRECTORY(${target_name}) target_link_libraries(${target_name} PUBLIC ${LIBRARY_NAME} @@ -24,6 +25,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) set(utility_target ${PROJECT_NAME}-utility) add_library(${utility_target} STATIC utility.cpp) +SET_STANDARD_OUTPUT_DIRECTORY(${utility_target}) target_link_libraries(${utility_target} PUBLIC ${PROJECT_NAME}) add_coal_test(math math.cpp) @@ -77,6 +79,7 @@ add_coal_test(broadphase_collision_2 broadphase_collision_2.cpp) ## Benchmark set(test_benchmark_target ${PROJECT_NAME}-test-benchmark) add_executable(${test_benchmark_target} benchmark.cpp) +SET_STANDARD_OUTPUT_DIRECTORY(${test_benchmark_target}) target_link_libraries(${test_benchmark_target} PUBLIC ${utility_target}