-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathCMakeLists.txt
412 lines (394 loc) · 8.46 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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
PROJECT(maiko C)
CMAKE_MINIMUM_REQUIRED(VERSION 3.15)
SET(CMAKE_EXPORT_COMPILE_COMMANDS ON)
SET(CMAKE_C_STANDARD 99)
IF(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_COMPILER_ID MATCHES "GNU")
IF(UNIX AND CMAKE_GENERATOR STREQUAL "Ninja")
SET(CMAKE_C_FLAGS "-fdiagnostics-color=always ${CMAKE_C_FLAGS}")
ENDIF()
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
ENDIF()
IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
ENDIF()
INCLUDE(CheckLibraryExists)
CHECK_LIBRARY_EXISTS(m fmod "" NEED_LIB_M)
IF(NEED_LIB_M)
SET(MAIKO_LIBRARIES m)
ENDIF()
SET(MAIKO_DEFINITIONS
"-DRELEASE=351"
)
OPTION(MAIKO_DISPLAY_X11 "Use X11 for display." ON)
IF(MAIKO_DISPLAY_X11)
FIND_PACKAGE(X11 REQUIRED)
SET(MAIKO_DISPLAY_X11_DEFINITIONS
"-DXWINDOW"
)
SET(MAIKO_DISPLAY_X11_LIBRARIES X11::X11)
SET(MAIKO_DISPLAY_X11_SRCS
src/xbbt.c
src/xcursor.c
src/xinit.c
src/xlspwin.c
src/xmkicon.c
src/xrdopt.c
src/xscroll.c
src/xwinman.c
)
SET(MAIKO_DISPLAY_X11_HDRS
inc/xbbtdefs.h
inc/xbitmaps.h
inc/xcursordefs.h
inc/xdefs.h
inc/xinitdefs.h
inc/XKeymap.h
inc/xlspwindefs.h
inc/xmkicondefs.h
inc/xrdoptdefs.h
inc/xscrolldefs.h
inc/xscroll.h
inc/xwinmandefs.h
)
ENDIF()
IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
LIST(APPEND MAIKO_DEFINITIONS
"-DOS5"
"-DUSE_DLPI"
)
ENDIF()
IF(APPLE)
# Suppress "has no symbols" warnings when building static libraries on macOS:
# https://stackoverflow.com/questions/4929255/building-static-libraries-on-mac-using-cmake-and-gcc/33067191#33067191
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
ENDIF()
# These don't build on Linux. Some are for SunOS and DOS. Others ... ?
SET(BAD_SRCS
src/atom.c
src/chatter.c
src/codeconv.c
src/codetbl.c
src/ejlisp.c
src/imagefile2.c
src/imagefile.c
src/lpdual.c
src/lpkit.c
src/lplexyy.c
src/lpmain.c
src/lpread.c
src/lpsolve.c
src/lptran.c
src/lpwrite.c
src/lpytab.c
src/mnwevent.c
src/mnxmeth.c
src/picture.c
src/rawcolor.c
src/rawrs232c.c
src/rs232c.c
src/truecolor.c
)
SET(MAIKO_SRCS
src/allocmds.c
src/arith2.c
src/arith3.c
src/arith4.c
src/array2.c
src/array3.c
src/array4.c
src/array5.c
src/array6.c
src/array.c
src/asmbbt.c
src/bbtsub.c
src/bin.c
src/binds.c
src/bitblt.c
src/blt.c
src/byteswap.c
src/car-cdr.c
src/chardev.c
src/common.c
src/conspage.c
src/dbgtool.c
src/dir.c
src/dlpi.c
src/draw.c
src/dsk.c
src/dspif.c
src/dspsubrs.c
src/eqf.c
src/ether.c
src/findkey.c
src/foreign.c
src/fp.c
src/fvar.c
src/gc2.c
src/gcarray.c
src/gc.c
src/gccode.c
src/gcfinal.c
src/gchtfind.c
src/gcmain3.c
src/gcoflow.c
src/gcr.c
src/gcrcell.c
src/gcscan.c
src/gvar2.c
src/hardrtn.c
src/inet.c
src/initdsp.c
src/initkbd.c
src/initsout.c
src/intcall.c
src/kbdsubrs.c
src/keyevent.c
src/kprint.c
src/ldsout.c
src/lineblt8.c
src/lisp2c.c
src/llcolor.c
src/llstk.c
src/loopsops.c
src/lowlev1.c
src/lowlev2.c
src/lsthandl.c
src/misc7.c
src/miscn.c
src/mkatom.c
src/mkcell.c
src/mvs.c
src/osmsg.c
src/perrno.c
src/return.c
src/rpc.c
src/rplcons.c
src/shift.c
src/storage.c
src/subr0374.c
src/subr.c
src/sxhash.c
src/testtool.c
src/timer.c
src/tty.c
src/typeof.c
src/ubf1.c
src/ubf2.c
src/ubf3.c
src/ufn.c
src/ufs.c
src/unixcomm.c
src/unwind.c
src/uraid.c
src/usrsubr.c
src/uutils.c
src/vars3.c
src/vmemsave.c
src/xc.c
src/z2.c
)
SET(MAIKO_HDRS
inc/address.h
inc/adr68k.h
inc/allocmdsdefs.h
inc/arith2defs.h
inc/arith3defs.h
inc/arith4defs.h
inc/arith.h
inc/array2defs.h
inc/array3defs.h
inc/array4defs.h
inc/array5defs.h
inc/array6defs.h
inc/arraydefs.h
inc/array.h
inc/bb.h
inc/bbtsubdefs.h
inc/bindefs.h
inc/bindsdefs.h
inc/bitbltdefs.h
inc/bitblt.h
inc/bltdefs.h
inc/byteswapdefs.h
inc/car-cdrdefs.h
inc/cell.h
inc/chardevdefs.h
inc/commondefs.h
inc/conspagedefs.h
inc/dbgtooldefs.h
inc/dbprint.h
inc/debug.h
inc/devconf.h
inc/devif.h
inc/dirdefs.h
inc/display.h
inc/dld.h
inc/dlpidefs.h
inc/drawdefs.h
inc/dskdefs.h
inc/dspdata.h
inc/dspifdefs.h
inc/dspsubrsdefs.h
inc/emlglob.h
inc/eqfdefs.h
inc/etherdefs.h
inc/ether.h
inc/fast_dsp.h
inc/findkeydefs.h
inc/foreigndefs.h
inc/fpdefs.h
inc/fvardefs.h
inc/gc2defs.h
inc/gcarraydefs.h
inc/gccodedefs.h
inc/gcdata.h
inc/gcdefs.h
inc/gcfinaldefs.h
inc/gchtfinddefs.h
inc/gcmain3defs.h
inc/gcoflowdefs.h
inc/gcrcelldefs.h
inc/gcrdefs.h
inc/gcscandefs.h
inc/gvar2defs.h
inc/hardrtndefs.h
inc/hdw_conf.h
inc/ifpage.h
inc/inetdefs.h
inc/initatms.h
inc/initdspdefs.h
inc/initkbddefs.h
inc/initsoutdefs.h
inc/inlineC.h
inc/inln68k.h
inc/inlnPS2.h
inc/inlnSPARC.h
inc/intcalldefs.h
inc/iopage.h
inc/kbdsubrsdefs.h
inc/keyboard.h
inc/keyeventdefs.h
inc/keysym.h
inc/kprintdefs.h
inc/ldeXdefs.h
inc/ldsoutdefs.h
inc/lineblt8defs.h
inc/lisp2cdefs.h
inc/lispemul.h
inc/lispmap.h
inc/lispver2.h
inc/llcolordefs.h
inc/lldsp.h
inc/llstkdefs.h
inc/locfile.h
inc/loopsopsdefs.h
inc/lowlev1defs.h
inc/lowlev2defs.h
inc/lpdefs.h
inc/lpglob.h
inc/lpglobl.h
inc/lpkit.h
inc/lppatch.h
inc/lpproto.h
inc/lspglob.h
inc/lsptypes.h
inc/lsthandldefs.h
inc/maindefs.h
inc/medleyfp.h
inc/misc7defs.h
inc/miscndefs.h
inc/miscstat.h
inc/mkatomdefs.h
inc/mkcelldefs.h
inc/mnxdefs.h
inc/mvsdefs.h
inc/my.h
inc/MyWindow.h
inc/nfsfh.h
inc/nfswatch.h
inc/opcodes.h
inc/os.h
inc/osmsgdefs.h
inc/osmsg.h
inc/perrnodefs.h
inc/picture.h
inc/pilotbbt.h
inc/print.h
inc/rawrs232c.h
inc/returndefs.h
inc/return.h
inc/rpcdefs.h
inc/rplconsdefs.h
inc/rs232c.h
inc/shiftdefs.h
inc/stack.h
inc/storagedefs.h
inc/stream.h
inc/subr0374defs.h
inc/subrdefs.h
inc/subrs.h
inc/sxhashdefs.h
inc/testtooldefs.h
inc/timeout.h
inc/timerdefs.h
inc/tos1defs.h
inc/tosfns.h
inc/tosret.h
inc/tty.h
inc/typeofdefs.h
inc/ubf1defs.h
inc/ubf2defs.h
inc/ubf3defs.h
inc/ufsdefs.h
inc/unixcommdefs.h
inc/unixfork.h
inc/unwinddefs.h
inc/uraiddefs.h
inc/usrsubrdefs.h
inc/uutilsdefs.h
inc/vars3defs.h
inc/version.h
inc/vmemsavedefs.h
inc/vmemsave.h
inc/xcdefs.h
inc/z2defs.h
)
ADD_CUSTOM_TARGET(gen-vdate
COMMAND mkvdate > vdate.c
BYPRODUCTS vdate.c
)
ADD_EXECUTABLE(lde src/ldeboot.c src/unixfork.c)
TARGET_COMPILE_DEFINITIONS(lde PUBLIC ${MAIKO_DEFINITIONS})
TARGET_INCLUDE_DIRECTORIES(lde PUBLIC inc)
IF(MAIKO_DISPLAY_X11)
# Tell it that the X11 launcher is available.
TARGET_COMPILE_DEFINITIONS(lde PUBLIC ${MAIKO_DISPLAY_X11_DEFINITIONS})
# This is needed so that it can call XOpenDisplay.
TARGET_LINK_LIBRARIES(lde X11::X11)
ENDIF()
ADD_EXECUTABLE(ldeether src/ldeether.c src/dlpi.c)
TARGET_COMPILE_DEFINITIONS(ldeether PUBLIC ${MAIKO_DEFINITIONS})
TARGET_INCLUDE_DIRECTORIES(ldeether PUBLIC inc)
IF(MAIKO_DISPLAY_X11)
ADD_EXECUTABLE(ldex
src/main.c
vdate.c
${MAIKO_SRCS}
${MAIKO_HDRS}
${MAIKO_DISPLAY_X11_SRCS}
${MAIKO_DISPLAY_X11_HDRS}
)
TARGET_COMPILE_DEFINITIONS(ldex PUBLIC ${MAIKO_DEFINITIONS} ${MAIKO_DISPLAY_X11_DEFINITIONS})
TARGET_INCLUDE_DIRECTORIES(ldex PUBLIC inc)
TARGET_LINK_LIBRARIES(ldex ${MAIKO_LIBRARIES} ${MAIKO_DISPLAY_X11_LIBRARIES})
ENDIF()
ADD_EXECUTABLE(mkvdate src/mkvdate.c)
TARGET_COMPILE_DEFINITIONS(mkvdate PUBLIC ${MAIKO_DEFINITIONS})
TARGET_INCLUDE_DIRECTORIES(mkvdate PUBLIC inc)
ADD_EXECUTABLE(setsout src/setsout.c src/byteswap.c)
TARGET_COMPILE_DEFINITIONS(setsout PUBLIC ${MAIKO_DEFINITIONS})
TARGET_INCLUDE_DIRECTORIES(setsout PUBLIC inc)
ADD_EXECUTABLE(tstsout src/tstsout.c src/byteswap.c)
TARGET_COMPILE_DEFINITIONS(tstsout PUBLIC ${MAIKO_DEFINITIONS})
TARGET_INCLUDE_DIRECTORIES(tstsout PUBLIC inc)