Files
FreeCADWasmDev/cMake/FreeCADWebEmscripten.cmake
wangdequan b5a086fda5
Some checks failed
FreeCAD master CI / Prepare (push) Has been cancelled
FreeCAD master CI / Pixi (push) Has been cancelled
FreeCAD master CI / Ubuntu (push) Has been cancelled
FreeCAD master CI / Windows (push) Has been cancelled
FreeCAD master CI / Lint (push) Has been cancelled
FreeCAD master CI / WrapUp (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Stale Issues / stale (push) Has been cancelled
FreeCAD WebAssembly development snapshot
2026-08-20 07:00:53 +08:00

37 lines
1.7 KiB
CMake

# SPDX-License-Identifier: LGPL-2.1-or-later
# Keep the preset independent of a distro-specific Emscripten installation
# path. Users may provide FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN or EMSCRIPTEN;
# otherwise resolve emcc and its real path from PATH.
set(FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN "" CACHE FILEPATH
"Path to Emscripten.cmake used by the FreeCAD Web preset")
if(NOT FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN OR
NOT EXISTS "${FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN}")
if(DEFINED ENV{EMSCRIPTEN} AND
EXISTS "$ENV{EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake")
set(FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN
"$ENV{EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake"
CACHE FILEPATH "Resolved Emscripten toolchain" FORCE)
else()
find_program(_FREECAD_WEB_EMCC emcc)
if(_FREECAD_WEB_EMCC)
get_filename_component(_FREECAD_WEB_EMCC_REAL "${_FREECAD_WEB_EMCC}" REALPATH)
get_filename_component(_FREECAD_WEB_EMSCRIPTEN_ROOT "${_FREECAD_WEB_EMCC_REAL}" DIRECTORY)
if(EXISTS "${_FREECAD_WEB_EMSCRIPTEN_ROOT}/cmake/Modules/Platform/Emscripten.cmake")
set(FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN
"${_FREECAD_WEB_EMSCRIPTEN_ROOT}/cmake/Modules/Platform/Emscripten.cmake"
CACHE FILEPATH "Resolved Emscripten toolchain" FORCE)
endif()
endif()
endif()
endif()
if(NOT EXISTS "${FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN}")
message(FATAL_ERROR
"Could not locate Emscripten.cmake. Set EMSCRIPTEN or "
"FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN to the Emscripten installation root/file.")
endif()
include("${FREECAD_WEB_EMSCRIPTEN_TOOLCHAIN}")