summaryrefslogtreecommitdiff
path: root/xmake/templates/c++/module/binary
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/templates/c++/module/binary')
-rw-r--r--xmake/templates/c++/module/binary/.gitignore8
-rw-r--r--xmake/templates/c++/module/binary/modules/binary/bar/.gitignore8
-rw-r--r--xmake/templates/c++/module/binary/modules/binary/bar/src/add.cpp9
-rw-r--r--xmake/templates/c++/module/binary/modules/binary/bar/src/sub.cpp9
-rw-r--r--xmake/templates/c++/module/binary/modules/binary/bar/xmake.lua10
-rw-r--r--xmake/templates/c++/module/binary/src/main.cpp6
-rw-r--r--xmake/templates/c++/module/binary/xmake.lua15
7 files changed, 65 insertions, 0 deletions
diff --git a/xmake/templates/c++/module/binary/.gitignore b/xmake/templates/c++/module/binary/.gitignore
new file mode 100644
index 000000000..152105761
--- /dev/null
+++ b/xmake/templates/c++/module/binary/.gitignore
@@ -0,0 +1,8 @@
+# Xmake cache
+.xmake/
+build/
+
+# MacOS Cache
+.DS_Store
+
+
diff --git a/xmake/templates/c++/module/binary/modules/binary/bar/.gitignore b/xmake/templates/c++/module/binary/modules/binary/bar/.gitignore
new file mode 100644
index 000000000..152105761
--- /dev/null
+++ b/xmake/templates/c++/module/binary/modules/binary/bar/.gitignore
@@ -0,0 +1,8 @@
+# Xmake cache
+.xmake/
+build/
+
+# MacOS Cache
+.DS_Store
+
+
diff --git a/xmake/templates/c++/module/binary/modules/binary/bar/src/add.cpp b/xmake/templates/c++/module/binary/modules/binary/bar/src/add.cpp
new file mode 100644
index 000000000..93fdf0ad8
--- /dev/null
+++ b/xmake/templates/c++/module/binary/modules/binary/bar/src/add.cpp
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv) {
+ int a = atoi(argv[1]);
+ int b = atoi(argv[2]);
+ printf("%d", a + b);
+ return 0;
+}
diff --git a/xmake/templates/c++/module/binary/modules/binary/bar/src/sub.cpp b/xmake/templates/c++/module/binary/modules/binary/bar/src/sub.cpp
new file mode 100644
index 000000000..ae7b6d1f2
--- /dev/null
+++ b/xmake/templates/c++/module/binary/modules/binary/bar/src/sub.cpp
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv) {
+ int a = atoi(argv[1]);
+ int b = atoi(argv[2]);
+ printf("%d", a - b);
+ return 0;
+}
diff --git a/xmake/templates/c++/module/binary/modules/binary/bar/xmake.lua b/xmake/templates/c++/module/binary/modules/binary/bar/xmake.lua
new file mode 100644
index 000000000..add3c6e97
--- /dev/null
+++ b/xmake/templates/c++/module/binary/modules/binary/bar/xmake.lua
@@ -0,0 +1,10 @@
+add_rules("mode.debug", "mode.release")
+
+target("add")
+ add_rules("module.binary")
+ add_files("src/add.cpp")
+
+target("sub")
+ add_rules("module.binary")
+ add_files("src/sub.cpp")
+
diff --git a/xmake/templates/c++/module/binary/src/main.cpp b/xmake/templates/c++/module/binary/src/main.cpp
new file mode 100644
index 000000000..9b6abffea
--- /dev/null
+++ b/xmake/templates/c++/module/binary/src/main.cpp
@@ -0,0 +1,6 @@
+#include <iostream>
+
+int main(int argc, char **argv) {
+ std::cout << "hello world!" << std::endl;
+ return 0;
+}
diff --git a/xmake/templates/c++/module/binary/xmake.lua b/xmake/templates/c++/module/binary/xmake.lua
new file mode 100644
index 000000000..d73d457d3
--- /dev/null
+++ b/xmake/templates/c++/module/binary/xmake.lua
@@ -0,0 +1,15 @@
+add_rules("mode.debug", "mode.release")
+
+add_moduledirs("modules")
+
+target("${TARGET_NAME}")
+ set_kind("binary")
+ add_files("src/*.cpp")
+ on_config(function (target)
+ import("binary.bar")
+ print("binary: 1 + 1 = %s", bar.add(1, 1))
+ print("binary: 1 - 1 = %s", bar.sub(1, 1))
+ end)
+
+${FAQ}
+