-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
168 lines (119 loc) · 3.45 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
#
# CMakeLists.txt for Perpetuum
#
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
project ("Perpetuum")
find_package (ARPA2CM 0.3 NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ARPA2CM_MODULE_PATH})
include (MacroEnsureOutOfSourceBuild)
include (MacroAddUninstallTarget)
include (MacroGitVersionInfo)
include (MacroCreateConfigFiles)
macro_ensure_out_of_source_build("Do not build Perpetuum in the source directory.")
set (CMAKE_MACOSX_RPATH 0)
option (DEBUG
"Produce verbose output about Petri net processing"
OFF)
option (BUILD_SINGLE_THREADED
"Build without atomic operations because Perpetuum runs in one thread"
ON)
option (PETRINET_SINGLETONS
"Optimise with singular instances for each Petri net defined"
OFF)
if (${PETRINET_SINGLETONS})
set (PETRINET_GLOBAL_NAME "" CACHE STRING
"Efficiently reference the Petri Net via a global variable name")
else ()
unset (PETRINET_GLOBAL_NAME CACHE)
endif ()
option (PETRINET_FLAT_SCHEDULING
"Schedule Petri net activity in a flat loop, avoid stack-based recursion"
ON)
option (PETRINET_WITHOUT_NAMES
"Save storage space by not storing name strings in the Petri Net"
OFF)
if (${PETRINET_SINGLETONS})
if (${PETRINET_GLOBAL_NAME STREQUAL "")
unset (PETRINET_GLOBAL_NAME)
endif ()
endif ()
enable_testing ()
#
# Dependencies
#
if (NOT ${BUILD_SINGLE_THREADED})
find_package (Threads REQUIRED)
endif()
find_package (PkgConfig)
#TODO# find_package (cmph REQUIRED)
#TODO# pkg_search_module (
#TODO# cmph REQUIRED
#TODO# cmph libcmph Cmph CMPH
#TODO# )
find_program (GNUMAKE
NAMES gmake make)
#
# Version Information
#
get_version_from_git (Perpetuum 0.0.0)
#
# Building
#
if (${BUILD_SINGLE_THREADED})
add_definitions (-DCONFIG_SINGLE_THREADED)
endif ()
if (${PETRINET_FLAT_SCHEDULING})
add_definitions (-DPETRINET_FLAT_SCHEDULING)
else ()
add_definitions (-DPETRINET_RECURSIVE_SCHEDULING)
endif ()
if (${PETRINET_WITHOUT_NAMES})
add_definitions (-DPETRINET_WITHOUT_NAMES)
endif ()
if (${PETRINET_SINGLETONS})
add_definitions (-DPETRINET_SINGLETONS)
if (NOT ${PETRINET_GLOBAL_NAME} STREQUAL "")
add_definitions (-DPETRINET_GLOBAL_NAME=${PETRINET_GLOBAL_NAME})
endif ()
endif ()
include_directories (include)
add_subdirectory (erlang)
#TODO# configure_file (
#TODO# contrib/pkgconfig/perpetuum.pc.in
#TODO# ${PROJECT_BINARY_DIR}/perpetuum.pc
#TODO# @ONLY
#TODO# )
add_custom_target (perpetuum-codegen ALL
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/compiler/perpetuum
${CMAKE_BINARY_DIR}/perpetuum-codegen)
#TODO# create_config_files (Perpetuum)
#
# TESTS
#
add_subdirectory (test)
#
# INSTALLATION
#
install (FILES ${CMAKE_SOURCE_DIR}/src/runtime.c
${CMAKE_SOURCE_DIR}/src/flatsched.c
${CMAKE_SOURCE_DIR}/src/evfire.c
DESTINATION share/perpetuum)
install (FILES ${CMAKE_SOURCE_DIR}/include/perpetuum/model.h
${CMAKE_SOURCE_DIR}/include/perpetuum/api.h
DESTINATION include/perpetuum)
install (FILES ${CMAKE_BINARY_DIR}/perpetuum-codegen
PERMISSIONS WORLD_EXECUTE
DESTINATION bin)
add_uninstall_target ()
#
# PACKAGING
#
set (CPACK_BUNDLE_NAME "perpetuum")
set (CPACK_PACKAGE_CONTACT "Rick van Rein <[email protected]>")
set (CPACK_PACKAGE_VENDOR "ARPA2.net")
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Perpetuum generates asynchronous schedulers from Petri nets")
set (CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README.MD)
set (CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
include (PackAllPossible)
include (CPack)