Initial rework
This commit is contained in:
@@ -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]
|
||||
@@ -0,0 +1,5 @@
|
||||
extern "C" void print(const char* str);
|
||||
|
||||
int main() {
|
||||
print("Hello, World!");
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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]
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "print/print.hpp"
|
||||
|
||||
int main() {
|
||||
print("Hello, World!");
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
@@ -0,0 +1,8 @@
|
||||
name: program
|
||||
gpid: examples
|
||||
semv: 1.0.0
|
||||
|
||||
targets:
|
||||
- name: hello
|
||||
type: program
|
||||
srcs: [./entry.cpp]
|
||||
@@ -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!");
|
||||
}
|
||||
Reference in New Issue
Block a user