CMakeLists.txt 2.07 KB
Newer Older
jcarpent's avatar
jcarpent committed
1
#
2
# Copyright (c) 2015-2020 CNRS INRIA
jcarpent's avatar
jcarpent committed
3
4
#

5
6
7
# ----------------------------------------------------
# --- BENCHMARK --------------------------------------
# ----------------------------------------------------
8
9
10
11
IF(WIN32)
  ADD_DEFINITIONS("-DNOMINMAX")
ENDIF()

jcarpent's avatar
jcarpent committed
12
13
ADD_CUSTOM_TARGET(bench)

14
MACRO(ADD_BENCH bench_name)
15
16
17
18
19
20
21
22
23
24
  IF(BUILD_BENCHMARK)
    ADD_EXECUTABLE(${bench_name} ${bench_name}.cpp)
  ELSE(BUILD_BENCHMARK)
    ADD_EXECUTABLE(${bench_name} EXCLUDE_FROM_ALL ${bench_name}.cpp)
  ENDIF(BUILD_BENCHMARK)
  SET(ExtraMacroArgs ${ARGN})
  LIST(LENGTH ExtraMacroArgs NumExtraMacroArgs)
  IF(NumExtraMacroArgs GREATER 0)
    SET(link_to_main_lib ${ARGV1})
    IF(link_to_main_lib)
Justin Carpentier's avatar
Justin Carpentier committed
25
      SET_TARGET_PROPERTIES(${bench_name} PROPERTIES COMPILE_DEFINITIONS PINOCCHIO_MODEL_DIR="${PINOCCHIO_MODEL_DIR}")
26
      TARGET_LINK_LIBRARIES(${bench_name} PUBLIC ${PROJECT_NAME})
27
28
29
30
    ENDIF(link_to_main_lib)
  ENDIF()
  
  ADD_DEPENDENCIES(bench ${bench_name})
31
32
ENDMACRO(ADD_BENCH)

33
34
35
MACRO(ADD_TEST_CFLAGS target flag)
  SET_PROPERTY(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS " ${flag}")
ENDMACRO(ADD_TEST_CFLAGS)
36

37
38
39
40
41
42
43
44
IF(CPPAD_FOUND)
  INCLUDE_DIRECTORIES(${cppad_INCLUDE_DIR})
ENDIF(CPPAD_FOUND)

IF(CPPADCG_FOUND)
  INCLUDE_DIRECTORIES(${cppadcg_INCLUDE_DIR})
ENDIF(CPPADCG_FOUND)

45
46
# timings
# 
47
ADD_BENCH(timings TRUE)
48
49
50
IF(CPPADCG_FOUND)
  ADD_BENCH(timings-cg TRUE)
  SET_PROPERTY(TARGET timings-cg PROPERTY CXX_STANDARD 11)
51
  TARGET_LINK_LIBRARIES(timings-cg PUBLIC ${CMAKE_DL_LIBS})
52
ENDIF(CPPADCG_FOUND)
53

54
55
56
57
# timings
# 
ADD_BENCH(timings-cholesky TRUE)

58
# timings derivatives
59
60
61
 
ADD_BENCH(timings-derivatives TRUE)
IF(CPPAD_FOUND)
62
  TARGET_LINK_LIBRARIES(timings-derivatives PUBLIC ${cppad_LIBRARY})
63
64
65
66
ENDIF(CPPAD_FOUND)
IF(CPPADCG_FOUND)
  SET_PROPERTY(TARGET timings-derivatives PROPERTY CXX_STANDARD 11)
ENDIF(CPPADCG_FOUND)
67

68
# timings-eigen
69
70
# 
ADD_BENCH(timings-eigen)
Justin Carpentier's avatar
Justin Carpentier committed
71
TARGET_INCLUDE_DIRECTORIES(timings-eigen PUBLIC ${EIGEN3_INCLUDE_DIRS})
72

73
# timings-geometry
74
75
# 
IF(URDFDOM_FOUND AND HPP_FCL_FOUND)
76
  ADD_BENCH(timings-geometry TRUE)
77
ENDIF(URDFDOM_FOUND AND HPP_FCL_FOUND)
78
79
80

# timings-jacobian
#
Justin Carpentier's avatar
Justin Carpentier committed
81
ADD_BENCH(timings-jacobian TRUE)