Initial rework

This commit is contained in:
2026-06-25 02:45:43 +00:00
commit 24b46f7fc2
56 changed files with 2166 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
name: archive
gpid: examples
semv: 1.0.0
targets:
- name: example
type: archive
srcs: [./example.cpp]
- name: hello
type: program
deps: [example]
srcs: [./entry.cpp]
+5
View File
@@ -0,0 +1,5 @@
extern "C" void print(const char* str);
int main() {
print("Hello, World!");
}
+11
View File
@@ -0,0 +1,11 @@
#include <iostream>
#if __cplusplus >= 202302L
# define do_print(x) std::print(x)
#else // Old C++ version.
# define do_print(x) std::cout << x << std::endl
#endif // Check C++ version.
extern "C" void print(const char* str) {
do_print(str);
}
+17
View File
@@ -0,0 +1,17 @@
name: dynlib
gpid: examples
semv: 1.0.0
targets:
- name: example
type: dynlib
defs:
- !private _PRINT_BUILD_DLL
srcs: [./example.cpp]
- name: hello
type: program
deps: [example]
defs:
- !private PRINT_DLL
srcs: [./entry.cpp]
+5
View File
@@ -0,0 +1,5 @@
#include "print/print.hpp"
int main() {
print("Hello, World!");
}
+12
View File
@@ -0,0 +1,12 @@
#include <iostream>
#include "print/print.hpp"
#if __cplusplus >= 202302L
# define do_print(x) std::print(x)
#else // Old C++ version.
# define do_print(x) std::cout << x << std::endl
#endif // Check C++ version.
PRINTAPI void print(const char* msg) {
do_print(msg);
}
+11
View File
@@ -0,0 +1,11 @@
#if defined(_WIN32) && defined(_PRINT_BUILD_DLL)
# define PRINTAPI __declspec(dllexport)
#elif defined(_WIN32) && defined(PRINT_DLL)
# define PRINTAPI __declspec(dllimport)
#elif defined(__GNUC__) && defined(_PRINT_BUILD_DLL)
# define PRINTAPI __attribute__((visibility("default")))
#else
# define PRINTAPI
#endif
PRINTAPI void print(const char* msg);
+8
View File
@@ -0,0 +1,8 @@
name: program
gpid: examples
semv: 1.0.0
targets:
- name: hello
type: program
srcs: [./entry.cpp]
+11
View File
@@ -0,0 +1,11 @@
#include <iostream>
#if __cplusplus >= 202302L
# define print(x) std::print(x)
#else // Old C++ version.
# define print(x) std::cout << x << std::endl
#endif // Check C++ version.
int main() {
print("Hello, World!");
}