【发布时间】:2021-05-05 13:12:20
【问题描述】:
我目前正在尝试按照 README 中的说明在 Windows 上构建 Ammo.js。 我有
-
emcc在路径中 -
cmake通过 Visual Studio 安装 (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe) - MinGW 通过 Chocolatey 安装
显然,因为我在 Windows 上,cmake 无法解析到 CMakeLists.txt 中的可执行文件的任何路径
set(EMSCRIPTEN_ROOT $ENV{EMSDK}/upstream/emscripten CACHE STRING "Emscripten path")
所以我不得不用我的二进制文件的完整路径替换它们:
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")
现在,如果我运行cmake -B builds,cmake 似乎运行没有错误,但它会输出以下文件:
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
没有 ammo.js、没有 ammo.wasm.js 和没有 ammo.wasm
当我尝试使用 'MinGW Makefiles' 标志编译时,它会出错:
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!
我不能使用预建文件调用new Ammo.btBoxShape(new Ammo.btVector3()) throws
Uncaught (in promise) RuntimeError: memory access out of bounds,据我了解,我需要在编译期间分配更大的堆。
那么如何在 Windows 上构建 Ammo.js?
【问题讨论】:
标签: cmake windows-10 emscripten ammo.js