Testing - WebAssembly build validation #256

Add WebAssembly build workflow for Ubuntu and update CMake warnings for OpenGL usage
Add workaround for platform-specific macros setup before project command
Update CMake configuration for Emscripten and Android toolchains;
Disable default features for vcpkg manifest
Update GitHub workflows to support multiple build types and improve compiler flag handling
Disabled DETools module for Emscripten support in CMake configuration
This commit is contained in:
Pasukhin Dmitry
2025-02-14 17:08:45 +01:00
committed by GitHub
parent 67bd61d4d3
commit 5b574af01f
6 changed files with 193 additions and 48 deletions

View File

@@ -32,6 +32,30 @@ if (BUILD_USE_VCPKG)
endif()
set (VCPKG_MANIFEST_DIR "${CMAKE_SOURCE_DIR}/adm/vcpkg")
# Disable default features for vcpkg manifest
set (VCPKG_MANIFEST_NO_DEFAULT_FEATURES 1)
# detection for Emscripten toolchain
if(CMAKE_TOOLCHAIN_FILE MATCHES ".*mscripten\.cmake$" OR "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" MATCHES ".*mscripten\.cmake$")
set(EMSCRIPTEN 1)
endif()
# detection for Android toolchain
if(CMAKE_TOOLCHAIN_FILE MATCHES ".*ndroid\.toolchain\.cmake$" OR "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" MATCHES ".*ndroid\.toolchain\.cmake$")
set(ANDROID 1)
endif()
# detection for android common variables
if (NOT "${CMAKE_ANDROID_NDK}" STREQUAL "" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Android" OR NOT "${ANDROID_NDK}" STREQUAL "")
set (ANDROID 1)
endif()
else()
# Setting up the system and compiler specific variables.
# Can't be done on early stages with VCPKG enabled.
# VCPKG installing dependencies as soon as call PROJECT,
# but for then moment need to define required list of dependencies.
PROJECT (OCCT)
endif()
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/adm/cmake")
@@ -99,6 +123,11 @@ else()
"Please use our contact form at https://occt3d.com/")
unset (BUILD_SHARED_LIBS)
unset (BUILD_SHARED_LIBRARY_NAME_POSTFIX)
if (BUILD_OPT_PROFILE STREQUAL "Production")
set (BUILD_OPT_PROFILE "Default" CACHE STRING "Select profile for compiler and linker." FORCE)
message(WARNING "Static libraries are not optimized for production builds. "
"Please use shared libraries for production builds.")
endif()
endif()
if (WIN32)
@@ -378,6 +407,10 @@ if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" AND BUILD_MODULE_Draw)
message (STATUS "Info. Draw module is turned off due to it is not supported on UWP")
set (BUILD_MODULE_Draw OFF CACHE BOOL "${BUILD_MODULE_Draw_DESCR}" FORCE)
endif()
if (EMSCRIPTEN AND BUILD_MODULE_DETools)
message (STATUS "Info. DETools module is turned off due to it is not supported on Emscripten")
set (BUILD_MODULE_DETools OFF CACHE BOOL "${BUILD_MODULE_DETools_DESCR}" FORCE)
endif()
# accumulate used toolkits (first level) in BUILD_TOOLKITS variable
list (APPEND BUILD_TOOLKITS ${BUILD_ADDITIONAL_TOOLKITS})
@@ -587,7 +620,9 @@ if (CAN_USE_GLES2 AND USE_GLES2)
if (NOT IOS)
list (APPEND OCCT_3RDPARTY_CMAKE_LIST "adm/cmake/egl")
list (APPEND OCCT_3RDPARTY_CMAKE_LIST "adm/cmake/gles2")
OCCT_ADD_VCPKG_FEATURE ("angle")
if (NOT EMSCRIPTEN)
OCCT_ADD_VCPKG_FEATURE ("angle")
endif()
endif()
else()
if (NOT CAN_USE_GLES2)
@@ -729,8 +764,12 @@ else()
OCCT_CHECK_AND_UNSET ("INSTALL_QT")
endif()
# the name of the project
project (OCCT)
# VCPKG require delayed processing of 3rdparty.
# That is why we delay the creating project and setting up
# the platform specific variables.
if (BUILD_USE_VCPKG)
project (OCCT)
endif()
# copying clang-format file to the root of the project
file(COPY ${CMAKE_SOURCE_DIR}/.clang-format DESTINATION ${CMAKE_SOURCE_DIR})