-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCMakeLists.txt
256 lines (201 loc) · 9.62 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
cmake_minimum_required(VERSION 2.8.4)
project(RayLanguage)
# Configure project
set(EXECUTABLE_OUTPUT_PATH ${RayLanguage_SOURCE_DIR}/bin)
# sub-sources flags
set(RVM YES)
set(RayInterpreter NO)
set(DebugFlag NO) # NO - for build library
set(copyResources NO)
set(RayPreloadFlag NO) # lib must be compiled with RAY_LIBRARY_PRELOAD_ALLOCATOR in RayConfig
if(NOT ${DebugFlag})
set(BUILD_SHARED_LIBS ON)
# Display Build path
set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
set(LIBRARY_NAME Ray)
endif()
set(EXECUTABLE_NAME RayLanguage)
include_directories(Classes)
set(HEADER_FILES # Worker headers
Classes/RayFoundation/RayConfig.h
Classes/RayFoundation/RayBase.h
Classes/RayFoundation/RSystem.h
Classes/RayFoundation/RayCheckFoundation.h
Classes/RayFoundation/RColors.h
Classes/RayFoundation/RSyntax.h
Classes/RayFoundation/RBasics/RBasics.h
Classes/RayFoundation/RErrors.h
# Memory operations
Classes/RayFoundation/RMemoryOperations/RByteOperations.h
Classes/RayFoundation/RMemoryOperations/RData.h
Classes/RayFoundation/RMemoryOperations/RSandBox.h
Classes/RayFoundation/RMemoryOperations/RAutoPool.h
# Containers
Classes/RayFoundation/RContainers/RArray.h
Classes/RayFoundation/RContainers/RArray_Blocks.h
Classes/RayFoundation/RContainers/RArray_Parallel.h
Classes/RayFoundation/RContainers/RList.h
Classes/RayFoundation/RContainers/RDictionary.h
Classes/RayFoundation/RContainers/RBuffer.h
# Strings
Classes/RayFoundation/RString/RString.h
Classes/RayFoundation/RString/RString_Char.h
Classes/RayFoundation/RString/RString_File.h
Classes/RayFoundation/RString/RString_Numbers.h
Classes/RayFoundation/RString/RString_UTF8.h
Classes/RayFoundation/RString/RString_Consts.h
# Encoding
Classes/RayFoundation/REncoding/RBase64.h
Classes/RayFoundation/REncoding/purge.h
Classes/RayFoundation/REncoding/evasion.h
Classes/RayFoundation/REncoding/PurgeEvasionUtils.h
Classes/RayFoundation/REncoding/PurgeEvasionUtilsRay.h
# Others
Classes/RayFoundation/RClassTable/RClassTable.h
Classes/RayFoundation/RClassTable/RClassNamePair.h
Classes/RayFoundation/RThread/RThread.h
Classes/RayFoundation/RThread/RThreadPool.h
# Networking
Classes/RayFoundation/RNetwork/RSocket.h
Classes/RayFoundation/RNetwork/RTCPHandler.h
# Core header
Classes/RayFoundation/RayFoundation.h
# Utils
Classes/RayFoundation/Utils/Utils.h
Classes/RayFoundation/Utils/PurgeEvasionConnection.h
Classes/RayFoundation/Utils/PurgeEvasionTCPHandler.h
Classes/RayFoundation/Utils/PurgeEvasionParallel.h)
set(SOURCE_FILES Classes/RayFoundation/RayBase.c
Classes/RayFoundation/RBasics/RBasics.c
# Containers
Classes/RayFoundation/RContainers/RArray.c
Classes/RayFoundation/RContainers/RArray_Blocks.c
Classes/RayFoundation/RContainers/RArray_Parallel.c
Classes/RayFoundation/RContainers/RList.c
Classes/RayFoundation/RContainers/RDictionary.c
Classes/RayFoundation/RContainers/RBuffer.c
# Memory operations
Classes/RayFoundation/RMemoryOperations/RByteOperations.c
Classes/RayFoundation/RMemoryOperations/RData.c
Classes/RayFoundation/RMemoryOperations/RSandBox.c
Classes/RayFoundation/RMemoryOperations/RAutoPool.c
# Strings
Classes/RayFoundation/RString/RString.c
Classes/RayFoundation/RString/RString_Char.c
Classes/RayFoundation/RString/RString_File.c
Classes/RayFoundation/RString/RString_Numbers.c
Classes/RayFoundation/RString/RString_UTF8.c
Classes/RayFoundation/RString/RString_Consts.c
# Encoding
Classes/RayFoundation/REncoding/RBase64.c
Classes/RayFoundation/REncoding/purge.c
Classes/RayFoundation/REncoding/evasion.c
Classes/RayFoundation/REncoding/PurgeEvasionUtils.c
Classes/RayFoundation/REncoding/PurgeEvasionUtilsRay.c
# Others
Classes/RayFoundation/RClassTable/RClassTable.c
Classes/RayFoundation/RClassTable/RClassNamePair.c
Classes/RayFoundation/RThread/RThread.c
Classes/RayFoundation/RThread/RThreadPool.c
# Networking
Classes/RayFoundation/RNetwork/RSocket.c
Classes/RayFoundation/RNetwork/RTCPHandler.c
# Utils
Classes/RayFoundation/Utils/Utils.c
Classes/RayFoundation/Utils/PurgeEvasionConnection.c
Classes/RayFoundation/Utils/PurgeEvasionTCPHandler.c
Classes/RayFoundation/Utils/PurgeEvasionParallel.c)
if(NOT ${DebugFlag})
add_library(
${LIBRARY_NAME}
SHARED
${HEADER_FILES}
${SOURCE_FILES}
)
else()
set(DEBUG_SOURCES ${SOURCE_FILES})
set(DEBUG_HEADERS ${HEADER_FILES})
endif()
if(RVM) # RVM -----------------------------------------------------------------------
set(RVM_HEADERS
Classes/RVirtualMachine/RVirtualFunction/RVirtualFunction.h
Classes/RVirtualMachine/RVirtualCompiler/RVirtualCompiler.h
Classes/RVirtualMachine/RVirtualMachine/RVirtualMachine.h)
set(RVM_SOURCES
Classes/RVirtualMachine/RVirtualFunction/RVirtualFunction.c
Classes/RVirtualMachine/RVirtualCompiler/RVirtualCompiler.c
Classes/RVirtualMachine/RVirtualMachine/RVirtualMachine.c)
add_executable(RVM ${RVM_HEADERS} ${RVM_SOURCES})
target_link_libraries(
RVM
${LIBRARY_NAME}
)
else()
set(RVM_HEADERS)
set(RVM_SOURCES)
endif() # RVM -----------------------------------------------------------------------
if(RayInterpreter) # RInterpreter ---------------------------------------------------
set(RINTERPRETER_HEADERS # Interpreter
Classes/RInterpreter/RInterpereterConsts.h
Classes/RInterpreter/RIProperties/RIProperties.h
Classes/RInterpreter/RIMethods/RIMethods.h
Classes/RInterpreter/RIClass/RIClass.h
Classes/RInterpreter/RInterpreter.h)
set(RINTERPRETER_SOURCES # Interpreter
Classes/RInterpreter/RIProperties/RIProperties.c
Classes/RInterpreter/RIMethods/RIMethods.c
Classes/RInterpreter/RIClass/RIClass.c
Classes/RInterpreter/RInterpreter.c)
add_executable(RayInterpreter ${RINTERPRETER_HEADERS} ${RINTERPRETER_SOURCES})
target_link_libraries(
RayInterpreter
${LIBRARY_NAME}
)
else()
set(RINTERPRETER_HEADERS)
set(RINTERPRETER_SOURCES)
endif() # RInterpreter ---------------------------------------------------
add_executable(${EXECUTABLE_NAME} Classes/main.c Classes/Tests.h
Classes/Tests.c
Classes/RayChat.h
Classes/RayChat.c
${RVM_HEADERS}
${RVM_SOURCES}
${RINTERPRETER_HEADERS}
${RINTERPRETER_SOURCES}
${DEBUG_SOURCES}
${DEBUG_HEADERS})
target_link_libraries(
${EXECUTABLE_NAME}
)
if(copyResources)
file(COPY Resources DESTINATION ${EXECUTABLE_OUTPUT_PATH})
endif()
if(NOT ${DebugFlag})
# file(COPY ${RayLanguage_SOURCE_DIR}/Classes/RayFoundation DESTINATION ${EXECUTABLE_OUTPUT_PATH})
if(${RayPreloadFlag})
SET( ENV{LD_PRELOAD} ${LIBRARY_OUTPUT_PATH}/${LIBRARY_NAME})
endif()
target_link_libraries(
${EXECUTABLE_NAME}
${LIBRARY_NAME}
)
if(WIN32)
target_link_libraries(${LIBRARY_NAME} wsock32 ws2_32)
else()
target_link_libraries(${EXECUTABLE_NAME} curses)
target_link_libraries(${LIBRARY_NAME} pthread)
endif()
set_target_properties(${EXECUTABLE_NAME} PROPERTIES PREFIX "")
install( TARGETS ${EXECUTABLE_NAME}
RUNTIME DESTINATION bin COMPONENT libraries
LIBRARY DESTINATION lib COMPONENT libraries
ARCHIVE DESTINATION lib/static COMPONENT libraries)
else()
if(WIN32)
set(ADDITIONAL_OS_LIBRARIES wsock32 ws2_32)
else()
set(ADDITIONAL_OS_LIBRARIES pthread)
endif()
target_link_libraries(${LIBRARY_NAME} ${ADDITIONAL_OS_LIBRARIES})
endif()