modify vanilla build to never use internal makefile

appveyor will build both versions on x64 since it can (maybe) run fast enough?
generate lua.hpp for versions 5.1, since it doesn't roll its own
This commit is contained in:
ThePhD 2017-12-24 17:59:45 -05:00
parent 83013333d7
commit f2db7e3a6f
3 changed files with 165 additions and 233 deletions

View File

@ -52,7 +52,7 @@ set(CXX_FEATURES
# # # General project flags
if (MSVC)
add_definitions(/DUNICODE /D_UNICODE /D_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING)
add_definitions(/DUNICODE /D_UNICODE /D_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING /D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
add_compile_options(/W4 /EHsc)
else()
add_compile_options(-Wno-unknown-warning -Wno-unknown-warning-option -Wall -Wextra -Wpedantic -pedantic -pedantic-errors -Wno-noexcept-type -ftemplate-depth=1024)

View File

@ -60,11 +60,11 @@ before_build:
- cmake .. -G "%CMAKE_GENERATOR%" -DLUA_VERSION="%LUA_VERSION%" -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON
build_script:
- cmake --build . --config Debug
- if "%PLATFORM%"=="x64" (cmake --build . --config Debug)
- cmake --build . --config Release
test_script:
- ctest -C Debug --output-on-failure
- if "%PLATFORM%"=="x64" (ctest -C Debug --output-on-failure)
- ctest -C Release --output-on-failure
notifications:

View File

@ -164,7 +164,7 @@ endif()
# # Potential compiler variables
if (MSVC)
set(LUA_VANILLA_LUA_LUAC_COMPILER_OPTIONS "")
set(LUA_VANILLA_LUA_LUAC_COMPILER_OPTIONS "/W1")
if (BUILD_LUA_AS_DLL)
set(LUA_VANILLA_DLL_DEFINE LUA_BUILD_AS_DLL)
else()
@ -182,17 +182,19 @@ if (LUA_VANILLA_VERSION MATCHES "^5.1")
lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c lstate.c
lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c lauxlib.c
lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c ltablib.c
lstrlib.c linit.c)
lstrlib.c loadlib.c linit.c)
set(LUA_VANILLA_LUA_SOURCES lua.c )
set(LUA_VANILLA_LUAC_SOURCES luac.c print.c )
set(LUA_VANILLA_GENERATE_LUA_HPP true)
elseif (LUA_VANILLA_VERSION MATCHES "^5.2")
set(LUA_VANILLA_LIB_SOURCES lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c
lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c
lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c
lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c
liolib.c lmathlib.c loslib.c lstrlib.c ltablib.c linit.c)
lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c
lmathlib.c loslib.c lstrlib.c ltablib.c loadlib.c linit.c)
set(LUA_VANILLA_LUA_SOURCES lua.c )
set(LUA_VANILLA_LUAC_SOURCES luac.c )
set(LUA_VANILLA_GENERATE_LUA_HPP false)
else()
if (NOT LUA_VANILLA_VERSION MATCHES "^5.3")
message(STATUS "Using the Lua 5.3 sources list for a version of Lua that is not 5.3: may result in an incomplete build or errors later")
@ -204,6 +206,7 @@ else()
loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c)
set(LUA_VANILLA_LUA_SOURCES lua.c )
set(LUA_VANILLA_LUAC_SOURCES luac.c )
set(LUA_VANILLA_GENERATE_LUA_HPP false)
endif()
if (BUILD_LUA_AS_DLL)
@ -218,245 +221,174 @@ STRING(REGEX REPLACE "\\.c" ${LUA_BUILD_OBJECT_FILE_SUFFIX} LUA_VANILLA_LIB_OBJE
STRING(REGEX REPLACE "\\.c" ${LUA_BUILD_OBJECT_FILE_SUFFIX} LUA_VANILLA_LUA_OBJECTS ${LUA_VANILLA_LUA_SOURCES})
STRING(REGEX REPLACE "\\.c" ${LUA_BUILD_OBJECT_FILE_SUFFIX} LUA_VANILLA_LUAC_OBJECTS ${LUA_VANILLA_LUAC_SOURCES})
if (WIN32 OR MSVC OR BUILD_LUA_AS_DLL)
set(LUA_VANILLA_BUILD_DIRECTLY TRUE)
else()
set(LUA_VANILLA_BUILD_DIRECTLY FALSE)
endif()
# download, just for the sake of download + extract
# we can get additional mileage if we're just doing the static build...
if (LUA_VANILLA_BUILD_DIRECTLY)
# have to use 2 different commands just to have an empty command
# that results in nothing being run
# TODO: talk to smarter CMake people...?
# have to use 2 different commands just to have an empty command
# that results in nothing being run
# TODO: talk to smarter CMake people...?
ExternalProject_Add(LUA_VANILLA
BUILD_IN_SOURCE TRUE
BUILD_ALWAYS TRUE
TLS_VERIFY TRUE
PREFIX ${LUA_BUILD_TOPLEVEL}
SOURCE_DIR ${LUA_BUILD_TOPLEVEL}
DOWNLOAD_DIR ${LUA_BUILD_TOPLEVEL}
TMP_DIR "${LUA_BUILD_TOPLEVEL}-tmp"
STAMP_DIR "${LUA_BUILD_TOPLEVEL}-stamp"
INSTALL_DIR "${LUA_BUILD_INSTALL_DIR}"
URL https://www.lua.org/ftp/lua-${LUA_VANILLA_VERSION}.tar.gz
URL_MD5 ${LUA_VANILLA_MD5}
URL_HASH SHA1=${LUA_VANILLA_SHA1}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
BUILD_BYPRODUCTS ${LUA_VANILLA_BYPRODUCTS} "${LUA_VANILLA_LIB_SOURCES}" "${LUA_VANILLA_LUA_SOURCES}" "${LUA_VANILLA_LUAC_SOURCES}")
else()
# targets if we're building using the makefile
if (MINGW)
set(LUA_VANILLA_MAKE_TARGET generic)
elseif(APPLE)
set(LUA_VANILLA_MAKE_TARGET macosx)
elseif(UNIX AND NOT APPLE)
set(LUA_VANILLA_MAKE_TARGET linux)
else()
set(LUA_VANILLA_MAKE_TARGET generic)
endif()
ExternalProject_Add(LUA_VANILLA
BUILD_IN_SOURCE TRUE
BUILD_ALWAYS TRUE
TLS_VERIFY TRUE
PREFIX ${LUA_BUILD_TOPLEVEL}
SOURCE_DIR ${LUA_BUILD_TOPLEVEL}
DOWNLOAD_DIR ${LUA_BUILD_TOPLEVEL}
TMP_DIR "${LUA_BUILD_TOPLEVEL}-tmp"
STAMP_DIR "${LUA_BUILD_TOPLEVEL}-stamp"
INSTALL_DIR "${LUA_BUILD_INSTALL_DIR}"
URL https://www.lua.org/ftp/lua-${LUA_VANILLA_VERSION}.tar.gz
URL_MD5 ${LUA_VANILLA_MD5}
URL_HASH SHA1=${LUA_VANILLA_SHA1}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
BUILD_BYPRODUCTS ${LUA_VANILLA_BYPRODUCTS} "${LUA_VANILLA_LIB_SOURCES}" "${LUA_VANILLA_LUA_SOURCES}" "${LUA_VANILLA_LUAC_SOURCES}")
set(LUA_VANILLA_LIBNAME ${CMAKE_STATIC_LIBRARY_PREFIX}${LUA_LIBRARY}${CMAKE_STATIC_LIBRARY_SUFFIX})
set(LUA_VANILLA_MAKE_MODIFICATIONS TO_LIB="${LUA_VANILLA_LIBNAME}" LUA_A="${LUA_VANILLA_LIBNAME}" SYSCFLAGS=-DLUA_COMPAT_ALL)
set(LUA_VANILLA_MAKE_INSTALL_TOOL "copy /B /Y")
set(LUA_VANILLA_MAKE_INSTALL_TOP "${LUA_BUILD_INSTALL_DIR}")
set(LUA_VANILLA_MAKE_INSTALL_BIN "${LUA_BIN_DIR}")
set(LUA_VANILLA_MAKE_INSTALL_INC "${LUA_INCLUDE_DIR}")
set(LUA_VANILLA_MAKE_INSTALL_LIB "${LUA_LIB_DIR}")
set(LUA_VANILLA_MAKE_INSTALL_MAN "${LUA_BUILD_INSTALL_DIR}/man/man1")
set(LUA_VANILLA_MAKE_INSTALL_LMOD "${LUA_BUILD_INSTALL_DIR}/share/lua/$V")
set(LUA_VANILLA_MAKE_INSTALL_CMOD "${LUA_BUILD_INSTALL_DIR}/lib/lua/$V")
file(TO_NATIVE_PATH "${LUA_VANILLA_MAKE_INSTALL_TOP}" LUA_VANILLA_MAKE_INSTALL_TOP)
file(TO_NATIVE_PATH "${LUA_VANILLA_MAKE_INSTALL_BIN}" LUA_VANILLA_MAKE_INSTALL_BIN)
file(TO_NATIVE_PATH "${LUA_VANILLA_MAKE_INSTALL_INC}" LUA_VANILLA_MAKE_INSTALL_INC)
file(TO_NATIVE_PATH "${LUA_VANILLA_MAKE_INSTALL_LIB}" LUA_VANILLA_MAKE_INSTALL_LIB)
file(TO_NATIVE_PATH "${LUA_VANILLA_MAKE_INSTALL_MAN}" LUA_VANILLA_MAKE_INSTALL_MAN)
file(TO_NATIVE_PATH "${LUA_VANILLA_MAKE_INSTALL_LMOD}" LUA_VANILLA_MAKE_INSTALL_LMOD)
file(TO_NATIVE_PATH "${LUA_VANILLA_MAKE_INSTALL_CMOD}" LUA_VANILLA_MAKE_INSTALL_CMOD)
if (WIN32)
# powershell invokes too many rules and stupid errors,
# and mkdir freaks out when the directory exists because it doesn't have a -p options
# all in all, windows cmd tools SUCK
# set(LUA_VANILLA_MAKE_MKDIR_TOOL "powershell -c New-Item -ItemType directory -force -Name")
#set(LUA_VANILLA_MAKE_MKDIR_TOOL "powershell -c New-Item -ItemType directory -force -Name")
set(LUA_VANILLA_MAKE_MKDIR_TOOL "mkdir")
set(LUA_VANILLA_MAKE_MODIFICATIONS ${LUA_VANILLA_MAKE_MODIFICATIONS} RM=del MKDIR=${LUA_VANILLA_MAKE_MKDIR_TOOL})
set(LUA_VANILLA_MAKE_MODIFICATIONS ${LUA_VANILLA_MAKE_MODIFICATIONS} INSTALL="${LUA_VANILLA_MAKE_INSTALL_TOOL}" INSTALL_EXEC="${LUA_VANILLA_MAKE_INSTALL_TOOL}" INSTALL_DATA="${LUA_VANILLA_MAKE_INSTALL_TOOL}")
endif()
set(LUA_VANILLA_MAKE_MODIFICATIONS ${LUA_VANILLA_MAKE_MODIFICATIONS} INSTALL_TOP="${LUA_VANILLA_MAKE_INSTALL_TOP}" INSTALL_BIN="${LUA_VANILLA_MAKE_INSTALL_BIN}" INSTALL_INC="${LUA_VANILLA_MAKE_INSTALL_INC}" INSTALL_LIB="${LUA_VANILLA_MAKE_INSTALL_LIB}" INSTALL_MAN="${LUA_VANILLA_MAKE_INSTALL_MAN}" INSTALL_LMOD="${LUA_VANILLA_MAKE_INSTALL_LMOD}" INSTALL_CMOD="${LUA_VANILLA_MAKE_INSTALL_CMOD}")
# make a quick lua.hpp for 5.1 targets that don't have it
if (LUA_VANILLA_GENERATE_LUA_HPP)
file (WRITE "${LUA_VANILLA_SOURCE_DIR}/lua.hpp" "// lua.hpp
// Lua header files for C++
// <<extern \"C\">> not supplied automatically because Lua also compiles as C++
set(LUA_VANILLA_BUILD_COMMAND make ${LUA_VANILLA_MAKE_TARGET} ${LUA_VANILLA_MAKE_MODIFICATIONS})
set(LUA_VANILLA_INSTALL_COMMAND make install ${LUA_VANILLA_MAKE_MODIFICATIONS})
set(LUA_VANILLA_TEST_COMMAND make test ${LUA_VANILLA_MAKE_MODIFICATIONS})
ExternalProject_Add(LUA_VANILLA
BUILD_IN_SOURCE TRUE
BUILD_ALWAYS TRUE
TLS_VERIFY TRUE
PREFIX ${LUA_BUILD_TOPLEVEL}
SOURCE_DIR ${LUA_BUILD_TOPLEVEL}
DOWNLOAD_DIR ${LUA_BUILD_TOPLEVEL}
TMP_DIR "${LUA_BUILD_TOPLEVEL}-tmp"
STAMP_DIR "${LUA_BUILD_TOPLEVEL}-stamp"
INSTALL_DIR "${LUA_BUILD_INSTALL_DIR}"
URL https://www.lua.org/ftp/lua-${LUA_VANILLA_VERSION}.tar.gz
URL_MD5 ${LUA_VANILLA_MD5}
URL_HASH SHA1=${LUA_VANILLA_SHA1}
CONFIGURE_COMMAND ""
BUILD_COMMAND ${LUA_VANILLA_BUILD_COMMAND}
INSTALL_COMMAND ${LUA_VANILLA_INSTALL_COMMAND}
TEST_COMMAND ${LUA_VANILLA_TEST_COMMAND}
BUILD_BYPRODUCTS ${LUA_VANILLA_BYPRODUCTS} "${LUA_VANILLA_LIB_SOURCES}" "${LUA_VANILLA_LUA_SOURCES}" "${LUA_VANILLA_LUAC_SOURCES}")
extern \"C\" {
#include \"lua.h\"
#include \"lualib.h\"
#include \"lauxlib.h\"
}
")
endif()
# # Target names
set(lualib "lualib_${LUA_VANILLA_VERSION}")
set(luainterpreter "lua_${LUA_VANILLA_VERSION}")
set(luacompiler "luac_${LUA_VANILLA_VERSION}")
if (LUA_VANILLA_BUILD_DIRECTLY)
# Lua does not out-of-the-box support building
# a shared library: http://lua-users.org/lists/lua-l/2006-10/msg00098.html
# in this case, we essentially need to
# build Lua for our purposes, which is annoying
# the external project is just a dummy to get and extract the file:
# after that, we define actual targets...!
# Lua does not out-of-the-box support building
# a shared library: http://lua-users.org/lists/lua-l/2006-10/msg00098.html
# in this case, we essentially need to
# build Lua for our purposes, which is annoying
# the external project is just a dummy to get and extract the file:
# after that, we define actual targets...!
# make an actual, buildable target
# that other parts of the code can depend on
add_library(${lualib} ${LUA_BUILD_LIBRARY_TYPE} "${LUA_VANILLA_LIB_SOURCES}")
set_target_properties(${lualib}
PROPERTIES
LANGUAGE C
LINKER_LANGUAGE C
C_STANDARD 99
C_EXTENSIONS TRUE
POSITION_INDEPENDENT_CODE TRUE
INCLUDE_DIRECTORIES ${LUA_VANILLA_SOURCE_DIR}
RUNTIME_OUTPUT_DIRECTORY ${LUA_BIN_DIR}
LIBRARY_OUTPUT_DIRECTORY ${LUA_BIN_DIR}
ARCHIVE_OUTPUT_DIRECTORY ${LUA_LIB_DIR}
OUTPUT_NAME ${LUA_BUILD_LIBNAME}
RUNTIME_OUTPUT_NAME ${LUA_BUILD_LIBNAME}
LIBRARY_OUTPUT_NAME ${LUA_BUILD_LIBNAME}
ARCHIVE_OUTPUT_NAME ${LUA_BUILD_LIBNAME})
target_include_directories(${lualib}
PRIVATE ${LUA_VANILLA_SOURCE_DIR}
PUBLIC ${LUA_VANILLA_SOURCE_DIR})
target_compile_definitions(${lualib}
PUBLIC LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE}
PRIVATE LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE})
if (WIN32)
#target_compile_definitions(${lualib}
# PRIVATE LUA_USE_WINDOWS)
else()
target_compile_definitions(${lualib}
PRIVATE LUA_USE_LINUX)
endif()
# make an actual, buildable target
# that other parts of the code can depend on
add_library(${lualib} ${LUA_BUILD_LIBRARY_TYPE} "${LUA_VANILLA_LIB_SOURCES}")
set_target_properties(${lualib}
PROPERTIES
LANGUAGE C
LINKER_LANGUAGE C
C_STANDARD 99
C_EXTENSIONS TRUE
POSITION_INDEPENDENT_CODE TRUE
INCLUDE_DIRECTORIES ${LUA_VANILLA_SOURCE_DIR}
RUNTIME_OUTPUT_DIRECTORY ${LUA_BIN_DIR}
LIBRARY_OUTPUT_DIRECTORY ${LUA_BIN_DIR}
ARCHIVE_OUTPUT_DIRECTORY ${LUA_LIB_DIR}
OUTPUT_NAME ${LUA_BUILD_LIBNAME}
RUNTIME_OUTPUT_NAME ${LUA_BUILD_LIBNAME}
LIBRARY_OUTPUT_NAME ${LUA_BUILD_LIBNAME}
ARCHIVE_OUTPUT_NAME ${LUA_BUILD_LIBNAME})
target_include_directories(${lualib}
PRIVATE ${LUA_VANILLA_SOURCE_DIR}
PUBLIC ${LUA_VANILLA_SOURCE_DIR})
target_compile_definitions(${lualib}
PUBLIC LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE}
PRIVATE LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE})
if (MSVC)
target_compile_options(${lualib}
PRIVATE ${LUA_VANILLA_LUALIB_COMPILER_OPTIONS})
add_dependencies(${lualib} LUA_VANILLA)
if (CMAKE_DL_LIBS)
target_link_libraries(${lualib} ${CMAKE_DL_LIBS})
endif()
if (UNIX)
target_link_libraries(${lualib} m)
endif()
# we don't really need this section...
# Lua Interpreter
add_executable(${luainterpreter} ${LUA_VANILLA_LUA_SOURCES})
set_target_properties(${luainterpreter}
PROPERTIES
LANGUAGE C
LINKER_LANGUAGE C
C_STANDARD 99
C_EXTENSIONS TRUE
OUTPUT_NAME lua-${LUA_VANILLA_VERSION})
target_include_directories(${luainterpreter}
PRIVATE ${LUA_VANILLA_SOURCE_DIR})
target_compile_definitions(${luainterpreter}
PUBLIC LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE}
PRIVATE LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE})
if (WIN32)
#target_compile_definitions(${luainterpreter}
# PRIVATE LUA_USE_WINDOWS)
else()
target_compile_definitions(${luainterpreter}
PRIVATE LUA_USE_LINUX)
endif()
target_compile_options(${luainterpreter}
PRIVATE ${LUA_VANILLA_LUA_LUAC_COMPILER_OPTIONS})
target_link_libraries(${luainterpreter} ${lualib})
if (CMAKE_DL_LIBS)
target_link_libraries(${luainterpreter} ${CMAKE_DL_LIBS})
endif()
if (UNIX)
target_link_libraries(${luainterpreter} m readline)
endif()
# LuaC Compiler
add_executable(${luacompiler} ${LUA_VANILLA_LUAC_SOURCES} ${LUA_VANILLA_LIB_SOURCES})
set_target_properties(${luacompiler}
PROPERTIES
LANGUAGE C
LINKER_LANGUAGE C
C_STANDARD 99
C_EXTENSIONS TRUE
OUTPUT_NAME luac-${LUA_VANILLA_VERSION})
target_include_directories(${luacompiler}
PRIVATE ${LUA_VANILLA_SOURCE_DIR})
target_compile_options(${luacompiler}
PRIVATE ${LUA_VANILLA_LUA_LUAC_COMPILER_OPTIONS})
target_compile_definitions(${luacompiler}
PUBLIC LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE}
PRIVATE LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE})
if (WIN32)
#target_compile_definitions(${luacompiler}
# PRIVATE LUA_USE_WINDOWS)
else()
target_compile_definitions(${luacompiler}
PRIVATE LUA_USE_LINUX)
endif()
target_link_libraries(${luacompiler} ${lualib})
if (CMAKE_DL_LIBS)
target_link_libraries(${luacompiler} ${CMAKE_DL_LIBS})
endif()
if (UNIX)
target_link_libraries(${luacompiler} m readline)
endif()
# set externally-visible target indicator
set(LUA_LIBRARIES ${lualib})
else ()
# the proper build/install/test commands have generated the library for us
# note that this only works for static libs (see above comment under other branch)
add_library(${lualib} ${LUA_BUILD_LIBRARY_TYPE} IMPORTED)
set_target_properties(lualib_${LUA_VANILLA_VERSION}
PROPERTIES
LANGUAGE C
LINKER_LANGUAGE C
INCLUDE_DIRECTORIES ${LUA_INCLUDE_DIR}
RUNTIME_OUTPUT_DIRECTORY ${LUA_BIN_DIR}
LIBRARY_OUTPUT_DIRECTORY ${LUA_LIB_DIR}
ARCHIVE_OUTPUT_DIRECTORY ${LUA_LIB_DIR}
RUNTIME_OUTPUT_NAME ${LUA_BUILD_LIBNAME}
LIBRARY_OUTPUT_NAME ${LUA_BUILD_LIBNAME}
ARCHIVE_OUTPUT_NAME ${LUA_BUILD_LIBNAME}
IMPORTED_LOCATION ${LUA_VANILLA_LIB_FILE}
IMPORTED_SONAME ${LUA_VANILLA_DLL_FILE})
# make sure the library we export really does depend on Lua
add_dependencies(${lualib} LUA_VANILLA)
# set externally-visible target indicator
set(LUA_LIBRARIES ${lualib})
PRIVATE /W1)
endif()
if (WIN32)
#target_compile_definitions(${lualib}
# PRIVATE LUA_USE_WINDOWS)
else()
target_compile_definitions(${lualib}
PRIVATE LUA_USE_LINUX)
endif()
target_compile_options(${lualib}
PRIVATE ${LUA_VANILLA_LUALIB_COMPILER_OPTIONS})
add_dependencies(${lualib} LUA_VANILLA)
if (CMAKE_DL_LIBS)
target_link_libraries(${lualib} ${CMAKE_DL_LIBS})
endif()
if (UNIX)
target_link_libraries(${lualib} m)
endif()
# we don't really need this section...
# Lua Interpreter
add_executable(${luainterpreter} ${LUA_VANILLA_LUA_SOURCES})
set_target_properties(${luainterpreter}
PROPERTIES
LANGUAGE C
LINKER_LANGUAGE C
C_STANDARD 99
C_EXTENSIONS TRUE
OUTPUT_NAME lua-${LUA_VANILLA_VERSION})
target_include_directories(${luainterpreter}
PRIVATE ${LUA_VANILLA_SOURCE_DIR})
target_compile_definitions(${luainterpreter}
PUBLIC LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE}
PRIVATE LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE})
if (MSVC)
target_compile_options(${luainterpreter}
PRIVATE /W1)
endif()
if (WIN32)
#target_compile_definitions(${luainterpreter}
# PRIVATE LUA_USE_WINDOWS)
else()
target_compile_definitions(${luainterpreter}
PRIVATE LUA_USE_LINUX)
endif()
target_compile_options(${luainterpreter}
PRIVATE ${LUA_VANILLA_LUA_LUAC_COMPILER_OPTIONS})
target_link_libraries(${luainterpreter} ${lualib})
if (CMAKE_DL_LIBS)
target_link_libraries(${luainterpreter} ${CMAKE_DL_LIBS})
endif()
if (UNIX)
target_link_libraries(${luainterpreter} m readline)
endif()
# LuaC Compiler
add_executable(${luacompiler} ${LUA_VANILLA_LUAC_SOURCES} ${LUA_VANILLA_LIB_SOURCES})
set_target_properties(${luacompiler}
PROPERTIES
LANGUAGE C
LINKER_LANGUAGE C
C_STANDARD 99
C_EXTENSIONS TRUE
OUTPUT_NAME luac-${LUA_VANILLA_VERSION})
target_include_directories(${luacompiler}
PRIVATE ${LUA_VANILLA_SOURCE_DIR})
target_compile_options(${luacompiler}
PRIVATE ${LUA_VANILLA_LUA_LUAC_COMPILER_OPTIONS})
target_compile_definitions(${luacompiler}
PUBLIC LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE}
PRIVATE LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE})
if (MSVC)
target_compile_options(${luacompiler}
PRIVATE /W1)
endif()
if (WIN32)
#target_compile_definitions(${luacompiler}
# PRIVATE LUA_USE_WINDOWS)
else()
target_compile_definitions(${luacompiler}
PRIVATE LUA_USE_LINUX)
endif()
target_link_libraries(${luacompiler} ${lualib})
if (CMAKE_DL_LIBS)
target_link_libraries(${luacompiler} ${CMAKE_DL_LIBS})
endif()
if (UNIX)
# TODO: make readline optional?
target_link_libraries(${luacompiler} m readline)
endif()
# set externally-visible target indicator
set(LUA_LIBRARIES ${lualib})
set(LUA_FOUND TRUE)