forked from gazebosim/gz-common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
169 lines (137 loc) · 5.51 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
161
162
163
164
165
166
167
168
169
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
#============================================================================
# Initialize the project
#============================================================================
project(gz-common5 VERSION 5.5.0)
set(GZ_COMMON_VER ${PROJECT_VERSION_MAJOR})
#============================================================================
# Find gz-cmake
#============================================================================
find_package(gz-cmake3 REQUIRED)
set(GZ_CMAKE_VER ${gz-cmake3_VERSION_MAJOR})
#============================================================================
# Configure the project
#============================================================================
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
gz_configure_project(VERSION_SUFFIX)
#============================================================================
# Set project-specific options
#============================================================================
#--------------------------------------
# Option: Should Windows test symlinking?
if(WIN32)
option(
GZ_BUILD_SYMLINK_TESTS_ON_WINDOWS
"Creating symlinks requires special permissions on Windows, so those tests are disabled by default"
false)
endif()
#--------------------------------------
# Option: Should we use our internal copy of tinyxml2?
if(UNIX OR APPLE)
option(USE_EXTERNAL_TINYXML2 "Use a system-installed version of tinyxml2" ON)
elseif(WIN32)
# For backward compatibility, this option on Windows by default is OFF
option(USE_EXTERNAL_TINYXML2 "Use a system-installed version of tinyxml2" OFF)
endif()
#============================================================================
# Search for project-specific dependencies
#============================================================================
message(STATUS "\n\n-- ====== Finding Dependencies ======")
#--------------------------------------
# Find gz-math
gz_find_package(gz-math7 REQUIRED_BY geospatial graphics events)
set(GZ_MATH_VER ${gz-math7_VERSION_MAJOR})
#--------------------------------------
# Find gz-utils
gz_find_package(gz-utils2 REQUIRED)
set(GZ_UTILS_VER ${gz-utils2_VERSION_MAJOR})
#--------------------------------------
# Find Tinyxml2
if(USE_EXTERNAL_TINYXML2)
gz_find_package(TINYXML2 PRETTY tinyxml2
REQUIRED_BY graphics
PRIVATE_FOR graphics)
else()
message(STATUS "Skipping search for tinyxml2 and using an internal version\n")
endif()
#--------------------------------------
# Find libdl
gz_find_package(
DL REQUIRED PRIVATE PRETTY libdl PURPOSE "Required for plugins")
#--------------------------------------
# Find dependencies that we ignore for Visual Studio
if(NOT MSVC)
#------------------------------------
# Find uuid
gz_find_package(UUID REQUIRED PRETTY uuid)
endif()
#------------------------------------
# Find Freeimage
gz_find_package(FreeImage VERSION 3.9
REQUIRED_BY graphics
PRIVATE_FOR graphics)
#------------------------------------
# Find GNU Triangulation Surface Library
gz_find_package(
GTS PRETTY gts PURPOSE "GNU Triangulation Surface library"
REQUIRED_BY graphics
PRIVATE_FOR graphics)
#------------------------------------
# Find GDAL
gz_find_package(GDAL VERSION 3.0
PKGCONFIG gdal
PKGCONFIG_VER_COMPARISON >=
PRIVATE_FOR geospatial
REQUIRED_BY geospatial)
#------------------------------------
# Find libswscale
gz_find_package(SWSCALE REQUIRED_BY av PRETTY libswscale)
#------------------------------------
# Find avdevice
gz_find_package(AVDEVICE VERSION 56.4.100 REQUIRED_BY av PRETTY libavdevice)
set(HAVE_AVDEVICE ${AVDEVICE_FOUND})
#------------------------------------
# Find avformat
gz_find_package(AVFORMAT REQUIRED_BY av PRETTY libavformat)
#------------------------------------
# Find avcodec
gz_find_package(AVCODEC REQUIRED_BY av PRETTY libavcodec)
#------------------------------------
# Find avutil
gz_find_package(AVUTIL REQUIRED_BY av PRETTY libavutil)
#------------------------------------
# Find assimp
gz_find_package(GzAssimp REQUIRED_BY graphics PRETTY assimp)
message(STATUS "-------------------------------------------\n")
#============================================================================
# Configure the build
#============================================================================
configure_file("${PROJECT_SOURCE_DIR}/cppcheck.suppress.in"
${PROJECT_BINARY_DIR}/cppcheck.suppress)
gz_configure_build(QUIT_IF_BUILD_ERRORS
COMPONENTS av events graphics geospatial io profiler testing)
#============================================================================
# Create package information
#============================================================================
gz_create_packages()
#============================================================================
# Create documentation
#============================================================================
configure_file(${CMAKE_SOURCE_DIR}/api.md.in ${CMAKE_BINARY_DIR}/api.md)
configure_file(${CMAKE_SOURCE_DIR}/tutorials.md.in ${CMAKE_BINARY_DIR}/tutorials.md)
gz_create_docs(
API_MAINPAGE_MD "${CMAKE_BINARY_DIR}/api.md"
TUTORIALS_MAINPAGE_MD "${CMAKE_BINARY_DIR}/tutorials.md"
TAGFILES
"${GZ-MATH_DOXYGEN_TAGFILE} = ${GZ-MATH_API_URL}"
)
#============================================================================
# Build examples
#============================================================================
if (BUILD_TESTING)
gz_build_examples(
SOURCE_DIR ${PROJECT_SOURCE_DIR}/examples
BINARY_DIR ${PROJECT_BINARY_DIR}/examples
)
endif()