-
-
Notifications
You must be signed in to change notification settings - Fork 676
Description
Godot version
v4.4.1.stable.nixpkgs [49a5bc7b6]
godot-cpp version
godot-4.4.1-stable
System information
NixOS 25.05.20250721.92c2e04 (Warbler)
Issue description
I'm unable to properly compile GDExtension project for web with CMake. It seems that the variables from emsdkHack.cmake
should enable compilation of shared libraries with emscripten, but the variables are set to the godot-cpp
project directory scope, not at the top-level GDExtension project scope where it's needed and expected. The only thing that is properly set is the TARGET_SUPPORTS_SHARED_LIBS
global property as global properties do not follow directory scopes. This way, the project compiles with warning
em++: warning: linking a library with `-shared` will emit a static object file. This is a form of emulation to support existing build systems. If you want to build a runtime shared library use the SIDE_MODULE setting. [-Wemcc]
and the output library is unusable with godot. If I manually include the emsdkHack.cmake
file after my top level project
call, the compilation passes without a problem. Even with library generated this way, the Remote Deploy -> Run in Browser
is not loading and returning Uncaught (in promise) undefined
in Firefox console. This might be unrelated issue or result of invalid compilation.
Steps to reproduce
- Either enter dev environment via
nix develop
or have prerequisites defined inflake.nix
in yourPATH
via your favourite approach.
To reproduce the failing build:
emcmake cmake --preset default -B build-emscripten
cmake --build build-emscripten
- Uncomment the
include
in top levelCMakeLists.txt
and compile again for successful build
To try the extension in the editor, also compile it natively:
4. cmake --preset default
5. cmake --build build
6. Open the editor and run the main scene, or alternatively Remote Deploy -> Run in Browser