| 1 |
cmake_minimum_required(VERSION 3.13) |
| 2 |
|
| 3 |
project(TADS) |
| 4 |
|
| 5 |
# Add sources to a target from a specified directory |
| 6 |
function(add_sources target dir) |
| 7 |
cmake_parse_arguments(PARSE_ARGV 2 ADD "" "" "SRCS") |
| 8 |
list(TRANSFORM ADD_SRCS PREPEND ${dir}) |
| 9 |
target_sources(${target} PRIVATE ${ADD_SRCS}) |
| 10 |
endfunction() |
| 11 |
|
| 12 |
# Find the requested library |
| 13 |
set(GlkLibPath "glk" CACHE PATH "Glk Library Path") |
| 14 |
set(GlkLibName "" CACHE STRING "Glk Library Name (without lib- or -.a)") |
| 15 |
if (GlkLibName STREQUAL "") |
| 16 |
get_filename_component(GlkLibNameReal ${GlkLibPath} NAME) |
| 17 |
else () |
| 18 |
set(GlkLibNameReal ${GlkLibName} STRING) |
| 19 |
endif() |
| 20 |
add_library(glk STATIC IMPORTED) |
| 21 |
set_target_properties(glk PROPERTIES IMPORTED_LOCATION "${GlkLibPath}/lib${GlkLibNameReal}.a") |
| 22 |
target_include_directories(glk INTERFACE ${GlkLibPath}) |
| 23 |
|
| 24 |
add_executable(tadsr) |
| 25 |
target_link_libraries(tadsr glk) |
| 26 |
target_include_directories(tadsr PRIVATE . ../tads2/ ../tads3/) |
| 27 |
add_sources(tadsr "./" |
| 28 |
SRCS memicmp.c osbuffer.c osextra.c osglk.c osglkban.c osmisc.c osparse.c |
| 29 |
osportable.cc t23run.cpp t2askf.c t2indlg.c t3askf.cpp t3indlg.cpp vmuni_cs.cpp) |
| 30 |
add_sources(tadsr "../tads2/" |
| 31 |
SRCS argize.c bif.c bifgdum.c cmap.c cmd.c dat.c dbgtr.c errmsg.c execmd.c |
| 32 |
fio.c fioxor.c getstr.c ler.c linfdum.c lst.c mch.c mcm.c mcs.c obj.c oem.c |
| 33 |
os0.c oserr.c osifc.c osnoui.c osrestad.c osstzprs.c ostzposix.c out.c output.c |
| 34 |
ply.c qas.c regex.c run.c runstat.c suprun.c trd.c voc.c vocab.c) |
| 35 |
add_sources(tadsr "../tads3/" |
| 36 |
SRCS charmap.cpp md5.cpp resldexe.cpp resload.cpp sha2.cpp std.cpp tcerr.cpp |
| 37 |
tcerrmsg.cpp tcgen.cpp tcglob.cpp tcmain.cpp tcprs.cpp tcprs_rt.cpp tcprsnf.cpp |
| 38 |
tcprsnl.cpp tcprsstm.cpp tcsrc.cpp tct3.cpp tct3_d.cpp tct3nl.cpp tct3stm.cpp |
| 39 |
tct3unas.cpp tctok.cpp utf8.cpp vmanonfn.cpp vmbif.cpp vmbifl.cpp vmbifreg.cpp |
| 40 |
vmbift3.cpp vmbiftad.cpp vmbiftio.cpp vmbignum.cpp vmbignumlib.cpp vmbt3_nd.cpp |
| 41 |
vmbytarr.cpp vmcfgmem.cpp vmcoll.cpp vmconhmp.cpp vmconsol.cpp vmcrc.cpp |
| 42 |
vmcset.cpp vmdate.cpp vmdict.cpp vmdynfunc.cpp vmerr.cpp vmerrmsg.cpp |
| 43 |
vmfile.cpp vmfilnam.cpp vmfilobj.cpp vmfref.cpp vmfunc.cpp vmglob.cpp |
| 44 |
vmgram.cpp vmhash.cpp vmhostsi.cpp vmhosttx.cpp vmimage.cpp vmimg_nd.cpp |
| 45 |
vmini_nd.cpp vminit.cpp vminitim.cpp vmintcls.cpp vmisaac.cpp vmiter.cpp |
| 46 |
vmlog.cpp vmlookup.cpp vmlst.cpp vmmain.cpp vmmcreg.cpp vmmeta.cpp |
| 47 |
vmnetfillcl.cpp vmobj.cpp vmop.cpp vmpack.cpp vmpat.cpp vmpool.cpp |
| 48 |
vmpoolim.cpp vmregex.cpp vmrun.cpp vmrunsym.cpp vmsa.cpp vmsave.cpp vmsort.cpp |
| 49 |
vmsortv.cpp vmsrcf.cpp vmstack.cpp vmstr.cpp vmstrbuf.cpp vmstrcmp.cpp |
| 50 |
vmtmpfil.cpp vmtobj.cpp vmtype.cpp vmtypedh.cpp vmtz.cpp vmtzobj.cpp |
| 51 |
vmundo.cpp vmvec.cpp vmconnom.cpp) |
| 52 |
set_property(TARGET tadsr PROPERTY CXX_STANDARD 11) |
| 53 |
target_compile_definitions(tadsr PRIVATE GLK GLK_TIMERS GLK_UNICODE TC_TARGET_T3 RUNTIME VMGLOB_STRUCT) |
| 54 |
if(MINGW32) |
| 55 |
target_compile_definitions(tadsr PRIVATE DMSDOS DT_WIN32) |
| 56 |
endif() |
| 57 |
if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") |
| 58 |
# This is a style choice in the code. |
| 59 |
target_compile_options(tadsr PRIVATE -Wno-deprecated-register -Wno-logical-not-parentheses -Wno-pointer-sign -Wno-string-concatenation) |
| 60 |
endif() |