diff --git a/.github/workflows/build-lua51.yml b/.github/workflows/build-lua51.yml new file mode 100644 index 0000000000..96997b5575 --- /dev/null +++ b/.github/workflows/build-lua51.yml @@ -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' diff --git a/.github/workflows/build-lua53.yml b/.github/workflows/build-lua53.yml new file mode 100644 index 0000000000..a3fe63e1a1 --- /dev/null +++ b/.github/workflows/build-lua53.yml @@ -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' diff --git a/.github/workflows/build-lua54.yml b/.github/workflows/build-lua54.yml new file mode 100644 index 0000000000..7aa8c87161 --- /dev/null +++ b/.github/workflows/build-lua54.yml @@ -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' diff --git a/src/lualib/lua/CMakeLists.txt b/src/lualib/lua/CMakeLists.txt index 4d8aa141d8..3f36675640 100644 --- a/src/lualib/lua/CMakeLists.txt +++ b/src/lualib/lua/CMakeLists.txt @@ -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 $ DESTINATION "${CMAKE_INSTALL_PREFIX}" OPTIONAL) else() install(TARGETS lua_compiler DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") -endif() \ No newline at end of file +endif() diff --git a/src/lualib/luajit/CMakeLists.txt b/src/lualib/luajit/CMakeLists.txt index f0b184ed7b..0f9d5f3b2e 100644 --- a/src/lualib/luajit/CMakeLists.txt +++ b/src/lualib/luajit/CMakeLists.txt @@ -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( @@ -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})