Skip to content

Commit

Permalink
Don't build Lua submodule with cmake -DENABLE_SYSTEM_LUA=ON ..
Browse files Browse the repository at this point in the history
Building something that isn't used is a waste of time.
  • Loading branch information
pehjota committed Jan 18, 2024
1 parent e661294 commit 24ab945
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,39 +75,49 @@ if(HISTORY_FOUND)
endif()

# get source lists
GetSources("lua" lua_sources)
if(NOT ENABLE_SYSTEM_LUA)
GetSources("lua" lua_sources)
endif()
GetSources("libwesnoth_sdl" wesnoth_sdl_sources)
GetSources("libwesnoth_widgets" wesnoth_widget-sources)
GetSources("libwesnoth" wesnoth_game_sources)
GetSources("libwesnoth_core" wesnoth_core_sources)
GetSources("wesnoth" wesnoth_sources)

# Inject a header into the Lua sources for Wesnoth-specific changes
# makedepend won't see it so we have to specifically add it as a dependency.
file(GLOB wesnoth_lua_config wesnoth_lua_config.h)
set_source_files_properties(${lua_sources} PROPERTIES OBJECT_DEPENDS ${wesnoth_lua_config})
if(NOT ENABLE_SYSTEM_LUA)
# Inject a header into the Lua sources for Wesnoth-specific changes
# makedepend won't see it so we have to specifically add it as a dependency.
file(GLOB wesnoth_lua_config wesnoth_lua_config.h)
set_source_files_properties(${lua_sources} PROPERTIES OBJECT_DEPENDS ${wesnoth_lua_config})
endif()

if(WIN32)
set(wesnoth_core_sources ${wesnoth_core_sources} log_windows.cpp)
set(wesnoth_game_sources ${wesnoth_game_sources} desktop/windows_tray_notification.cpp desktop/windows_battery_info.cpp)
endif()

set_source_files_properties(${lua_sources} PROPERTIES LANGUAGE CXX)
if(NOT ENABLE_SYSTEM_LUA)
set_source_files_properties(${lua_sources} PROPERTIES LANGUAGE CXX)
endif()

# We explicitly want lua compiled as C++ version
if(MSVC)
set_source_files_properties(${lua_sources} PROPERTIES COMPILE_FLAGS "/FI\"${wesnoth_lua_config}\"")
# silence an implicit bitshift conversion warning
set_property(SOURCE SOURCE ${lua_sources} APPEND_STRING PROPERTY COMPILE_FLAGS " /wd4334 /TP")
else()
set_source_files_properties(${lua_sources} PROPERTIES COMPILE_FLAGS "-include \"${wesnoth_lua_config}\" -x c++ -Wno-old-style-cast -Wno-useless-cast -Wno-stringop-overflow")
if(NOT ENABLE_SYSTEM_LUA)
# We explicitly want lua compiled as C++ version
if(MSVC)
set_source_files_properties(${lua_sources} PROPERTIES COMPILE_FLAGS "/FI\"${wesnoth_lua_config}\"")
# silence an implicit bitshift conversion warning
set_property(SOURCE SOURCE ${lua_sources} APPEND_STRING PROPERTY COMPILE_FLAGS " /wd4334 /TP")
else()
set_source_files_properties(${lua_sources} PROPERTIES COMPILE_FLAGS "-include \"${wesnoth_lua_config}\" -x c++ -Wno-old-style-cast -Wno-useless-cast -Wno-stringop-overflow")
endif()
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# silence a Clang specific warning due to extra parenthesis in if statements
set_property(SOURCE SOURCE ${lua_sources} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-parentheses-equality")
# silence a Clang specific warning when compiling the lua code
set_property(SOURCE SOURCE ${lua_sources} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-string-plus-int")
if(NOT ENABLE_SYSTEM_LUA)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# silence a Clang specific warning due to extra parenthesis in if statements
set_property(SOURCE SOURCE ${lua_sources} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-parentheses-equality")
# silence a Clang specific warning when compiling the lua code
set_property(SOURCE SOURCE ${lua_sources} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-string-plus-int")
endif()
endif()

# On apple only
Expand Down

0 comments on commit 24ab945

Please sign in to comment.