-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
122 lines (99 loc) · 4.61 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
#=============================================================================
# CMake configuration file for Chrono-Tutorial
#
#=============================================================================
cmake_minimum_required(VERSION 3.18)
cmake_policy(SET CMP0091 NEW)
project(ChronoTutorial)
# Set location of executable
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
#-----------------------------------------------------------------------------
# Always use full RPATH (differentiating between the build and install trees)
#-----------------------------------------------------------------------------
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing, but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif()
#-----------------------------------------------------------------------------
# Force C++11
#-----------------------------------------------------------------------------
#if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# set(CH_LINKERFLAG_EXE "${CH_LINKERFLAG_EXE} -framework IOKit -framework Cocoa -framework OpenGL")
#endif()
#-----------------------------------------------------------------------------
# Fix for VS 2017 15.8 and newer to handle alignment specification with Eigen
#-----------------------------------------------------------------------------
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if(MSVC AND ${MSVC_VERSION} GREATER_EQUAL 1915)
add_definitions( "-D_ENABLE_EXTENDED_ALIGNED_STORAGE" )
endif()
endif()
#-----------------------------------------------------------------------------
# Disable some warnings
#-----------------------------------------------------------------------------
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
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
add_definitions( "-MP" ) # perform parallel builds
endif(MSVC)
endif()
#-----------------------------------------------------------------------------
# Invoke CMake in subdirectories
#-----------------------------------------------------------------------------
if(NOT Chrono_DIR)
set(Chrono_DIR "" CACHE PATH "The directory containing a CMake configuration file for Chrono.")
return()
endif()
# Options for configuring/building individual sets of programs
option(ENABLE_CHRONO_PROGRAMS "Build the Chrono tutorial programs" ON)
option(ENABLE_VEHICLE_PROGRAMS "Build the Chrono::Vehicle tutorial programs" ON)
option(ENABLE_FEA_PROGRAMS "Build the Chrono::FEA tutorial programs" ON)
option(ENABLE_MULTICORE_PROGRAMS "Build the Chrono::Multicore tutorial programs" ON)
option(ENABLE_SENSOR_PROGRAMS "Build the Chrono::Sensor tutorial programs" OFF)
option(ENABLE_SYNCHRONO_PROGRAMS "Build the SynChrono tutorial programs" OFF)
# Keep track of all DLLs. Each submodule should append to these list.
list(APPEND ALL_DLL_NAMES "")
list(APPEND ALL_DEPENDENCY_DLLS "")
# Propagate configuration to submodules.
if(ENABLE_CHRONO_PROGRAMS)
message(STATUS "==== Chrono programs ====")
add_subdirectory(slider_crank)
endif()
if(ENABLE_VEHICLE_PROGRAMS)
message(STATUS "==== Chrono::Vehicle programs ====")
add_subdirectory(wheeled_vehicle)
endif()
if(ENABLE_FEA_PROGRAMS)
message(STATUS "==== Chrono::FEA programs ====")
add_subdirectory(FEA)
endif()
if(ENABLE_MULTICORE_PROGRAMS)
message(STATUS "==== Chrono::Multicore programs ====")
add_subdirectory(multicore)
endif()
if(ENABLE_SENSOR_PROGRAMS)
message(STATUS "==== Chrono::Sensor programs ====")
add_subdirectory(sensor)
endif()
if(ENABLE_SYNCHRONO_PROGRAMS)
message(STATUS "==== SynChrono programs ====")
add_subdirectory(synchrono)
endif()
#--------------------------------------------------------------
# Copy DLLs
#--------------------------------------------------------------
# Add custom command for copying DLLs to the appropriate binary
# output folder (on Windows only).
add_DLL_copy_command("${ALL_DLL_NAMES}" "${ALL_DEPENDENCY_DLLS}")