Add minimal example
This commit is contained in:
parent
1827006b02
commit
1402505a6d
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Build files
|
||||||
|
/build
|
||||||
|
/build.ninja
|
||||||
|
/shuriken.override.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
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
export module generators.number;
|
||||||
|
|
||||||
|
// Example function that returns a number
|
||||||
|
export int get_number() {
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
export module generators.text;
|
||||||
|
|
||||||
|
// Example function that returns a string
|
||||||
|
export const char* get_text() {
|
||||||
|
return "meow!";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
import printing;
|
||||||
|
|
||||||
|
// Example main function that calls a function from a module to print things
|
||||||
|
int main() {
|
||||||
|
print_things();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
module;
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
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';
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
../../../src/shuriken.py
|
||||||
Loading…
Reference in New Issue