feat(Github Action): Add all version in test action (#292)
This commit is contained in:
@@ -54,9 +54,15 @@ FetchContent_Declare(
|
||||
)
|
||||
FetchContent_MakeAvailable(${LUA_VERSION})
|
||||
|
||||
# Easen warnings
|
||||
# Easen warnings - disable Werror for Lua sources
|
||||
string(REGEX REPLACE "( |^)/W[0-9]( |$)" "\\1/W2\\2" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REGEX REPLACE "( |^)/W[0-9]( |$)" "\\1/W2\\2" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
# Remove -Werror from flags for Lua compilation
|
||||
string(REGEX REPLACE "-Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REGEX REPLACE "-Werror" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
# Also remove any warning-as-error flags
|
||||
string(REGEX REPLACE "-Wno-error=[^ ]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REGEX REPLACE "-Wno-error=[^ ]*" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
|
||||
set(LUA_SOURCE_FOLDER "${${LUA_VERSION}_SOURCE_DIR}/src")
|
||||
|
||||
@@ -100,10 +106,11 @@ if (WIN32)
|
||||
endif()
|
||||
elseif (APPLE)
|
||||
target_compile_definitions(lualib PUBLIC LUA_USE_MACOSX)
|
||||
target_compile_options(lualib PRIVATE -Wno-deprecated-declarations -Wno-empty-body)
|
||||
target_compile_options(lualib PRIVATE -Wno-deprecated-declarations -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-sign-compare -Wno-string-plus-int)
|
||||
target_link_libraries(lualib readline)
|
||||
elseif (UNIX)
|
||||
target_compile_definitions(lualib PUBLIC LUA_USE_LINUX)
|
||||
target_compile_options(lualib PRIVATE -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-sign-compare -Wno-string-plus-int)
|
||||
target_link_libraries(lualib ${CMAKE_DL_LIBS} m readline)
|
||||
set_target_properties(lualib PROPERTIES OUTPUT_NAME ${LUA_VERSION})
|
||||
endif()
|
||||
@@ -111,6 +118,9 @@ endif()
|
||||
add_executable(lua_interpreter ${LUA_SOURCE_FOLDER}/lua.c)
|
||||
target_link_libraries(lua_interpreter lualib)
|
||||
target_compile_definitions(lua_interpreter PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
if (NOT WIN32)
|
||||
target_compile_options(lua_interpreter PRIVATE -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-sign-compare -Wno-string-plus-int)
|
||||
endif()
|
||||
set_target_properties(lua_interpreter PROPERTIES OUTPUT_NAME ${LUA_VERSION}_interpreter)
|
||||
if (WIN32)
|
||||
install(TARGETS lua_interpreter DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
@@ -122,10 +132,13 @@ endif()
|
||||
add_executable(lua_compiler ${LUA_SOURCE_FOLDER}/luac.c)
|
||||
target_link_libraries(lua_compiler lualib)
|
||||
target_compile_definitions(lua_compiler PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
if (NOT WIN32)
|
||||
target_compile_options(lua_compiler PRIVATE -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-sign-compare -Wno-string-plus-int)
|
||||
endif()
|
||||
set_target_properties(lua_compiler PROPERTIES OUTPUT_NAME ${LUA_VERSION}_compiler)
|
||||
if (WIN32)
|
||||
install(TARGETS lua_compiler DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
install(FILES $<TARGET_PDB_FILE:lua_compiler> DESTINATION "${CMAKE_INSTALL_PREFIX}" OPTIONAL)
|
||||
else()
|
||||
install(TARGETS lua_compiler DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -29,6 +29,13 @@
|
||||
|
||||
project ( lua C )
|
||||
|
||||
# Remove -Werror from flags for LuaJIT compilation
|
||||
string(REGEX REPLACE "-Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REGEX REPLACE "-Werror" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
# Also remove any warning-as-error flags
|
||||
string(REGEX REPLACE "-Wno-error=[^ ]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REGEX REPLACE "-Wno-error=[^ ]*" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
|
||||
# Download source
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
@@ -131,7 +138,7 @@ if (UNIX OR APPLE)
|
||||
add_custom_command(
|
||||
OUTPUT ${LUAJIT_LIB_PATH}
|
||||
# COMMAND $(MAKE) -C ${LUA_BIN_FOLDER} PREFIX=${LUA_INSTALL_PATH}
|
||||
COMMAND $(MAKE) -C ${LUA_BIN_FOLDER} install PREFIX=${LUA_INSTALL_PATH}
|
||||
COMMAND $(MAKE) -C ${LUA_BIN_FOLDER} install PREFIX=${LUA_INSTALL_PATH} "CFLAGS=-O2 -fomit-frame-pointer -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-sign-compare -Wno-string-plus-int"
|
||||
)
|
||||
# endif()
|
||||
add_custom_target(luajit_target DEPENDS ${LUAJIT_LIB_PATH})
|
||||
|
||||
Reference in New Issue
Block a user