quickjs-ng / quickjs

QuickJS, the Next Generation: a mighty JavaScript engine
MIT License
687 stars 66 forks source link

Fixed CMakeLists.txt for Emscripten builds #403

Closed jonathanmarvens closed 1 month ago

jonathanmarvens commented 1 month ago

The run-test262 target fails for Emscripten due to the ftw() usage.

chqrlie commented 1 month ago

The run-test262 target fails for Emscripten due to the ftw() usage.

Of course run-test262 should not be built for this arch, it is only supposed to run on the host. How can cmake be instructed to distinguish between host executables and target executables, yet not compile quickjs twice when host and target are identical?

jonathanmarvens commented 1 month ago

The run-test262 target fails for Emscripten due to the ftw() usage.

Of course run-test262 should not be built for this arch, it is only supposed to run on the host. How can cmake be instructed to distinguish between host executables and target executables, yet not compile quickjs twice when host and target are identical?

@chqrlie That gets into the cross-compilation features of CMake, which I haven’t messed with in a long time. That said, I can experiment for a better solution that takes that into consideration, but can we at least get this PR in so that Emscripten builds are no longer broken?

chqrlie commented 1 month ago

The run-test262 target fails for Emscripten due to the ftw() usage.

Of course run-test262 should not be built for this arch, it is only supposed to run on the host. How can cmake be instructed to distinguish between host executables and target executables, yet not compile quickjs twice when host and target are identical?

@chqrlie That gets into the cross-compilation features of CMake, which I haven’t messed with in a long time. That said, I can experiment for a better solution that takes that into consideration, but can we at least get this PR in so that Emscripten builds are no longer broken?

I am going to merge the patch. I would prefer a solution using make :)

jonathanmarvens commented 1 month ago

@chqrlie Thank you.

I would prefer a solution using make :)

I try to avoid flame wars, so I generally do my best to keep my very strong and totally not nice opinions about CMake to myself. Haha.

Anyway, I’ll spend a bit of time experimenting on a better solution as promised.

saghul commented 1 month ago

I think testing for https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING.html might be what we need.