-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
187 lines (148 loc) · 5.11 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
cmake_minimum_required(VERSION 3.3)
project(ocac)
if(NOT USER_INCLUDE_DIRS)
set(USER_INCLUDE_DIRS
"contrib/ports/unix/port/include"
)
endif()
if(NOT OCAC_IMPL_DIR)
set(OCAC_IMPL_DIR "impl")
endif()
set(OCAC_DEV_UTILS TRUE)
set(OCAC_CORE_INCLUDES
src/include/ocac/occ/datatypes/agent.h
src/include/ocac/occ/datatypes/base.h
src/include/ocac/occ/datatypes/blockmatrix.h
src/include/ocac/occ/datatypes/eventsubscription.h
src/include/ocac/occ/datatypes/framework.h
src/include/ocac/occ/datatypes/library.h
src/include/ocac/occ/datatypes/management.h
src/include/ocac/occ/datatypes/network.h
src/include/ocac/occ/datatypes/task.h
src/include/ocac/occ/datatypes/time.h
src/include/ocac/occ/datatypes/worker.h
src/include/ocac/ocp/ocp1.h
src/include/ocac/opt.h
src/include/ocac/arch.h
src/include/ocac/debug.h
src/include/ocac/class.h
src/include/ocac/def.h
src/include/ocac/obj.h
src/include/ocac/utf8.h
src/include/ocac/session.h
src/include/ocac/net.h
src/include/ocac/reset.h
src/include/ocac/core.h
src/include/ocac/host/timer.h
src/include/ocac/host/sock.h
)
set(OCAC_CORE_SOURCE_FILES
src/core/occ/datatypes.c
src/core/class.c
src/core/def.c
src/core/obj.c
src/core/utf8.c
src/core/session.c
src/core/net.c
src/core/reset.c
src/core/core.c
)
list(APPEND OCAC_TARGET_LIST ocaccore)
add_library(ocaccore STATIC
${OCAC_CORE_INCLUDES}
${OCAC_CORE_SOURCE_FILES}
${USER_INCLUDES}
)
target_include_directories(ocaccore PUBLIC
src/include
src/third_party
"${OCAC_IMPL_DIR}"
"${USER_INCLUDE_DIRS}"
)
set_property(TARGET ocaccore PROPERTY C_STANDARD 99)
set_property(TARGET ocaccore PROPERTY LINKER_LANGUAGE C)
set(OCAC_IMPL_INCLUDES
"${OCAC_IMPL_DIR}/ocacopts.h"
"${OCAC_IMPL_DIR}/obj_registry.h"
"${OCAC_IMPL_DIR}/occclasses/root.h"
"${OCAC_IMPL_DIR}/occclasses/workers/worker.h"
"${OCAC_IMPL_DIR}/occclasses/workers/block.h"
"${OCAC_IMPL_DIR}/occclasses/managers/manager.h"
"${OCAC_IMPL_DIR}/occclasses/managers/device.h"
"${OCAC_IMPL_DIR}/occclasses/managers/subscription.h"
)
set(OCAC_IMPL_SOURCE_FILES
"${OCAC_IMPL_DIR}/obj_registry.c"
"${OCAC_IMPL_DIR}/occclasses/root.c"
"${OCAC_IMPL_DIR}/occclasses/workers/worker.c"
"${OCAC_IMPL_DIR}/occclasses/workers/block.c"
"${OCAC_IMPL_DIR}/occclasses/managers/manager.c"
"${OCAC_IMPL_DIR}/occclasses/managers/device.c"
"${OCAC_IMPL_DIR}/occclasses/managers/subscription.c"
)
list(APPEND OCAC_TARGET_LIST ocacimpl)
add_library(ocacimpl STATIC
${OCAC_IMPL_INCLUDES}
${OCAC_IMPL_SOURCE_FILES}
)
#target_include_directories(ocacimpl PUBLIC
# "${OCAC_IMPL_DIR}"
# "${USER_INCLUDES}"
#)
set_property(TARGET ocacimpl PROPERTY C_STANDARD 11)
set_property(TARGET ocacimpl PROPERTY LINKER_LANGUAGE C)
target_link_libraries(ocacimpl ocaccore)
### DEV UTILS
list(APPEND OCAC_TARGET_LIST ocacmethod)
add_executable(ocacmethod EXCLUDE_FROM_ALL contrib/dev/method.c)
target_include_directories(ocacmethod PUBLIC
src/include
src/third_party
"${OCAC_IMPL_DIR}"
${USER_INCLUDE_DIRS}
)
target_link_libraries(ocacmethod ocaccore ocacimpl)
set_property(TARGET ocacmethod PROPERTY C_STANDARD 99)
set_property(TARGET ocacmethod PROPERTY LINKER_LANGUAGE C)
list(APPEND OCAC_TARGET_LIST ocacparamg)
add_executable(ocacparamg EXCLUDE_FROM_ALL contrib/dev/genparam.c)
target_include_directories(ocacparamg PUBLIC
src/include
src/third_party
"${OCAC_IMPL_DIR}"
${USER_INCLUDE_DIRS}
)
target_link_libraries(ocacparamg ocaccore ocacimpl)
set_property(TARGET ocacparamg PROPERTY C_STANDARD 99)
set_property(TARGET ocacparamg PROPERTY LINKER_LANGUAGE C)
list(APPEND OCAC_TARGET_LIST ocacparamp)
add_executable(ocacparamp EXCLUDE_FROM_ALL contrib/dev/parseparam.c)
target_include_directories(ocacparamp PUBLIC
src/include
src/third_party
"${OCAC_IMPL_DIR}"
${USER_INCLUDE_DIRS}
)
target_link_libraries(ocacparamp ocaccore ocacimpl)
set_property(TARGET ocacparamp PROPERTY C_STANDARD 99)
set_property(TARGET ocacparamp PROPERTY LINKER_LANGUAGE C)
add_custom_target(dev-utils DEPENDS ocacmethod ocacparamg ocacparamp)
if(CMAKE_BUILD_TYPE MATCHES Debug)
foreach(TARGET IN LISTS OCAC_TARGET_LIST)
target_compile_definitions(${TARGET} PUBLIC DEBUG=1)
endforeach()
elseif(CMAKE_BUILD_TYPE MATCHES Release)
foreach(TARGET IN LISTS OCAC_TARGET_LIST)
target_compile_definitions(${TARGET} PUBLIC RELEASE=1)
endforeach()
endif()
add_executable(testcc test.c )
target_link_libraries(testcc ocaccore)
target_include_directories(testcc PUBLIC
src/include
src/third_party
"${OCAC_IMPL_DIR}"
${USER_INCLUDE_DIRS}
)
set_property(TARGET testcc PROPERTY C_STANDARD 99)
set_property(TARGET testcc PROPERTY LINKER_LANGUAGE C)