diff --git a/examples/minimal/.gitignore b/examples/minimal/.gitignore new file mode 100644 index 0000000..75c3626 --- /dev/null +++ b/examples/minimal/.gitignore @@ -0,0 +1,4 @@ +# Build files +/build +/build.ninja +/shuriken.override.yaml diff --git a/examples/minimal/shuriken.yaml b/examples/minimal/shuriken.yaml new file mode 100644 index 0000000..adeb9c8 --- /dev/null +++ b/examples/minimal/shuriken.yaml @@ -0,0 +1,11 @@ +# Example shuriken.yaml config for a minimal C++ project with modules. + +defaults: + cpp_standard: c++20 + cpp_flags: -Wall -Wextra -Werror -pedantic + +default_target: linux + +targets: + linux: + output_file: minimal_example diff --git a/examples/minimal/src/generators/number.cppm b/examples/minimal/src/generators/number.cppm new file mode 100644 index 0000000..688973f --- /dev/null +++ b/examples/minimal/src/generators/number.cppm @@ -0,0 +1,6 @@ +export module generators.number; + +// Example function that returns a number +export int get_number() { + return 42; +} diff --git a/examples/minimal/src/generators/text.cppm b/examples/minimal/src/generators/text.cppm new file mode 100644 index 0000000..5a9e5ef --- /dev/null +++ b/examples/minimal/src/generators/text.cppm @@ -0,0 +1,6 @@ +export module generators.text; + +// Example function that returns a string +export const char* get_text() { + return "meow!"; +} diff --git a/examples/minimal/src/main.cpp b/examples/minimal/src/main.cpp new file mode 100644 index 0000000..24af854 --- /dev/null +++ b/examples/minimal/src/main.cpp @@ -0,0 +1,6 @@ +import printing; + +// Example main function that calls a function from a module to print things +int main() { + print_things(); +} diff --git a/examples/minimal/src/printing.cppm b/examples/minimal/src/printing.cppm new file mode 100644 index 0000000..8bd3b00 --- /dev/null +++ b/examples/minimal/src/printing.cppm @@ -0,0 +1,14 @@ +module; + +#include + +import generators.number; +import generators.text; + +export module printing; + +// Example function that prints things from the generator functions +export void print_things() { + std::cout << get_text() << '\n'; + std::cout << get_number() << '\n'; +} diff --git a/examples/minimal/tools/shuriken.py b/examples/minimal/tools/shuriken.py new file mode 120000 index 0000000..dc142ea --- /dev/null +++ b/examples/minimal/tools/shuriken.py @@ -0,0 +1 @@ +../../../src/shuriken.py \ No newline at end of file