Skip to content

feat(Github Action): Add all version in test action #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/build-lua51.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Build mod-eluna with Lua51 🌙

on:
push:
branches:
- 'master'
- 'main'
pull_request:

jobs:
build_lua51:
uses: ./.github/workflows/core-build-base.yml
with:
lua_version: 'lua51'
14 changes: 14 additions & 0 deletions .github/workflows/build-lua53.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Build mod-eluna with Lua53 🌙

on:
push:
branches:
- 'master'
- 'main'
pull_request:

jobs:
build_lua53:
uses: ./.github/workflows/core-build-base.yml
with:
lua_version: 'lua53'
14 changes: 14 additions & 0 deletions .github/workflows/build-lua54.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Build mod-eluna with Lua54 🌙

on:
push:
branches:
- 'master'
- 'main'
pull_request:

jobs:
build_lua54:
uses: ./.github/workflows/core-build-base.yml
with:
lua_version: 'lua54'
19 changes: 16 additions & 3 deletions src/lualib/lua/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -100,17 +106,21 @@ 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()

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}")
Expand All @@ -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()
9 changes: 8 additions & 1 deletion src/lualib/luajit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -129,7 +136,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})
Expand Down
Loading