This repository has been archived by the owner on Mar 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
106 lines (80 loc) · 3.57 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
cmake_minimum_required(VERSION 2.8.3)
project(akin)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected. Default to Release!")
set(CMAKE_BUILD_TYPE "Release")
endif(NOT CMAKE_BUILD_TYPE)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX /usr)
MESSAGE(STATUS "Setting installation prefix to ${CMAKE_INSTALL_PREFIX} by default")
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
option(build_Core_Only "Build only the core akin library" OFF)
option(build_osgAkin "Build OpenSceneGraph support for akin" ON)
option(build_urdfAkin "Build URDF support for akin" ON)
option(build_HuboKin "Build the Hubo extension of akin" ON)
option(build_dartAkin "Build akin's wrapper for DART" ON)
if(build_Core_Only)
set(build_osgAkin OFF CACHE BOOL "Build OpenSceneGraph support for akin" FORCE)
set(build_urdfAkin OFF CACHE BOOL "Build URDF support for akin" FORCE)
set(build_HuboKin OFF CACHE BOOL "Build the Hubo extension of akin" FORCE)
set(build_dartAkin OFF CACHE BOOL "Build akin's wrapper for DART" FORCE)
endif(build_Core_Only)
set(COMPLETED_BUILD TRUE CACHE BOOL INTERNAL)
add_definitions("-Wall -Wextra")
list( APPEND CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}" )
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(Eigen REQUIRED)
include_directories(${Eigen_INCLUDE_DIRS})
set(LIBRARY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib)
set(HEADER_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/include)
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/utils)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
add_subdirectory(akin)
add_subdirectory(utils)
if(build_HuboKin)
if(didBuild_urdfAkin)
MESSAGE(STATUS "Building HuboKin")
add_subdirectory(HuboKin)
else(didBuild_urdfAkin)
MESSAGE(WARNING "Could NOT build HuboKin, because it depends on urdfAkin!")
endif(didBuild_urdfAkin)
else(build_HuboKin)
MESSAGE(STATUS "Ignoring HuboKin")
set(COMPLETED_BUILD FALSE CACHE BOOL INTERNAL)
endif(build_HuboKin)
if(COMPLETED_BUILD)
set(exec_dependencies osgAkin
${OSG_LIBRARIES}
HuboKin
urdfAkin
${urdfdom_LIBRARIES}
akin
GL )
enable_testing()
file(GLOB unit_tests_source "test/*.cpp")
LIST(SORT unit_tests_source)
message(STATUS "\n Unit Tests: ")
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
foreach(utest_src_file ${unit_tests_source})
get_filename_component(test_base ${utest_src_file} NAME_WE)
message(STATUS "Adding test ${test_base}")
add_executable(${test_base} ${utest_src_file})
target_link_libraries(${test_base} ${exec_dependencies})
add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}/${test_base})
add_custom_target(${test_base}.run ${test_base} ${ARGN})
add_dependencies(check ${test_base})
endforeach(utest_src_file)
file(GLOB apps_source "apps/*.cpp")
LIST(SORT apps_source)
message(STATUS "\n Applications: ")
foreach(app_src_file ${apps_source})
get_filename_component(app_base ${app_src_file} NAME_WE)
message(STATUS "Adding application ${app_base}")
add_executable(${app_base} ${app_src_file})
target_link_libraries(${app_base} ${exec_dependencies})
endforeach(app_src_file)
else(COMPLETED_BUILD)
message(STATUS "The entire package was NOT compiled, so we will not generate apps and tests!\n")
endif(COMPLETED_BUILD)