summaryrefslogtreecommitdiffhomepage
path: root/example
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-12-19 14:15:06 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-12-19 14:15:06 +0100
commit2ae776318e6c92079528c35f3f5faf81f54fa10e (patch)
tree80ce9d565cf53927243d6d1f6e8c9006e2b790db /example
parentdb5d7e371e7183e4b5db26632ae2f511db4e0e41 (diff)
chore: Add MailMap, rename `examples` to `example`.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'example')
-rw-r--r--example/example_01_hello_world/hello_world.cc7
-rw-r--r--example/example_01_hello_world/posix.json10
-rw-r--r--example/example_01_hello_world/win64.json10
-rw-r--r--example/example_02_libnebuild/README.md7
-rw-r--r--example/example_02_libnebuild/libnebuild.cc17
-rw-r--r--example/example_02_libnebuild/posix.json20
-rw-r--r--example/example_02_libnebuild/win64.json19
-rw-r--r--example/example_03_hello_world_toml/hello_world.cc7
-rw-r--r--example/example_03_hello_world_toml/posix.toml8
-rw-r--r--example/example_03_hello_world_toml/win64.toml8
10 files changed, 113 insertions, 0 deletions
diff --git a/example/example_01_hello_world/hello_world.cc b/example/example_01_hello_world/hello_world.cc
new file mode 100644
index 0000000..ae47ce8
--- /dev/null
+++ b/example/example_01_hello_world/hello_world.cc
@@ -0,0 +1,7 @@
+#include <iostream>
+#include <string>
+
+int main(int argc, char** argv) {
+ std::cout << "hello, world!\n";
+ return 0;
+}
diff --git a/example/example_01_hello_world/posix.json b/example/example_01_hello_world/posix.json
new file mode 100644
index 0000000..197e4a2
--- /dev/null
+++ b/example/example_01_hello_world/posix.json
@@ -0,0 +1,10 @@
+{
+ "compiler_path": "clang++",
+ "compiler_std": "c++20",
+ "headers_path": ["lib"],
+ "sources_path": ["hello_world.cc"],
+ "output_name": "./hello_world.elf",
+ "compiler_flags": ["-fPIC"],
+ "cpp_macros": ["FOO_MACRO"],
+ "run_after_build": true
+}
diff --git a/example/example_01_hello_world/win64.json b/example/example_01_hello_world/win64.json
new file mode 100644
index 0000000..4545228
--- /dev/null
+++ b/example/example_01_hello_world/win64.json
@@ -0,0 +1,10 @@
+{
+ "compiler_path": "x86_64-w64-mingw32-g++",
+ "compiler_std": "c++20",
+ "headers_path": ["lib"],
+ "sources_path": ["hello_world.cc"],
+ "output_name": "./hello_world.elf",
+ "compiler_flags": ["-fPIC"],
+ "cpp_macros": ["FOO_MACRO"],
+ "run_after_build": true
+}
diff --git a/example/example_02_libnebuild/README.md b/example/example_02_libnebuild/README.md
new file mode 100644
index 0000000..21e64be
--- /dev/null
+++ b/example/example_02_libnebuild/README.md
@@ -0,0 +1,7 @@
+# Notice for Deployment.
+
+In order to use libNeBuild, it shall live on the same directory,
+<br/>
+or within a directory recognized in the `$LD_LIBRARY_PATH` or `$DYLD_LIBRARY_PATH` variable.
+
+## Thanks in advance. \ No newline at end of file
diff --git a/example/example_02_libnebuild/libnebuild.cc b/example/example_02_libnebuild/libnebuild.cc
new file mode 100644
index 0000000..fffb962
--- /dev/null
+++ b/example/example_02_libnebuild/libnebuild.cc
@@ -0,0 +1,17 @@
+#include <NeBuildKit/JSONManifestBuilder.h>
+
+int main(int argc, char** argv) {
+#ifndef _WIN32
+ constexpr auto path = "./posix.json";
+#else
+ constexpr auto path = ".\\win64.json";
+#endif
+
+ NeBuild::JSONManifestBuilder builder;
+ NeBuild::BuildConfig config;
+
+ config.path_ = path;
+ config.dry_run_ = false;
+
+ return builder.BuildTarget(config);
+}
diff --git a/example/example_02_libnebuild/posix.json b/example/example_02_libnebuild/posix.json
new file mode 100644
index 0000000..d7ef767
--- /dev/null
+++ b/example/example_02_libnebuild/posix.json
@@ -0,0 +1,20 @@
+{
+ "compiler_path": "clang++",
+ "compiler_std": "c++20",
+ "headers_path": [
+ "../../include",
+ "../../vendor"
+ ],
+ "sources_path": [
+ "libnebuild.cc"
+ ],
+ "output_name": "./libnebuild.elf",
+ "compiler_flags": [
+ "-L/usr/lib",
+ "-lNeBuildKit"
+ ],
+ "cpp_macros": [
+ "FOO_MACRO"
+ ],
+ "run_after_build": true
+} \ No newline at end of file
diff --git a/example/example_02_libnebuild/win64.json b/example/example_02_libnebuild/win64.json
new file mode 100644
index 0000000..094208b
--- /dev/null
+++ b/example/example_02_libnebuild/win64.json
@@ -0,0 +1,19 @@
+{
+ "compiler_path": "x86_64-w64-mingw32-g++",
+ "compiler_std": "c++20",
+ "headers_path": [
+ "../../include",
+ "../../vendor"
+ ],
+ "sources_path": [
+ "libbtb.cc"
+ ],
+ "output_name": "./libbtb.exe",
+ "compiler_flags": [
+ "-lNeBuild"
+ ],
+ "cpp_macros": [
+ "FOO_MACRO"
+ ],
+ "run_after_build": true
+} \ No newline at end of file
diff --git a/example/example_03_hello_world_toml/hello_world.cc b/example/example_03_hello_world_toml/hello_world.cc
new file mode 100644
index 0000000..ae47ce8
--- /dev/null
+++ b/example/example_03_hello_world_toml/hello_world.cc
@@ -0,0 +1,7 @@
+#include <iostream>
+#include <string>
+
+int main(int argc, char** argv) {
+ std::cout << "hello, world!\n";
+ return 0;
+}
diff --git a/example/example_03_hello_world_toml/posix.toml b/example/example_03_hello_world_toml/posix.toml
new file mode 100644
index 0000000..a384ddb
--- /dev/null
+++ b/example/example_03_hello_world_toml/posix.toml
@@ -0,0 +1,8 @@
+compiler_path = "clang++"
+compiler_std = "c++20"
+headers_path = [ "lib" ]
+sources_path = [ "hello_world.cc" ]
+output_name = "./hello_world.elf"
+compiler_flags = [ "-fPIC" ]
+cpp_macros = [ "FOO_MACRO" ]
+run_after_build = true
diff --git a/example/example_03_hello_world_toml/win64.toml b/example/example_03_hello_world_toml/win64.toml
new file mode 100644
index 0000000..6f30476
--- /dev/null
+++ b/example/example_03_hello_world_toml/win64.toml
@@ -0,0 +1,8 @@
+compiler_path = "x86_64-w64-mingw32-g++"
+compiler_std = "c++20"
+headers_path = [ "lib" ]
+sources_path = [ "hello_world.cc" ]
+output_name = "./hello_world.elf"
+compiler_flags = [ "-fPIC" ]
+cpp_macros = [ "FOO_MACRO" ]
+run_after_build = true