forked from esmini/esmini
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
89 lines (67 loc) · 2.67 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
message(STATUS "CMake version: " ${CMAKE_VERSION})
# Set to the current lowest tested version of CMake
if(WIN32)
# for cmake generator VisualStudio 2017 support
cmake_minimum_required (VERSION 3.7.0 FATAL_ERROR)
else()
cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
endif()
project (EnvironmentSimulator)
if(MSVC)
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
elseif (MINGW)
endif()
set(CMAKE_CXX_STANDARD 14)
# Allow for folder structure
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# The static libaries needs to be compiled with position independent code
# otherwise we cant link with them when building dynamic libaries
# An alternative to this global option is to set POSITION_INDEPENDENT_CODE on each target
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set (LINUX true)
else ()
set (LINUX false)
endif ()
if (LINUX OR APPLE OR MINGW OR MSVC)
set(INSTALL_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin")
else ()
message(FATAL_ERROR "Unrecognized platform therefore there isn't an installation directory. Stopping the cmake process.")
endif ()
set(INSTALL_DIRECTORY_CODE_EXAMPLES "${CMAKE_HOME_DIRECTORY}/code-examples-bin")
set(PUGIXML_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/externals/pugixml")
set(EXPR_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/externals/expr")
if(MSVC)
set(DIRENT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/externals/dirent/win")
else()
set(DIRENT_INCLUDE_DIR "")
endif()
include_directories( ${PUGIXML_INCLUDE_DIR} ${EXPR_INCLUDE_DIR})
set(USE_OSG True CACHE BOOL "If projects that depend on OpenSceneGraph should be compiled.")
set(USE_OSI True CACHE BOOL "If code that depend on OSI should be compiled.")
set(USE_SUMO True CACHE BOOL "If code that depend on SUMO should be compiled.")
set(USE_GTEST True CACHE BOOL "If unit test suites based on googletest should be compiled.")
set(DYN_PROTOBUF False CACHE BOOL "Set for dynamic linking of protobuf library (.so/.dll)")
if (USE_OSG)
add_definitions(-D_USE_OSG)
endif (USE_OSG)
if (USE_OSI)
add_definitions(-D_USE_OSI)
endif (USE_OSI)
if (USE_SUMO)
add_definitions(-D_USE_SUMO)
endif (USE_SUMO)
if (USE_GTEST)
add_definitions(-D_USE_GTEST)
endif (USE_GTEST)
if (DYN_PROTOBUF)
add_definitions(-D_DYN_PROTOBUF)
add_definitions(-DPROTOBUF_USE_DLLS)
endif (DYN_PROTOBUF)
add_subdirectory(EnvironmentSimulator)
if( NOT EXISTS "test/OSC-ALKS-scenarios/.git" )
execute_process(COMMAND git submodule update --init WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()
# Add variables to global scope, e.g. when esmini is used as submodule
set(PUGIXML_INCLUDE_DIR ${PUGIXML_INCLUDE_DIR} CACHE INTERNAL "")
set(EXPR_INCLUDE_DIR ${EXPR_INCLUDE_DIR} CACHE INTERNAL "")