Skip to content

Unable to cross-compile magnum-based project for Emscripten #490

@Xeverous

Description

@Xeverous

I have successfully installed Emscripten on Windows but when I'm trying to build my project for Emscripten the configuration fails with this error:

CMake Error at external/magnum/CMakeLists.txt:295 (include):
  include could not find load file:

    UseEmscripten

magnum/CMakeLists.txt seems to try to include UseEmscripten.cmake but this file is located in magnum/toolchains/modules. I think that the relative path is wrong - the file is in a different directory:

magnum/CMakeLists.txt

Lines 294 to 296 in 515bfce

if(CORRADE_TARGET_EMSCRIPTEN)
include(UseEmscripten)
endif()

Few notes:

  • I have pulled newest magnum, magnum-integration and corrade (all from their master).
  • It's unclear to me in which shell and what state should I have before running commands desribed here: https://doc.magnum.graphics/corrade/building-corrade.html#building-corrade-cross-emscripten - it seems to me that corrade docs coflict with this emscripten docs which tell me to use emcmake cmake and then input my all flags as usual. emcmake adds extra cmake flags, including CMAKE_TOOLCHAIN_FILE which has different path value from one recommended in corrade docs.
  • I get the same error regardless of whether I use cmake ... or emcmake cmake ... in emscripten-activated shell.
  • For native 64-bit Windows build I'm building the project using submoduled magnum and corrade repositories, added by add_subdirectory within my CMake files. I would like to keep this approach. It works very well.
  • I would like to build my project as for the native build, just with small differences as on emscripten docs (emcmake cmake ... instead of cmake ... and emmake make instead of make). A lot of my dependencies are recursively git-submoduled and are added using add_subdirectory in my CMake files (this also applies to magnum and corrade). This forms some dependency chain in CMake recipes and when I tell CMake to build everything it performs incremental build flawlessly.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions