forked from carla-simulator/carla
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
160 lines (125 loc) · 3.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#[[
Copyright (c) 2024 Computer Vision Center (CVC) at the Universitat Autonoma
de Barcelona (UAB).
This work is licensed under the terms of the MIT license.
For a copy, see <https://opensource.org/licenses/MIT>.
]]
cmake_minimum_required (
VERSION
3.27.2
)
cmake_policy (SET CMP0097 NEW)
cmake_policy (SET CMP0091 NEW)
cmake_policy (SET CMP0074 NEW)
cmake_policy (SET CMP0077 NEW)
if (${CMAKE_MINOR_VERSION} GREATER_EQUAL 24)
cmake_policy (SET CMP0135 NEW)
endif ()
set (CARLA_VERSION_MAJOR 0)
set (CARLA_VERSION_MINOR 9)
set (CARLA_VERSION_PATCH 15)
set (
CARLA_VERSION
${CARLA_VERSION_MAJOR}.${CARLA_VERSION_MINOR}.${CARLA_VERSION_PATCH}
)
project (
CARLA
VERSION
${CARLA_VERSION}
LANGUAGES
C
CXX
ASM # This is required by some dependencies, such as LibPNG.
DESCRIPTION
"Open-source simulator for autonomous driving research."
HOMEPAGE_URL
https://carla.org
)
set (CMAKE_CXX_STANDARD 20)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_C_STANDARD 11)
set (CMAKE_C_STANDARD_REQUIRED ON)
set (
CARLA_WORKSPACE_PATH
${CMAKE_CURRENT_SOURCE_DIR}
)
set (
CARLA_PACKAGE_PATH
${CMAKE_BINARY_DIR}/Package
)
set (
CARLA_UNREAL_PLUGINS_PATH
${CARLA_WORKSPACE_PATH}/Unreal/CarlaUnreal/Plugins
)
include (CheckCCompilerFlag)
include (CheckCXXCompilerFlag)
include (CheckLinkerFlag)
include (${CARLA_WORKSPACE_PATH}/CMake/Util.cmake)
include (${CARLA_WORKSPACE_PATH}/CMake/CarlaOptions.cmake)
include (${CARLA_WORKSPACE_PATH}/CMake/Warnings.cmake)
include (${CARLA_WORKSPACE_PATH}/CMake/Errors.cmake)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
carla_warning (
"CARLA is set to be built in Debug mode. This may cause issues when building CarlaUnrealEditor."
)
endif ()
if (LINUX)
check_linker_flag (CXX -lpthread HAS_PTHREAD)
if (HAS_PTHREAD)
add_link_options (-lpthread)
endif ()
endif ()
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
if (WIN32)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set (CARLA_DEBUG_AFFIX d)
set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebugDLL")
else ()
set (CARLA_DEBUG_AFFIX )
set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
endif ()
endif ()
set (CARLA_COMMON_DEFINITIONS)
foreach (FORMAT ${LIBCARLA_IMAGE_SUPPORTED_FORMATS})
carla_message ("Enabling CARLA image support for \"${FORMAT}\".")
string (TOUPPER "${FORMAT}" FORMAT_UPPERCASE)
list (APPEND CARLA_COMMON_DEFINITIONS LIBCARLA_IMAGE_SUPPORT_${FORMAT_UPPERCASE}=1)
endforeach ()
if (WIN32)
add_compile_definitions (_CRT_SECURE_NO_WARNINGS)
endif ()
if (WIN32)
# https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170
list (APPEND CARLA_COMMON_DEFINITIONS _WIN32_WINNT=0x0601) # <- Windows 10
list (APPEND CARLA_COMMON_DEFINITIONS HAVE_SNPRINTF)
list (APPEND CARLA_COMMON_DEFINITIONS _USE_MATH_DEFINES)
endif ()
set (CARLA_EXCEPTION_DEFINITIONS)
if (ENABLE_EXCEPTIONS)
# Nothing
else ()
list (APPEND CARLA_EXCEPTION_DEFINITIONS ASIO_NO_EXCEPTIONS)
list (APPEND CARLA_EXCEPTION_DEFINITIONS BOOST_NO_EXCEPTIONS)
list (APPEND CARLA_EXCEPTION_DEFINITIONS LIBCARLA_NO_EXCEPTIONS)
list (APPEND CARLA_EXCEPTION_DEFINITIONS PUGIXML_NO_EXCEPTIONS)
endif ()
include (${CARLA_WORKSPACE_PATH}/CMake/CarlaDependencies.cmake)
if (BUILD_CARLA_CLIENT OR BUILD_CARLA_SERVER)
add_subdirectory (LibCarla)
endif ()
if (BUILD_OSM_WORLD_RENDERER)
add_subdirectory (osm-world-renderer)
endif ()
if (ENABLE_ROS2)
set (BOOST_INCLUDE_PATH ${CMAKE_BINARY_DIR}/_deps/boost-src/libs)
add_subdirectory (Ros2Native)
endif()
if (BUILD_PYTHON_API)
add_subdirectory (PythonAPI)
endif ()
if (BUILD_CARLA_UNREAL)
add_subdirectory (Unreal)
endif ()
if (BUILD_EXAMPLES)
add_subdirectory (Examples)
endif ()