diff options
| author | Arthur LAURENT <[email protected]> | 2024-07-24 02:29:57 +0200 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2024-07-24 02:29:57 +0200 |
| commit | d7e9d430ccc5de6162f9f361983d1f50a16a179b (patch) | |
| tree | d2f309b91c0b98d0f8171fcb10b01f9c6e0050d0 /tests/projects/c++/modules/culling/test.lua | |
| parent | e2fb5383a099652e2ac29b139a60e3d723d66113 (diff) | |
improve module culling tests
Diffstat (limited to 'tests/projects/c++/modules/culling/test.lua')
| -rw-r--r-- | tests/projects/c++/modules/culling/test.lua | 70 |
1 files changed, 69 insertions, 1 deletions
diff --git a/tests/projects/c++/modules/culling/test.lua b/tests/projects/c++/modules/culling/test.lua index 7717f8049..91c19553c 100644 --- a/tests/projects/c++/modules/culling/test.lua +++ b/tests/projects/c++/modules/culling/test.lua @@ -1 +1,69 @@ -inherit(".test_base") +import("lib.detect.find_tool") +import("core.base.semver") +import("utils.ci.is_running", {alias = "ci_is_running"}) + +function _build() + local outdata + if ci_is_running() then + outdata = os.iorun("xmake -rvD") + else + outdata = os.iorun("xmake -r") + end + if outdata then + if outdata:find("culled") then + raise("Modules culling does not work\n%s", outdata) + end + end +end + +function can_build() + if is_subhost("windows") then + return true + elseif is_subhost("msys") then + return true + elseif is_host("linux") then + local gcc = find_tool("gcc", {version = true}) + if gcc and gcc.version and semver.compare(gcc.version, "11.0") >= 0 then + return true + end + local clang = find_tool("clang", {version = true}) + if clang and clang.version and semver.compare(clang.version, "14.0") >= 0 then + return true + end + end +end + +function main(t) + if is_subhost("windows") then + local clang = find_tool("clang", {version = true}) + if clang and clang.version and semver.compare(clang.version, "17.0") >= 0 then + os.exec("xmake f --toolchain=clang -c --yes") + _build() + os.exec("xmake clean -a") + os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes") + _build() + end + + os.exec("xmake clean -a") + os.exec("xmake f -c --yes") + _build() + elseif is_subhost("msys") then + os.exec("xmake f -c -p mingw --yes") + _build() + elseif is_host("linux") then + local gcc = find_tool("gcc", {version = true}) + if gcc and gcc.version and semver.compare(gcc.version, "11.0") >= 0 then + os.exec("xmake f -c --yes") + _build() + end + local clang = find_tool("clang", {version = true}) + if clang and clang.version and semver.compare(clang.version, "14.0") >= 0 then + os.exec("xmake clean -a") + os.exec("xmake f --toolchain=clang -c --yes") + _build() + os.exec("xmake clean -a") + os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes") + _build() + end + end +end |
