-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
187 lines (151 loc) · 6.52 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
#--------------------------------------------------------------
#
# File is based on example of CMake configuration file in Chrono.
# to build an external
# project depending on Chrono and on optional Chrono modules.
#
# This minimal sample project can be used as a template for a
# user project. Modify sections 1, 2, and 3 below as appropriate.
#
#--------------------------------------------------------------
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#--------------------------------------------------------------
# === 1 ===
# Modify the project name if you want:
#--------------------------------------------------------------
project(ChronoIsymtecAiParser)
include(CTest)
#--------------------------------------------------------------
# === 2 ===
# Find the Chrono package and any REQUIRED or OPTIONAL modules
# by invoking the find_package function in CONFIG mode:
# find_package(Chrono
# COMPONENTS req_module1 req_module1 ...
# OPTIONAL opt_module1 opt_module2 ...
# CONFIG)
# The following Chrono modules can be requested (their names
# are case insensitive): Cascade, Cosimulation, FEA, Irrlicht,
# Matlab, Parallel, Postprocess, Python, Vehicle.
#
# Note that you will have to set the variable Chrono_DIR to
# specify the location of the ChronoConfig.cmake script, if
# it is not in its default install location.
# Chrono_DIR can be either a Chrono build tree or a Chrono install tree.
#
# The following variables are set and can be used further down:
# CHRONO_FOUND
# set to true if Chrono and all required components were found
# CHRONO_C_FLAGS
# CHRONO_CXX_FLAGS
# C and C++ compilation flags
# CHRONO_INCLUDE_DIRS
# additional paths for included headers
# CHRONO_LIBRARIES
# list of required libraries (with full path)
# CHRONO_LINKER_FLAGS
# additional linker flags
# CHRONO_DLLS
# list of all DLL dependencies (with full path)
# CHRONO_DATA_DIR
# path to the Chrono data make_directory
#
# In addition, for each requested component [COMPONENT], the
# following variable is set to true (ON) or false (OFF):
# CHRONO_[COMPONENT]_FOUND
#
# In this example, we only request the Irrlicht module (required)
#--------------------------------------------------------------
option(ENABLE_MODULE_IRRLICHT "Enable the Chrono Irrlicht module" OFF)
LIST(APPEND CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}/../Chrono/lib64")
find_package(Chrono
OPTIONAL_COMPONENTS Irrlicht
CONFIG)
#--------------------------------------------------------------
# Return now if Chrono or a required component was not found.
#--------------------------------------------------------------
if (NOT Chrono_FOUND)
message("Could not find Chrono or one of its required modules")
return()
endif()
#--------------------------------------------------------------
# Enable creation of "application bundles" on MacOSX.
#--------------------------------------------------------------
# This is necessary for any Irrlicht-based project (like the example here).
# For OpenGL-based or non-graphics projects, this is optional and the block
# below can be removed (or else explcitly set CMAKE_MACOSX_BUNDLE to 'OFF').
#
# If creating application bundles, the build output will be named 'demo_IRR_IsymtecAi_parser.app'.
# Use the convenience script 'run_app.sh' available under 'contrib/appbundle-macosx/'
# to run:
# start_demo.sh demo_IRR_IsymtecAi_parser.app
if(APPLE)
set(CMAKE_MACOSX_BUNDLE ON)
endif()
#--------------------------------------------------------------
# Add path to Chrono headers and to headers of all dependencies
# of the requested modules.
#--------------------------------------------------------------
include_directories(${CHRONO_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
#--------------------------------------------------------------
# Enable Multiprocessor-Compilation for MSVC solution
#--------------------------------------------------------------
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if(MSVC)
add_definitions( "-MP" )
endif(MSVC)
endif()
#--------------------------------------------------------------
# Tweaks to disable some warnings with MSVC
#--------------------------------------------------------------
if(MSVC)
add_definitions("-D_CRT_SECURE_NO_DEPRECATE") # avoids deprecation warnings
add_definitions("-D_SCL_SECURE_NO_DEPRECATE") # avoids deprecation warnings
add_definitions( "-DNOMINMAX" ) # do not use MSVC's min/max macros
set(EXTRA_COMPILE_FLAGS "/wd4275") # disable warnings triggered by Irrlicht
else()
set(EXTRA_COMPILE_FLAGS "")
endif()
#--------------------------------------------------------------
# === 4 (OPTIONAL) ===
#
# Optionally, add a custom command for copying all Chrono and
# dependency DLLs to the appropriate binary output folder.
# This function has effect only on Windows.
#
# Note that you must first set EXECUTABLE_OUTPUT_PATH
# (this can simply be ${CMAKE_BINARY_DIR}, like in this example)
#--------------------------------------------------------------
if(MSVC OR XCODE_VERSION)
set(CMAKE_CONFIGURATION_TYPES Release CACHE STRING "Choose the type of build.")
set_property(CACHE CMAKE_CONFIGURATION_TYPES PROPERTY STRINGS Debug Release MinSizeRel RelWithDebInfo)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
mark_as_advanced(FORCE CMAKE_BUILD_TYPE)
mark_as_advanced(CLEAR CMAKE_CONFIGURATION_TYPES)
set(CPACK_BUILD_TYPE ${CMAKE_CONFIGURATION_TYPES})
else()
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build.")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release MinSizeRel RelWithDebInfo)
set(CPACK_BUILD_TYPE ${CMAKE_BUILD_TYPE})
endif()
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib64)
add_DLL_copy_command("${CHRONO_DLLS}")
#------------------------------------------------------------
# Copy data directory to BUILD tree
# Install data directory
# Install sample template_project
#------------------------------------------------------------
if(MSVC OR XCODE_VERSION)
set(TEST_DATA_DIRECTORY ${CMAKE_BINARY_DIR}/bin/data/)
else()
set(TEST_DATA_DIRECTORY ${CMAKE_BINARY_DIR}/data/)
endif()
file(COPY ${CMAKE_SOURCE_DIR}/data/ DESTINATION ${TEST_DATA_DIRECTORY})
#------------------------------------------------------------
# Defer configuration of all Chrono libraries and programs
#------------------------------------------------------------
add_subdirectory(src)
add_subdirectory(test)