-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
144 lines (111 loc) · 5.96 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
#--------------------------------------------------------------
#
# Example of file to be used in CMake to build an external
# project based on Chrono::Engine
#
#--------------------------------------------------------------
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
#--------------------------------------------------------------
# Modify the project name if you want:
PROJECT(EddyCurrent_New)
#--------------------------------------------------------------
# NOTE! use find_package() to define ChronoEngine libraries and variables,
# along with some optional units (components).
# This requires that you copied FindChronoEngine.cmake in
# the Modules/ directory of your Cmake installation. If it
# is not there, you can copy it in a cmake/ directory in your project,
# and add that directory to the search path of CMake by typing
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
#find_package(ChronoEngine COMPONENTS unit_IRRLICHT unit_POSTPROCESS unit_FEM unit_PYPARSER)
find_package(ChronoEngine COMPONENTS unit_IRRLICHT unit_PYPARSER unit_POSTPROCESS)
#--------------------------------------------------------------
# After the ChronoEngine package has been found, you
# can add its include directories with the headers.
# Use ${CHRONOENGINE_INCLUDES} for this.
INCLUDE_DIRECTORIES( ${CHRONOENGINE_INCLUDES} )
#--------------------------------------------------------------
# Set c++ sources for building the exe, as usual in CMake
ADD_EXECUTABLE(conveyor source/conveyor_Ida.cpp
source/SimulatorCES.h
source/UserInterfaceEventReceiver.cpp
source/UserInterfaceEventReceiver.h
source/ElectricParticleProperty.h
source/ElectricForcesCES.h
source/ProcessFlow.h
source/ParserEmitter.h
source/ParserElectricForcesCES.h
source/ParserChRandomShapeCreator.h
source/ParserChDistribution.h )
#--------------------------------------------------------------
# Avoid logging too many warnings for the Irrlicht unit
IF(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
SET(CH_BUILDFLAGS "${CH_BUILDFLAGS} /wd4275")
ENDIF()
#--------------------------------------------------------------
# The following is needed for some platforms
SET_TARGET_PROPERTIES(conveyor PROPERTIES
COMPILE_FLAGS "${CH_BUILDFLAGS}"
LINK_FLAGS "${CH_LINKERFLAG_EXE}" )
#--------------------------------------------------------------
# Uncomment the following if you want the executable to
# go into some specific directory:
# SET (CH_BINDIR_DEBUG "" CACHE PATH "Where are your Chrono debug binaries (.dll, .exe etc.) installed?")
# SET (CH_BINDIR_RELEASE "" CACHE PATH "Where are your Chrono release binaries (.dll, .exe etc.) installed?")
# set_target_property(conveyor RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CH_BINDIR_DEBUG}")
# set_target_property(conveyor RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CH_BINDIR_RELEASE}")
# This done, you do not need to copy all the ChronoEngine.dll
# files in the output directory; also, the bin/data/ dir
# will be shared by all programs.
# OTHERWISE, VICEVERSA, copy the .dll files in your .exe folder:
# This will help because after you compile the program, the
# ChronoEngine dll will be copied in the same directory (in case
# someone has updated ChronoEngine you do not have to remember to
# update the copy of the dll in your folder)
# FOR WINDOWS ONLY****
SET (CH_BINDIR_DEBUG "" CACHE PATH "Where are your Chrono debug binaries (.dll, .exe etc.) installed?")
SET (CH_BINDIR_RELEASE "" CACHE PATH "Where are your Chrono release binaries (.dll, .exe etc.) installed?")
#get_target_property( MY_RUNTIME_DIR_DEBUG conveyor RUNTIME_OUTPUT_DIRECTORY_DEBUG) do not work..
#get_target_property( MY_RUNTIME_DIR_RELEASE conveyor RUNTIME_OUTPUT_DIRECTORY_RELEASE) do not work..
MESSAGE( STATUS " runtime dir debug: " ${MY_RUNTIME_DIR_DEBUG} )
ADD_CUSTOM_COMMAND(
TARGET conveyor
POST_BUILD
# COMMAND ${CMAKE_COMMAND} -E copy
# "${CH_BINDIR_DEBUG}/ChronoEngine.dll" "${CMAKE_BINARY_DIR}/Debug/"
# COMMAND ${CMAKE_COMMAND} -E copy
# "${CH_BINDIR_DEBUG}/ChronoEngine_POSTPROCESS.dll" "${CMAKE_BINARY_DIR}/Debug/"
# COMMAND ${CMAKE_COMMAND} -E copy
# "${CH_BINDIR_DEBUG}/ChronoEngine_IRRLICHT.dll" "${CMAKE_BINARY_DIR}/Debug/"
# COMMAND ${CMAKE_COMMAND} -E copy
# "${CH_BINDIR_DEBUG}/ChronoEngine_PYPARSER.dll" "${CMAKE_BINARY_DIR}/Debug/"
# COMMAND ${CMAKE_COMMAND} -E copy
# "${CH_BINDIR_DEBUG}/ChronoEngine_FEM.dll" "${CMAKE_BINARY_DIR}/Debug/"
# COMMAND ${CMAKE_COMMAND} -E copy
# "${CH_BINDIR_DEBUG}/Irrlicht.dll" "${CMAKE_BINARY_DIR}/Debug/"
COMMAND ${CMAKE_COMMAND} -E copy
"${CH_BINDIR_RELEASE}/ChronoEngine.dll" "${CMAKE_BINARY_DIR}/Release/"
COMMAND ${CMAKE_COMMAND} -E copy
"${CH_BINDIR_RELEASE}/ChronoEngine_IRRLICHT.dll" "${CMAKE_BINARY_DIR}/Release/"
COMMAND ${CMAKE_COMMAND} -E copy
"${CH_BINDIR_RELEASE}/ChronoEngine_POSTPROCESS.dll" "${CMAKE_BINARY_DIR}/Release/"
COMMAND ${CMAKE_COMMAND} -E copy
"${CH_BINDIR_RELEASE}/ChronoEngine_PYPARSER.dll" "${CMAKE_BINARY_DIR}/Release/"
# COMMAND ${CMAKE_COMMAND} -E copy
# "${CH_BINDIR_RELEASE}/ChronoEngine_FEM.dll" "${CMAKE_BINARY_DIR}/Release/"
COMMAND ${CMAKE_COMMAND} -E copy
"${CH_BINDIR_RELEASE}/Irrlicht.dll" "${CMAKE_BINARY_DIR}/Release/"
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_SOURCE_DIR}/objects" "${CMAKE_BINARY_DIR}/objects"
)
#--------------------------------------------------------------
# NOTE! In the following, at least add the following line
# in order to link all the required libraries (the main
# ChronoEngine library and all other libraries of units
# defined with the COMPONENTS parameters in find_package)
#
TARGET_LINK_LIBRARIES(conveyor
${CHRONOENGINE_LIBRARIES}
)
# this is only to simplify the GUI of CMake
MARK_AS_ADVANCED(CMAKE_INSTALL_PREFIX)