Files
workinf_Blender_Wasm/web/engine/CMakeLists.txt
mes123456 7c16b279ae
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
Advance M7 workflows and release operations
2026-08-15 17:43:53 -04:00

37 lines
1.7 KiB
CMake

cmake_minimum_required(VERSION 3.24)
project(blender_web_engine LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(WITH_WEB ON CACHE BOOL "Build the browser Blender engine")
option(WEB_ENGINE_THREADS "Build the pthread variant" OFF)
include("${CMAKE_CURRENT_LIST_DIR}/../../blender-5.2.0/build_files/cmake/platform/web.cmake")
if(WEB_ENGINE_THREADS)
add_compile_options(-pthread)
add_link_options(-pthread -sPTHREAD_POOL_SIZE=1)
endif()
add_library(blender_web_engine_core STATIC
"${CMAKE_CURRENT_LIST_DIR}/../../blender-5.2.0/source/blender/web_engine/web_engine_api.cpp"
"${CMAKE_CURRENT_LIST_DIR}/web_engine_native_reader_stub.cpp"
)
target_include_directories(blender_web_engine_core PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/../../blender-5.2.0/source/blender/web_engine"
"${CMAKE_CURRENT_LIST_DIR}/../../blender-5.2.0/extern/json/include"
)
add_executable(web_engine web_engine_smoke.cpp)
target_link_libraries(web_engine PRIVATE blender_web_engine_core)
set(WEB_ENGINE_EXPORTED_RUNTIME_METHODS "['ccall','cwrap']")
if(WEB_ENGINE_THREADS)
set(WEB_ENGINE_EXPORTED_RUNTIME_METHODS "['ccall','cwrap','PThread']")
endif()
target_link_options(web_engine PRIVATE
"-sEXPORTED_FUNCTIONS=['_malloc','_free','_web_engine_create','_web_engine_destroy','_web_engine_get_memory_stats','_web_engine_get_live_handles','_web_engine_get_allocated_bytes','_web_engine_open_blend','_web_engine_apply_command','_web_engine_get_scene_snapshot','_web_engine_save_blend','_web_engine_free_buffer','_web_engine_last_error_code','_web_engine_last_error_message']"
"-sEXPORTED_RUNTIME_METHODS=${WEB_ENGINE_EXPORTED_RUNTIME_METHODS}"
)
set_target_properties(web_engine PROPERTIES OUTPUT_NAME "web_engine")