diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-09-09 11:27:30 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-09-09 11:27:30 +0200 |
commit | b01bac3506584402da98e874f52d8075beb145ff (patch) | |
tree | b4e8e1f26b33aa0b96dc4c664f40d209357d96bb | |
parent | 1b223af456140fb02af647bed6cbff18973b0229 (diff) |
Handle Emscripten -pthread mode
-rw-r--r-- | libbuild2/cc/link-rule.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx index 76d8418..d8f22d4 100644 --- a/libbuild2/cc/link-rule.cxx +++ b/libbuild2/cc/link-rule.cxx @@ -1266,6 +1266,21 @@ namespace build2 if (wasm.path ().empty ()) wasm.derive_path (); + + // If we have -pthread then we get additional .worker.js file + // which is used for thread startup. In a somewhat hackish way we + // represent it as an exe{} member to make sure it gets installed + // next to the main .js file. + // + if (find_option ("-pthread", cmode) || + find_option ("-pthread", t, c_loptions) || + find_option ("-pthread", t, x_loptions)) + { + exe& worker (add_adhoc_member<exe> (t, "worker.js")); + + if (worker.path ().empty ()) + worker.derive_path (); + } } // Add VC's .pdb. Note that we are looking for the link.exe /DEBUG |