summaryrefslogtreecommitdiff
path: root/tests/test_cases/deps/object
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_cases/deps/object')
-rw-r--r--tests/test_cases/deps/object/TARGETS43
-rw-r--r--tests/test_cases/deps/object/bar.cpp3
-rw-r--r--tests/test_cases/deps/object/bar.hpp9
-rw-r--r--tests/test_cases/deps/object/foo.cpp3
-rw-r--r--tests/test_cases/deps/object/foo.hpp8
-rw-r--r--tests/test_cases/deps/object/main.cpp8
6 files changed, 74 insertions, 0 deletions
diff --git a/tests/test_cases/deps/object/TARGETS b/tests/test_cases/deps/object/TARGETS
new file mode 100644
index 0000000..98d7bdb
--- /dev/null
+++ b/tests/test_cases/deps/object/TARGETS
@@ -0,0 +1,43 @@
+{ "foo":
+ { "type": ["@", "rules", "CC", "library"]
+ , "name": ["foo"]
+ , "shared": ["yes"]
+ , "hdrs": ["foo.hpp"]
+ , "srcs": ["foo.cpp"]
+ , "deps": ["bar"]
+ , "stage": ["foo"]
+ }
+, "bar":
+ { "type": ["@", "rules", "CC", "library"]
+ , "object_only": ["yes"]
+ , "hdrs": ["bar.hpp"]
+ , "srcs": ["bar.cpp"]
+ , "stage": ["bar"]
+ }
+, "baz":
+ { "type": ["@", "rules", "CC", "library"]
+ , "name": ["baz"]
+ , "shared": ["yes"]
+ , "deps": ["bar"]
+ , "stage": ["baz"]
+ }
+, "main":
+ { "type": ["@", "rules", "CC", "binary"]
+ , "name": ["main"]
+ , "srcs": ["main.cpp"]
+ , "private-deps": ["foo"]
+ }
+, "test_main":
+ { "type": ["@", "rules", "shell/test", "script"]
+ , "name": ["test_main"]
+ , "test": ["test_main.sh"]
+ , "deps": ["main"]
+ }
+, "test_main.sh":
+ { "type": "file_gen"
+ , "name": "test.sh"
+ , "data": "set -e\n[ \"$(./main)\" = \"Hello World and Galaxy\" ]"
+ }
+, "install_main":
+ {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["main"]}
+}
diff --git a/tests/test_cases/deps/object/bar.cpp b/tests/test_cases/deps/object/bar.cpp
new file mode 100644
index 0000000..5d7c616
--- /dev/null
+++ b/tests/test_cases/deps/object/bar.cpp
@@ -0,0 +1,3 @@
+#include <string>
+
+std::string bar() { return "and Galaxy"; }
diff --git a/tests/test_cases/deps/object/bar.hpp b/tests/test_cases/deps/object/bar.hpp
new file mode 100644
index 0000000..9c97d54
--- /dev/null
+++ b/tests/test_cases/deps/object/bar.hpp
@@ -0,0 +1,9 @@
+#ifndef BAR_HPP
+#define BAR_HPP
+
+#include <string>
+
+// use this object lib to extend the public symbols of shared lib 'foo' by 'bar'
+std::string bar();
+
+#endif
diff --git a/tests/test_cases/deps/object/foo.cpp b/tests/test_cases/deps/object/foo.cpp
new file mode 100644
index 0000000..9687a6a
--- /dev/null
+++ b/tests/test_cases/deps/object/foo.cpp
@@ -0,0 +1,3 @@
+#include "foo.hpp"
+
+std::string foo() { return "Hello World"; }
diff --git a/tests/test_cases/deps/object/foo.hpp b/tests/test_cases/deps/object/foo.hpp
new file mode 100644
index 0000000..d880c27
--- /dev/null
+++ b/tests/test_cases/deps/object/foo.hpp
@@ -0,0 +1,8 @@
+#ifndef FOO_HPP
+#define FOO_HPP
+
+#include <string>
+
+std::string foo();
+
+#endif
diff --git a/tests/test_cases/deps/object/main.cpp b/tests/test_cases/deps/object/main.cpp
new file mode 100644
index 0000000..cfc2a4f
--- /dev/null
+++ b/tests/test_cases/deps/object/main.cpp
@@ -0,0 +1,8 @@
+#include "bar/bar.hpp"
+#include "foo/foo.hpp"
+#include <iostream>
+
+int main(int argc, char const *argv[]) {
+ std::cout << foo() << " " << bar() << std::endl;
+ return 0;
+}