-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
246 lines (232 loc) · 6.25 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
cmake_minimum_required(VERSION 2.8)
project(owlisp)
## locate swig:
#find_program(SWIG swig)
#if (NOT SWIG)
# message(FATAL_ERROR "swig not found (maybe you want to tell me where I can find it by passing '-DCMAKE_PROGRAM_PATH=/path')!")
#endif (NOT SWIG)
#
#
#
## find llvm headers:
#find_path(LLVM_INCLUDE_DIR llvm-c/Core.h)
#if (NOT LLVM_INCLUDE_DIR)
# message(FATAL_ERROR "llvm headers not found (maybe you want to tell me where I can find it by passing '-DCMAKE_INCLUDE_PATH=/path')!")
#endif (NOT LLVM_INCLUDE_DIR)
#
#
#
## find llvm library:
#set(LLVM_NAMES ${LLVM_NAMES} LLVM-3.4 LLVM-3.3 LLVM-3.2 LLVM)
#find_library(LLVM_LIBRARY NAMES ${LLVM_NAMES})
#if (NOT LLVM_LIBRARY)
# message(FATAL_ERROR "llvm library not found (maybe you want to tell me where I can find it by passing '-DCMAKE_LIBRARY_PATH=/path')!")
#endif (NOT LLVM_LIBRARY)
#
#
#
## find llvm-link:
#find_program(LLVM_LINK llvm-link)
#if (NOT LLVM_LINK)
# message(FATAL_ERROR "llvm-link not found (maybe you want to tell me where I can find it by passing '-DCMAKE_PROGRAM_PATH=/path')!")
#endif (NOT LLVM_LINK)
#
#
#
## find llvm-as:
#find_program(LLVM_AS llvm-as)
#if (NOT LLVM_AS)
# message(FATAL_ERROR "llvm-as not found (maybe you want to tell me where I can find it by passing '-DCMAKE_PROGRAM_PATH=/path')!")
#endif (NOT LLVM_AS)
#
#
#
## find clang:
#find_program(CLANG clang)
#if (NOT CLANG)
# message(FATAL_ERROR "clang not found (maybe you want to tell me where I can find it by passing '-DCMAKE_PROGRAM_PATH=/path')!")
#endif (NOT CLANG)
#
#
#
## find sbcl:
#find_program(SBCL sbcl)
#if (NOT SBCL)
# message(FATAL_ERROR "sbcl not found (maybe you want to tell me where I can find it by passing '-DCMAKE_PROGRAM_PATH=/path')!")
#endif (NOT SBCL)
#
#
#
#add_subdirectory(src/llvm/cffi) # defines target 'swig_generation'
#add_subdirectory(src/crt) # defines target 'runtime_generation'
#add_subdirectory(src/crt-ng) # builds libowlisprt.a
#
#
#
## compile owlisp-frontend:
#set(OWLISPFRONTEND ${CMAKE_CURRENT_SOURCE_DIR}/owlisp-frontend)
#set(COMPILELOG compile.log)
#
#set(MAKELISPIN ${CMAKE_CURRENT_SOURCE_DIR}/make.lisp.in)
#set(MAKELISP ${CMAKE_CURRENT_SOURCE_DIR}/make.lisp)
#configure_file(
# ${MAKELISPIN}
# ${MAKELISP}
# @ONLY
#)
#
#set(LDLIBPATH ${CMAKE_LIBRARY_PATH} ${LD_LIBRARY_PATH})
#add_custom_command(
# OUTPUT ${OWLISPFRONTEND}
# COMMAND LD_LIBRARY_PATH=${LDLIBPATH} ${SBCL} --load "${MAKELISP}" >${COMPILELOG} 2>&1
# DEPENDS swig_generation runtime_generation
#)
#
#add_custom_target(
# owlisp-frontend_generation ALL
# DEPENDS ${OWLISPFRONTEND}
#)
#
#set(OWLISPIN ${CMAKE_CURRENT_SOURCE_DIR}/toolchain/owlisp.in)
#set(OWLISP ${CMAKE_CURRENT_SOURCE_DIR}/toolchain/owlisp)
#configure_file(
# ${OWLISPIN}
# ${OWLISP}
# @ONLY
#)
#
#
#
## installation instructions:
#set(RUNTIMEBC ${CMAKE_CURRENT_SOURCE_DIR}/src/crt/runtime.bc)
#
#set(BININSTALLS ${OWLISPFRONTEND} ${OWLISP})
#set(LIBINSTALLS ${RUNTIMEBC})
#
#install(
# PROGRAMS ${BININSTALLS}
# DESTINATION bin
#)
#install(
# FILES ${LIBINSTALLS}
# DESTINATION lib
#)
#
#
#
## uninstall target:
#set(UNINSTALL_FILES
# ${CMAKE_INSTALL_PREFIX}/bin/owlisp-frontend
# ${CMAKE_INSTALL_PREFIX}/bin/owlisp
# ${CMAKE_INSTALL_PREFIX}/lib/runtime.bc
#)
#add_custom_target(
# uninstall
# COMMAND rm -rf ${UNINSTALL_FILES}
#)
find_program(EMCC emcc)
if (EMCC)
message(STATUS "Found emscripten: " ${EMCC})
else (EMCC)
message(WARNING "Could not find emscripten. You will not be able to compile to JavaScript.")
endif (EMCC)
# add target owlisprt for building libowlisprt:
add_subdirectory(src/crt-ng2)
# find sbcl:
find_program(SBCL sbcl)
if (NOT SBCL)
message(FATAL_ERROR "sbcl not found (maybe you want to tell me where I can find it by passing '-DCMAKE_PROGRAM_PATH=/path')!")
endif (NOT SBCL)
# compile owlisp2c:
set(OWLISP_L2C_BIN_FILENAME owlisp-l2c)
set(OWLISP_L2C_BIN ${PROJECT_BINARY_DIR}/${OWLISP_L2C_BIN_FILENAME})
set(COMPILELOG owlisp-l2c-build.log)
set(MAKELISPIN ${CMAKE_CURRENT_SOURCE_DIR}/make.lisp.in)
set(MAKELISP ${CMAKE_CURRENT_SOURCE_DIR}/make.lisp)
configure_file(
${MAKELISPIN}
${MAKELISP}
@ONLY
)
set(LDLIBPATH ${CMAKE_LIBRARY_PATH} ${LD_LIBRARY_PATH})
#add_custom_command(
# OUTPUT ${OWLISP2CBIN}
# COMMAND LD_LIBRARY_PATH=${LDLIBPATH} ${SBCL} --load "${MAKELISP}" >${COMPILELOG} 2>&1
# #DEPENDS owlisprt
#)
#
#add_custom_target(
# clean_owlisp2c
# COMMAND rm -vf ${OWLISP2CBIN}
#)
add_custom_target(
owlisp-l2c ALL
#DEPENDS clean_owlisp2c ${OWLISP2CBIN}
COMMAND LD_LIBRARY_PATH=${LDLIBPATH} ${SBCL} --load "${MAKELISP}" >${COMPILELOG} 2>&1
)
set(OWLISP_CONFIG_FILENAME owlisp.cfg)
set(OWLISP_CONFIG_IN ${CMAKE_CURRENT_SOURCE_DIR}/etc/${OWLISP_CONFIG_FILENAME}.in)
set(OWLISP_CONFIG ${PROJECT_BINARY_DIR}/${OWLISP_CONFIG_FILENAME})
set(OWLISP_C2O_BIN_FILENAME owlisp-c2o)
set(OWLISP_C2O_BIN_IN ${CMAKE_CURRENT_SOURCE_DIR}/bin/${OWLISP_C2O_BIN_FILENAME}.in)
set(OWLISP_C2O_BIN ${PROJECT_BINARY_DIR}/${OWLISP_C2O_BIN_FILENAME})
set(OWLISP_O2X_BIN_FILENAME owlisp-o2x)
set(OWLISP_O2X_BIN_IN ${CMAKE_CURRENT_SOURCE_DIR}/bin/${OWLISP_O2X_BIN_FILENAME}.in)
set(OWLISP_O2X_BIN ${PROJECT_BINARY_DIR}/${OWLISP_O2X_BIN_FILENAME})
set(OWLISP_BIN_FILENAME owlisp)
set(OWLISP_BIN_IN ${CMAKE_CURRENT_SOURCE_DIR}/bin/${OWLISP_BIN_FILENAME}.in)
set(OWLISP_BIN ${PROJECT_BINARY_DIR}/${OWLISP_BIN_FILENAME})
if (EMCC)
set(OWLISP_C2BC_BIN_FILENAME owlisp-c2bc)
set(OWLISP_C2BC_BIN_IN ${CMAKE_CURRENT_SOURCE_DIR}/bin/${OWLISP_C2BC_BIN_FILENAME}.in)
set(OWLISP_C2BC_BIN ${PROJECT_BINARY_DIR}/${OWLISP_C2BC_BIN_FILENAME})
set(OWLISP_BC2JS_BIN_FILENAME owlisp-bc2js)
set(OWLISP_BC2JS_BIN_IN ${CMAKE_CURRENT_SOURCE_DIR}/bin/${OWLISP_BC2JS_BIN_FILENAME}.in)
set(OWLISP_BC2JS_BIN ${PROJECT_BINARY_DIR}/${OWLISP_BC2JS_BIN_FILENAME})
endif (EMCC)
configure_file(
${OWLISP_CONFIG_IN}
${OWLISP_CONFIG}
@ONLY
)
configure_file(
${OWLISP_C2O_BIN_IN}
${OWLISP_C2O_BIN}
@ONLY
)
configure_file(
${OWLISP_O2X_BIN_IN}
${OWLISP_O2X_BIN}
@ONLY
)
configure_file(
${OWLISP_BIN_IN}
${OWLISP_BIN}
@ONLY
)
if (EMCC)
configure_file(
${OWLISP_C2BC_BIN_IN}
${OWLISP_C2BC_BIN}
@ONLY
)
configure_file(
${OWLISP_BC2JS_BIN_IN}
${OWLISP_BC2JS_BIN}
@ONLY
)
endif (EMCC)
install(
FILES ${OWLISP_CONFIG}
DESTINATION etc
)
install(
PROGRAMS ${OWLISP_C2O_BIN} ${OWLISP_L2C_BIN} ${OWLISP_O2X_BIN} ${OWLISP_BIN}
DESTINATION bin
)
if (EMCC)
install(
PROGRAMS ${OWLISP_C2BC_BIN} ${OWLISP_BC2JS_BIN}
DESTINATION bin
)
endif (EMCC)