forked from sbpl/sbpl
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
113 lines (96 loc) · 3.56 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
107
108
109
110
111
112
113
cmake_minimum_required(VERSION 2.8)
PROJECT( sbpl )
# version (e.g. for packaging)
set(SBPL_MAJOR_VERSION 1)
set(SBPL_MINOR_VERSION 3)
set(SBPL_PATCH_VERSION 1)
set(SBPL_VERSION ${SBPL_MAJOR_VERSION}.${SBPL_MINOR_VERSION}.${SBPL_PATCH_VERSION})
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "-std=c++1y ${CMAKE_CXX_FLAGS}")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_definitions(-O3 )
IF(APPLE)
set(CMAKE_MACOSX_RPATH 1)
ENDIF(APPLE)
execute_process(
COMMAND "python2.7" -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"
OUTPUT_VARIABLE PYTHON_INCLUDE_DIRS
OUTPUT_STRIP_TRAILING_WHITESPACE
)
include_directories(
${PYTHON_INCLUDE_DIRS}
"${PROJECT_SOURCE_DIR}/src/include"
"${PROJECT_SOURCE_DIR}/dep/pybind11/include"
)
add_library(sbpl SHARED
src/discrete_space_information/environment_nav2D.cpp
src/discrete_space_information/environment_navxythetalat.cpp
src/discrete_space_information/environment_navxythetamlevlat.cpp
src/discrete_space_information/environment_nav2Duu.cpp
src/discrete_space_information/environment_XXX.cpp
src/discrete_space_information/environment_robarm.cpp
src/heuristics/embedded_heuristic.cpp
src/planners/adplanner.cpp
src/planners/ANAplanner.cpp
src/planners/araplanner.cpp
src/planners/lazyARA.cpp
src/planners/mhaplanner.cpp
src/planners/ppcpplanner.cpp
src/planners/rstarplanner.cpp
src/planners/viplanner.cpp
src/utils/heap.cpp
src/utils/mdp.cpp
src/utils/utils.cpp
src/utils/2Dgridsearch.cpp
src/utils/config.cpp
src/runners/runners.cpp
)
set(SBPL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
set(SBPL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
# support for pkg-config
set(PKG_NAME "sbpl")
set(PKG_DESC "The Search Based Planning Library")
set(PKG_SBPL_LIBS "-lsbpl")
set(pkg_conf_file_in "${CMAKE_CURRENT_SOURCE_DIR}/sbpl.pc.in")
set(pkg_conf_file "${PROJECT_BINARY_DIR}/InstallFiles/sbpl.pc")
configure_file("${pkg_conf_file_in}" "${pkg_conf_file}" @ONLY)
install(FILES ${pkg_conf_file} DESTINATION lib/pkgconfig/ COMPONENT pkgconfig)
# support for cmake-config:
configure_file(sbpl-config.cmake.in
"${PROJECT_BINARY_DIR}/InstallFiles/sbpl-config.cmake" @ONLY)
configure_file(sbpl-config-version.cmake.in
"${PROJECT_BINARY_DIR}/InstallFiles/sbpl-config-version.cmake" @ONLY)
install(FILES
"${PROJECT_BINARY_DIR}/InstallFiles/sbpl-config.cmake"
"${PROJECT_BINARY_DIR}/InstallFiles/sbpl-config-version.cmake"
DESTINATION share/sbpl/)
# support for build tree export
option(SBPL_BUILD_TREE_EXPORT "Enable build tree exports" OFF)
if (${SBPL_BUILD_TREE_EXPORT})
export(TARGETS sbpl FILE sbpl-targets.cmake)
set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src/include")
configure_file(
sbpl-config-tree-export.cmake.in
"${PROJECT_BINARY_DIR}/sbpl-config.cmake"
@ONLY)
export(PACKAGE sbpl)
endif()
install(DIRECTORY src/include/sbpl DESTINATION include
FILES_MATCHING PATTERN "*.h")
install(TARGETS sbpl
LIBRARY DESTINATION lib)
if(APPLE)
set(PYTHON_LIBRARIES "${PYTHON_PREFIX}/lib/libpython2.7.dylib")
else(APPLE)
# it seems like libpython2.7.so is not necessary on ubuntu
# set(PYTHON_LIBRARIES "${PYTHON_PREFIX}/lib/libpython2.7.so")
endif(APPLE)
add_library(sbpl_module SHARED
${PROJECT_SOURCE_DIR}/src/python_wrapper.cpp)
target_link_libraries(sbpl_module ${PYTHON_LIBRARIES} ${PROJECT_NAME})
# Don't prepend wrapper library name with lib and add to Python libs.
set_target_properties(sbpl_module PROPERTIES
PREFIX "_"
SUFFIX ".so"
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/sbpl
)