Commit fb181398 authored by jcarpent's avatar jcarpent
Browse files

[Cmake] Refactorize bench by adding ADD_BENCH macro

parent b08ed9ef
...@@ -17,51 +17,51 @@ ...@@ -17,51 +17,51 @@
# ---------------------------------------------------- # ----------------------------------------------------
# --- BENCHMARK -------------------------------------- # --- BENCHMARK --------------------------------------
# ---------------------------------------------------- # ----------------------------------------------------
MACRO(ADD_BENCH bench_name)
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)
SET_TARGET_PROPERTIES(${bench_name} PROPERTIES COMPILE_DEFINITIONS PINOCCHIO_SOURCE_DIR="${${PROJECT_NAME}_SOURCE_DIR}")
TARGET_LINK_LIBRARIES(${bench_name} ${PROJECT_NAME})
ENDIF(link_to_main_lib)
ENDIF()
ENDMACRO(ADD_BENCH)
MACRO(ADD_TEST_CFLAGS target flag) MACRO(ADD_TEST_CFLAGS target flag)
SET_PROPERTY(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS " ${flag}") SET_PROPERTY(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS " ${flag}")
ENDMACRO(ADD_TEST_CFLAGS) ENDMACRO(ADD_TEST_CFLAGS)
# timings # timings
# #
IF(BUILD_BENCHMARK) ADD_BENCH(timings TRUE)
ADD_EXECUTABLE(timings timings.cpp)
ELSE(BUILD_BENCHMARK)
ADD_EXECUTABLE(timings EXCLUDE_FROM_ALL timings.cpp)
ENDIF(BUILD_BENCHMARK)
TARGET_LINK_LIBRARIES (timings ${PROJECT_NAME})
SET_TARGET_PROPERTIES (timings PROPERTIES COMPILE_DEFINITIONS PINOCCHIO_SOURCE_DIR="${${PROJECT_NAME}_SOURCE_DIR}")
# timings-eigen # timings-eigen
# #
IF(BUILD_BENCHMARK)
ADD_EXECUTABLE(timings-eigen timings-eigen.cpp)
ELSE(BUILD_BENCHMARK)
ADD_EXECUTABLE(timings-eigen EXCLUDE_FROM_ALL timings-eigen.cpp)
ENDIF(BUILD_BENCHMARK)
PKG_CONFIG_USE_DEPENDENCY(timings-eigen eigen3)
#
ADD_BENCH(timings-eigen)
# geomTimings # timings-geometry
# #
IF(URDFDOM_FOUND AND HPP_FCL_FOUND) IF(URDFDOM_FOUND AND HPP_FCL_FOUND)
IF(BUILD_BENCHMARK) ADD_BENCH(timings-geometry TRUE)
ADD_EXECUTABLE(geomTimings timings-geometry.cpp) PKG_CONFIG_USE_DEPENDENCY(timings-geometry hpp-fcl)
ELSE(BUILD_BENCHMARK)
ADD_EXECUTABLE(geomTimings EXCLUDE_FROM_ALL timings-geometry.cpp)
ENDIF(BUILD_BENCHMARK)
IF(BUILD_TESTS_WITH_HPP) IF(BUILD_TESTS_WITH_HPP)
ADD_OPTIONAL_DEPENDENCY("hpp-model-urdf") ADD_OPTIONAL_DEPENDENCY("hpp-model-urdf")
IF(HPP_MODEL_URDF_FOUND) IF(HPP_MODEL_URDF_FOUND)
PKG_CONFIG_USE_DEPENDENCY(geomTimings hpp-model-urdf) PKG_CONFIG_USE_DEPENDENCY(timings-geometry hpp-model-urdf)
ADD_TEST_CFLAGS(geomTimings "-DWITH_HPP_MODEL_URDF") ADD_TEST_CFLAGS(timings-geometry "-DWITH_HPP_MODEL_URDF")
ENDIF(HPP_MODEL_URDF_FOUND) ENDIF(HPP_MODEL_URDF_FOUND)
ENDIF(BUILD_TESTS_WITH_HPP) ENDIF(BUILD_TESTS_WITH_HPP)
TARGET_LINK_LIBRARIES (geomTimings ${PROJECT_NAME})
PKG_CONFIG_USE_DEPENDENCY(geomTimings hpp-fcl)
SET_TARGET_PROPERTIES (geomTimings PROPERTIES COMPILE_DEFINITIONS PINOCCHIO_SOURCE_DIR="${${PROJECT_NAME}_SOURCE_DIR}")
ENDIF(URDFDOM_FOUND AND HPP_FCL_FOUND) ENDIF(URDFDOM_FOUND AND HPP_FCL_FOUND)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment