2019-07-16 20:19:11 -06:00
|
|
|
project(lua CXX)
|
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2011-08-08 15:19:44 -06:00
|
|
|
|
2019-07-16 20:19:11 -06:00
|
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DLUA_USE_APICHECK")
|
2012-03-23 00:56:29 -06:00
|
|
|
|
2016-08-09 16:49:39 -06:00
|
|
|
# Make bit32 library available (for things like bit32.extract())
|
2019-07-16 20:19:11 -06:00
|
|
|
add_definitions(-DLUA_COMPAT_BITLIB)
|
2016-08-09 16:49:39 -06:00
|
|
|
|
2019-07-16 20:19:11 -06:00
|
|
|
if(WIN32)
|
|
|
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE /wd4334)
|
|
|
|
else()
|
|
|
|
add_definitions(-DLUA_USE_POSIX -DLUA_USE_DLOPEN)
|
|
|
|
set(LIBS m dl)
|
|
|
|
endif()
|
2011-08-08 15:19:44 -06:00
|
|
|
|
2019-07-16 20:19:11 -06:00
|
|
|
if(UNIX)
|
|
|
|
add_definitions(-DLINUX_BUILD)
|
|
|
|
if(DFHACK_BUILD_64)
|
|
|
|
set(CMAKE_C_FLAGS "-m64 -mno-avx")
|
|
|
|
else()
|
|
|
|
set(CMAKE_C_FLAGS "-m32")
|
|
|
|
endif()
|
|
|
|
endif()
|
2011-08-08 15:30:30 -06:00
|
|
|
|
2019-07-16 20:19:11 -06:00
|
|
|
set(HDR_LIBLUA
|
|
|
|
include/lapi.h
|
|
|
|
include/lauxlib.h
|
|
|
|
include/lcode.h
|
|
|
|
include/lctype.h
|
|
|
|
include/ldebug.h
|
|
|
|
include/ldo.h
|
|
|
|
include/lfunc.h
|
|
|
|
include/lgc.h
|
|
|
|
include/llex.h
|
|
|
|
include/llimits.h
|
|
|
|
include/lmem.h
|
|
|
|
include/lobject.h
|
|
|
|
include/lopcodes.h
|
|
|
|
include/lparser.h
|
|
|
|
include/lstate.h
|
|
|
|
include/lstring.h
|
|
|
|
include/ltable.h
|
|
|
|
include/ltm.h
|
|
|
|
include/lua.h
|
|
|
|
include/luaconf.h
|
|
|
|
include/lualib.h
|
|
|
|
include/lundump.h
|
|
|
|
include/lvm.h
|
|
|
|
include/lzio.h
|
2012-03-13 07:46:48 -06:00
|
|
|
)
|
2019-07-16 20:19:11 -06:00
|
|
|
set_source_files_properties(${HDR_LIBLUA} PROPERTIES HEADER_FILE_ONLY TRUE)
|
2012-03-13 07:46:48 -06:00
|
|
|
include_directories(include)
|
|
|
|
|
2011-08-08 15:19:44 -06:00
|
|
|
# Build Libraries
|
2019-07-16 20:19:11 -06:00
|
|
|
set(SRC_LIBLUA
|
|
|
|
src/lapi.c
|
|
|
|
src/lauxlib.c
|
|
|
|
src/lbaselib.c
|
|
|
|
src/lbitlib.c
|
|
|
|
src/lcode.c
|
|
|
|
src/lcorolib.c
|
|
|
|
src/lctype.c
|
|
|
|
src/ldblib.c
|
|
|
|
src/ldebug.c
|
|
|
|
src/ldo.c
|
|
|
|
src/ldump.c
|
|
|
|
src/lfunc.c
|
|
|
|
src/lgc.c
|
|
|
|
src/linit.c
|
|
|
|
src/liolib.c
|
|
|
|
src/llex.c
|
|
|
|
src/lmathlib.c
|
|
|
|
src/lmem.c
|
|
|
|
src/loadlib.c
|
|
|
|
src/lobject.c
|
|
|
|
src/lopcodes.c
|
|
|
|
src/loslib.c
|
|
|
|
src/lparser.c
|
|
|
|
src/lstate.c
|
|
|
|
src/lstring.c
|
|
|
|
src/lstrlib.c
|
|
|
|
src/ltable.c
|
|
|
|
src/ltablib.c
|
|
|
|
src/ltm.c
|
|
|
|
src/lundump.c
|
|
|
|
src/lutf8lib.c
|
|
|
|
src/lvm.c
|
|
|
|
src/lzio.c
|
2011-08-08 15:19:44 -06:00
|
|
|
)
|
2012-03-24 05:13:51 -06:00
|
|
|
# compile with C++ compiler
|
|
|
|
set_source_files_properties(${SRC_LIBLUA} PROPERTIES LANGUAGE CXX)
|
|
|
|
# append headers to sources to make them show up in MSVC GUI
|
2019-07-16 20:19:11 -06:00
|
|
|
list(APPEND SRC_LIBLUA ${HDR_LIBLUA})
|
2011-08-08 15:19:44 -06:00
|
|
|
|
2019-07-16 20:19:11 -06:00
|
|
|
add_library(lua SHARED ${SRC_LIBLUA})
|
|
|
|
target_link_libraries(lua ${LIBS})
|
2012-03-19 10:12:27 -06:00
|
|
|
|
2019-07-20 13:15:39 -06:00
|
|
|
if(MSVC)
|
2019-10-04 11:15:58 -06:00
|
|
|
# need no space to prevent /FI from being stripped: https://github.com/DFHack/dfhack/issues/1455
|
|
|
|
target_compile_options(lua PRIVATE "/FIdfhack_llimits.h")
|
2019-07-20 13:15:39 -06:00
|
|
|
else()
|
2019-07-20 12:26:30 -06:00
|
|
|
target_compile_options(lua PRIVATE -include dfhack_llimits.h)
|
2019-07-20 13:15:39 -06:00
|
|
|
endif()
|
2018-07-05 12:16:50 -06:00
|
|
|
|
2012-03-19 10:12:27 -06:00
|
|
|
install(TARGETS lua
|
2019-07-16 20:19:11 -06:00
|
|
|
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
|
|
|
|
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION})
|
2011-08-08 15:19:44 -06:00
|
|
|
|
2019-07-16 20:19:11 -06:00
|
|
|
ide_folder(lua "Depends")
|