Skip to content

Commit

Permalink
Merge pull request #106 from nim65s/devel
Browse files Browse the repository at this point in the history
CMake: allow use of installed jrl-cmakemodules & Eigenrand
  • Loading branch information
jorisv committed Sep 9, 2024
2 parents a9d98dd + 8590cdb commit a706819
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 25 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- Allow use of installed jrl-cmakemodules & eigenrand ([#106](https://github.com/Simple-Robotics/proxsuite-nlp/pull/106))

## [0.7.1] - 2024-09-04

### Added
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ compute_project_args(PROJECT_ARGS LANGUAGES CXX)
project(${PROJECT_NAME} ${PROJECT_ARGS})
set(CMAKE_VERBOSE_MAKEFILE OFF)

include(${CMAKE_CURRENT_LIST_DIR}/cmake/boost.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/ide.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/apple.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/python.cmake)
include(${JRL_CMAKE_MODULES}/boost.cmake)
include(${JRL_CMAKE_MODULES}/ide.cmake)
include(${JRL_CMAKE_MODULES}/apple.cmake)
include(${JRL_CMAKE_MODULES}/python.cmake)
include(CMakeDependentOption)

apply_default_apple_configuration()
Expand Down
59 changes: 38 additions & 21 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,36 @@

add_project_dependency(Boost COMPONENTS unit_test_framework REQUIRED)

# Fetch private dependencies
include(FetchContent)

# Add eigenrand dependency
# TODO use main bab2min/EigenRand when PR is merged
FetchContent_Declare(
eigenrand
GIT_REPOSITORY https://github.com/ManifoldFR/EigenRand.git
GIT_TAG 23d287e
GIT_PROGRESS TRUE
EXCLUDE_FROM_ALL SYSTEM
find_path(
EigenRand_INCLUDE_DIR
NAMES EigenRand
PATHS ${EigenRand_PREFIX}
PATH_SUFFIXES include/EigenRand
)
set(EIGENRAND_BUILD_TEST
OFF
CACHE INTERNAL "Enable EigenRand test"
)
set(EIGENRAND_BUILD_BENCHMARK
OFF
CACHE INTERNAL "Enable EigenRand benchmark"
)
FetchContent_MakeAvailable(eigenrand)

if(NOT EigenRand_INCLUDE_DIR)
# Fetch private dependencies
include(FetchContent)

# Add eigenrand dependency
# TODO use main bab2min/EigenRand when PR is merged
FetchContent_Declare(
eigenrand
GIT_REPOSITORY https://github.com/ManifoldFR/EigenRand.git
GIT_TAG 23d287e
GIT_PROGRESS TRUE
EXCLUDE_FROM_ALL SYSTEM
)
set(EIGENRAND_BUILD_TEST
OFF
CACHE INTERNAL "Enable EigenRand test"
)
set(EIGENRAND_BUILD_BENCHMARK
OFF
CACHE INTERNAL "Enable EigenRand benchmark"
)
FetchContent_MakeAvailable(eigenrand)
endif()

# Add benchmark dependency
if(BUILD_BENCHMARK)
Expand All @@ -49,7 +58,15 @@ install(
set(TEST_UTIL_LIB ${PROJECT_NAME}-test_util)
add_library(${TEST_UTIL_LIB} STATIC util.cpp)
target_link_libraries(${TEST_UTIL_LIB} PUBLIC ${PROJECT_NAME})
target_link_libraries(${TEST_UTIL_LIB} PUBLIC EigenRand::EigenRand)
modernize_target_link_libraries(
${TEST_UTIL_LIB}
SCOPE
PUBLIC
TARGETS
EigenRand::EigenRand
INCLUDE_DIRS
${EigenRand_INCLUDE_DIR}
)
set_target_properties(${TEST_UTIL_LIB} PROPERTIES LINKER_LANGUAGE CXX)

macro(ADD_TEST_CFLAGS test_name flag)
Expand Down

0 comments on commit a706819

Please sign in to comment.