# SPDX-License-Identifier: LGPL-2.1-or-later set(FREECAD_WEB_DEPENDENCY_ROOT "${CMAKE_SOURCE_DIR}/build-web" CACHE PATH "Root containing the installed Emscripten dependencies") set(FREECAD_WEB_YAML_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/yaml-install" CACHE PATH "yaml-cpp Emscripten installation prefix") set(FREECAD_WEB_EIGEN_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/eigen-install" CACHE PATH "Eigen 3.4.0 installation prefix") set(FREECAD_WEB_BOOST_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/boost-install" CACHE PATH "Boost 1.83.0 Emscripten installation prefix") set(FREECAD_WEB_QT_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/qt-install" CACHE PATH "Qt Emscripten installation prefix") set(FREECAD_WEB_PYTHON_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/python-install" CACHE PATH "CPython Emscripten installation prefix") set(FREECAD_WEB_PYTHON_BUILD_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/python-probe" CACHE PATH "CPython Emscripten build tree containing extension archives") set(FREECAD_WEB_ICU_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/icu-install" CACHE PATH "ICU 68.2 Emscripten installation prefix") set(FREECAD_WEB_ZLIB_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/zlib-install" CACHE PATH "zlib 1.3 Emscripten installation prefix") set(FREECAD_WEB_XERCESC_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/xerces-install" CACHE PATH "Xerces-C 3.2.4 Emscripten installation prefix") set(FREECAD_WEB_OCCT_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/occt-install" CACHE PATH "OpenCASCADE 7.6.3 Emscripten installation prefix") set(FREECAD_WEB_OPENSSL_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/openssl-install" CACHE PATH "OpenSSL 3.2.2 Emscripten installation prefix") set(FREECAD_WEB_CURL_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/curl-install" CACHE PATH "CURL 8.8.0 Emscripten installation prefix") set(FREECAD_WEB_HOST_PYTHON_EXECUTABLE "" CACHE FILEPATH "Native Python used for configure-time generators in a Web build") set(FREECAD_WEB_PTHREAD_DEPENDENCY_ROOT "" CACHE PATH "Optional root containing atomics-tagged pthread Web dependencies") # The regular Web dependency bundle intentionally omits QtGui/QtWidgets. A # native TechDraw build needs the separately staged Qt closure; select it when # the caller has not supplied a usable native Qt root. Keep an explicit # FREECAD_WEB_QT_ROOT override authoritative so ordinary Web builds retain the # lightweight dependency set. if(FREECAD_WEB_ENABLE_TECHDRAW_NATIVE AND NOT EXISTS "${FREECAD_WEB_QT_ROOT}/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake" AND EXISTS "${FREECAD_WEB_DEPENDENCY_ROOT}/qt-techdraw-install/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake") set(FREECAD_WEB_QT_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}/qt-techdraw-install" CACHE PATH "Qt Emscripten installation prefix" FORCE) message(STATUS "TechDraw native: using staged QtGui closure at ${FREECAD_WEB_QT_ROOT}") endif() if(FREECAD_WEB_ENABLE_TECHDRAW_NATIVE) if(NOT FREECAD_WEB_PTHREAD_DEPENDENCY_ROOT AND EXISTS "${FREECAD_WEB_DEPENDENCY_ROOT}/occt-pthread-install" AND EXISTS "${FREECAD_WEB_DEPENDENCY_ROOT}/python-pthread-install" AND EXISTS "${FREECAD_WEB_DEPENDENCY_ROOT}/yaml-pthread-install" AND EXISTS "${FREECAD_WEB_DEPENDENCY_ROOT}/icu-pthread-install" AND EXISTS "${FREECAD_WEB_DEPENDENCY_ROOT}/boost-pthread-install") set(FREECAD_WEB_PTHREAD_DEPENDENCY_ROOT "${FREECAD_WEB_DEPENDENCY_ROOT}" CACHE PATH "Root containing atomics-tagged pthread Web dependencies" FORCE) endif() if(FREECAD_WEB_PTHREAD_DEPENDENCY_ROOT AND EXISTS "${FREECAD_WEB_PTHREAD_DEPENDENCY_ROOT}/occt-pthread-install" AND EXISTS "${FREECAD_WEB_PTHREAD_DEPENDENCY_ROOT}/python-pthread-install" AND EXISTS "${FREECAD_WEB_PTHREAD_DEPENDENCY_ROOT}/yaml-pthread-install" AND EXISTS "${FREECAD_WEB_PTHREAD_DEPENDENCY_ROOT}/icu-pthread-install" AND EXISTS "${FREECAD_WEB_PTHREAD_DEPENDENCY_ROOT}/boost-pthread-install") message(STATUS "TechDraw native: using atomics-tagged pthread dependency closure") set(FREECAD_WEB_OCCT_ROOT "${FREECAD_WEB_PTHREAD_DEPENDENCY_ROOT}/occt-pthread-install" CACHE PATH "OpenCASCADE pthread Web installation prefix" FORCE) set(FREECAD_WEB_PYTHON_ROOT "${FREECAD_WEB_PTHREAD_DEPENDENCY_ROOT}/python-pthread-install" CACHE PATH "CPython pthread Web installation prefix" FORCE) set(FREECAD_WEB_PYTHON_BUILD_ROOT "${FREECAD_WEB_PTHREAD_DEPENDENCY_ROOT}/python-pthread" CACHE PATH "CPython pthread Web build tree" FORCE) set(FREECAD_WEB_YAML_ROOT "${FREECAD_WEB_PTHREAD_DEPENDENCY_ROOT}/yaml-pthread-install" CACHE PATH "yaml-cpp pthread Web installation prefix" FORCE) set(FREECAD_WEB_ICU_ROOT "${FREECAD_WEB_PTHREAD_DEPENDENCY_ROOT}/icu-pthread-install" CACHE PATH "ICU pthread Web installation prefix" FORCE) set(FREECAD_WEB_BOOST_ROOT "${FREECAD_WEB_PTHREAD_DEPENDENCY_ROOT}/boost-pthread-install" CACHE PATH "Boost pthread Web installation prefix" FORCE) endif() endif() function(_freecad_web_require path description) if(NOT EXISTS "${path}") message(FATAL_ERROR "FREECAD_WEB requires ${description} at ${path}. " "Run tools/prepare_web_dependencies.sh first or set the matching " "FREECAD_WEB_*_ROOT cache variable.") endif() endfunction() set(_freecad_web_yaml_dir "${FREECAD_WEB_YAML_ROOT}/lib/cmake/yaml-cpp") set(_freecad_web_eigen_include "${FREECAD_WEB_EIGEN_ROOT}/include/eigen3") set(_freecad_web_boost_include "${FREECAD_WEB_BOOST_ROOT}/include") set(_freecad_web_boost_library_dir "${FREECAD_WEB_BOOST_ROOT}/lib") set(_freecad_web_qt_cmake_root "${FREECAD_WEB_QT_ROOT}/lib/cmake") set(_freecad_web_python_include "${FREECAD_WEB_PYTHON_ROOT}/include/python3.12") set(_freecad_web_python_library "${FREECAD_WEB_PYTHON_ROOT}/lib/libpython3.12.a") set(_freecad_web_icu_include "${FREECAD_WEB_ICU_ROOT}/include") set(_freecad_web_icu_uc_library "${FREECAD_WEB_ICU_ROOT}/lib/libicuuc.a") set(_freecad_web_icu_i18n_library "${FREECAD_WEB_ICU_ROOT}/lib/libicui18n.a") set(_freecad_web_icu_data_library "${FREECAD_WEB_ICU_ROOT}/lib/libicudata.a") set(_freecad_web_zlib_include "${FREECAD_WEB_ZLIB_ROOT}/include") set(_freecad_web_zlib_library "${FREECAD_WEB_ZLIB_ROOT}/lib/libz.a") set(_freecad_web_xerces_include "${FREECAD_WEB_XERCESC_ROOT}/include") set(_freecad_web_xerces_library "${FREECAD_WEB_XERCESC_ROOT}/lib/libxerces-c.a") set(_freecad_web_occt_dir "${FREECAD_WEB_OCCT_ROOT}/lib/cmake/opencascade") if(FREECAD_WEB_ENABLE_CLOUD) set(_freecad_web_openssl_include "${FREECAD_WEB_OPENSSL_ROOT}/include") set(_freecad_web_openssl_crypto "${FREECAD_WEB_OPENSSL_ROOT}/lib/libcrypto.a") set(_freecad_web_openssl_ssl "${FREECAD_WEB_OPENSSL_ROOT}/lib/libssl.a") set(_freecad_web_curl_include "${FREECAD_WEB_CURL_ROOT}/include") set(_freecad_web_curl_library "${FREECAD_WEB_CURL_ROOT}/lib/libcurl.a") endif() _freecad_web_require("${_freecad_web_yaml_dir}/yaml-cpp-config.cmake" "yaml-cpp CMake package") _freecad_web_require("${_freecad_web_eigen_include}/signature_of_eigen3_matrix_library" "Eigen Web headers") _freecad_web_require("${_freecad_web_eigen_include}/Eigen/src/Core/util/Macros.h" "Eigen version header") _freecad_web_require("${_freecad_web_boost_include}/boost/version.hpp" "Boost Web headers") foreach(_freecad_web_boost_component program_options regex thread date_time atomic) _freecad_web_require("${_freecad_web_boost_library_dir}/libboost_${_freecad_web_boost_component}.a" "Boost Web ${_freecad_web_boost_component} library") endforeach() _freecad_web_require("${_freecad_web_qt_cmake_root}/Qt5/Qt5Config.cmake" "Qt5 CMake package") _freecad_web_require("${_freecad_web_qt_cmake_root}/Qt5Core/Qt5CoreConfig.cmake" "Qt5Core CMake package") _freecad_web_require("${_freecad_web_qt_cmake_root}/Qt5Network/Qt5NetworkConfig.cmake" "Qt5Network CMake package") _freecad_web_require("${_freecad_web_qt_cmake_root}/Qt5Xml/Qt5XmlConfig.cmake" "Qt5Xml CMake package") if(FREECAD_WEB_ENABLE_TECHDRAW_NATIVE) foreach(_freecad_web_qt_native_component Gui Widgets Concurrent) _freecad_web_require("${_freecad_web_qt_cmake_root}/Qt5${_freecad_web_qt_native_component}/Qt5${_freecad_web_qt_native_component}Config.cmake" "Qt5${_freecad_web_qt_native_component} CMake package") endforeach() foreach(_freecad_web_qt_support_component EventDispatcherSupport FontDatabaseSupport EglSupport PlatformCompositorSupport AccessibilitySupport DeviceDiscoverySupport ServiceSupport ThemeSupport) set("Qt5${_freecad_web_qt_support_component}_DIR" "${_freecad_web_qt_cmake_root}/Qt5${_freecad_web_qt_support_component}" CACHE PATH "Web Qt5${_freecad_web_qt_support_component} package" FORCE) endforeach() endif() _freecad_web_require("${_freecad_web_python_include}/Python.h" "CPython 3.12 Web headers") _freecad_web_require("${_freecad_web_python_library}" "CPython 3.12 Web static library") _freecad_web_require("${_freecad_web_icu_include}/unicode/utypes.h" "ICU Web headers") _freecad_web_require("${_freecad_web_icu_uc_library}" "ICU Web uc static library") _freecad_web_require("${_freecad_web_icu_i18n_library}" "ICU Web i18n static library") _freecad_web_require("${_freecad_web_icu_data_library}" "ICU Web data static library") _freecad_web_require("${_freecad_web_zlib_include}/zlib.h" "zlib Web headers") _freecad_web_require("${_freecad_web_zlib_library}" "zlib Web static library") _freecad_web_require("${_freecad_web_xerces_include}/xercesc/util/PlatformUtils.hpp" "Xerces-C Web headers") _freecad_web_require("${_freecad_web_xerces_library}" "Xerces-C Web static library") _freecad_web_require("${_freecad_web_occt_dir}/OpenCASCADEConfig.cmake" "OpenCASCADE Web CMake package") _freecad_web_require("${FREECAD_WEB_OCCT_ROOT}/include/opencascade/Standard_Version.hxx" "OpenCASCADE Web headers") _freecad_web_require("${FREECAD_WEB_OCCT_ROOT}/lib/libTKernel.a" "OpenCASCADE Web foundation library") if(FREECAD_WEB_ENABLE_CLOUD) _freecad_web_require("${_freecad_web_openssl_include}/openssl/opensslv.h" "OpenSSL Web headers") _freecad_web_require("${_freecad_web_openssl_crypto}" "OpenSSL Web crypto static library") _freecad_web_require("${_freecad_web_openssl_ssl}" "OpenSSL Web TLS static library") _freecad_web_require("${_freecad_web_curl_include}/curl/curl.h" "CURL Web headers") _freecad_web_require("${_freecad_web_curl_library}" "CURL Web static library") endif() if(NOT FREECAD_WEB_HOST_PYTHON_EXECUTABLE) find_program(_freecad_web_host_python NAMES python3.12 python3) if(NOT _freecad_web_host_python) message(FATAL_ERROR "FREECAD_WEB needs a native Python 3.12 interpreter for configure-time generators. " "Set FREECAD_WEB_HOST_PYTHON_EXECUTABLE.") endif() set(FREECAD_WEB_HOST_PYTHON_EXECUTABLE "${_freecad_web_host_python}" CACHE FILEPATH "Native Python used for configure-time generators in a Web build" FORCE) endif() # Emscripten's package root mode excludes arbitrary host paths, so direct the # package lookups at the validated target installations. Python deliberately # combines a native interpreter with WebAssembly development artifacts. set("yaml-cpp_DIR" "${_freecad_web_yaml_dir}" CACHE PATH "Web yaml-cpp package" FORCE) set(EIGEN3_INCLUDE_DIR "${_freecad_web_eigen_include}" CACHE PATH "Eigen Web headers" FORCE) set(Boost_ROOT "${FREECAD_WEB_BOOST_ROOT}" CACHE PATH "Boost Web installation prefix" FORCE) set(BOOST_ROOT "${FREECAD_WEB_BOOST_ROOT}" CACHE PATH "Boost Web installation prefix" FORCE) set(Boost_NO_SYSTEM_PATHS ON CACHE BOOL "Use only the Boost Web installation" FORCE) set(Boost_USE_STATIC_LIBS ON CACHE BOOL "Use Boost Web static libraries" FORCE) set(Boost_USE_MULTITHREADED OFF CACHE BOOL "Use single-threaded Boost Web libraries" FORCE) set(Boost_INCLUDE_DIR "${_freecad_web_boost_include}" CACHE PATH "Boost Web headers" FORCE) set(Boost_LIBRARY_DIR "${_freecad_web_boost_library_dir}" CACHE PATH "Boost Web libraries" FORCE) set(Qt5_DIR "${_freecad_web_qt_cmake_root}/Qt5" CACHE PATH "Web Qt5 package" FORCE) list(PREPEND CMAKE_PREFIX_PATH "${_freecad_web_qt_cmake_root}") set(_freecad_web_qt_components Core Network Xml) if(FREECAD_WEB_ENABLE_TECHDRAW_NATIVE) list(APPEND _freecad_web_qt_components Gui Widgets Concurrent) endif() foreach(_freecad_web_qt_component IN LISTS _freecad_web_qt_components) set("Qt5${_freecad_web_qt_component}_DIR" "${_freecad_web_qt_cmake_root}/Qt5${_freecad_web_qt_component}" CACHE PATH "Web Qt5${_freecad_web_qt_component} package" FORCE) endforeach() unset(_freecad_web_qt_components) set(Python3_EXECUTABLE "${FREECAD_WEB_HOST_PYTHON_EXECUTABLE}" CACHE FILEPATH "Native Python for Web configure-time generators" FORCE) set(Python3_INCLUDE_DIR "${_freecad_web_python_include}" CACHE PATH "CPython Web development headers" FORCE) set(Python3_LIBRARY "${_freecad_web_python_library}" CACHE FILEPATH "CPython Web static library" FORCE) set(ICU_ROOT "${FREECAD_WEB_ICU_ROOT}" CACHE PATH "Web ICU installation prefix" FORCE) set(ICU_INCLUDE_DIR "${_freecad_web_icu_include}" CACHE PATH "Web ICU headers" FORCE) set(ICU_UC_LIBRARY "${_freecad_web_icu_uc_library}" CACHE FILEPATH "Web ICU uc library" FORCE) set(ICU_UC_LIBRARY_RELEASE "${_freecad_web_icu_uc_library}" CACHE FILEPATH "Web ICU uc release library" FORCE) set(ICU_I18N_LIBRARY "${_freecad_web_icu_i18n_library}" CACHE FILEPATH "Web ICU i18n library" FORCE) set(ICU_I18N_LIBRARY_RELEASE "${_freecad_web_icu_i18n_library}" CACHE FILEPATH "Web ICU i18n release library" FORCE) set(FREECAD_WEB_ICU_DATA_LIBRARY "${_freecad_web_icu_data_library}" CACHE FILEPATH "Web ICU data static library" FORCE) set(ZLIB_ROOT "${FREECAD_WEB_ZLIB_ROOT}" CACHE PATH "zlib Web installation prefix" FORCE) set(ZLIB_USE_STATIC_LIBS ON CACHE BOOL "Use the zlib Web static library" FORCE) set(ZLIB_INCLUDE_DIR "${_freecad_web_zlib_include}" CACHE PATH "zlib Web headers" FORCE) set(ZLIB_LIBRARY "${_freecad_web_zlib_library}" CACHE FILEPATH "zlib Web static library" FORCE) set(ZLIB_LIBRARY_RELEASE "${_freecad_web_zlib_library}" CACHE FILEPATH "zlib Web release library" FORCE) set(XercesC_INCLUDE_DIR "${_freecad_web_xerces_include}" CACHE PATH "Xerces-C Web headers" FORCE) set(XercesC_LIBRARY "${_freecad_web_xerces_library}" CACHE FILEPATH "Xerces-C Web static library" FORCE) set(OpenCASCADE_DIR "${_freecad_web_occt_dir}" CACHE PATH "OpenCASCADE Web CMake package" FORCE) set(OCCT_CMAKE_FALLBACK OFF CACHE BOOL "Use the OpenCASCADE Web CMake package" FORCE) if(FREECAD_WEB_ENABLE_CLOUD) set(OPENSSL_ROOT_DIR "${FREECAD_WEB_OPENSSL_ROOT}" CACHE PATH "OpenSSL Web installation prefix" FORCE) set(OPENSSL_USE_STATIC_LIBS TRUE CACHE BOOL "Use OpenSSL Web static libraries" FORCE) set(OPENSSL_INCLUDE_DIR "${_freecad_web_openssl_include}" CACHE PATH "OpenSSL Web headers" FORCE) set(OPENSSL_CRYPTO_LIBRARY "${_freecad_web_openssl_crypto}" CACHE FILEPATH "OpenSSL Web crypto static library" FORCE) set(OPENSSL_SSL_LIBRARY "${_freecad_web_openssl_ssl}" CACHE FILEPATH "OpenSSL Web TLS static library" FORCE) set(CURL_NO_CURL_CMAKE ON CACHE BOOL "Use CMake's FindCURL for the Web archive" FORCE) set(CURL_USE_STATIC_LIBS ON CACHE BOOL "Use the CURL Web static library" FORCE) set(CURL_INCLUDE_DIR "${_freecad_web_curl_include}" CACHE PATH "CURL Web headers" FORCE) set(CURL_LIBRARY "${_freecad_web_curl_library}" CACHE FILEPATH "CURL Web static library" FORCE) set(CURL_LIBRARY_RELEASE "${_freecad_web_curl_library}" CACHE FILEPATH "CURL Web release static library" FORCE) endif() unset(_freecad_web_yaml_dir) unset(_freecad_web_eigen_include) unset(_freecad_web_boost_include) unset(_freecad_web_boost_library_dir) unset(_freecad_web_qt_cmake_root) unset(_freecad_web_python_include) unset(_freecad_web_python_library) unset(_freecad_web_icu_include) unset(_freecad_web_icu_uc_library) unset(_freecad_web_icu_i18n_library) unset(_freecad_web_icu_data_library) unset(_freecad_web_zlib_include) unset(_freecad_web_zlib_library) unset(_freecad_web_xerces_include) unset(_freecad_web_xerces_library) unset(_freecad_web_occt_dir) unset(_freecad_web_openssl_include) unset(_freecad_web_openssl_crypto) unset(_freecad_web_openssl_ssl) unset(_freecad_web_curl_include) unset(_freecad_web_curl_library) unset(_freecad_web_host_python)