summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-07-24 09:22:06 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-07-24 09:22:06 +0100
commitc2ebe8fd7195c24293cb48c7ec57b194e70c6a63 (patch)
tree7819763d3b1b094ee985611baead6114ddec9d41 /examples
parenta3ea256d00e5aac45574c7c8b076b60630f73a95 (diff)
fix: Fix examples's contents and placed 'examples' in the root directory.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/example_01_hello_world/hello_world.cc7
-rw-r--r--examples/example_01_hello_world/posix.json10
-rw-r--r--examples/example_01_hello_world/win64.json10
-rw-r--r--examples/example_02_libnebuild/README.md7
-rw-r--r--examples/example_02_libnebuild/libnebuild.cc15
-rw-r--r--examples/example_02_libnebuild/posix.json20
-rw-r--r--examples/example_02_libnebuild/win64.json19
7 files changed, 88 insertions, 0 deletions
diff --git a/examples/example_01_hello_world/hello_world.cc b/examples/example_01_hello_world/hello_world.cc
new file mode 100644
index 0000000..ae47ce8
--- /dev/null
+++ b/examples/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/examples/example_01_hello_world/posix.json b/examples/example_01_hello_world/posix.json
new file mode 100644
index 0000000..c3c8151
--- /dev/null
+++ b/examples/example_01_hello_world/posix.json
@@ -0,0 +1,10 @@
+{
+ "compiler_path": "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/examples/example_01_hello_world/win64.json b/examples/example_01_hello_world/win64.json
new file mode 100644
index 0000000..4af5bdd
--- /dev/null
+++ b/examples/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/examples/example_02_libnebuild/README.md b/examples/example_02_libnebuild/README.md
new file mode 100644
index 0000000..21e64be
--- /dev/null
+++ b/examples/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/examples/example_02_libnebuild/libnebuild.cc b/examples/example_02_libnebuild/libnebuild.cc
new file mode 100644
index 0000000..e6e489d
--- /dev/null
+++ b/examples/example_02_libnebuild/libnebuild.cc
@@ -0,0 +1,15 @@
+#include <BuildKit/JSONManifestBuilder.h>
+#include <cstdlib>
+
+#ifndef _WIN32
+static auto kPath = "./posix.json";
+#else
+static auto kPath = ".\win64.json";
+#endif
+
+int main(int argc, char** argv) {
+ auto builder = new NeBuild::JSONManifestBuilder();
+ if (!builder) return EXIT_FAILURE;
+
+ return builder->buildTarget(strlen(kPath), kPath);
+}
diff --git a/examples/example_02_libnebuild/posix.json b/examples/example_02_libnebuild/posix.json
new file mode 100644
index 0000000..989e712
--- /dev/null
+++ b/examples/example_02_libnebuild/posix.json
@@ -0,0 +1,20 @@
+{
+ "compiler_path": "g++",
+ "compiler_std": "c++20",
+ "headers_path": [
+ "../../dev",
+ "../../vendor"
+ ],
+ "sources_path": [
+ "libnebuild.cc"
+ ],
+ "output_name": "libnebuild.elf",
+ "compiler_flags": [
+ "-L/usr/local/lib",
+ "-lNeBuild"
+ ],
+ "cpp_macros": [
+ "FOO_MACRO"
+ ],
+ "run_after_build": true
+} \ No newline at end of file
diff --git a/examples/example_02_libnebuild/win64.json b/examples/example_02_libnebuild/win64.json
new file mode 100644
index 0000000..a873f5d
--- /dev/null
+++ b/examples/example_02_libnebuild/win64.json
@@ -0,0 +1,19 @@
+{
+ "compiler_path": "x86_64-w64-mingw32-g++",
+ "compiler_std": "c++20",
+ "headers_path": [
+ "../../",
+ "../../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