-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
56 lines (47 loc) · 2.31 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
cmake_minimum_required(VERSION 3.16.3)
project(simOMPL)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_MACOSX_RPATH 1)
find_package(Boost REQUIRED COMPONENTS system serialization)
if(NOT COPPELIASIM_INCLUDE_DIR)
if(DEFINED ENV{COPPELIASIM_ROOT_DIR})
set(COPPELIASIM_INCLUDE_DIR $ENV{COPPELIASIM_ROOT_DIR}/programming/include)
else()
set(COPPELIASIM_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../include)
endif()
endif()
list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules
${COPPELIASIM_INCLUDE_DIR}/cmake)
find_package(CoppeliaSim 4.5.1.7 REQUIRED)
find_package(Eigen3 REQUIRED)
include(ExternalProject)
set(OMPL_VERSION 1.5.0)
set(OMPL_ABI_VERSION 16)
set(OMPL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/ompl-${OMPL_VERSION}-prefix)
set(OMPL_SRC_DIR ${OMPL_PREFIX}/src/ompl-${OMPL_VERSION})
set(OMPL_BUILD_DIR ${OMPL_PREFIX}/src/ompl-${OMPL_VERSION}-build)
ExternalProject_Add(ompl-${OMPL_VERSION}
URL https://github.com/ompl/ompl/archive/${OMPL_VERSION}.tar.gz
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DOMPL_BUILD_DEMOS=OFF -DOMPL_BUILD_PYBINDINGS=OFF -DOMPL_BUILD_PYTESTS=OFF -DOMPL_BUILD_TESTS=OFF -DOMPL_REGISTRATION=OFF -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
BUILD_COMMAND ${CMAKE_COMMAND} --build ${OMPL_BUILD_DIR} --config ${CMAKE_BUILD_TYPE}
INSTALL_COMMAND ""
)
include_directories(${OMPL_SRC_DIR}/src ${OMPL_BUILD_DIR}/src)
if(WIN32)
link_directories(${OMPL_BUILD_DIR}/src/ompl/${CMAKE_BUILD_TYPE})
else()
link_directories(${OMPL_BUILD_DIR}/lib)
endif()
include_directories(${CMAKE_CURRENT_BINARY_DIR}/generated)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external)
coppeliasim_generate_stubs(${CMAKE_CURRENT_BINARY_DIR}/generated XML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/sourceCode/callbacks.xml LUA_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lua/simOMPL.lua)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sourceCode/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
coppeliasim_add_plugin(simOMPL SOURCES sourceCode/plugin.cpp)
add_dependencies(simOMPL ompl-${OMPL_VERSION})
target_link_libraries(simOMPL PRIVATE Boost::boost Boost::system Boost::serialization)
target_link_libraries(simOMPL PRIVATE Eigen3::Eigen)
target_link_libraries(simOMPL PRIVATE ompl)
if(NOT WIN32)
install(DIRECTORY ${OMPL_BUILD_DIR}/lib/ DESTINATION ${COPPELIASIM_LIBRARIES_DIR})
endif()