I'm currently trying to build Ammo.js on Windows, following the Instructions in the README. I have
emcc
in Pathcmake
installed via Visual Studio (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe
)- MinGW installed via Chocolatey
Apparently, because I'm on Windows, cmake could not resolve any paths to the executables in CMakeLists.txt
set(EMSCRIPTEN_ROOT $ENV{EMSDK}/upstream/emscripten CACHE STRING "Emscripten path")
so I had to replace them with full paths to my Binaries:
set(EMSCRIPTEN_ROOT "C:/Program Files/emsdk/upstream/emscripten" CACHE STRING "Emscripten path")
set(CMAKE_TOOLCHAIN_FILE "C:/Program Files/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake")
set(WEBIDL_BINDER_SCRIPT "C:/Program Files/emsdk/upstream/emscripten/tools/webidl_binder.py")
Now, if I run cmake -B builds
, cmake seems to run without errors, but it spits out the following files:
cmake -B builds
-- Building for: Visual Studio 16 2019
-- Found Python3: C:/Python39/python.exe (found version "3.9.1") found components:
Interpreter CMake Deprecation Warning at bullet/CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions.
OPENGL FOUND
nul
-- WARNING: you are using the obsolete 'GLU' package, please use 'OpenGL' instead
-- Could NOT find OpenGL (missing: OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY OPENGL_INCLUDE_DIR)
-- Configuring done
-- Generating done
-- Build files have been written to: G:/dev/projects/ammo.js/builds
There is no ammo.js, no ammo.wasm.js and no ammo.wasm
When I try to compile with the 'MinGW Makefiles'
flag, it errors out:
cmake -B builds -G 'MinGW Makefiles'
-- Found Python3: C:/Python39/python.exe (found version "3.9.1") found components: Interpreter
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
I can't use the prebuilt Files as calling to new Ammo.btBoxShape(new Ammo.btVector3())
throws
Uncaught (in promise) RuntimeError: memory access out of bounds
and in my Understanding i need to allocate a larger heap during compile time.
So how do I build Ammo.js on Windows?
Had two separate Problems here
The MinGw installation from Chocolatey does not include mingw32-make.exe. I uninstalled it, got the MinGW-Installer and proceeded as per this answer: CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles"
I had to actually run
cmake --build builds
after the first command, which I overlooked in the docs