forked from ilpincy/argos3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
121 lines (106 loc) · 2.82 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
#
# Set minimum required version
#
cmake_minimum_required(VERSION 2.8.12)
#
# Set the path additional cmake files must be searched for
#
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
#
# Set CMake policies to select wanted behaviors
#
# Use new policies introduced up to this version
cmake_policy(VERSION 2.8.12)
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif(POLICY CMP0042)
#
# Include path points to the base source dir
#
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
#
# Make sure we are under Unix
#
if(NOT UNIX)
message(FATAL_ERROR "ARGoS compiles only under UNIX, sorry!")
endif(NOT UNIX)
#
# Set build options
#
include(${CMAKE_SOURCE_DIR}/cmake/ARGoSBuildOptions.cmake)
#
# Set compiler flags
#
include(${CMAKE_SOURCE_DIR}/cmake/ARGoSBuildFlags.cmake)
#
# Check for libraries
#
include(${CMAKE_SOURCE_DIR}/cmake/ARGoSBuildChecks.cmake)
#
# Set up CPack for later use
#
include(${CMAKE_SOURCE_DIR}/cmake/ARGoSPackaging.cmake)
#
# Create config file with settings that must be accessed from C++
#
configure_file(
${CMAKE_SOURCE_DIR}/core/config.h.in
${CMAKE_BINARY_DIR}/core/config.h
@ONLY)
install(FILES ${CMAKE_BINARY_DIR}/core/config.h DESTINATION include/argos3/core)
#
# Create a soft link 'argos3' pointing to the build directory
# It is necessary for the config.h file to be found by the compiler
#
if(NOT EXISTS ${CMAKE_BINARY_DIR}/argos3)
execute_process(
COMMAND ln -s . argos3
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endif(NOT EXISTS ${CMAKE_BINARY_DIR}/argos3)
#
# Compile stuff
#
add_subdirectory(core)
add_subdirectory(plugins)
if(ARGOS_BUILD_FOR_SIMULATOR)
add_subdirectory(testing)
endif(ARGOS_BUILD_FOR_SIMULATOR)
#
# Create documentation
#
include(${CMAKE_SOURCE_DIR}/cmake/ARGoSCreateDocs.cmake)
#
# Create .gdbinit file for GDB support
# It is placed in the same directory as the argos3 executable
#
configure_file(
${CMAKE_SOURCE_DIR}/scripts/gdbinit.in
${CMAKE_BINARY_DIR}/core/.gdbinit
@ONLY)
#
# Create setup_envsh file for bash support
# It is placed in the base build directory
#
configure_file(
${CMAKE_SOURCE_DIR}/scripts/setup_env.sh.in
${CMAKE_BINARY_DIR}/setup_env.sh
@ONLY)
#
# Install extra stuff
#
if(ARGOS_INSTALL_LDSOCONF)
# Configuration file for /etc/ld.so.conf.d/
configure_file(
${CMAKE_SOURCE_DIR}/scripts/argos3.conf.in
${CMAKE_BINARY_DIR}/argos3.conf
@ONLY)
install(FILES ${CMAKE_BINARY_DIR}/argos3.conf DESTINATION /etc/ld.so.conf.d)
endif(ARGOS_INSTALL_LDSOCONF)
# Configuration file for pkg-config
configure_file(
${CMAKE_SOURCE_DIR}/scripts/argos3.pc.in
${CMAKE_BINARY_DIR}/argos3_${ARGOS_BUILD_FOR}.pc
@ONLY)
install(FILES ${CMAKE_BINARY_DIR}/argos3_${ARGOS_BUILD_FOR}.pc DESTINATION lib/pkgconfig)
# Bash completion file
install(FILES ${CMAKE_SOURCE_DIR}/scripts/argos3_bash_completion.sh DESTINATION share/argos3)