-
Notifications
You must be signed in to change notification settings - Fork 94
/
CMakeLists.txt
556 lines (477 loc) · 19.2 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
cmake_minimum_required (VERSION 3.5)
option(ADD_HOME_LOCAL_PREFIX "Add ~/.local to cmake prefix" OFF)
if(ADD_HOME_LOCAL_PREFIX)
set(CMAKE_PREFIX_PATH $ENV{HOME}/.local/ ${CMAKE_PREFIX_PATH})
endif()
# see : https://crascit.com/2016/04/09/using-ccache-with-cmake/
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
else()
message("ccache not found, repeated builds will be faster if this program is installed")
endif()
project (scrimmage)
set(PROJECT_VERSION "0.2.0-dev")
# give SCRIMMAGE 1 series a few more soversions
set(SCRIMMAGE_SOVERSION "00")
if(NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX /usr/local)
endif()
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib:$ORIGIN/../lib/${PROJECT_NAME}/plugin_libs" CACHE STRING "The installed RPATH")
# fetch all the local directories for generated code
get_filename_component(PROJECT_PLUGIN_LIBS_DIR ${PROJECT_BINARY_DIR}/plugin_libs ABSOLUTE)
get_filename_component(SCRIMMAGE_INC_DIR ./include ABSOLUTE)
get_filename_component(SCRIMMAGE_SCRIPTS_DIR ./scripts ABSOLUTE)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/Modules
${PROJECT_SOURCE_DIR}/share/cmake/${PROJECT_NAME})
set(SCRIMMAGE_PYTHON_DIR ${PROJECT_SOURCE_DIR}/python)
set(SCRIMMAGE_PROTO_PATH ${CMAKE_CURRENT_LIST_DIR}/src/proto)
set(MSGS_INCLUDE_DIR ${PROJECT_BINARY_DIR}/msgs)
set(PROTO_INCLUDE_DIR ${PROJECT_BINARY_DIR}/src/proto)
include_directories(${PROTO_INCLUDE_DIR})
include(MacroAddExternalTarget)
include(MacroSubDirList)
include(FindPythonModule)
include(FetchContent)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
"Choose the type of build, options are: Debug Release
RelWithDebInfo MinSizeRel." FORCE)
endif()
if (${SCRIMMAGE_CXX_VERSION})
set(CMAKE_CXX_STANDARD ${SCRIMMAGE_CXX_VERSION})
else()
set(CMAKE_CXX_STANDARD 14)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
# macOS requires additional directories added to the path
set(APPEND_TO_PATH "")
if(APPLE)
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-type-c-linkage")
string(JOIN ":" APPEND_TO_PATH
"${PROJECT_BINARY_DIR}/bin/scrimmage.app/Contents/MacOS"
"${PROJECT_BINARY_DIR}/bin/scrimmage-playback.app/Contents/MacOS"
"${PROJECT_BINARY_DIR}/bin/scrimmage-viz.app/Contents/MacOS")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall") # -fprofile-arcs -ftest-coverage")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall") # -fprofile-arcs -ftest-coverage")
option(SETUP_HOME_CONFIG "Setup ~/.scrimmage" ON)
set(LOCAL_CONFIG_DIR "$ENV{HOME}/.scrimmage" CACHE PATH "Local ~/.scrimmage config directory")
include(GenerateSetEnv)
GenerateSetEnv(
SETUP_LOCAL_CONFIG_DIR ${SETUP_HOME_CONFIG}
LOCAL_CONFIG_DIR ${LOCAL_CONFIG_DIR}
SETENV_IN_FILE ${PROJECT_SOURCE_DIR}/share/cmake/scrimmage/setenv.in
MISSION_PATH ${PROJECT_SOURCE_DIR}/missions
PLUGIN_PATH ${PROJECT_BINARY_DIR}/plugin_libs
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/plugins
PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${SCRIMMAGE_SCRIPTS_DIR} ${APPEND_TO_PATH}
CONFIG_PATH ${PROJECT_SOURCE_DIR}/config
DATA_PATH ${PROJECT_SOURCE_DIR}/data
PYTHONPATH ${PROJECT_SOURCE_DIR}/src/plugins/autonomy/python
${PROJECT_BINARY_DIR}/msgs/scrimmage/msgs
)
option(EXTERNAL "EXTERNAL" 0)
option(ENABLE_PYTHON_BINDINGS "ENABLE_PYTHON_BINDINGS" ON)
set(PYTHON_MIN_VERSION "" CACHE STRING "Minimum Python version for building, typically outside of environment default Python")
add_library(scrimmage-python INTERFACE)
if (ENABLE_PYTHON_BINDINGS)
# Find Python
#The order of the following find_package calls is important!
if (PYTHON_MIN_VERSION)
find_package(PythonInterp ${PYTHON_MIN_VERSION} REQUIRED)
find_package(PythonLibs ${PYTHON_MIN_VERSION} REQUIRED)
else()
find_package(PythonInterp REQUIRED)
find_package(PythonLibs REQUIRED)
endif()
message(STATUS "Python Versions Found: ${PYTHONLIBS_VERSION_STRING}")
message(STATUS "PYTHON_LIBRARIES : ${PYTHON_LIBRARIES}")
message(STATUS "PYTHON_INCLUDE_DIRS: ${PYTHON_INCLUDE_DIRS}")
set(PYTHON_FOUND TRUE)
# We have already found the python libs and modules, so tell pybind11 to not
# search for the python interpreter and libraries again.
set(PYTHONLIBS_FOUND TRUE)
set(PYTHON_MODULE_EXTENSION TRUE)
find_package(pybind11 REQUIRED)
set(PYBIND11_INCLUDE_DIRS ${pybind11_INCLUDE_DIRS})
target_include_directories(scrimmage-python
SYSTEM INTERFACE ${PYTHON_INCLUDE_DIRS} ${pybind11_INCLUDE_DIRS})
target_compile_definitions(scrimmage-python
INTERFACE -DENABLE_PYTHON_BINDINGS=1)
target_link_libraries(scrimmage-python INTERFACE ${PYTHON_LIBRARIES})
else()
target_compile_definitions(scrimmage-python
INTERFACE -DENABLE_PYTHON_BINDINGS=0)
endif()
install(TARGETS scrimmage-python EXPORT ${PROJECT_NAME}-targets)
########################################################
# Find Protobuf
########################################################
set(PROTOBUF_VERSION 3.0)
set(PROTOC "" CACHE STRING "External protoc executable")
set(PROTOBUF_LIBS "" CACHE STRING "External protobuf lib (libprotobuf.so)")
set(PROTOBUF_INCLUDE "" CACHE STRING "External protobuf include directory")
if (PROTOC STREQUAL "" OR PROTOBUF_LIBS STREQUAL "" OR PROTOBUF_INCLUDE STREQUAL "")
find_package(Protobuf ${PROTOBUF_VERSION} REQUIRED)
if (Protobuf_VERSION AND CMAKE_VERSION VERSION_GREATER 3.5)
set(PROTOBUF_VERSION ${Protobuf_VERSION})
else()
# cmake does not provide a version before 3.6
# so we assume that it is the protobuf supplied by the scrimmage ppa
# this is only used for versioning the protobuf in the setup.py file
# so it can be overwritten
set(PROTOBUF_VERSION 3.3.0)
endif()
else()
set(PROTOBUF_PROTOC_EXECUTABLE "${PROTOC}")
set(PROTOBUF_LIBRARIES "${PROTOBUF_LIBS}")
set(PROTOBUF_INCLUDE_DIRS "${PROTOBUF_INCLUDE}")
endif()
set(PROTOBUF_INCLUDE ${PROTOBUF_INCLUDE_DIRS})
########################################################
# Find GRPC
########################################################
set(GRPC_VERSION 1.2.1)
find_package(GRPC)
########################################################
# Find LibXML2
########################################################
# Sets:
# - LIBXML2_FOUND
# - LIBXML2_LIBRARIES
# - LIBXML2_INCLUDE_DIRS
find_package(LibXml2)
########################################################
# Find GeographicLib
########################################################
find_package (GeographicLib REQUIRED)
add_definitions (${GeographicLib_DEFINITIONS})
########################################################
# Find JSBSim
########################################################
if (NOT APPLE)
find_package(JSBSIM REQUIRED)
string(FIND "${JSBSIM_INCLUDE_DIRS}" "NOTFOUND" POS)
if (JSBSIM_FOUND AND (POS EQUAL -1))
add_definitions(-DENABLE_JSBSIM=1)
else()
add_definitions(-DENABLE_JSBSIM=0)
message(--------------------------)
message("JSBSIM_NOT_FOUND, plugins that use this library will not be built")
message(--------------------------)
endif()
else()
add_definitions(-DENABLE_JSBSIM=0)
message(--------------------------)
message("Apple detected, plugins that use JSBSim will not be built")
message(--------------------------)
endif()
########################################################
# Find VTK
########################################################
find_package(VTK QUIET NO_MODULE)
if (${VTK_FOUND})
if (${VTK_MAJOR_VERSION} LESS 7)
set(OPENGL_MODULE vtkRenderingOpenGL)
else()
set(OPENGL_MODULE vtkRenderingOpenGL2)
set(EXTRUSION_MODULES vtkFiltersModeling vtkIOGeoJSON)
endif()
set(VTK_MODULES
vtkFiltersSources
vtkFiltersTexture
vtkInteractionStyle
vtkIOGeometry
vtkIOImage
vtkIOLegacy
vtkRenderingAnnotation
vtkRenderingCore
${OPENGL_MODULE}
${EXTRUSION_MODULES})
find_package(VTK QUIET NO_MODULE COMPONENTS ${VTK_MODULES})
endif()
if (${VTK_FOUND})
message(STATUS "Found VTK Version: ${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}")
include_directories(SYSTEM ${VTK_INCLUDE_DIRS})
include(${VTK_USE_FILE})
add_definitions(-DENABLE_VTK=1)
else()
add_definitions(-DENABLE_VTK=0)
endif()
########################################################
# Find Eigen
########################################################
if(NOT "${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
# 32 bit check, see https://cmake.org/pipermail/cmake/2013-December/056587.html
# see also: http://eigen.tuxfamily.org/dox/group__TopicUnalignedArrayAssert.html
add_definitions(-DEIGEN_DONT_VECTORIZE=1)
add_definitions(-DEIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT=1)
endif()
find_package(Eigen3 QUIET)
if (NOT Eigen3_FOUND)
include(LibFindMacros)
libfind_pkg_check_modules(EIGEN_PKGCONFIG eigen3)
if (EIGEN_PKGCONFIG_INCLUDE_DIRS STREQUAL "")
message(FATAL_ERROR "could not find eigen either through find_package or pkgconfig")
endif()
set(EIGEN3_INCLUDE_DIR ${EIGEN_PKGCONFIG_INCLUDE_DIRS})
message("Found Eigen with pkg-config, EIGEN3_INCLUDE_DIR: ${EIGEN3_INCLUDE_DIR}")
endif()
########################################################
# Find Boost
########################################################
#set(Boost_DEBUG ON)
find_package(Boost 1.55 COMPONENTS thread date_time iostreams program_options regex
filesystem system graph chrono REQUIRED)
add_library(scrimmage-boost INTERFACE)
target_include_directories(scrimmage-boost INTERFACE ${Boost_INCLUDE_DIRS})
target_link_libraries(scrimmage-boost INTERFACE ${Boost_LIBRARIES})
install(TARGETS scrimmage-boost EXPORT ${PROJECT_NAME}-targets)
########################################################
# Find OpenCV
########################################################
# Look for both OpenCV 3 and 4, giving preference to 4
find_package(OpenCV 4 QUIET)
if (NOT OpenCV_FOUND)
find_package(OpenCV 3 QUIET)
endif()
if (OpenCV_FOUND)
add_library(scrimmage-opencv INTERFACE)
target_include_directories(scrimmage-opencv INTERFACE ${OpenCV_INCLUDE_DIRS})
target_compile_definitions(scrimmage-opencv INTERFACE -DENABLE_OPENCV=1)
target_link_libraries(scrimmage-opencv INTERFACE ${OpenCV_LIBRARIES})
install(TARGETS scrimmage-opencv EXPORT ${PROJECT_NAME}-targets)
else()
add_definitions(-DENABLE_OPENCV=0)
endif()
########################################################
# Find ROS
########################################################
option(BUILD_ROS_PLUGINS "BUILD_ROS_PLUGINS" OFF)
if (BUILD_ROS_PLUGINS)
find_package(catkin REQUIRED COMPONENTS roscpp sensor_msgs std_msgs
geometry_msgs nav_msgs tf image_transport cv_bridge tf2_ros tf2 tf2_geometry_msgs)
if (catkin_FOUND)
include_directories(${catkin_INCLUDE_DIRS})
endif()
endif()
########################################################
# Find AirSim
########################################################
find_package(AirSim)
if (AIRSIM_FOUND)
include_directories(${AIRSIM_INCLUDE_DIRS})
add_definitions(-DENABLE_AIRSIM=1)
else()
add_definitions(-DENABLE_AIRSIM=0)
endif()
########################################################
# Recurse into src, share, and plugins
########################################################
add_subdirectory(share)
add_subdirectory(msgs)
add_subdirectory(src)
if (NOT EXTERNAL)
add_subdirectory(tools)
endif()
add_subdirectory(${SCRIMMAGE_PYTHON_DIR})
option(BUILD_DOCS "Build documentation" OFF)
if (BUILD_DOCS)
add_subdirectory(docs)
endif()
###################################################################
# Add gtest
###################################################################
option(BUILD_TESTS "BUILD_TESTS" OFF)
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE AND BUILD_TESTS)
enable_testing()
############################################################
# copied from
# https://github.com/google/googletest/tree/master/googletest#incorporating-into-an-existing-cmake-project
############################################################
# Download and unpack googletest at configure time
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG origin/main
GIT_SHALLOW true
GIT_PROGRESS true
)
# Prevent overriding the parent project's compiler/linker
# settings on Windows
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
add_subdirectory(test)
endif()
###############################################################################
# Installation
###############################################################################
set(PROJECT_DESCRIPTION "A multi-agent simulator")
# - Add each library to LIBS_STRING
# SCRIMMAGE_GTRI_SIM_LIBS is a "global" variable that is passed
# down to each sub directory and every library that is
# generated in this project appends its name to this
# variable.
foreach(I ${PROJECT_LIBS})
set (LIBS_STRING "${LIBS_STRING} -l${I}")
endforeach()
#############################################################################
# Generate the cmake configuration files for the build tree
#############################################################################
include(CMakePackageConfigHelpers)
# Configure variables used in project-config.cmake.in for build tree
set(TMP_INCLUDE_INSTALL_DIR ${PROJECT_SOURCE_DIR}/include)
set(TMP_MSGS_INCLUDE_DIR ${MSGS_INCLUDE_DIR})
set(TMP_PROTO_INCLUDE_DIR ${PROTO_INCLUDE_DIR})
set(SCRIMMAGE_MSGS_PROTO_PATH ${CMAKE_CURRENT_LIST_DIR}/msgs)
set(SHARE_INSTALL_DIR ${PROJECT_SOURCE_DIR}/share)
configure_package_config_file(
${PROJECT_SOURCE_DIR}/cmake/Modules/project-config.cmake.in
${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
INSTALL_DESTINATION ${PROJECT_BINARY_DIR}
PATH_VARS TMP_INCLUDE_INSTALL_DIR SCRIMMAGE_PROTO_PATH
SCRIMMAGE_MSGS_PROTO_PATH SHARE_INSTALL_DIR
)
write_basic_package_version_file(
${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
# Export project export set to the build tree
export(
EXPORT ${PROJECT_NAME}-targets
FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-targets.cmake"
)
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry ~/.cmake)
export(PACKAGE ${PROJECT_NAME})
#############################################################################
# Generate the cmake configuration files for the install tree
#############################################################################
set(INCLUDE_INSTALL_DIR include/ CACHE PATH "Include install dir")
set(SHARE_INSTALL_DIR share/)
set(LIB_INSTALL_DIR lib/ CACHE PATH "Library install dir")
set(CMAKE_CONFIG_DEST "${LIB_INSTALL_DIR}/${PROJECT_NAME}/cmake")
# Configure variables used in project-config.cmake.in for install tree
set(TMP_INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_DIR})
unset(TMP_MSGS_INCLUDE_DIR)
unset(TMP_PROTO_INCLUDE_DIR)
set(SCRIMMAGE_PROTO_PATH ${SHARE_INSTALL_DIR}/${PROJECT_NAME}/proto)
set(SCRIMMAGE_MSGS_PROTO_PATH ${SHARE_INSTALL_DIR}/${PROJECT_NAME}/msgs)
configure_package_config_file(
${PROJECT_SOURCE_DIR}/cmake/Modules/project-config.cmake.in
${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}-config.cmake
INSTALL_DESTINATION ${CMAKE_CONFIG_DEST}
PATH_VARS TMP_INCLUDE_INSTALL_DIR SCRIMMAGE_PROTO_PATH
SCRIMMAGE_MSGS_PROTO_PATH SHARE_INSTALL_DIR
)
write_basic_package_version_file(
${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
# Install cmake config files
install(FILES ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}-config.cmake
${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}-config-version.cmake
DESTINATION ${CMAKE_CONFIG_DEST})
# Export project export set to the install tree
install(
EXPORT ${PROJECT_NAME}-targets
DESTINATION ${CMAKE_CONFIG_DEST}
)
#############################################################################
# Install Targets
#############################################################################
# Install all mission XML files under share
install(
DIRECTORY missions
DESTINATION share/${PROJECT_NAME}
FILES_MATCHING PATTERN "*.xml"
)
# Install all library headers
install(
DIRECTORY include/${PROJECT_NAME}
DESTINATION include
FILES_MATCHING PATTERN "*.h"
)
# Install all plugin configuration files
install(
DIRECTORY include/${PROJECT_NAME}
DESTINATION etc
FILES_MATCHING PATTERN "*.xml"
)
# Install all scrimmage proto headers
install(
DIRECTORY ${PROTO_INCLUDE_DIR}/${PROJECT_NAME}
DESTINATION include
FILES_MATCHING PATTERN "*.pb.h"
)
# Install all project message proto headers
install(
DIRECTORY ${MSGS_INCLUDE_DIR}/${PROJECT_NAME}
DESTINATION include
FILES_MATCHING PATTERN "*.pb.h"
)
# Install the .proto files in case another project wants to use them
install(
DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/src/proto
DESTINATION share/${PROJECT_NAME}
FILES_MATCHING PATTERN "*.proto"
)
# Install the message .proto files in case another project wants to use them
install(
DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/msgs
DESTINATION share/${PROJECT_NAME}
FILES_MATCHING PATTERN "*.proto"
)
if (NOT EXTERNAL)
# Install meshes, terrain, maps that come with scrimmage core
install(
DIRECTORY data/gui
DESTINATION share/${PROJECT_NAME}/data
)
endif()
# Create the ld.so.conf.d/project.conf file
if (NOT APPLE)
file(WRITE
${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}.conf
"${CMAKE_INSTALL_PREFIX}/lib\n${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}/plugin_libs"
)
option(ENABLE_LD_SO_CONF_INSTALL "Install ${PROJECT_NAME}.conf to /etc/ld.so.conf.d" OFF)
if (ENABLE_LD_SO_CONF_INSTALL)
install(
FILES ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}.conf
DESTINATION /etc/ld.so.conf.d
)
endif()
endif()
# Install the project-setenv file
install(
FILES ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}-setenv
DESTINATION etc/scrimmage/env
)
# Install scrimmage cmake helper files
install(
DIRECTORY ${PROJECT_SOURCE_DIR}/share/cmake
DESTINATION share
)
###############################################################################
# Binary installation generation
###############################################################################
set(CPACK_GENERATOR "DEB")
set(CPACK_INSTALL_CMAKE_PROJECTS "${PROJECT_BINARY_DIR};${PROJECT_NAME};ALL;/")
set(CPACK_OUTPUT_CONFIG_FILE "${PROJECT_BINARY_DIR}/CPackConfig.cmake")
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SCRIMMAGE")
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_RELEASE 1)
set(CPACK_PACKAGE_CONTACT "Kevin DeMarco")
set(CPACK_PACKAGE_VENDOR "GTRI")
set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CMAKE_SYSTEM_PROCESSOR}")
include(CPack)