From b885be85b3257132ae100395ef9be648d5c083ac Mon Sep 17 00:00:00 2001 From: Ralph Sennhauser Date: Wed, 18 Sep 2024 19:49:16 +0200 Subject: [PATCH] Allow system cxxtest Add option to build-source-libs and premake to uses system provided cxxtest. Closes: #5792 Signed-off-by: Ralph Sennhauser --- build/premake/extern_libs5.lua | 10 ++++++---- build/premake/premake5.lua | 7 ++++++- libraries/build-source-libs.sh | 6 +++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/build/premake/extern_libs5.lua b/build/premake/extern_libs5.lua index ea8241a3c0..a12a792b5a 100644 --- a/build/premake/extern_libs5.lua +++ b/build/premake/extern_libs5.lua @@ -254,10 +254,12 @@ extern_lib_defs = { }, cxxtest = { compile_settings = function() - if externalincludedirs then - externalincludedirs { libraries_source_dir .. "cxxtest-4.4" } - else - sysincludedirs { libraries_source_dir .. "cxxtest-4.4" } + if not _OPTIONS["with-system-cxxtest"] then + if externalincludedirs then + externalincludedirs { libraries_source_dir .. "cxxtest-4.4" } + else + sysincludedirs { libraries_source_dir .. "cxxtest-4.4" } + end end end, }, diff --git a/build/premake/premake5.lua b/build/premake/premake5.lua index ab7ffefd6f..c0f01f1c8e 100644 --- a/build/premake/premake5.lua +++ b/build/premake/premake5.lua @@ -6,6 +6,7 @@ newoption { trigger = "icc", description = "Use Intel C++ Compiler (Linux only; newoption { trigger = "jenkins-tests", description = "Configure CxxTest to use the XmlPrinter runner which produces Jenkins-compatible output" } newoption { trigger = "minimal-flags", description = "Only set compiler/linker flags that are really needed. Has no effect on Windows builds" } newoption { trigger = "outpath", description = "Location for generated project files" } +newoption { trigger = "with-system-cxxtest", description = "Search standard paths for cxxtest, instead of using bundled copy" } newoption { trigger = "with-system-mozjs", description = "Search standard paths for libmozjs91, 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)" } @@ -1399,7 +1400,11 @@ function setup_tests() if os.istarget("windows") then cxxtest.setpath(rootdir.."/build/bin/cxxtestgen.exe") else - cxxtest.setpath(rootdir.."/libraries/source/cxxtest-4.4/bin/cxxtestgen") + if _OPTIONS["with-system-cxxtest"] then + cxxtest.setpath("/usr/bin/cxxtestgen") + else + cxxtest.setpath(rootdir.."/libraries/source/cxxtest-4.4/bin/cxxtestgen") + end end local runner = "ErrorPrinter" diff --git a/libraries/build-source-libs.sh b/libraries/build-source-libs.sh index d735563b36..e01983a607 100755 --- a/libraries/build-source-libs.sh +++ b/libraries/build-source-libs.sh @@ -22,6 +22,7 @@ case "$(realpath .)" in esac without_nvtt=false +with_system_cxxtest=false with_system_nvtt=false with_system_mozjs=false with_spirv_reflect=false @@ -31,6 +32,7 @@ JOBS=${JOBS:="-j2"} for i in "$@"; do case $i in --without-nvtt) without_nvtt=true ;; + --with-system-cxxtest) with_system_cxxtest=true ;; --with-system-nvtt) with_system_nvtt=true ;; --with-system-mozjs) with_system_mozjs=true ;; --with-spirv-reflect) with_spirv_reflect=true ;; @@ -55,7 +57,9 @@ export MAKE JOBS echo "Building third-party dependencies..." echo -./source/cxxtest-4.4/build.sh || die "cxxtest build failed" +if [ "$with_system_cxxtest" = "false" ]; then + ./source/cxxtest-4.4/build.sh || die "cxxtest build failed" +fi echo ./source/fcollada/build.sh || die "FCollada build failed" echo