lua.cmake /size: 2758 b    last modification: 2024-01-16 10:21
1set(lua_sources
2
3    source/luacore/lua54/src/lapi.c
4    source/luacore/lua54/src/lauxlib.c
5    source/luacore/lua54/src/lbaselib.c
6    source/luacore/lua54/src/lcode.c
7    source/luacore/lua54/src/lcorolib.c
8    source/luacore/lua54/src/lctype.c
9    source/luacore/lua54/src/ldblib.c
10    source/luacore/lua54/src/ldebug.c
11    source/luacore/lua54/src/ldo.c
12    source/luacore/lua54/src/ldump.c
13    source/luacore/lua54/src/lfunc.c
14    source/luacore/lua54/src/lgc.c
15    source/luacore/lua54/src/linit.c
16    source/luacore/lua54/src/liolib.c
17    source/luacore/lua54/src/llex.c
18    source/luacore/lua54/src/lmathlib.c
19    source/luacore/lua54/src/lmem.c
20    source/luacore/lua54/src/loadlib.c
21    source/luacore/lua54/src/lobject.c
22    source/luacore/lua54/src/lopcodes.c
23    source/luacore/lua54/src/loslib.c
24    source/luacore/lua54/src/lparser.c
25    source/luacore/lua54/src/lstate.c
26    source/luacore/lua54/src/lstring.c
27    source/luacore/lua54/src/lstrlib.c
28    source/luacore/lua54/src/ltable.c
29    source/luacore/lua54/src/ltablib.c
30    source/luacore/lua54/src/ltm.c
31    source/luacore/lua54/src/lua.c
32    source/luacore/lua54/src/lundump.c
33    source/luacore/lua54/src/lutf8lib.c
34    source/luacore/lua54/src/lvm.c
35    source/luacore/lua54/src/lzio.c
36
37    source/luacore/luapeg/lptree.c
38    source/luacore/luapeg/lpvm.c
39    source/luacore/luapeg/lpprint.c
40    source/luacore/luapeg/lpcap.c
41    source/luacore/luapeg/lpcset.c
42    source/luacore/luapeg/lpcode.c
43
44)
45
46add_library(lua STATIC ${lua_sources})
47
48set_property(TARGET lua PROPERTY C_STANDARD 99)
49
50target_include_directories(lua PRIVATE
51    source/luacore/lua54/src
52    source/luacore/luapeg
53)
54
55# luajit: 8000, lua 5.3: 1000000 or 15000
56
57target_compile_definitions(lua PUBLIC
58    # This one should also be set in the lua namespace!
59  # LUAI_HASHLIMIT=6 # obsolete
60  # LUAI_MAXSHORTLEN=48
61    LUAI_MAXCSTACK=6000
62    LUA_UCID # permits utf8 
63  # LUA_USE_JUMPTABLE=0
64    LPEG_DEBUG
65  # LUA_NOCVTS2N
66    LUA_NOBUILTIN # disable likely usage
67  # LUAI_ASSERT
68  # LUA_STRFTIMEOPTIONS="aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%" 
69  # MINSTRTABSIZE=65536
70  # LUA_USE_JUMPTABLE=0
71    NDEBUG=0
72)
73
74if (UNIX)
75    target_compile_definitions(lua PUBLIC
76        LUA_USE_POSIX
77        LUA_USE_DLOPEN
78    )
79endif (UNIX)
80
81if (NOT MSVC)
82    target_compile_options(lua PRIVATE
83        -Wno-cast-align
84        -Wno-cast-qual
85    )
86endif (NOT MSVC)
87
88# if (CMAKE_HOST_APPLE)
89#     target_compile_definitions(lua PUBLIC
90#         TARGET_OS_IOS=0
91#         TARGET_OS_WATCH=0
92#         TARGET_OS_TV=0
93#     )
94# endif (CMAKE_HOST_APPLE)
95
96# this seems to be ok for mingw default
97#
98# todo: what is the right way to increase the stack (mingw)
99
100# target_compile_options(lua PRIVATE -DLUAI_MAXCSTACK=65536 -Wl,--stack,16777216)
101