forked from MarcelRaschke/VAL
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
314 lines (281 loc) · 10.7 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
cmake_minimum_required (VERSION 2.8)
set (CMAKE_CXX_STANDARD 14)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
# Display command line run by cmake
if (NOT CMAKE_VERBOSE_MAKEFILE)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()
# Installation configuration
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
if( APPLE )
set(CMAKE_MACOSX_RPATH TRUE)
set(CMAKE_INSTALL_RPATH "@executable_path")
else()
set(CMAKE_INSTALL_RPATH "$ORIGIN")
endif()
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
project (Val)
get_filename_component(APPLICATIONS_DIR applications ABSOLUTE)
get_filename_component(EXTERNALS_DIR externals ABSOLUTE)
get_filename_component(LIBRARIES_DIR libraries ABSOLUTE)
set(LIBRARY_VAL_DIR ${LIBRARIES_DIR}/VAL)
set(LIBRARY_VAL_INCLUDE_DIR ${LIBRARY_VAL_DIR}/include)
set(LIBRARY_VAL_SRC_DIR ${LIBRARY_VAL_DIR}/src)
include_directories(${LIBRARY_VAL_INCLUDE_DIR} ${LIBRARY_VAL_INCLUDE_DIR}/Parser)
# Build not using shared library VAL (For development purposes only)
set (VERIFY_SYMBOLS False)
# Use Debug build type by default if none specified
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Debug)
endif()
# Set output folder
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(CMAKE_COMPILER_IS_GNUCC)
# needed for gcc 4.6+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fpermissive")
endif()
# Enable/Disable external solver feature through dl library
if (NOT SUPPORT_EXTERNALS)
set(SUPPORT_EXTERNALS False)
endif()
# VAL
set(LIB_VAL_SOURCE_FILES
${LIBRARY_VAL_SRC_DIR}/Parser/pddl+.cpp
${LIBRARY_VAL_SRC_DIR}/AccumulatedDelta.cpp
${LIBRARY_VAL_SRC_DIR}/Action.cpp
${LIBRARY_VAL_SRC_DIR}/CausalGraph.cpp
${LIBRARY_VAL_SRC_DIR}/DebugWriteController.cpp
${LIBRARY_VAL_SRC_DIR}/Environment.cpp
${LIBRARY_VAL_SRC_DIR}/Events.cpp
${LIBRARY_VAL_SRC_DIR}/FastEnvironment.cpp
${LIBRARY_VAL_SRC_DIR}/FuncAnalysis.cpp
${LIBRARY_VAL_SRC_DIR}/FuncExp.cpp
${LIBRARY_VAL_SRC_DIR}/HowAnalyser.cpp
${LIBRARY_VAL_SRC_DIR}/instantiation.cpp
${LIBRARY_VAL_SRC_DIR}/LaTeXSupport.cpp
${LIBRARY_VAL_SRC_DIR}/LibLink.cpp
${LIBRARY_VAL_SRC_DIR}/Ownership.cpp
${LIBRARY_VAL_SRC_DIR}/PinguPlanGenerator.cpp
${LIBRARY_VAL_SRC_DIR}/Plan.cpp
${LIBRARY_VAL_SRC_DIR}/Polynomial.cpp
${LIBRARY_VAL_SRC_DIR}/PrettyPrinter.cpp
${LIBRARY_VAL_SRC_DIR}/Proposition.cpp
${LIBRARY_VAL_SRC_DIR}/ptree.cpp
${LIBRARY_VAL_SRC_DIR}/random.cpp
${LIBRARY_VAL_SRC_DIR}/RelaxTranslator.cpp
${LIBRARY_VAL_SRC_DIR}/RepairAdvice.cpp
${LIBRARY_VAL_SRC_DIR}/RobustAnalyse.cpp
${LIBRARY_VAL_SRC_DIR}/SASActions.cpp
${LIBRARY_VAL_SRC_DIR}/SimpleEval.cpp
${LIBRARY_VAL_SRC_DIR}/State.cpp
${LIBRARY_VAL_SRC_DIR}/TIM.cpp
${LIBRARY_VAL_SRC_DIR}/TimSupport.cpp
${LIBRARY_VAL_SRC_DIR}/ToFunction.cpp
${LIBRARY_VAL_SRC_DIR}/TrajectoryConstraints.cpp
${LIBRARY_VAL_SRC_DIR}/typecheck.cpp
${LIBRARY_VAL_SRC_DIR}/TypedAnalyser.cpp
${LIBRARY_VAL_SRC_DIR}/Utils.cpp
${LIBRARY_VAL_SRC_DIR}/Validator.cpp
${LIBRARY_VAL_SRC_DIR}/valLib.cpp)
add_library(VAL SHARED ${LIB_VAL_SOURCE_FILES})
if( CMAKE_COMPILER_IS_GNUCC )
target_compile_options(VAL PUBLIC "-DVAL_EXPORTS")
endif()
# Add source files of parser in the Debug area for debugging.
if ( ${CMAKE_BUILD_TYPE} MATCHES Debug )
add_custom_command(TARGET VAL POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${LIBRARY_VAL_SRC_DIR}/Parser/pddl+.y ${LIBRARY_VAL_SRC_DIR}/Parser/pddl+.cpp ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
endif()
if( WIN32 )
target_compile_options(VAL PUBLIC "-DYY_NO_UNISTD_H")
endif()
# Support of external solvers feature
if( ${SUPPORT_EXTERNALS} )
target_compile_options(VAL PUBLIC "-DSUPPORTEXTERNALS")
target_include_directories(VAL PUBLIC ${EXTERNALS_DIR}/dlfcn-win32/include)
if( WIN32 )
find_library(LIB_DLFCN libdl.dll ${EXTERNALS_DIR}/dlfcn-win32/lib/win64)
target_link_libraries(VAL ${LIB_DLFCN})
else()
target_link_libraries(VAL dl)
endif()
endif()
# Analyse
set(ANALYSE_SOURCE_FILES
${APPLICATIONS_DIR}/Analyse/src/main.cpp)
add_executable(Analyse ${ANALYSE_SOURCE_FILES})
target_link_libraries(Analyse VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(Analyse2 ${ANALYSE_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# DomainView
set(DOMAIN_VIEW_SOURCE_FILES
${APPLICATIONS_DIR}/DomainView/src/main.cpp)
add_executable(DomainView ${DOMAIN_VIEW_SOURCE_FILES})
target_link_libraries(DomainView VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(DomainView2 ${DOMAIN_VIEW_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# HowWhatWhen
set(HOW_WHAT_WHEN_SOURCE_FILES
${APPLICATIONS_DIR}/HowWhatWhen/src/main.cpp)
add_executable(HowWhatWhen ${HOW_WHAT_WHEN_SOURCE_FILES})
target_link_libraries(HowWhatWhen VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(HowWhatWhen2 ${HOW_WHAT_WHEN_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# Instantiate
set(INSTANTIATE_SOURCE_FILES
${APPLICATIONS_DIR}/Instantiate/src/main.cpp)
add_executable(Instantiate ${INSTANTIATE_SOURCE_FILES})
target_link_libraries(Instantiate VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(Instantiate2 ${INSTANTIATE_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# Instantiation IP
#set(INSTANTIATION_IP_SOURCE_FILES
# ${APPLICATIONS_DIR}/InstantiationIP/src/main.cpp)
#add_executable(InstantiationIP ${INSTANTIATION_IP_SOURCE_FILES})
#target_link_libraries(InstantiationIP VAL)
#if( ${VERIFY_SYMBOLS} )
# add_executable(InstantiationIP2 ${INSTANTIATION_IP_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
#endif()
# Parser
set(PARSER_SOURCE_FILES
${APPLICATIONS_DIR}/Parser/src/main.cpp)
add_executable(Parser ${PARSER_SOURCE_FILES})
target_link_libraries(Parser VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(Parser2 ${PARSER_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# PinguPlan
set(PINGUPLAN_SOURCE_FILES
${APPLICATIONS_DIR}/PinguPlan/src/main.cpp)
add_executable(PinguPlan ${PINGUPLAN_SOURCE_FILES})
target_link_libraries(PinguPlan VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(PinguPlan2 ${PINGUPLAN_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# PlanRec
set(PLANREC_SOURCE_FILES
${APPLICATIONS_DIR}/PlanRec/src/main.cpp)
add_executable(PlanRec ${PLANREC_SOURCE_FILES})
target_link_libraries(PlanRec VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(PlanRec2 ${PLANREC_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# PlanSeqStep
set(PLAN_SEQ_STEP_SOURCE_FILES
${APPLICATIONS_DIR}/PlanSeqStep/src/main.cpp)
add_executable(PlanSeqStep ${PLAN_SEQ_STEP_SOURCE_FILES})
target_link_libraries(PlanSeqStep VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(PlanSeqStep2 ${PLAN_SEQ_STEP_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# PlanToValStep
set(PLAN_TO_VAL_STEP_SOURCE_FILES
${APPLICATIONS_DIR}/PlanToValStep/src/main.cpp)
add_executable(PlanToValStep ${PLAN_TO_VAL_STEP_SOURCE_FILES})
target_link_libraries(PlanToValStep VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(PlanToValStep2 ${PLAN_TO_VAL_STEP_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# Relax
set(RELAX_SOURCE_FILES
${APPLICATIONS_DIR}/Relax/src/main.cpp)
add_executable(Relax ${RELAX_SOURCE_FILES})
target_link_libraries(Relax VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(Relax2 ${RELAX_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# TIM
set(TIM_SOURCE_FILES
${APPLICATIONS_DIR}/TIM/src/main.cpp)
add_executable(TIM ${TIM_SOURCE_FILES})
target_link_libraries(TIM VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(TIM2 ${TIM_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# ToFn
set(TOFN_SOURCE_FILES
${APPLICATIONS_DIR}/ToFn/src/main.cpp)
add_executable(ToFn ${TOFN_SOURCE_FILES})
target_link_libraries(ToFn VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(ToFn2 ${TOFN_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# TypedAnalysis
set(TAN_SOURCE_FILES
${APPLICATIONS_DIR}/TypeAnalysis/src/main.cpp)
add_executable(TypeAnalysis ${TAN_SOURCE_FILES})
target_link_libraries(TypeAnalysis VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(TypeAnalysis2 ${TAN_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# Validate
set(VALIDATE_SOURCE_FILES
${APPLICATIONS_DIR}/Validate/src/main.cpp)
add_executable(Validate ${VALIDATE_SOURCE_FILES})
target_link_libraries(Validate VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(Validate2 ${VALIDATE_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# ValStep
set(VALSTEP_SOURCE_FILES
${APPLICATIONS_DIR}/ValStep/src/main.cpp)
add_executable(ValStep ${VALSTEP_SOURCE_FILES})
target_link_libraries(ValStep VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(ValStep2 ${VALSTEP_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# ValueSeq
set(VALUE_SEQ_SOURCE_FILES
${APPLICATIONS_DIR}/ValueSeq/src/main.cpp)
add_executable(ValueSeq ${VALUE_SEQ_SOURCE_FILES})
target_link_libraries(ValueSeq VAL)
if( ${VERIFY_SYMBOLS} )
add_executable(ValueSeq2 ${VALUE_SEQ_SOURCE_FILES} ${LIB_VAL_SOURCE_FILES})
endif()
# Targets to be installed
install(
TARGETS VAL Analyse DomainView HowWhatWhen Instantiate Parser PinguPlan PlanRec PlanSeqStep PlanToValStep Relax TIM ToFn TypeAnalysis Validate ValStep ValueSeq
RUNTIME DESTINATION bin
LIBRARY DESTINATION bin
)
install(
FILES ${APPLICATIONS_DIR}/README.md
DESTINATION .
)
if( WIN32 )
if( TOOLCHAIN_PREFIX STREQUAL i686-w64-mingw32 )
file(GLOB_RECURSE LIBGCC_PATH /usr/lib/gcc/${TOOLCHAIN_PREFIX}/*win32/libgcc_s_sjlj-1.dll)
file(GLOB_RECURSE LIBSTD_PATH /usr/lib/gcc/${TOOLCHAIN_PREFIX}/*win32/libstdc++-6.dll)
file(GLOB_RECURSE LIBWINPTHREAD_PATH /usr/${TOOLCHAIN_PREFIX}/lib/libwinpthread-1.dll)
install(
FILES ${LIBGCC_PATH} ${LIBSTD_PATH} ${LIBWINPTHREAD_PATH}
DESTINATION bin
)
elseif( TOOLCHAIN_PREFIX STREQUAL x86_64-w64-mingw32 )
file(GLOB_RECURSE LIBGCC_PATH /usr/lib/gcc/${TOOLCHAIN_PREFIX}/*win32/libgcc_s_seh-1.dll)
file(GLOB_RECURSE LIBSTD_PATH /usr/lib/gcc/${TOOLCHAIN_PREFIX}/*win32/libstdc++-6.dll)
file(GLOB_RECURSE LIBWINPTHREAD_PATH /usr/${TOOLCHAIN_PREFIX}/lib/libwinpthread-1.dll)
install(
FILES ${LIBGCC_PATH} ${LIBSTD_PATH} ${LIBWINPTHREAD_PATH}
DESTINATION bin
)
endif()
endif()
# Configuration of CPack
include (InstallRequiredSystemLibraries)
if( WIN32 )
set(CPACK_GENERATOR "ZIP")
SET(CPACK_SOURCE_GENERATOR "ZIP")
else()
set(CPACK_GENERATOR "ZIP;TGZ")
SET(CPACK_SOURCE_GENERATOR "ZIP;TGZ")
endif()
set (CPACK_PACKAGE_VERSION "$ENV{BUILD_BUILDNUMBER}")
include (CPack)