Created
October 30, 2018 14:34
-
-
Save thosakwe/1507cc117fd8c6cc804390d05bd8785d to your computer and use it in GitHub Desktop.
Simple build pipeline...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Glob up C++ sources | |
| var srcs = combine([ | |
| glob("src/*{.h,.cpp}") | |
| ]) | |
| // Exclude some sources | |
| srcs = exclude(srcs, [glob("test/**")]) | |
| // Grab all the object files, creates multiple targets | |
| var objects = compile_cpp(srcs).outputs | |
| // Next, add a linking step that creates libfoo.a | |
| var linkStep = link_cpp("foo", objects) | |
| // We can make it a shared library | |
| linkStep.shared = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| macro compile_wat_to_wasm(source) { | |
| var name = extension(source, ".wasm") | |
| return process(["wat2wasm", "-o", name, source]) | |
| } | |
| // Globs many sources through wat2wasm | |
| macro compile_wasm(sources) { | |
| return multi_target(sources, compile_wat_to_wasm) | |
| } | |
| // Call it. Produces foo.wasm, hello.wasm | |
| compile_wasm(["foo.wat", "hello.wat"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import "../wasm.tmake" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment