1
0
forked from mirrors/0ad

Check for WX in premake and rename atlas option

The option --atlas is oddly different than any other feature flag,
change it to be in line with the others and enable it by default. The
new option is --without-atlas.

As the WX binaries aren't precompiled for Windows automagically disable
atlas there for users running the batchfile through filemanger if WX is
missing.

On *nix not providing a valid wx-config whith enabled atlas is
considered an error.

Fixes: #6401
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser
2024-12-14 08:00:14 +01:00
parent c09d12a959
commit 949d5f8c0b
5 changed files with 31 additions and 29 deletions
@@ -68,7 +68,7 @@ pipeline {
bat "cd libraries && get-windows-libs.bat" bat "cd libraries && get-windows-libs.bat"
bat "(robocopy E:\\wxWidgets-3.2.6\\lib libraries\\win32\\wxwidgets\\lib /MIR /NDL /NJH /NJS /NP /NS /NC) ^& IF %ERRORLEVEL% LEQ 1 exit 0" bat "(robocopy E:\\wxWidgets-3.2.6\\lib libraries\\win32\\wxwidgets\\lib /MIR /NDL /NJH /NJS /NP /NS /NC) ^& IF %ERRORLEVEL% LEQ 1 exit 0"
bat "(robocopy E:\\wxWidgets-3.2.6\\include libraries\\win32\\wxwidgets\\include /MIR /NDL /NJH /NJS /NP /NS /NC) ^& IF %ERRORLEVEL% LEQ 1 exit 0" bat "(robocopy E:\\wxWidgets-3.2.6\\include libraries\\win32\\wxwidgets\\include /MIR /NDL /NJH /NJS /NP /NS /NC) ^& IF %ERRORLEVEL% LEQ 1 exit 0"
bat "cd build\\workspaces && update-workspaces.bat --atlas --without-pch --without-tests" bat "cd build\\workspaces && update-workspaces.bat --without-pch --without-tests"
} }
} }
+1 -1
View File
@@ -46,7 +46,7 @@ pipeline {
bat "cd libraries && get-windows-libs.bat" bat "cd libraries && get-windows-libs.bat"
bat "(robocopy /MIR /NDL /NJH /NJS /NP /NS /NC E:\\wxWidgets-3.2.6\\lib libraries\\win32\\wxwidgets\\lib) ^& IF %ERRORLEVEL% LEQ 1 exit 0" bat "(robocopy /MIR /NDL /NJH /NJS /NP /NS /NC E:\\wxWidgets-3.2.6\\lib libraries\\win32\\wxwidgets\\lib) ^& IF %ERRORLEVEL% LEQ 1 exit 0"
bat "(robocopy /MIR /NDL /NJH /NJS /NP /NS /NC E:\\wxWidgets-3.2.6\\include libraries\\win32\\wxwidgets\\include) ^& IF %ERRORLEVEL% LEQ 1 exit 0" bat "(robocopy /MIR /NDL /NJH /NJS /NP /NS /NC E:\\wxWidgets-3.2.6\\include libraries\\win32\\wxwidgets\\include) ^& IF %ERRORLEVEL% LEQ 1 exit 0"
bat "cd build\\workspaces && update-workspaces.bat --atlas --jenkins-tests" bat "cd build\\workspaces && update-workspaces.bat --jenkins-tests"
script { script {
if (params.CLEANBUILD) { if (params.CLEANBUILD) {
+13 -4
View File
@@ -59,6 +59,17 @@ local function add_third_party_include_paths(extern_lib)
end end
end end
local function wx_config_path()
local wx_config = os.getenv("WX_CONFIG") or "wx-config"
local _, error_code = os.outputof("command -v " .. wx_config)
if error_code ~= 0 then
print("WX_CONFIG must be set and valid or wx-config must be present when atlas is enabled")
print("current value: " .. wx_config)
os.exit(1)
end
return wx_config
end
pkgconfig = require "pkgconfig" pkgconfig = require "pkgconfig"
-- Configure pkgconfig for MacOSX systems -- Configure pkgconfig for MacOSX systems
@@ -727,16 +738,14 @@ extern_lib_defs = {
else else
-- wxwidgets does not come with a definition file for pkg-config, -- wxwidgets does not come with a definition file for pkg-config,
-- so we have to use wxwidgets' own config tool -- so we have to use wxwidgets' own config tool
wx_config_path = os.getenv("WX_CONFIG") or "wx-config" pkgconfig.add_includes(nil, wx_config_path(), "--unicode=yes --cxxflags")
pkgconfig.add_includes(nil, wx_config_path, "--unicode=yes --cxxflags")
end end
end, end,
link_settings = function() link_settings = function()
if os.istarget("windows") then if os.istarget("windows") then
libdirs { libraries_dir.."wxwidgets/lib/vc_lib" } libdirs { libraries_dir.."wxwidgets/lib/vc_lib" }
else else
wx_config_path = os.getenv("WX_CONFIG") or "wx-config" pkgconfig.add_links(nil, wx_config_path(), "--unicode=yes --libs std,gl")
pkgconfig.add_links(nil, wx_config_path, "--unicode=yes --libs std,gl")
end end
end, end,
}, },
+13 -4
View File
@@ -1,5 +1,4 @@
newoption { trigger = "android", description = "Use non-working Android cross-compiling mode" } newoption { trigger = "android", description = "Use non-working Android cross-compiling mode" }
newoption { trigger = "atlas", description = "Include Atlas scenario editor projects" }
newoption { trigger = "coverage", description = "Enable code coverage data collection (GCC only)" } newoption { trigger = "coverage", description = "Enable code coverage data collection (GCC only)" }
newoption { trigger = "gles", description = "Use non-working OpenGL ES 2.0 mode" } newoption { trigger = "gles", description = "Use non-working OpenGL ES 2.0 mode" }
newoption { trigger = "icc", description = "Use Intel C++ Compiler (Linux only; should use either \"--cc icc\" or --without-pch too, and then set CXX=icpc before calling make)" } newoption { trigger = "icc", description = "Use Intel C++ Compiler (Linux only; should use either \"--cc icc\" or --without-pch too, and then set CXX=icpc before calling make)" }
@@ -12,6 +11,7 @@ newoption { trigger = "with-system-mozjs", description = "Search standard paths
newoption { trigger = "with-system-nvtt", description = "Search standard paths for nvidia-texture-tools library, instead of using bundled copy" } newoption { trigger = "with-system-nvtt", description = "Search standard paths for nvidia-texture-tools library, instead of using bundled copy" }
newoption { trigger = "with-valgrind", description = "Enable Valgrind support (non-Windows only)" } newoption { trigger = "with-valgrind", description = "Enable Valgrind support (non-Windows only)" }
newoption { trigger = "without-audio", description = "Disable use of OpenAL/Ogg/Vorbis APIs" } newoption { trigger = "without-audio", description = "Disable use of OpenAL/Ogg/Vorbis APIs" }
newoption { trigger = "without-atlas", description = "Disable Atlas scenario/map editor and ActorEditor" }
newoption { trigger = "without-lobby", description = "Disable the use of gloox and the multiplayer lobby" } newoption { trigger = "without-lobby", description = "Disable the use of gloox and the multiplayer lobby" }
newoption { trigger = "without-miniupnpc", description = "Disable use of miniupnpc for port forwarding" } newoption { trigger = "without-miniupnpc", description = "Disable use of miniupnpc for port forwarding" }
newoption { trigger = "without-nvtt", description = "Disable use of NVTT" } newoption { trigger = "without-nvtt", description = "Disable use of NVTT" }
@@ -33,6 +33,15 @@ if _ACTION == "gmake" then
os.exit(1) os.exit(1)
end end
-- On Windows check if wxWidgets is available, if not disable atlas and emit warning.
-- This is because there are currently not prebuilt binaries provided.
if not _OPTIONS["without-atlas"] and os.istarget("windows") then
if not os.isfile("../../libraries/win32/wxwidgets/include/wx/wx.h") then
print("wxWidgets not found, disableing atlas")
_OPTIONS["without-atlas"] = ""
end
end
-- Root directory of project checkout relative to this .lua file -- Root directory of project checkout relative to this .lua file
rootdir = "../.." rootdir = "../.."
@@ -1439,7 +1448,7 @@ function setup_tests()
-- Don't include sysdep tests on the wrong sys -- Don't include sysdep tests on the wrong sys
-- Don't include Atlas tests unless Atlas is being built -- Don't include Atlas tests unless Atlas is being built
if not (string.find(v, "/sysdep/os/win/") and not os.istarget("windows")) and if not (string.find(v, "/sysdep/os/win/") and not os.istarget("windows")) and
not (string.find(v, "/tools/atlas/") and not _OPTIONS["atlas"]) and not (string.find(v, "/tools/atlas/") and _OPTIONS["without-atlas"]) and
not (string.find(v, "/sysdep/arch/x86_x64/") and ((arch ~= "amd64") or (arch ~= "x86"))) not (string.find(v, "/sysdep/arch/x86_x64/") and ((arch ~= "amd64") or (arch ~= "x86")))
then then
table.insert(test_files, v) table.insert(test_files, v)
@@ -1460,7 +1469,7 @@ function setup_tests()
filter { } filter { }
links { "mocks_test" } links { "mocks_test" }
if _OPTIONS["atlas"] then if not _OPTIONS["without-atlas"] then
links { "AtlasObject" } links { "AtlasObject" }
end end
extra_params = { extra_params = {
@@ -1554,7 +1563,7 @@ project("pyrogenesis") -- Set the main project active
links { static_lib_names_release } links { static_lib_names_release }
filter { } filter { }
if _OPTIONS["atlas"] then if not _OPTIONS["without-atlas"] then
setup_atlas_projects() setup_atlas_projects()
setup_atlas_frontends() setup_atlas_frontends()
end end
+3 -19
View File
@@ -20,36 +20,20 @@ cd "$(dirname "$0")" || die
premake_args="" premake_args=""
with_system_premake5=false with_system_premake5=false
enable_atlas=true
for i in "$@"; do for i in "$@"; do
case $i in case $i in
--with-system-premake5) with_system_premake5=true ;; --with-system-premake5) with_system_premake5=true ;;
--enable-atlas) enable_atlas=true ;;
--disable-atlas) enable_atlas=false ;;
# Assume any other --options are for Premake # Assume any other --options are for Premake
--*) premake_args="${premake_args} $i" ;; --*) premake_args="${premake_args} $i" ;;
esac esac
done done
if [ "$enable_atlas" = "true" ]; then
premake_args="${premake_args} --atlas"
if [ "$OS" = "Darwin" ]; then
# Provide path to wx-config on OS X (as wxwidgets doesn't support pkgconfig)
export WX_CONFIG="${WX_CONFIG:="$(pwd)/../../libraries/macos/wxwidgets/bin/wx-config"}"
else
export WX_CONFIG="${WX_CONFIG:="wx-config"}"
fi
if [ ! -x "$(command -v "$WX_CONFIG")" ]; then
echo 'WX_CONFIG must be set and valid or wx-config must be present when --atlas is passed as argument.'
exit 1
fi
fi
if [ "$OS" = "Darwin" ]; then if [ "$OS" = "Darwin" ]; then
# Set minimal SDK version # Set minimal SDK version
export MIN_OSX_VERSION="${MIN_OSX_VERSION:="10.12"}" : "${MIN_OSX_VERSION:=10.12}"
: "${WX_CONFIG:=$(realpath ../../libraries/macos/wxwidgets/bin/wx-config)}"
export MIN_OSX_VERSION WX_CONFIG
fi fi
# Now build Premake or use system's. # Now build Premake or use system's.