linux 使用cgal Emscripten失败

gwo2fgha  于 2023-11-17  发布在  Linux
关注(0)|答案(1)|浏览(170)

首先我克隆这个项目:https://github.com/yushi-bot/CGAL_triangulation_demo
背景资料:我正在尝试使用Emscripten技术将使用CGAL库的C++程序编译为WebAssembly(wasm)格式,以便在网页上运行它。单独使用CMake时编译成功。但是,当我尝试使用命令emcmake make../时,编译过程失败。

cmake ../        (at build folder which make by myself , it is success)

个字符
当我使用这个命令时。

emcmake cmake ../
configure: cmake ../ -DCMAKE_TOOLCHAIN_FILE=/usr/share/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/usr/bin/node;--experimental-wasm-threads
CMake Error at CMakeLists.txt:4 (find_package):
  By not providing "FindCGAL.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "CGAL", but
  CMake did not find one.

  Could not find a package configuration file provided by "CGAL" with any of
  the following names:

    CGALConfig.cmake
    cgal-config.cmake

  Add the installation prefix of "CGAL" to CMAKE_PREFIX_PATH or set
  "CGAL_DIR" to a directory containing one of the above files.  If "CGAL"
  provides a separate development package or SDK, be sure it has been
  installed.

-- Configuring incomplete, errors occurred!
See also "/home/lyciih/github/CGAL_triangulation_demo/build/CMakeFiles/CMakeOutput.log".
emcmake: error: 'cmake ../ -DCMAKE_TOOLCHAIN_FILE=/usr/share/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/usr/bin/node;--experimental-wasm-threads' failed (returned 1)

的字符串
请告诉我怎么修。
多谢帮忙

k75qkfdt

k75qkfdt1#

此问题与:https://github.com/emscripten-core/emscripten/issues/13310
简而言之:emscripten中的工具链文件限制了包和库的搜索路径,因此无法找到CGAL。您可以在调用emcmake cmake ...时通过设置-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH来覆盖此行为
另见:https://cmake.org/cmake/help/latest/variable/CMAKE_FIND_ROOT_PATH_MODE_PACKAGE.html#cmake-find-root-path-mode-package

相关问题