diff options
| author | ruki <[email protected]> | 2021-10-18 21:03:03 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-10-18 21:03:03 +0800 |
| commit | 0f72e5b597abf1f3caff40cc1e9b15f68212ad0e (patch) | |
| tree | 616b20f34a515e45bcf5d14fad7b903006489454 /tests/projects/c++ | |
| parent | 2c018854833aa388bb16580f7d61646e90ce4bda (diff) | |
| parent | 7e6fba5fe7662b4e58ce150aeab17c70b6b12254 (diff) | |
Merge pull request #1749 from xmake-io/unit_build
Support Unity build
Diffstat (limited to 'tests/projects/c++')
| -rw-r--r-- | tests/projects/c++/unity_build/src/bar/test4.cpp | 12 | ||||
| -rw-r--r-- | tests/projects/c++/unity_build/src/bar/test5.cpp | 13 | ||||
| -rw-r--r-- | tests/projects/c++/unity_build/src/bar/test6.cpp | 8 | ||||
| -rw-r--r-- | tests/projects/c++/unity_build/src/foo/test.cpp | 8 | ||||
| -rw-r--r-- | tests/projects/c++/unity_build/src/foo/test2.cpp | 8 | ||||
| -rw-r--r-- | tests/projects/c++/unity_build/src/header.h | 27 | ||||
| -rw-r--r-- | tests/projects/c++/unity_build/src/header2.h | 0 | ||||
| -rw-r--r-- | tests/projects/c++/unity_build/src/main.cpp | 8 | ||||
| -rw-r--r-- | tests/projects/c++/unity_build/src/test.c | 4 | ||||
| -rw-r--r-- | tests/projects/c++/unity_build/src/test7.cpp | 8 | ||||
| -rw-r--r-- | tests/projects/c++/unity_build/src/test8.cpp | 8 | ||||
| -rw-r--r-- | tests/projects/c++/unity_build/test.lua | 6 | ||||
| -rw-r--r-- | tests/projects/c++/unity_build/xmake.lua | 9 |
13 files changed, 119 insertions, 0 deletions
diff --git a/tests/projects/c++/unity_build/src/bar/test4.cpp b/tests/projects/c++/unity_build/src/bar/test4.cpp new file mode 100644 index 000000000..8fe732964 --- /dev/null +++ b/tests/projects/c++/unity_build/src/bar/test4.cpp @@ -0,0 +1,12 @@ + +// main.cpp +#include "header.h" + +namespace MY_UNITY_ID { + int i = 42; +} + +int test4() +{ + return MY_UNITY_ID::i; +} diff --git a/tests/projects/c++/unity_build/src/bar/test5.cpp b/tests/projects/c++/unity_build/src/bar/test5.cpp new file mode 100644 index 000000000..afff0b46c --- /dev/null +++ b/tests/projects/c++/unity_build/src/bar/test5.cpp @@ -0,0 +1,13 @@ + +// main.cpp +#include "header.h" + +namespace MY_UNITY_ID { + int i = 42; +} + +int test5() +{ + return MY_UNITY_ID::i; +} + diff --git a/tests/projects/c++/unity_build/src/bar/test6.cpp b/tests/projects/c++/unity_build/src/bar/test6.cpp new file mode 100644 index 000000000..efbd7c6c1 --- /dev/null +++ b/tests/projects/c++/unity_build/src/bar/test6.cpp @@ -0,0 +1,8 @@ + +// main.cpp +#include "header.h" + +int test6() +{ + return 0; +} diff --git a/tests/projects/c++/unity_build/src/foo/test.cpp b/tests/projects/c++/unity_build/src/foo/test.cpp new file mode 100644 index 000000000..e9d6c83d9 --- /dev/null +++ b/tests/projects/c++/unity_build/src/foo/test.cpp @@ -0,0 +1,8 @@ + +// main.cpp +#include "header.h" + +int test() +{ + return 0; +} diff --git a/tests/projects/c++/unity_build/src/foo/test2.cpp b/tests/projects/c++/unity_build/src/foo/test2.cpp new file mode 100644 index 000000000..596359cd2 --- /dev/null +++ b/tests/projects/c++/unity_build/src/foo/test2.cpp @@ -0,0 +1,8 @@ + +// main.cpp +#include "header.h" + +int test2() +{ + return 0; +} diff --git a/tests/projects/c++/unity_build/src/header.h b/tests/projects/c++/unity_build/src/header.h new file mode 100644 index 000000000..affda55ca --- /dev/null +++ b/tests/projects/c++/unity_build/src/header.h @@ -0,0 +1,27 @@ +// header.h +#ifndef HEADER_H +#define HEADER_H + +#include <algorithm> +#include <deque> +#include <iostream> +#include <map> +#include <memory> +#include <set> +//#include <thread> +#include <utility> +#include <vector> +#include <string> +#include <queue> +#include <cstdlib> +#include <utility> +#include <exception> +#include <list> +#include <stack> +#include <complex> +#include <fstream> +#include <cstdio> +#include <iomanip> + +#endif + diff --git a/tests/projects/c++/unity_build/src/header2.h b/tests/projects/c++/unity_build/src/header2.h new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/projects/c++/unity_build/src/header2.h diff --git a/tests/projects/c++/unity_build/src/main.cpp b/tests/projects/c++/unity_build/src/main.cpp new file mode 100644 index 000000000..27d41ee50 --- /dev/null +++ b/tests/projects/c++/unity_build/src/main.cpp @@ -0,0 +1,8 @@ +#include "header.h" + +int main(int argc, char** argv) +{ + std::string s("xmake"); + printf("hello %s!\n", s.c_str()); + return 0; +} diff --git a/tests/projects/c++/unity_build/src/test.c b/tests/projects/c++/unity_build/src/test.c new file mode 100644 index 000000000..7f0aa2bf4 --- /dev/null +++ b/tests/projects/c++/unity_build/src/test.c @@ -0,0 +1,4 @@ + +void test_c(void) +{ +} diff --git a/tests/projects/c++/unity_build/src/test7.cpp b/tests/projects/c++/unity_build/src/test7.cpp new file mode 100644 index 000000000..24aeff619 --- /dev/null +++ b/tests/projects/c++/unity_build/src/test7.cpp @@ -0,0 +1,8 @@ + +// main.cpp +#include "header.h" + +int test7() +{ + return 0; +} diff --git a/tests/projects/c++/unity_build/src/test8.cpp b/tests/projects/c++/unity_build/src/test8.cpp new file mode 100644 index 000000000..6ad5680a6 --- /dev/null +++ b/tests/projects/c++/unity_build/src/test8.cpp @@ -0,0 +1,8 @@ + +// main.cpp +#include "header.h" + +int test8() +{ + return 0; +} diff --git a/tests/projects/c++/unity_build/test.lua b/tests/projects/c++/unity_build/test.lua new file mode 100644 index 000000000..b76241be2 --- /dev/null +++ b/tests/projects/c++/unity_build/test.lua @@ -0,0 +1,6 @@ +-- main entry +function main(t) + + -- build project + t:build() +end diff --git a/tests/projects/c++/unity_build/xmake.lua b/tests/projects/c++/unity_build/xmake.lua new file mode 100644 index 000000000..a881c5c36 --- /dev/null +++ b/tests/projects/c++/unity_build/xmake.lua @@ -0,0 +1,9 @@ +target("test") + set_kind("binary") + add_includedirs("src") + add_rules("c++.unity_build", {batchsize = 2, uniqueid = "MY_UNITY_ID"}) + add_files("src/*.c", "src/*.cpp") + add_files("src/foo/*.cpp", {unity_group = "foo"}) + add_files("src/bar/*.cpp", {unity_group = "bar"}) + + |
