@@ -239,12 +239,12 @@ if(BUILD_WITH_PINOCCHIO_SUPPORT)
239
239
"If you didn't build proxsuite-nlp yourself, please contact the maintainer for the distribution you used."
240
240
)
241
241
endif ()
242
- add_compile_definitions (ALIGATOR_WITH_PINOCCHIO)
243
- list (APPEND CFLAGS_DEPENDENCIES "-DALIGATOR_WITH_PINOCCHIO" )
244
- set (PINOCCHIO_V3 ${pinocchio_VERSION} VERSION_GREATER "3.0.0" )
245
- if (PINOCCHIO_V3)
246
- add_compile_definitions (ALIGATOR_PINOCCHIO_V3)
242
+
243
+ if (${pinocchio_VERSION} VERSION_GREATER "3.0.0" )
244
+ set (PINOCCHIO_V3 TRUE )
247
245
endif ()
246
+
247
+ list (APPEND CFLAGS_DEPENDENCIES "-DALIGATOR_WITH_PINOCCHIO" )
248
248
elseif (PROXSUITE_NLP_WITH_PINOCCHIO_SUPPORT)
249
249
message (
250
250
WARNING
@@ -255,7 +255,6 @@ endif()
255
255
256
256
if (BUILD_CROCODDYL_COMPAT)
257
257
message (STATUS "Building with Crocoddyl support." )
258
- add_compile_definitions (ALIGATOR_WITH_CROCODDYL_COMPAT)
259
258
list (APPEND CFLAGS_DEPENDENCIES "-DALIGATOR_WITH_CROCODDYL_COMPAT" )
260
259
endif ()
261
260
@@ -270,7 +269,6 @@ if(BUILD_WITH_CHOLMOD_SUPPORT)
270
269
STATUS
271
270
"Build with CHOLMOD support (LGPL). See CHOLMOD/Doc/License.txt for further details."
272
271
)
273
- add_compile_definitions (ALIGATOR_WITH_CHOLMOD)
274
272
endif ()
275
273
276
274
if (BUILD_PYTHON_INTERFACE)
@@ -285,6 +283,7 @@ if(BUILD_PYTHON_INTERFACE)
285
283
set (${PYLIB_NAME} _INSTALL_DIR ${PYTHON_SITELIB} /${PROJECT_NAME} )
286
284
endif ()
287
285
286
+ # Without template instantiation, library only compiles exceptions and logging.
288
287
set (LIB_SOURCES src/utils/exceptions.cpp src/utils/logger.cpp)
289
288
290
289
file (
@@ -299,8 +298,8 @@ if(ENABLE_TEMPLATE_INSTANTIATION)
299
298
GLOB_RECURSE LIB_TEMPLATE_SOURCES
300
299
CONFIGURE_DEPENDS
301
300
${PROJECT_SOURCE_DIR} /src/core/*.cpp
302
- ${PROJECT_SOURCE_DIR} /src/solvers/fddp /*.cpp
303
- ${PROJECT_SOURCE_DIR} /src/solvers/proxddp/ *.cpp
301
+ ${PROJECT_SOURCE_DIR} /src/gar /*.cpp
302
+ ${PROJECT_SOURCE_DIR} /src/solvers/*.cpp
304
303
${PROJECT_SOURCE_DIR} /src/modelling/*.cpp
305
304
)
306
305
file (
@@ -367,8 +366,6 @@ elseif(ALIGATOR_TRACY_ENABLE)
367
366
endif ()
368
367
endif ()
369
368
370
- add_subdirectory (gar)
371
-
372
369
# Create the main shared library.
373
370
function (create_library)
374
371
add_library (${PROJECT_NAME} SHARED ${LIB_HEADERS} ${LIB_SOURCES} )
@@ -382,7 +379,6 @@ function(create_library)
382
379
)
383
380
set_standard_output_directory(${PROJECT_NAME} )
384
381
385
- target_link_libraries (${PROJECT_NAME} PUBLIC aligator::gar)
386
382
# Extract the compile definitions of the project for export
387
383
get_directory_property (CURRENT_COMPILE_DEFINITIONS COMPILE_DEFINITIONS )
388
384
target_compile_definitions (
@@ -395,6 +391,15 @@ function(create_library)
395
391
${PROJECT_NAME}
396
392
PUBLIC pinocchio::pinocchio_default pinocchio::pinocchio_collision
397
393
)
394
+ target_compile_definitions (${PROJECT_NAME} PUBLIC ALIGATOR_WITH_PINOCCHIO)
395
+ if (PINOCCHIO_V3)
396
+ target_compile_definitions (${PROJECT_NAME} PUBLIC ALIGATOR_PINOCCHIO_V3)
397
+ endif ()
398
+ endif ()
399
+
400
+ if (BUILD_WITH_CHOLMOD_SUPPORT)
401
+ target_link_libraries (${PROJECT_NAME} PUBLIC CHOLMOD::CHOLMOD)
402
+ target_compile_definitions (${PROJECT_NAME} PUBLIC ALIGATOR_WITH_CHOLMOD)
398
403
endif ()
399
404
400
405
if (BUILD_WITH_OPENMP_SUPPORT)
@@ -463,29 +468,37 @@ add_subdirectory(bindings)
463
468
464
469
# benchmarks, examples, and tests
465
470
466
- macro (create_ex_or_bench is_bench exfile exname)
471
+ macro (create_ex_or_bench exfile exname)
472
+ cmake_parse_arguments (arg_ex "BENCHMARK" "" "DEPENDENCIES" ${ARGN} )
473
+
467
474
add_executable (${exname} ${exfile} )
468
- if (${is_bench } )
469
- set (ex_type "bench " )
475
+ if (${arg_ex_BENCHMARK } )
476
+ set (ex_type "benchmark " )
470
477
else ()
471
478
set (ex_type "example" )
472
479
endif ()
473
- message (STATUS "Adding cpp ${ex_type} ${exname} " )
480
+ message (STATUS "Adding cpp ${ex_type} ${exname} ( ${exfile} ) " )
474
481
set_target_properties (${exname} PROPERTIES LINKER_LANGUAGE CXX)
475
482
set_standard_output_directory(${exname} )
476
483
target_include_directories (${exname} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} )
477
484
478
- target_link_libraries (${exname} PUBLIC ${PROJECT_NAME} )
485
+ target_link_libraries (
486
+ ${exname}
487
+ PRIVATE ${PROJECT_NAME} ${arg_ex_DEPENDENCIES}
488
+ )
489
+ if (${arg_ex_BENCHMARK} )
490
+ target_link_libraries (${exname} PRIVATE benchmark::benchmark)
491
+ endif ()
492
+ if (DEFINED arg_ex_DEPENDENCIES)
493
+ message (" Dependencies:" )
494
+ foreach (_dep ${arg_ex_DEPENDENCIES} )
495
+ message (" ${_dep} " )
496
+ endforeach ()
497
+ endif ()
479
498
endmacro ()
480
499
481
500
if (BUILD_WITH_PINOCCHIO_SUPPORT AND (BUILD_EXAMPLES OR BUILD_BENCHMARKS))
482
501
ADD_PROJECT_PRIVATE_DEPENDENCY(example-robot-data 4.0.9 REQUIRED)
483
- macro (target_add_example_robot_data target_name)
484
- target_link_libraries (
485
- ${target_name}
486
- PRIVATE example-robot-data::example-robot-data
487
- )
488
- endmacro ()
489
502
endif ()
490
503
491
504
# create an utility library to avoid recompiling crocoddyl talos arm problem
@@ -503,10 +516,13 @@ if(BUILD_CROCODDYL_COMPAT AND (BUILD_EXAMPLES OR BUILD_BENCHMARKS))
503
516
)
504
517
target_link_libraries (
505
518
croc_talos_arm_utils
506
- PUBLIC ${PROJECT_NAME} Boost::boost crocoddyl::crocoddyl
519
+ PUBLIC
520
+ ${PROJECT_NAME}
521
+ Boost::boost
522
+ crocoddyl::crocoddyl
523
+ example-robot-data::example-robot-data
507
524
)
508
525
set_standard_output_directory(croc_talos_arm_utils)
509
- target_add_example_robot_data(croc_talos_arm_utils)
510
526
endif ()
511
527
512
528
if (BUILD_BENCHMARKS OR BUILD_TESTING)
@@ -515,7 +531,7 @@ if(BUILD_BENCHMARKS OR BUILD_TESTING)
515
531
STATIC
516
532
${PROJECT_SOURCE_DIR} /tests/gar/test_util.cpp
517
533
)
518
- target_link_libraries (gar_test_utils PRIVATE aligator::gar )
534
+ target_link_libraries (gar_test_utils PRIVATE ${PROJECT_NAME} )
519
535
set_standard_output_directory(gar_test_utils)
520
536
endif ()
521
537
@@ -531,14 +547,13 @@ if(PINOCCHIO_V3 AND (BUILD_EXAMPLES OR BUILD_BENCHMARKS))
531
547
PUBLIC ${PROJECT_SOURCE_DIR} /examples
532
548
)
533
549
set_standard_output_directory(talos_walk_utils)
534
- target_link_libraries (talos_walk_utils PUBLIC ${PROJECT_NAME} )
535
- target_add_example_robot_data(talos_walk_utils)
536
- function (target_add_talos_walk target )
537
- target_link_libraries (
538
- ${target}
539
- PRIVATE talos_walk_utils pinocchio::pinocchio_parsers
540
- )
541
- endfunction ()
550
+ target_link_libraries (
551
+ talos_walk_utils
552
+ PUBLIC
553
+ ${PROJECT_NAME}
554
+ pinocchio::pinocchio_parsers
555
+ example-robot-data::example-robot-data
556
+ )
542
557
endif ()
543
558
544
559
if (BUILD_EXAMPLES)
0 commit comments