diff options
| author | Arthur LAURENT <[email protected]> | 2025-05-21 01:37:17 +0200 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2025-05-21 04:53:30 +0200 |
| commit | 8b4e9f90ba045edb14cb2800c506ee6bc5118cd7 (patch) | |
| tree | ffa4bc5edf9e19d953689fde3cc811382397e786 /tests/projects/c++/modules/cmake | |
| parent | bfc0f75db8c238187aa011f522adf9685e023b31 (diff) | |
(C++ modules support) refactor tests
Diffstat (limited to 'tests/projects/c++/modules/cmake')
| -rw-r--r-- | tests/projects/c++/modules/cmake/src/hello.mpp | 11 | ||||
| -rw-r--r-- | tests/projects/c++/modules/cmake/src/hello_impl.cpp | 14 | ||||
| -rw-r--r-- | tests/projects/c++/modules/cmake/src/main.cpp | 7 | ||||
| -rw-r--r-- | tests/projects/c++/modules/cmake/test.lua | 60 | ||||
| -rw-r--r-- | tests/projects/c++/modules/cmake/xmake.lua | 8 |
5 files changed, 0 insertions, 100 deletions
diff --git a/tests/projects/c++/modules/cmake/src/hello.mpp b/tests/projects/c++/modules/cmake/src/hello.mpp deleted file mode 100644 index 268964aa3..000000000 --- a/tests/projects/c++/modules/cmake/src/hello.mpp +++ /dev/null @@ -1,11 +0,0 @@ -export module hello; - -export namespace hello { - class say { - public: - say(int data); - void hello(); - private: - int data_; - }; -} diff --git a/tests/projects/c++/modules/cmake/src/hello_impl.cpp b/tests/projects/c++/modules/cmake/src/hello_impl.cpp deleted file mode 100644 index 5dd555a7a..000000000 --- a/tests/projects/c++/modules/cmake/src/hello_impl.cpp +++ /dev/null @@ -1,14 +0,0 @@ -module; -#include <iostream> - -module hello; - -using namespace std; -namespace hello { - say::say(int data) : data_(data) { - - } - void say::hello() { - cout << "hello, say class: " << data_ << endl; - } -} diff --git a/tests/projects/c++/modules/cmake/src/main.cpp b/tests/projects/c++/modules/cmake/src/main.cpp deleted file mode 100644 index b96807bda..000000000 --- a/tests/projects/c++/modules/cmake/src/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -import hello; - -int main() { - hello::say s(sizeof(hello::say)); - s.hello(); - return 0; -} diff --git a/tests/projects/c++/modules/cmake/test.lua b/tests/projects/c++/modules/cmake/test.lua deleted file mode 100644 index 2b246c9a6..000000000 --- a/tests/projects/c++/modules/cmake/test.lua +++ /dev/null @@ -1,60 +0,0 @@ -import("lib.detect.find_tool") -import("core.base.semver") -import("core.tool.toolchain") -import("utils.ci.is_running", {alias = "ci_is_running"}) - -function _gen_cmakelist() - if not os.isfile("CMakeLists.txt") then - os.vrunv("xmake project -k cmake") - end -end - -function _build(name, opt) - opt = opt or {} - local build_args = {} - if ci_is_running() then - table.insert(build_args, "-vD") - end - os.rm(".xmake", "build") - os.mv("xmake.lua", "xmake.lua_") - os.vrunv("xmake", table.join({"f", "--trybuild=cmake", "--toolchain=" .. name}, build_args), {shell = true, envs = opt.envs}) - os.vrunv("xmake", table.join({"b"}, build_args), {shell = true, envs = opt.envs}) - os.mv("xmake.lua_", "xmake.lua") -end - -function _build_with(name, minver) - if name == "msvc" then - local _toolchain = toolchain.load(name, {plat = os.host(), arch = os.arch()}) - if _toolchain and _toolchain:check() then - local vcvars = _toolchain:config("vcvars") - if vcvars and vcvars.VCToolsVersion and semver.compare(vcvars.VCToolsVersion, minver) >= 0 then - _build(name, {envs = vcvars}) - end - end - else - local tool = find_tool(name, {version = true}) - if tool and tool.version and semver.compare(tool.version, minver) >= 0 then - local _toolchain = toolchain.load(name, {plat = os.host(), arch = os.arch()}) - if _toolchain and _toolchain:check() then - _build(name) - end - end - end -end - -function main(t) - os.setenv("CMAKE_GENERATOR", "Ninja") - - local cmake = find_tool("cmake", {version = true}) - local ninja = find_tool("ninja") - if ninja and cmake and cmake.version and semver.compare(cmake.version, "3.28") >= 0 then - _gen_cmakelist() - if is_subhost("windows") then - _build_with("clang", "19") - _build_with("msvc", "14.35") - elseif is_subhost("linux") then - _build_with("gcc", "14") - _build_with("clang", "19") - end - end -end diff --git a/tests/projects/c++/modules/cmake/xmake.lua b/tests/projects/c++/modules/cmake/xmake.lua deleted file mode 100644 index 42da78369..000000000 --- a/tests/projects/c++/modules/cmake/xmake.lua +++ /dev/null @@ -1,8 +0,0 @@ -add_rules("mode.release", "mode.debug") -set_languages("c++20") - -target("class") - set_kind("binary") - add_files("src/*.cpp", "src/*.mpp") - - |
