On Mon, Dec 15, 2025 at 11:28 AM Sahil Gautam <[email protected]> wrote:
> the linker flags are indeed passed in both of them, but the loader module > throws an error "LearnOpenGL/hello-triangle/shaders/shader.vert" file not > found. i use make on linux and ninja on windows though i see your point, > ninja is significantly faster. am using `--embed-file` now, thanks sam! > The other reason I recommend ninja so strongly is that it shows the failing sub commands. cmake + make will hide the commands from you, even when they fail, which causes a lot of annoying back and forth on our bug tracker :) regards > sahil gautam > > On 12/15/25 11:50 PM, 'Sam Clegg' via emscripten-discuss wrote: > > `target_link_options` should certainly work, and `CMAKE_EXE_LINKER_FLAGS` > will also work (the downside is that it applies to all executables). > > Can you build with `ninja -v` or `make VERBOSE=1` so you can see the full > link command that is being used (if you are not using ninja yet I recommend > switching right away). > > You can then easily see if the `--preload-file` argument is passed to the > linker or not. > > Also, I highly recommend using `--embed-file` over `--preload-file` unless > you have a specific reason not to. Embedding files in the binary in more > efficient in several ways. > > cheers, > sam > > > > On Sun, Dec 14, 2025 at 4:23 PM Sahil Gautam <[email protected]> > wrote: > >> hi, i have been putting together an opengl application and recently i got >> to know about Emscripten and wasm, so i got to work to add support for >> wasm. i got most of the things working thanks to the demo[2]. most of the >> examples (in [2] and elsewhere on the internet) append to >> `CMAKE_EXE_LINKER_FLAGS` the wasm specific linker flags including >> `--preload-file ... `. i read somewhere while learning cmake "we shouldn't >> modify CMAKE_EXE_LINKER_FLAGS directly".. don't remember where i read that. >> >> so i tried using `target_link_options` but the files don't load and the >> .data file isn't created either. i wonder if there's a better way to set >> these flags than directly appending to CMAKE_EXE_LINKER_FLAGS and i also >> wonder why target_link_options doesn't work. >> >> i will really appreciate some help. i asked this question on an old >> github issue [3] as well, then got the idea of writing to the mailing list. >> >> regards >> sahil gautam >> >> [1]: https://codeberg.org/printfdebugging/learnopengl >> [2]: >> https://github.com/pongasoft/emscripten-glfw/blob/master/test/demo/CMakeLists.txt >> [3]: >> https://github.com/emscripten-core/emscripten/issues/4398#issuecomment-3652385357 >> -- >> You received this message because you are subscribed to the Google Groups >> "emscripten-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion visit >> https://groups.google.com/d/msgid/emscripten-discuss/51dc3253-10d8-4d20-a604-210ab219910cn%40googlegroups.com >> <https://groups.google.com/d/msgid/emscripten-discuss/51dc3253-10d8-4d20-a604-210ab219910cn%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/emscripten-discuss/CAL_va29LvwOkcmPyZj77kQf5zkRCdBH%2BGCPTqZzikceaa34rVQ%40mail.gmail.com > <https://groups.google.com/d/msgid/emscripten-discuss/CAL_va29LvwOkcmPyZj77kQf5zkRCdBH%2BGCPTqZzikceaa34rVQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/emscripten-discuss/c506ffa7-7b98-4af2-9a1f-6b56ed92ab89%40gmail.com > <https://groups.google.com/d/msgid/emscripten-discuss/c506ffa7-7b98-4af2-9a1f-6b56ed92ab89%40gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2-JOcQirxjeGnzGexSagi33sY3y_mjrA2UN_HV5rza2MQ%40mail.gmail.com.
