Add Chromium-only Blender WebEngine parity work
This commit is contained in:
@@ -0,0 +1,516 @@
|
||||
# SPDX-FileCopyrightText: 2024 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Common modern targets for the blender dependencies
|
||||
#
|
||||
# The optional dependencies in the bf::dependencies::optional namespace
|
||||
# will always exist, but will only be populated if the dep is actually
|
||||
# enabled. Doing it this way, prevents us from having to sprinkle
|
||||
# if(WITH_SOMEDEP) all over cmake, and you can just add
|
||||
# `bf::dependencies::optional::somedep` to the LIB section without
|
||||
# having to worry if it's enabled or not at the consumer site.
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure TBB
|
||||
|
||||
add_library(bf_deps_optional_tbb INTERFACE)
|
||||
add_library(bf::dependencies::optional::tbb ALIAS bf_deps_optional_tbb)
|
||||
|
||||
if(WITH_TBB)
|
||||
target_compile_definitions(bf_deps_optional_tbb INTERFACE WITH_TBB)
|
||||
target_include_directories(bf_deps_optional_tbb SYSTEM INTERFACE ${TBB_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_tbb INTERFACE ${TBB_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Manifold
|
||||
|
||||
add_library(bf_deps_optional_manifold INTERFACE)
|
||||
add_library(bf::dependencies::optional::manifold ALIAS bf_deps_optional_manifold)
|
||||
if(WITH_MANIFOLD)
|
||||
if(WIN32)
|
||||
target_compile_definitions(bf_deps_optional_manifold INTERFACE WITH_MANIFOLD)
|
||||
target_include_directories(bf_deps_optional_manifold SYSTEM INTERFACE ${MANIFOLD_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_manifold INTERFACE ${MANIFOLD_LIBRARIES} bf::dependencies::optional::tbb)
|
||||
else()
|
||||
if(TARGET manifold::manifold)
|
||||
target_compile_definitions(bf_deps_optional_manifold INTERFACE WITH_MANIFOLD)
|
||||
target_link_libraries(bf_deps_optional_manifold INTERFACE manifold::manifold)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure OpenVDB
|
||||
|
||||
add_library(bf_deps_optional_openvdb INTERFACE)
|
||||
add_library(bf::dependencies::optional::openvdb ALIAS bf_deps_optional_openvdb)
|
||||
|
||||
if(WITH_OPENVDB)
|
||||
target_compile_definitions(bf_deps_optional_openvdb INTERFACE WITH_OPENVDB)
|
||||
if(WITH_OPENVDB_BLOSC)
|
||||
target_compile_definitions(bf_deps_optional_openvdb INTERFACE WITH_OPENVDB_BLOSC)
|
||||
endif()
|
||||
if(WITH_OPENVDB_3_ABI_COMPATIBLE)
|
||||
target_compile_definitions(bf_deps_optional_openvdb INTERFACE OPENVDB_3_ABI_COMPATIBLE)
|
||||
endif()
|
||||
|
||||
target_include_directories(bf_deps_optional_openvdb SYSTEM INTERFACE ${OPENVDB_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_openvdb
|
||||
INTERFACE
|
||||
${OPENVDB_LIBRARIES}
|
||||
bf::dependencies::optional::tbb
|
||||
)
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Ceres
|
||||
add_library(bf_deps_optional_ceres INTERFACE)
|
||||
add_library(bf::dependencies::optional::ceres ALIAS bf_deps_optional_ceres)
|
||||
|
||||
if(TARGET Ceres::ceres)
|
||||
target_compile_definitions(bf_deps_optional_ceres INTERFACE WITH_CERES)
|
||||
target_link_libraries(bf_deps_optional_ceres INTERFACE Ceres::ceres)
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Eigen
|
||||
|
||||
add_library(bf_deps_eigen INTERFACE)
|
||||
add_library(bf::dependencies::eigen ALIAS bf_deps_eigen)
|
||||
target_link_libraries(bf_deps_eigen INTERFACE Eigen3::Eigen)
|
||||
|
||||
if(WITH_TBB)
|
||||
target_compile_definitions(bf_deps_eigen INTERFACE EIGEN_HAS_TBB)
|
||||
target_include_directories(bf_deps_eigen SYSTEM INTERFACE ${TBB_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_eigen INTERFACE ${TBB_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure OpenColorIO
|
||||
|
||||
add_library(bf::dependencies::opencolorio ALIAS OpenColorIO::OpenColorIO)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Zlib
|
||||
|
||||
add_library(bf_deps_zlib INTERFACE)
|
||||
add_library(bf::dependencies::zlib ALIAS bf_deps_zlib)
|
||||
|
||||
target_include_directories(bf_deps_zlib SYSTEM INTERFACE ${ZLIB_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_zlib INTERFACE ${ZLIB_LIBRARIES})
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure ZSTD
|
||||
|
||||
add_library(bf_deps_zstd INTERFACE)
|
||||
add_library(bf::dependencies::zstd ALIAS bf_deps_zstd)
|
||||
|
||||
target_include_directories(bf_deps_zstd SYSTEM INTERFACE ${ZSTD_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_zstd INTERFACE ${ZSTD_LIBRARIES})
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Freetype
|
||||
|
||||
add_library(bf_deps_freetype INTERFACE)
|
||||
add_library(bf::dependencies::freetype ALIAS bf_deps_freetype)
|
||||
|
||||
target_include_directories(bf_deps_freetype SYSTEM INTERFACE ${FREETYPE_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_freetype INTERFACE ${FREETYPE_LIBRARIES} ${BROTLI_LIBRARIES})
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure JPEG
|
||||
|
||||
add_library(bf_deps_jpeg INTERFACE)
|
||||
add_library(bf::dependencies::jpeg ALIAS bf_deps_jpeg)
|
||||
|
||||
target_include_directories(bf_deps_jpeg SYSTEM INTERFACE ${JPEG_INCLUDE_DIR})
|
||||
target_link_libraries(bf_deps_jpeg INTERFACE ${JPEG_LIBRARIES})
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure PNG
|
||||
|
||||
add_library(bf_deps_png INTERFACE)
|
||||
add_library(bf::dependencies::png ALIAS bf_deps_png)
|
||||
|
||||
target_include_directories(bf_deps_png SYSTEM INTERFACE ${PNG_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_png INTERFACE ${PNG_LIBRARIES})
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure OpenImageIO
|
||||
|
||||
add_library(bf::dependencies::openimageio ALIAS OpenImageIO::OpenImageIO)
|
||||
get_target_property(OPENIMAGEIO_TOOL OpenImageIO::oiiotool LOCATION)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure USD
|
||||
|
||||
add_library(bf_deps_optional_usd INTERFACE)
|
||||
add_library(bf::dependencies::optional::usd ALIAS bf_deps_optional_usd)
|
||||
|
||||
if(WITH_USD)
|
||||
target_compile_definitions(bf_deps_optional_usd INTERFACE WITH_USD)
|
||||
target_include_directories(bf_deps_optional_usd SYSTEM INTERFACE ${USD_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_usd INTERFACE ${USD_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Alembic
|
||||
|
||||
add_library(bf_deps_optional_alembic INTERFACE)
|
||||
add_library(bf::dependencies::optional::alembic ALIAS bf_deps_optional_alembic)
|
||||
|
||||
if(WITH_ALEMBIC)
|
||||
target_compile_definitions(bf_deps_optional_alembic INTERFACE WITH_ALEMBIC)
|
||||
target_include_directories(bf_deps_optional_alembic SYSTEM INTERFACE ${ALEMBIC_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_alembic INTERFACE ${ALEMBIC_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure OpenSubdiv
|
||||
|
||||
add_library(bf_deps_optional_opensubdiv INTERFACE)
|
||||
add_library(bf::dependencies::optional::opensubdiv ALIAS bf_deps_optional_opensubdiv)
|
||||
|
||||
if(WITH_OPENSUBDIV)
|
||||
target_compile_definitions(bf_deps_optional_opensubdiv INTERFACE WITH_OPENSUBDIV)
|
||||
target_include_directories(bf_deps_optional_opensubdiv SYSTEM INTERFACE ${OPENSUBDIV_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_opensubdiv INTERFACE ${OPENSUBDIV_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure OpenEXR
|
||||
|
||||
add_library(bf::dependencies::openexr ALIAS OpenEXR::OpenEXR)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure WebP
|
||||
|
||||
add_library(bf_deps_optional_webp INTERFACE)
|
||||
add_library(bf::dependencies::optional::webp ALIAS bf_deps_optional_webp)
|
||||
|
||||
if(WITH_IMAGE_WEBP)
|
||||
target_compile_definitions(bf_deps_optional_webp INTERFACE WITH_IMAGE_WEBP)
|
||||
target_include_directories(bf_deps_optional_webp SYSTEM INTERFACE ${WEBP_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_webp INTERFACE ${WEBP_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure OpenJPEG
|
||||
|
||||
add_library(bf_deps_optional_openjpeg INTERFACE)
|
||||
add_library(bf::dependencies::optional::openjpeg ALIAS bf_deps_optional_openjpeg)
|
||||
|
||||
if(WITH_IMAGE_OPENJPEG)
|
||||
target_compile_definitions(bf_deps_optional_openjpeg INTERFACE WITH_IMAGE_OPENJPEG)
|
||||
target_compile_definitions(bf_deps_optional_openjpeg INTERFACE ${OPENJPEG_DEFINES})
|
||||
target_include_directories(bf_deps_optional_openjpeg SYSTEM INTERFACE ${OPENJPEG_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_openjpeg INTERFACE ${OPENJPEG_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure SDL
|
||||
|
||||
add_library(bf_deps_optional_sdl INTERFACE)
|
||||
add_library(bf::dependencies::optional::sdl ALIAS bf_deps_optional_sdl)
|
||||
|
||||
if(WITH_SDL)
|
||||
target_link_libraries(bf_deps_optional_sdl INTERFACE SDL3::SDL3)
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure FFmpeg
|
||||
|
||||
add_library(bf_deps_optional_ffmpeg INTERFACE)
|
||||
add_library(bf::dependencies::optional::ffmpeg ALIAS bf_deps_optional_ffmpeg)
|
||||
|
||||
if(WITH_CODEC_FFMPEG)
|
||||
target_compile_definitions(bf_deps_optional_ffmpeg INTERFACE WITH_FFMPEG)
|
||||
target_include_directories(bf_deps_optional_ffmpeg SYSTEM INTERFACE ${FFMPEG_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_ffmpeg INTERFACE ${FFMPEG_LIBRARIES})
|
||||
if(WITH_IMAGE_OPENJPEG)
|
||||
target_link_libraries(bf_deps_optional_ffmpeg INTERFACE ${OPENJPEG_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Python
|
||||
|
||||
add_library(bf_deps_optional_python INTERFACE)
|
||||
add_library(bf::dependencies::optional::python ALIAS bf_deps_optional_python)
|
||||
|
||||
if(WITH_PYTHON)
|
||||
target_compile_definitions(bf_deps_optional_python INTERFACE WITH_PYTHON)
|
||||
target_include_directories(bf_deps_optional_python SYSTEM INTERFACE ${PYTHON_INCLUDE_DIR})
|
||||
target_link_libraries(bf_deps_optional_python INTERFACE ${PYTHON_LINKFLAGS})
|
||||
if(WITH_PYTHON_MODULE)
|
||||
target_compile_definitions(bf_deps_optional_python INTERFACE WITH_PYTHON_MODULE)
|
||||
else()
|
||||
target_link_libraries(bf_deps_optional_python INTERFACE ${PYTHON_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure GMP
|
||||
|
||||
add_library(bf_deps_optional_gmp INTERFACE)
|
||||
add_library(bf::dependencies::optional::gmp ALIAS bf_deps_optional_gmp)
|
||||
|
||||
if(WITH_GMP)
|
||||
target_compile_definitions(bf_deps_optional_gmp INTERFACE WITH_GMP)
|
||||
target_include_directories(bf_deps_optional_gmp SYSTEM INTERFACE ${GMP_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_gmp INTERFACE ${GMP_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure PugiXML
|
||||
|
||||
add_library(bf_deps_optional_pugixml INTERFACE)
|
||||
add_library(bf::dependencies::optional::pugixml ALIAS bf_deps_optional_pugixml)
|
||||
|
||||
if(WITH_PUGIXML)
|
||||
target_compile_definitions(bf_deps_optional_pugixml INTERFACE WITH_PUGIXML)
|
||||
target_include_directories(bf_deps_optional_pugixml SYSTEM INTERFACE ${PUGIXML_INCLUDE_DIR})
|
||||
target_link_libraries(bf_deps_optional_pugixml INTERFACE ${PUGIXML_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Haru
|
||||
|
||||
add_library(bf_deps_optional_haru INTERFACE)
|
||||
add_library(bf::dependencies::optional::haru ALIAS bf_deps_optional_haru)
|
||||
|
||||
if(WITH_HARU)
|
||||
target_compile_definitions(bf_deps_optional_haru INTERFACE WITH_HARU)
|
||||
target_include_directories(bf_deps_optional_haru SYSTEM INTERFACE ${HARU_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_haru INTERFACE ${HARU_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Vulkan
|
||||
|
||||
add_library(bf_deps_optional_vulkan INTERFACE)
|
||||
add_library(bf::dependencies::optional::vulkan ALIAS bf_deps_optional_vulkan)
|
||||
|
||||
if(WITH_VULKAN_BACKEND)
|
||||
target_include_directories(bf_deps_optional_vulkan SYSTEM INTERFACE ${VULKAN_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_vulkan INTERFACE ${VULKAN_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure ShaderC
|
||||
|
||||
add_library(bf_deps_optional_shaderc INTERFACE)
|
||||
add_library(bf::dependencies::optional::shaderc ALIAS bf_deps_optional_shaderc)
|
||||
|
||||
if(WITH_VULKAN_BACKEND)
|
||||
target_compile_definitions(bf_deps_optional_shaderc INTERFACE WITH_SHADERC)
|
||||
target_include_directories(bf_deps_optional_shaderc SYSTEM INTERFACE ${SHADERC_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_shaderc INTERFACE ${SHADERC_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Embree
|
||||
|
||||
add_library(bf_deps_optional_embree INTERFACE)
|
||||
add_library(bf::dependencies::optional::embree ALIAS bf_deps_optional_embree)
|
||||
|
||||
if(WITH_CYCLES_EMBREE)
|
||||
target_include_directories(bf_deps_optional_embree SYSTEM INTERFACE ${EMBREE_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_embree INTERFACE ${EMBREE_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure OpenPGL
|
||||
|
||||
add_library(bf_deps_optional_openpgl INTERFACE)
|
||||
add_library(bf::dependencies::optional::openpgl ALIAS bf_deps_optional_openpgl)
|
||||
|
||||
if(WITH_CYCLES_PATH_GUIDING)
|
||||
target_include_directories(bf_deps_optional_openpgl SYSTEM INTERFACE ${OPENPGL_INCLUDE_DIR})
|
||||
target_link_libraries(bf_deps_optional_openpgl INTERFACE ${OPENPGL_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure NanoVDB
|
||||
|
||||
add_library(bf_deps_optional_nanovdb INTERFACE)
|
||||
add_library(bf::dependencies::optional::nanovdb ALIAS bf_deps_optional_nanovdb)
|
||||
|
||||
if(WITH_NANOVDB)
|
||||
target_include_directories(bf_deps_optional_nanovdb SYSTEM INTERFACE ${NANOVDB_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Epoxy
|
||||
|
||||
add_library(bf_deps_epoxy INTERFACE)
|
||||
add_library(bf::dependencies::epoxy ALIAS bf_deps_epoxy)
|
||||
|
||||
target_include_directories(bf_deps_epoxy SYSTEM INTERFACE ${EPOXY_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_epoxy INTERFACE ${EPOXY_LIBRARIES})
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Gflags
|
||||
|
||||
add_library(bf_deps_gflags INTERFACE)
|
||||
add_library(bf::dependencies::gflags ALIAS bf_deps_gflags)
|
||||
|
||||
if(WITH_LIBMV OR WITH_GTESTS)
|
||||
target_compile_definitions(bf_deps_gflags INTERFACE ${GFLAGS_DEFINES})
|
||||
target_include_directories(bf_deps_gflags SYSTEM INTERFACE ${GFLAGS_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_gflags INTERFACE ${GFLAGS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Glog
|
||||
|
||||
add_library(bf_deps_glog INTERFACE)
|
||||
add_library(bf::dependencies::glog ALIAS bf_deps_glog)
|
||||
|
||||
if(WITH_LIBMV OR WITH_GTESTS)
|
||||
target_compile_definitions(bf_deps_glog INTERFACE ${GLOG_DEFINES})
|
||||
target_include_directories(bf_deps_glog SYSTEM INTERFACE ${GLOG_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_glog INTERFACE ${GLOG_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure OpenImageDenoise
|
||||
|
||||
add_library(bf_deps_optional_openimagedenoise INTERFACE)
|
||||
add_library(bf::dependencies::optional::openimagedenoise ALIAS bf_deps_optional_openimagedenoise)
|
||||
|
||||
if(WITH_OPENIMAGEDENOISE)
|
||||
target_compile_definitions(bf_deps_optional_openimagedenoise INTERFACE WITH_OPENIMAGEDENOISE)
|
||||
target_compile_definitions(bf_deps_optional_openimagedenoise INTERFACE OIDN_STATIC_LIB)
|
||||
target_include_directories(bf_deps_optional_openimagedenoise SYSTEM INTERFACE ${OPENIMAGEDENOISE_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_openimagedenoise INTERFACE ${OPENIMAGEDENOISE_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure FFTW3
|
||||
|
||||
add_library(bf_deps_optional_fftw3 INTERFACE)
|
||||
add_library(bf::dependencies::optional::fftw3 ALIAS bf_deps_optional_fftw3)
|
||||
|
||||
if(WITH_FFTW3)
|
||||
target_compile_definitions(bf_deps_optional_fftw3 INTERFACE WITH_FFTW3)
|
||||
target_include_directories(bf_deps_optional_fftw3 SYSTEM INTERFACE ${FFTW3_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_fftw3 INTERFACE ${FFTW3_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Bullet
|
||||
|
||||
add_library(bf_deps_optional_bullet INTERFACE)
|
||||
add_library(bf::dependencies::optional::bullet ALIAS bf_deps_optional_bullet)
|
||||
|
||||
if(WITH_BULLET)
|
||||
target_compile_definitions(bf_deps_optional_bullet INTERFACE WITH_BULLET)
|
||||
target_include_directories(bf_deps_optional_bullet SYSTEM INTERFACE ${BULLET_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_bullet INTERFACE ${BULLET_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Audaspace
|
||||
|
||||
add_library(bf_deps_optional_audaspace INTERFACE)
|
||||
add_library(bf::dependencies::optional::audaspace ALIAS bf_deps_optional_audaspace)
|
||||
|
||||
if(WITH_AUDASPACE)
|
||||
target_compile_definitions(bf_deps_optional_audaspace INTERFACE WITH_AUDASPACE)
|
||||
if(WITH_RUBBERBAND)
|
||||
target_compile_definitions(bf_deps_optional_audaspace INTERFACE WITH_RUBBERBAND)
|
||||
endif()
|
||||
target_include_directories(bf_deps_optional_audaspace SYSTEM INTERFACE ${AUDASPACE_C_INCLUDE_DIRS} ${AUDASPACE_PY_INCLUDE_DIRS})
|
||||
if(WITH_SYSTEM_AUDASPACE)
|
||||
target_link_libraries(bf_deps_optional_audaspace INTERFACE ${AUDASPACE_LIBRARIES} ${AUDASPACE_PY_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries(bf_deps_optional_audaspace INTERFACE audaspace audaspace-py)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Potrace
|
||||
|
||||
add_library(bf_deps_optional_potrace INTERFACE)
|
||||
add_library(bf::dependencies::optional::potrace ALIAS bf_deps_optional_potrace)
|
||||
|
||||
if(WITH_POTRACE)
|
||||
target_compile_definitions(bf_deps_optional_potrace INTERFACE WITH_POTRACE)
|
||||
target_include_directories(bf_deps_optional_potrace SYSTEM INTERFACE ${POTRACE_INCLUDE_DIRS})
|
||||
target_link_libraries(bf_deps_optional_potrace INTERFACE ${POTRACE_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Pthreads
|
||||
#
|
||||
add_library(bf_deps_pthreads INTERFACE)
|
||||
add_library(bf::dependencies::pthreads ALIAS bf_deps_pthreads)
|
||||
|
||||
# Include directories on non-Windows are handled globally.
|
||||
if(WIN32 AND NOT UNIX)
|
||||
target_include_directories(bf_deps_pthreads SYSTEM INTERFACE ${PTHREADS_INC})
|
||||
endif()
|
||||
if(DEFINED PTHREADS_LIBRARIES)
|
||||
target_link_libraries(bf_deps_pthreads INTERFACE ${PTHREADS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure libfmt
|
||||
#
|
||||
|
||||
add_library(bf::dependencies::fmt ALIAS fmt::fmt)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure OSL
|
||||
|
||||
if(WITH_CYCLES_OSL)
|
||||
add_library(bf_deps_optional_osl INTERFACE)
|
||||
target_link_libraries(bf_deps_optional_osl INTERFACE OSL::oslcomp OSL::oslquery OSL::oslnoise)
|
||||
# Link oslexec with the -force_load flag on macOS.
|
||||
if(APPLE)
|
||||
target_link_libraries(bf_deps_optional_osl INTERFACE -force_load OSL::oslexec)
|
||||
else()
|
||||
target_link_libraries(bf_deps_optional_osl INTERFACE OSL::oslexec)
|
||||
endif()
|
||||
add_library(bf::dependencies::optional::osl ALIAS bf_deps_optional_osl)
|
||||
get_target_property(OSL_COMPILER OSL::oslc LOCATION)
|
||||
else()
|
||||
add_library(bf_deps_optional_osl INTERFACE)
|
||||
add_library(bf::dependencies::optional::osl ALIAS bf_deps_optional_osl)
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure Draco
|
||||
|
||||
add_library(bf_deps_optional_draco INTERFACE)
|
||||
add_library(bf::dependencies::optional::draco ALIAS bf_deps_optional_draco)
|
||||
|
||||
if(TARGET draco::draco)
|
||||
target_compile_definitions(bf_deps_optional_draco INTERFACE WITH_DRACO)
|
||||
target_link_libraries(bf_deps_optional_draco INTERFACE draco::draco)
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure meshoptimizer
|
||||
|
||||
add_library(bf_deps_optional_meshoptimizer INTERFACE)
|
||||
add_library(bf::dependencies::optional::meshoptimizer ALIAS bf_deps_optional_meshoptimizer)
|
||||
|
||||
if(TARGET meshoptimizer::meshoptimizer)
|
||||
target_compile_definitions(bf_deps_optional_meshoptimizer INTERFACE WITH_MESHOPTIMIZER)
|
||||
target_link_libraries(bf_deps_optional_meshoptimizer INTERFACE meshoptimizer::meshoptimizer)
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configure TracyClient
|
||||
|
||||
add_library(bf_deps_optional_tracy_client INTERFACE)
|
||||
add_library(bf::dependencies::optional::tracy_client ALIAS bf_deps_optional_tracy_client)
|
||||
|
||||
if(WITH_TRACY)
|
||||
target_compile_definitions(bf_deps_optional_tracy_client INTERFACE WITH_TRACY)
|
||||
target_link_libraries(bf_deps_optional_tracy_client INTERFACE Tracy::TracyClient)
|
||||
endif()
|
||||
508
blender-5.2.0/build_files/cmake/platform/platform_apple.cmake
Normal file
508
blender-5.2.0/build_files/cmake/platform/platform_apple.cmake
Normal file
@@ -0,0 +1,508 @@
|
||||
# SPDX-FileCopyrightText: 2016 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Libraries configuration for Apple.
|
||||
|
||||
function(find_package_wrapper)
|
||||
# do nothing, just satisfy the function
|
||||
endfunction()
|
||||
|
||||
function(print_found_status
|
||||
lib_name
|
||||
lib_path
|
||||
)
|
||||
|
||||
if(FIRST_RUN)
|
||||
if(lib_path)
|
||||
message(STATUS "Found ${lib_name}: ${lib_path}")
|
||||
else()
|
||||
message(WARNING "Could NOT find ${lib_name}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
# Find system provided libraries.
|
||||
|
||||
# Find system ZLIB
|
||||
set(ZLIB_ROOT /usr)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(BZip2 REQUIRED)
|
||||
list(APPEND ZLIB_LIBRARIES ${BZIP2_LIBRARIES})
|
||||
|
||||
if(WITH_OPENAL)
|
||||
find_package(OpenAL REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_JACK)
|
||||
find_library(JACK_FRAMEWORK
|
||||
NAMES jackmp
|
||||
)
|
||||
|
||||
if(JACK_FRAMEWORK)
|
||||
set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
|
||||
else()
|
||||
set_and_warn_library_found("JACK" JACK_FRAMEWORK WITH_JACK)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED LIBDIR)
|
||||
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
|
||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/lib/macos_x64)
|
||||
else()
|
||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/lib/macos_${CMAKE_OSX_ARCHITECTURES})
|
||||
endif()
|
||||
endif()
|
||||
if(NOT EXISTS "${LIBDIR}/.git")
|
||||
message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'")
|
||||
endif()
|
||||
if(FIRST_RUN)
|
||||
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
|
||||
endif()
|
||||
|
||||
# Avoid searching for headers since this would otherwise override our lib
|
||||
# directory as well as PYTHON_ROOT_DIR.
|
||||
set(CMAKE_FIND_FRAMEWORK NEVER)
|
||||
|
||||
# Optionally use system Python if PYTHON_ROOT_DIR is specified.
|
||||
if(WITH_PYTHON)
|
||||
if(WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR)
|
||||
find_package(PythonLibsUnix REQUIRED)
|
||||
endif()
|
||||
else()
|
||||
# Python executable is needed as part of the build-process,
|
||||
# note that building without Python is quite unusual.
|
||||
find_program(PYTHON_EXECUTABLE "python3")
|
||||
endif()
|
||||
|
||||
# Prefer lib directory paths
|
||||
file(GLOB LIB_SUBDIRS ${LIBDIR}/*)
|
||||
set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS})
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Find precompiled libraries, and avoid system or user-installed ones.
|
||||
|
||||
if(EXISTS ${LIBDIR})
|
||||
include(platform_old_libs_update)
|
||||
without_system_libs_begin()
|
||||
endif()
|
||||
|
||||
if(WITH_ALEMBIC)
|
||||
find_package(Alembic)
|
||||
endif()
|
||||
|
||||
if(WITH_USD)
|
||||
find_package(USD REQUIRED)
|
||||
endif()
|
||||
add_bundled_libraries(usd/lib)
|
||||
|
||||
if(WITH_MATERIALX)
|
||||
find_package(MaterialX)
|
||||
set_and_warn_library_found("MaterialX" MaterialX_FOUND WITH_MATERIALX)
|
||||
endif()
|
||||
add_bundled_libraries(materialx/lib)
|
||||
|
||||
if(WITH_OPENSUBDIV)
|
||||
find_package(OpenSubdiv)
|
||||
endif()
|
||||
add_bundled_libraries(opensubdiv/lib)
|
||||
|
||||
if(WITH_CODEC_SNDFILE)
|
||||
find_package(SndFile)
|
||||
find_library(_sndfile_FLAC_LIBRARY NAMES flac HINTS ${LIBDIR}/sndfile/lib)
|
||||
find_library(_sndfile_OGG_LIBRARY NAMES ogg HINTS ${LIBDIR}/ffmpeg/lib)
|
||||
find_library(_sndfile_VORBIS_LIBRARY NAMES vorbis HINTS ${LIBDIR}/ffmpeg/lib)
|
||||
find_library(_sndfile_VORBISENC_LIBRARY NAMES vorbisenc HINTS ${LIBDIR}/ffmpeg/lib)
|
||||
list(APPEND LIBSNDFILE_LIBRARIES
|
||||
${_sndfile_FLAC_LIBRARY}
|
||||
${_sndfile_OGG_LIBRARY}
|
||||
${_sndfile_VORBIS_LIBRARY}
|
||||
${_sndfile_VORBISENC_LIBRARY}
|
||||
)
|
||||
|
||||
print_found_status("SndFile libraries" "${LIBSNDFILE_LIBRARIES}")
|
||||
unset(_sndfile_FLAC_LIBRARY)
|
||||
unset(_sndfile_OGG_LIBRARY)
|
||||
unset(_sndfile_VORBIS_LIBRARY)
|
||||
unset(_sndfile_VORBISENC_LIBRARY)
|
||||
endif()
|
||||
|
||||
if(WITH_PYTHON)
|
||||
if(NOT (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR))
|
||||
find_package(PythonLibsUnix REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_FFTW3)
|
||||
find_package(Fftw3)
|
||||
endif()
|
||||
|
||||
# FreeType compiled with Brotli compression for woff2.
|
||||
find_package(Freetype REQUIRED)
|
||||
set(BROTLI_LIBRARIES
|
||||
${LIBDIR}/brotli/lib/libbrotlicommon-static.a
|
||||
${LIBDIR}/brotli/lib/libbrotlidec-static.a
|
||||
)
|
||||
|
||||
if(WITH_HARFBUZZ)
|
||||
find_package(Harfbuzz)
|
||||
endif()
|
||||
|
||||
if(WITH_FRIBIDI)
|
||||
find_package(Fribidi)
|
||||
endif()
|
||||
|
||||
# Header dependency of required OpenImageIO.
|
||||
find_package(OpenEXR REQUIRED)
|
||||
add_bundled_libraries(openexr/lib)
|
||||
add_bundled_libraries(imath/lib)
|
||||
|
||||
string(APPEND PLATFORM_CFLAGS " -pipe -funsigned-char -fno-strict-aliasing -ffp-contract=off")
|
||||
set(PLATFORM_LINKFLAGS "\
|
||||
-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa \
|
||||
-framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework Metal \
|
||||
-framework QuartzCore"
|
||||
)
|
||||
|
||||
if(WITH_CODEC_FFMPEG)
|
||||
set(FFMPEG_ROOT_DIR ${LIBDIR}/ffmpeg)
|
||||
set(FFMPEG_FIND_COMPONENTS
|
||||
avcodec avdevice avfilter avformat avutil
|
||||
mp3lame ogg opus swresample swscale
|
||||
theora theoradec theoraenc vorbis vorbisenc
|
||||
vorbisfile vpx x264)
|
||||
# Frameworks required by libavfilter, using legacy macOS CGL
|
||||
string(APPEND PLATFORM_LINKFLAGS " -framework CoreImage -framework OpenGL")
|
||||
if(EXISTS ${LIBDIR}/ffmpeg/lib/libaom.a)
|
||||
list(APPEND FFMPEG_FIND_COMPONENTS aom)
|
||||
endif()
|
||||
if(EXISTS ${LIBDIR}/ffmpeg/lib/libx265.a)
|
||||
list(APPEND FFMPEG_FIND_COMPONENTS x265)
|
||||
endif()
|
||||
if(EXISTS ${LIBDIR}/ffmpeg/lib/libxvidcore.a)
|
||||
list(APPEND FFMPEG_FIND_COMPONENTS xvidcore)
|
||||
endif()
|
||||
find_package(FFmpeg)
|
||||
endif()
|
||||
|
||||
if(WITH_IMAGE_OPENJPEG OR WITH_CODEC_FFMPEG)
|
||||
# use openjpeg from libdir that is linked into ffmpeg
|
||||
find_package(OpenJPEG)
|
||||
endif()
|
||||
|
||||
find_library(SYSTEMSTUBS_LIBRARY
|
||||
NAMES
|
||||
SystemStubs
|
||||
PATHS
|
||||
)
|
||||
mark_as_advanced(SYSTEMSTUBS_LIBRARY)
|
||||
if(SYSTEMSTUBS_LIBRARY)
|
||||
list(APPEND PLATFORM_LINKLIBS SystemStubs)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENIMAGEDENOISE)
|
||||
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
||||
# OpenImageDenoise uses BNNS from the Accelerate framework.
|
||||
string(APPEND PLATFORM_LINKFLAGS " -framework Accelerate")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_JACK)
|
||||
string(APPEND PLATFORM_LINKFLAGS " -F/Library/Frameworks -weak_framework jackmp")
|
||||
endif()
|
||||
|
||||
if(WITH_VULKAN_BACKEND)
|
||||
find_package(ShaderC REQUIRED)
|
||||
find_package(Vulkan REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_SDL)
|
||||
find_package(SDL3 REQUIRED CONFIG)
|
||||
endif()
|
||||
add_bundled_libraries(sdl/lib)
|
||||
|
||||
set(EPOXY_ROOT_DIR ${LIBDIR}/epoxy)
|
||||
find_package(Epoxy REQUIRED)
|
||||
|
||||
set(PNG_ROOT ${LIBDIR}/png)
|
||||
find_package(PNG REQUIRED)
|
||||
|
||||
set(JPEG_ROOT ${LIBDIR}/jpeg)
|
||||
find_package(JPEG REQUIRED)
|
||||
|
||||
set(fmt_ROOT ${LIBDIR}/fmt)
|
||||
find_package(fmt REQUIRED)
|
||||
|
||||
if(WITH_IMAGE_WEBP)
|
||||
set(WEBP_ROOT_DIR ${LIBDIR}/webp)
|
||||
find_package(WebP REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_CODEC_FFMPEG)
|
||||
string(APPEND PLATFORM_LINKFLAGS " -liconv") # ffmpeg needs it !
|
||||
endif()
|
||||
|
||||
if(WITH_PUGIXML)
|
||||
find_package(PugiXML REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(OpenImageIO REQUIRED)
|
||||
add_bundled_libraries(openimageio/lib)
|
||||
|
||||
find_package(OpenColorIO 2.0.0 REQUIRED CONFIG)
|
||||
add_bundled_libraries(opencolorio/lib)
|
||||
|
||||
if(WITH_OPENVDB)
|
||||
find_package(OpenVDB)
|
||||
find_library(BLOSC_LIBRARIES NAMES blosc HINTS ${LIBDIR}/openvdb/lib)
|
||||
if(BLOSC_LIBRARIES)
|
||||
list(APPEND OPENVDB_LIBRARIES ${BLOSC_LIBRARIES})
|
||||
else()
|
||||
unset(BLOSC_LIBRARIES CACHE)
|
||||
endif()
|
||||
if(OPENVDB_FOUND)
|
||||
set(OPENVDB_DEFINITIONS "")
|
||||
endif()
|
||||
endif()
|
||||
add_bundled_libraries(openvdb/lib)
|
||||
|
||||
if(WITH_NANOVDB)
|
||||
find_package(NanoVDB)
|
||||
endif()
|
||||
|
||||
test_neon_support()
|
||||
if(SUPPORTS_NEON_BUILD)
|
||||
find_package(sse2neon REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_LLVM)
|
||||
find_package(LLVM)
|
||||
if(NOT LLVM_FOUND)
|
||||
message(FATAL_ERROR "LLVM not found.")
|
||||
endif()
|
||||
if(WITH_CLANG)
|
||||
find_package(Clang)
|
||||
if(NOT CLANG_FOUND)
|
||||
message(FATAL_ERROR "Clang not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES AND WITH_CYCLES_OSL)
|
||||
find_package(OSL 1.13.4 REQUIRED)
|
||||
endif()
|
||||
add_bundled_libraries(osl/lib)
|
||||
# OSL dependency
|
||||
add_bundled_libraries(openjph/lib)
|
||||
|
||||
if(WITH_CYCLES AND WITH_CYCLES_EMBREE)
|
||||
find_package(Embree 4.0.0 REQUIRED)
|
||||
endif()
|
||||
add_bundled_libraries(embree/lib)
|
||||
|
||||
if(WITH_OPENIMAGEDENOISE)
|
||||
find_package(OpenImageDenoise REQUIRED)
|
||||
add_bundled_libraries(openimagedenoise/lib)
|
||||
endif()
|
||||
|
||||
if(WITH_TBB)
|
||||
find_package(TBB 2021.13.0 REQUIRED)
|
||||
if(TBB_FOUND)
|
||||
get_target_property(TBB_LIBRARIES TBB::tbb LOCATION)
|
||||
get_target_property(TBB_INCLUDE_DIRS TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
|
||||
endif()
|
||||
set_and_warn_library_found("TBB" TBB_FOUND WITH_TBB)
|
||||
endif()
|
||||
add_bundled_libraries(tbb/lib)
|
||||
|
||||
if(WITH_POTRACE)
|
||||
find_package(Potrace REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_XR_OPENXR)
|
||||
find_package(XR_OpenXR_SDK REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_GMP)
|
||||
find_package(GMP REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_HARU)
|
||||
find_package(Haru REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_MANIFOLD)
|
||||
find_package(manifold REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_RUBBERBAND)
|
||||
find_package(Rubberband REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES AND WITH_CYCLES_PATH_GUIDING)
|
||||
find_package(openpgl QUIET)
|
||||
if(openpgl_FOUND)
|
||||
get_target_property(OPENPGL_LIBRARIES openpgl::openpgl LOCATION)
|
||||
get_target_property(OPENPGL_INCLUDE_DIR openpgl::openpgl INTERFACE_INCLUDE_DIRECTORIES)
|
||||
message(STATUS "Found OpenPGL: ${OPENPGL_LIBRARIES}")
|
||||
else()
|
||||
set(WITH_CYCLES_PATH_GUIDING OFF)
|
||||
message(STATUS "OpenPGL not found, disabling WITH_CYCLES_PATH_GUIDING")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(Eigen3 REQUIRED CONFIG)
|
||||
|
||||
if(WITH_LIBMV)
|
||||
find_package(Ceres REQUIRED CONFIG)
|
||||
endif()
|
||||
add_bundled_libraries(ceres/lib)
|
||||
|
||||
set(ZSTD_ROOT_DIR ${LIBDIR}/zstd)
|
||||
find_package(Zstd REQUIRED)
|
||||
|
||||
if(WITH_DRACO)
|
||||
find_package(draco REQUIRED CONFIG)
|
||||
endif()
|
||||
add_bundled_libraries(draco/lib)
|
||||
|
||||
if(WITH_MESHOPTIMIZER)
|
||||
find_package(meshoptimizer REQUIRED CONFIG)
|
||||
endif()
|
||||
add_bundled_libraries(meshoptimizer/lib)
|
||||
|
||||
if(WITH_TRACY)
|
||||
set(Tracy_ROOT_DIR ${LIBDIR}/tracy)
|
||||
find_package(Tracy REQUIRED CONFIG)
|
||||
endif()
|
||||
|
||||
if(EXISTS ${LIBDIR})
|
||||
without_system_libs_end()
|
||||
endif()
|
||||
|
||||
# Restore to default.
|
||||
set(CMAKE_FIND_FRAMEWORK FIRST)
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Set compiler and linker flags.
|
||||
|
||||
set(EXETYPE MACOSX_BUNDLE)
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "-g")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
||||
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "i386")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
|
||||
if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
string(APPEND CMAKE_C_FLAGS_RELEASE " -ftree-vectorize -fvariable-expansion-in-unroller")
|
||||
string(APPEND CMAKE_CXX_FLAGS_RELEASE " -ftree-vectorize -fvariable-expansion-in-unroller")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic")
|
||||
endif()
|
||||
|
||||
# Clang has too low template depth of 128 for libmv.
|
||||
string(APPEND CMAKE_CXX_FLAGS " -ftemplate-depth=1024")
|
||||
|
||||
# Avoid conflicts with Luxrender, and other plug-ins that may use the same
|
||||
# libraries as Blender with a different version or build options.
|
||||
set(PLATFORM_SYMBOLS_MAP ${CMAKE_SOURCE_DIR}/source/creator/symbols_apple.map)
|
||||
set(PLATFORM_LINKFLAGS_SYMBOL_HIDING "-Wl,-unexported_symbols_list,'${PLATFORM_SYMBOLS_MAP}'")
|
||||
|
||||
if(${XCODE_VERSION} VERSION_EQUAL 15.0)
|
||||
# V4.5 specific workaround: Enforce the legacy Xcode linker to avoid incorrect
|
||||
# assembly generation caused by known bugs in the modern linker shipped with
|
||||
# Xcode 15.0. See issue #148792 for details.
|
||||
string(APPEND PLATFORM_LINKFLAGS " -Wl,-ld_classic")
|
||||
elseif(${XCODE_VERSION} VERSION_GREATER_EQUAL 15.0)
|
||||
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64" AND WITH_LEGACY_MACOS_X64_LINKER)
|
||||
# Silence "no platform load command found in <static library>, assuming: macOS".
|
||||
#
|
||||
# NOTE: Using ld_classic costs minutes of extra linking time.
|
||||
string(APPEND PLATFORM_LINKFLAGS " -Wl,-ld_classic")
|
||||
else()
|
||||
# Silence "ld: warning: ignoring duplicate libraries".
|
||||
#
|
||||
# The warning is introduced with Xcode 15 and is triggered when the same library
|
||||
# is passed to the linker multiple times. This situation could happen with either
|
||||
# cyclic libraries, or some transitive dependencies where CMake might decide to
|
||||
# pass library to the linker multiple times to force it re-scan symbols. It is
|
||||
# not necessary for Xcode linker to ensure all symbols from library are used and
|
||||
# it is corrected in CMake 3.29:
|
||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/25297
|
||||
string(APPEND PLATFORM_LINKFLAGS " -Xlinker -no_warn_duplicate_libraries")
|
||||
|
||||
# Silence: ld: warning: reducing alignment of section __DATA,__common from 0x8000
|
||||
# to 0x4000 because it exceeds segment maximum alignment
|
||||
# The flag to silence this warning is only available on Xcode 26.4 and above.
|
||||
if(${XCODE_VERSION} VERSION_GREATER_EQUAL 26.4)
|
||||
string(APPEND PLATFORM_LINKFLAGS " -Xlinker -no_warn_reduced_section_align")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Make stack size more similar to Embree, required for Embree.
|
||||
string(APPEND PLATFORM_LINKFLAGS_EXECUTABLE " -Wl,-stack_size,0x100000")
|
||||
|
||||
# Suppress ranlib "has no symbols" warnings (workaround for #48250).
|
||||
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
# llvm-ranlib doesn't support this flag. Xcode's libtool does.
|
||||
if(NOT ${CMAKE_RANLIB} MATCHES ".*llvm-ranlib$")
|
||||
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||
endif()
|
||||
|
||||
if(WITH_COMPILER_CCACHE)
|
||||
if(NOT CMAKE_GENERATOR STREQUAL "Xcode")
|
||||
find_program(CCACHE_PROGRAM ccache)
|
||||
mark_as_advanced(CCACHE_PROGRAM)
|
||||
if(CCACHE_PROGRAM)
|
||||
# Makefiles and ninja
|
||||
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "" FORCE)
|
||||
mark_as_advanced(
|
||||
CMAKE_C_COMPILER_LAUNCHER
|
||||
CMAKE_CXX_COMPILER_LAUNCHER
|
||||
)
|
||||
else()
|
||||
message(WARNING "Ccache NOT found, disabling WITH_COMPILER_CCACHE")
|
||||
set(WITH_COMPILER_CCACHE OFF)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_COMPILER_ASAN)
|
||||
list(APPEND PLATFORM_BUNDLED_LIBRARIES ${COMPILER_ASAN_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(PLATFORM_BUNDLED_LIBRARIES)
|
||||
# For the installed Python module and installed Blender executable, we set the
|
||||
# rpath to the location where install step will copy the shared libraries.
|
||||
set(CMAKE_SKIP_INSTALL_RPATH FALSE)
|
||||
if(WITH_PYTHON_MODULE)
|
||||
list(APPEND CMAKE_INSTALL_RPATH "@loader_path/lib")
|
||||
else()
|
||||
list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../Resources/lib")
|
||||
endif()
|
||||
|
||||
# For binaries that are built but not installed (like makesdna or tests), we add
|
||||
# the original directory of all shared libraries to the rpath. This is needed because
|
||||
# these can be in different folders, and because the build and install folder may be
|
||||
# different.
|
||||
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||
list(APPEND CMAKE_BUILD_RPATH ${PLATFORM_BUNDLED_LIBRARY_DIRS})
|
||||
|
||||
# Environment variables to run precompiled executables that needed libraries.
|
||||
list(JOIN PLATFORM_BUNDLED_LIBRARY_DIRS ":" _library_paths)
|
||||
# Intentionally double "$$" which expands into "$" when instantiated.
|
||||
set(PLATFORM_ENV_BUILD "DYLD_LIBRARY_PATH=\"${_library_paths}:$$DYLD_LIBRARY_PATH\"")
|
||||
set(PLATFORM_ENV_INSTALL "DYLD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/Blender.app/Contents/Resources/lib/:$$DYLD_LIBRARY_PATH")
|
||||
unset(_library_paths)
|
||||
endif()
|
||||
|
||||
# Same as `CFBundleIdentifier` in Info.plist.
|
||||
set(CMAKE_XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.blenderfoundation.blender")
|
||||
@@ -0,0 +1,200 @@
|
||||
# SPDX-FileCopyrightText: 2016 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Xcode and system configuration for Apple.
|
||||
|
||||
# Detect processor architecture.
|
||||
if(NOT CMAKE_OSX_ARCHITECTURES)
|
||||
execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message(STATUS "Detected native architecture ${ARCHITECTURE}.")
|
||||
set(CMAKE_OSX_ARCHITECTURES ${ARCHITECTURE} CACHE STRING
|
||||
"Choose the architecture you want to build Blender for: arm64 or x86_64"
|
||||
FORCE)
|
||||
endif()
|
||||
|
||||
# Detect developer directory. Depending on configuration this may be either
|
||||
# an Xcode or Command Line Tools installation.
|
||||
execute_process(
|
||||
COMMAND xcode-select --print-path
|
||||
OUTPUT_VARIABLE XCODE_DEVELOPER_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# Detect Xcode version. It is provided by the Xcode generator but not
|
||||
# Unix Makefiles or Ninja.
|
||||
if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||
# Note that `xcodebuild -version` gives output in two lines: first line will include
|
||||
# Xcode version, second one will include build number. We are only interested in the
|
||||
# first line. Here is an example of the output:
|
||||
# Xcode 11.4
|
||||
# Build version 11E146
|
||||
# The expected XCODE_VERSION in this case is 11.4.
|
||||
execute_process(
|
||||
COMMAND xcodebuild -version
|
||||
OUTPUT_VARIABLE _xcode_vers_build_nr
|
||||
RESULT_VARIABLE _xcode_vers_result
|
||||
ERROR_QUIET)
|
||||
|
||||
if(_xcode_vers_result EQUAL 0)
|
||||
# Convert output to a single line by replacing newlines with spaces.
|
||||
# This is needed because regex replace can not operate through the newline character
|
||||
# and applies substitutions for each individual lines.
|
||||
string(REPLACE "\n" " " _xcode_vers_build_nr_single_line "${_xcode_vers_build_nr}")
|
||||
string(REGEX REPLACE "(.*)Xcode ([0-9\\.]+).*" "\\2" XCODE_VERSION "${_xcode_vers_build_nr_single_line}")
|
||||
unset(_xcode_vers_build_nr_single_line)
|
||||
endif()
|
||||
|
||||
unset(_xcode_vers_build_nr)
|
||||
unset(_xcode_vers_result)
|
||||
endif()
|
||||
|
||||
if(XCODE_VERSION)
|
||||
# Construct SDKs path ourselves, because xcode-select path could be ambiguous.
|
||||
# Both /Applications/Xcode.app/Contents/Developer or /Applications/Xcode.app would be allowed.
|
||||
set(XCODE_SDK_DIR ${XCODE_DEVELOPER_DIR}/Platforms/MacOSX.platform/Developer/SDKs)
|
||||
|
||||
# Detect SDK version to use
|
||||
if(NOT DEFINED OSX_SYSTEM)
|
||||
execute_process(
|
||||
COMMAND xcodebuild -version -sdk macosx SDKVersion
|
||||
OUTPUT_VARIABLE OSX_SYSTEM
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS "Detected OS X ${OSX_SYSTEM} and Xcode ${XCODE_VERSION} at ${XCODE_DEVELOPER_DIR}")
|
||||
message(STATUS "SDKs Directory: " ${XCODE_SDK_DIR})
|
||||
else()
|
||||
# If no Xcode version found, try detecting command line tools.
|
||||
execute_process(
|
||||
COMMAND pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
|
||||
OUTPUT_VARIABLE _cltools_pkg_info
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE _cltools_pkg_info_result
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
if(_cltools_pkg_info_result EQUAL 0)
|
||||
# Extract version.
|
||||
string(REGEX REPLACE ".*version: ([0-9]+)\\.([0-9]+).*" "\\1.\\2" XCODE_VERSION "${_cltools_pkg_info}")
|
||||
# SDK directory.
|
||||
set(XCODE_SDK_DIR "${XCODE_DEVELOPER_DIR}/SDKs")
|
||||
|
||||
# Detect SDK version to use.
|
||||
if(NOT DEFINED OSX_SYSTEM)
|
||||
execute_process(
|
||||
COMMAND xcrun --sdk macosx --show-sdk-version
|
||||
OUTPUT_VARIABLE OSX_SYSTEM
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS "Detected OS X ${OSX_SYSTEM} and Command Line Tools ${XCODE_VERSION} at ${XCODE_DEVELOPER_DIR}")
|
||||
message(STATUS "SDKs Directory: " ${XCODE_SDK_DIR})
|
||||
else()
|
||||
message(FATAL_ERROR "No Xcode or Command Line Tools detected")
|
||||
endif()
|
||||
|
||||
unset(_cltools_pkg_info)
|
||||
unset(_cltools_pkg_info_result)
|
||||
endif()
|
||||
|
||||
# Require a relatively recent Xcode version.
|
||||
if(${XCODE_VERSION} VERSION_LESS 16.0)
|
||||
message(FATAL_ERROR "Only Xcode version 16.0 and newer is supported")
|
||||
endif()
|
||||
|
||||
# Collect list of OSX system versions which will be used to detect path to corresponding SDK.
|
||||
# Start with macOS SDK version reported by xcodebuild and include possible extra ones.
|
||||
#
|
||||
# The reason for need of extra ones is because it's possible that xcodebuild will report
|
||||
# SDK version in the full manner (aka major.minor.patch), but the actual path will only
|
||||
# include major.minor.
|
||||
#
|
||||
# This happens, for example, on macOS Catalina 10.15.4 and Xcode 11.4: xcodebuild on this
|
||||
# system outputs "10.15.4", but the actual SDK path is MacOSX10.15.sdk.
|
||||
#
|
||||
# This should be safe from picking wrong SDK version because (a) xcodebuild reports full semantic
|
||||
# SDK version, so such SDK does exist on the system. And if it doesn't exist with full version
|
||||
# in the path, what SDK is in the major.minor folder then.
|
||||
set(OSX_SDK_TEST_VERSIONS ${OSX_SYSTEM})
|
||||
if(OSX_SYSTEM MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
|
||||
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1.\\2" OSX_SYSTEM_NO_PATCH "${OSX_SYSTEM}")
|
||||
list(APPEND OSX_SDK_TEST_VERSIONS ${OSX_SYSTEM_NO_PATCH})
|
||||
unset(OSX_SYSTEM_NO_PATCH)
|
||||
endif()
|
||||
|
||||
# Loop through all possible versions and pick the first one which resolves to a valid SDK path.
|
||||
set(OSX_SDK_PATH "")
|
||||
set(OSX_SDK_FOUND FALSE)
|
||||
set(OSX_SDKROOT "")
|
||||
foreach(OSX_SDK_VERSION ${OSX_SDK_TEST_VERSIONS})
|
||||
set(CURRENT_OSX_SDK_PATH "${XCODE_SDK_DIR}/MacOSX${OSX_SDK_VERSION}.sdk")
|
||||
if(EXISTS ${CURRENT_OSX_SDK_PATH})
|
||||
set(OSX_SDK_PATH "${CURRENT_OSX_SDK_PATH}")
|
||||
set(OSX_SDKROOT macosx${OSX_SDK_VERSION})
|
||||
set(OSX_SDK_FOUND TRUE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
unset(OSX_SDK_TEST_VERSIONS)
|
||||
|
||||
if(NOT OSX_SDK_FOUND)
|
||||
message(FATAL_ERROR "Unable to find SDK for macOS version ${OSX_SYSTEM}")
|
||||
endif()
|
||||
|
||||
message(STATUS "Detected OSX_SYSROOT: ${OSX_SDK_PATH}")
|
||||
|
||||
set(CMAKE_OSX_SYSROOT ${OSX_SDK_PATH} CACHE PATH "" FORCE)
|
||||
unset(OSX_SDK_PATH)
|
||||
unset(OSX_SDK_FOUND)
|
||||
|
||||
if(${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||
# to silence sdk not found warning, just overrides CMAKE_OSX_SYSROOT
|
||||
set(CMAKE_XCODE_ATTRIBUTE_SDKROOT ${OSX_SDKROOT})
|
||||
endif()
|
||||
unset(OSX_SDKROOT)
|
||||
|
||||
|
||||
# This is our minimum target, if you use higher sdk, weak linking happens
|
||||
# Mainly required because of Metal drivers.
|
||||
set(OSX_MIN_DEPLOYMENT_TARGET 11.2)
|
||||
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "${OSX_MIN_DEPLOYMENT_TARGET}" CACHE STRING "" FORCE)
|
||||
|
||||
if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||
# Force CMAKE_OSX_DEPLOYMENT_TARGET for makefiles, will not work else (CMake bug?)
|
||||
string(APPEND CMAKE_C_FLAGS " -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
add_definitions("-DMACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
endif()
|
||||
|
||||
if(WITH_COMPILER_CCACHE)
|
||||
if(CMAKE_GENERATOR STREQUAL "Xcode")
|
||||
find_program(CCACHE_PROGRAM ccache)
|
||||
mark_as_advanced(CCACHE_PROGRAM)
|
||||
if(CCACHE_PROGRAM)
|
||||
get_filename_component(ccompiler "${CMAKE_C_COMPILER}" NAME)
|
||||
get_filename_component(cxxcompiler "${CMAKE_CXX_COMPILER}" NAME)
|
||||
# Ccache can figure out which compiler to use if it's invoked from
|
||||
# a symlink with the name of the compiler.
|
||||
# https://ccache.dev/manual/4.1.html#_run_modes
|
||||
set(_fake_compiler_dir "${CMAKE_BINARY_DIR}/ccache")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_fake_compiler_dir})
|
||||
set(_fake_C_COMPILER "${_fake_compiler_dir}/${ccompiler}")
|
||||
set(_fake_CXX_COMPILER "${_fake_compiler_dir}/${cxxcompiler}")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CCACHE_PROGRAM}" ${_fake_C_COMPILER})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CCACHE_PROGRAM}" ${_fake_CXX_COMPILER})
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CC ${_fake_C_COMPILER} CACHE STRING "" FORCE)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CXX ${_fake_CXX_COMPILER} CACHE STRING "" FORCE)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_LD ${_fake_C_COMPILER} CACHE STRING "" FORCE)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS ${_fake_CXX_COMPILER} CACHE STRING "" FORCE)
|
||||
unset(_fake_compiler_dir)
|
||||
unset(_fake_C_COMPILER)
|
||||
unset(_fake_CXX_COMPILER)
|
||||
else()
|
||||
message(WARNING "Ccache NOT found, disabling WITH_COMPILER_CCACHE")
|
||||
set(WITH_COMPILER_CCACHE OFF)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,113 @@
|
||||
# SPDX-FileCopyrightText: 2022 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Auto update existing CMake caches for new libraries.
|
||||
|
||||
# Assert that `LIBDIR` is defined.
|
||||
if(NOT (DEFINED LIBDIR))
|
||||
message(FATAL_ERROR "Logical error, expected 'LIBDIR' to be defined!")
|
||||
endif()
|
||||
|
||||
# Clear cached variables whose name matches `pattern`.
|
||||
function(unset_cache_variables pattern)
|
||||
get_cmake_property(_cache_variables CACHE_VARIABLES)
|
||||
foreach(_cache_variable ${_cache_variables})
|
||||
if("${_cache_variable}" MATCHES "${pattern}")
|
||||
unset(${_cache_variable} CACHE)
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# Clear cached variables with values containing `contents`.
|
||||
function(unset_cached_variables_containing contents msg)
|
||||
get_cmake_property(_cache_variables CACHE_VARIABLES)
|
||||
set(_found "")
|
||||
set(_print_msg "")
|
||||
foreach(_cache_variable ${_cache_variables})
|
||||
# Skip "_" prefixed variables, these are used for internal book-keeping,
|
||||
# not under user control.
|
||||
string(FIND "${_cache_variable}" "_" _found)
|
||||
if(NOT (_found EQUAL 0))
|
||||
string(FIND "${${_cache_variable}}" "${contents}" _found)
|
||||
if(NOT (_found EQUAL -1))
|
||||
unset(${_cache_variable} CACHE)
|
||||
set(_print_msg ON)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
if(_print_msg)
|
||||
message(STATUS "${msg}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Detect update in 4.1 to shared library OpenImageDenoise and OSL.
|
||||
if(UNIX AND
|
||||
DEFINED OPENIMAGEDENOISE_LIBRARY AND
|
||||
OPENIMAGEDENOISE_LIBRARY MATCHES "libOpenImageDenoise.a$" AND
|
||||
(EXISTS ${LIBDIR}/openimagedenoise/lib/libOpenImageDenoise.so OR
|
||||
EXISTS ${LIBDIR}/openimagedenoise/lib/libOpenImageDenoise.dylib))
|
||||
message(STATUS "Auto updating CMake configuration for dynamic OpenImageDenoise")
|
||||
unset_cache_variables("^OPENIMAGEDENOISE")
|
||||
endif()
|
||||
|
||||
if(UNIX AND
|
||||
DEFINED OSL_OSLCOMP_LIBRARY AND
|
||||
OSL_OSLCOMP_LIBRARY MATCHES "liboslcomp.a$" AND
|
||||
(EXISTS ${LIBDIR}/osl/lib/liboslcomp.so OR
|
||||
EXISTS ${LIBDIR}/osl/lib/liboslcomp.dylib))
|
||||
message(STATUS "Auto updating CMake configuration for dynamic OpenShadingLanguage")
|
||||
unset_cache_variables("^OSL_")
|
||||
endif()
|
||||
|
||||
# Detect Python 3.10 to 3.11 upgrade for Blender 4.1.
|
||||
if(UNIX AND
|
||||
LIBDIR AND
|
||||
EXISTS ${LIBDIR} AND
|
||||
EXISTS ${LIBDIR}/python/bin/python3.11 AND
|
||||
DEFINED PYTHON_VERSION AND
|
||||
PYTHON_VERSION VERSION_LESS "3.11")
|
||||
|
||||
message(STATUS "Auto updating CMake configuration for Python 3.11")
|
||||
unset_cache_variables("^PYTHON_")
|
||||
endif()
|
||||
|
||||
# Detect update to 4.4 libs.
|
||||
if(LIBDIR AND
|
||||
EXISTS ${LIBDIR}/tbb/include/oneapi AND
|
||||
((DEFINED Boost_INCLUDE_DIR) OR (SYCL_LIBRARY MATCHES "sycl7")))
|
||||
message(STATUS "Auto updating CMake configuration for Blender 4.4 libraries")
|
||||
unset_cache_variables("^BOOST")
|
||||
unset_cache_variables("^Boost")
|
||||
unset_cache_variables("^EMBREE")
|
||||
unset_cache_variables("^IMATH")
|
||||
unset_cache_variables("^MATERIALX")
|
||||
unset_cache_variables("^NANOVDB")
|
||||
unset_cache_variables("^OPENCOLORIO")
|
||||
unset_cache_variables("^OPENEXR")
|
||||
unset_cache_variables("^OPENIMAGEDENOISE")
|
||||
unset_cache_variables("^OPENIMAGEIO")
|
||||
unset_cache_variables("^OPENVDB")
|
||||
unset_cache_variables("^OSL_")
|
||||
unset_cache_variables("^PYTHON")
|
||||
unset_cache_variables("^SYCL")
|
||||
unset_cache_variables("^TBB")
|
||||
unset_cache_variables("^USD")
|
||||
endif()
|
||||
|
||||
# Detect update to 5.0 libs.
|
||||
if(UNIX AND LIBDIR AND
|
||||
EXISTS ${LIBDIR}/haru/lib/libhpdf.a AND
|
||||
HARU_LIBRARY MATCHES "libhpdfs.a$")
|
||||
message(STATUS "Auto updating CMake configuration for Blender 5.0 libraries")
|
||||
unset_cache_variables("^HARU")
|
||||
endif()
|
||||
|
||||
# Detect update to 5.2 libs
|
||||
if(DEFINED CACHE{WITH_SDL})
|
||||
message(STATUS "Auto updating CMake configuration for Blender 5.2 libraries")
|
||||
# Following the SDL3 migration (PR !157521), WITH_SDL was renamed to WITH_SDL_AUDIO, and WITH_SDL became an uncached
|
||||
# variable depending on the value of WITH_SDL_AUDIO, WITH_GHOST_SDL, etc... Migrate value and unset old cache variable.
|
||||
set(WITH_SDL_AUDIO $CACHE{WITH_SDL} CACHE BOOL "" FORCE)
|
||||
unset(WITH_SDL CACHE)
|
||||
endif()
|
||||
1115
blender-5.2.0/build_files/cmake/platform/platform_unix.cmake
Normal file
1115
blender-5.2.0/build_files/cmake/platform/platform_unix.cmake
Normal file
File diff suppressed because it is too large
Load Diff
1213
blender-5.2.0/build_files/cmake/platform/platform_win32.cmake
Normal file
1213
blender-5.2.0/build_files/cmake/platform/platform_win32.cmake
Normal file
File diff suppressed because it is too large
Load Diff
167
blender-5.2.0/build_files/cmake/platform/web.cmake
Normal file
167
blender-5.2.0/build_files/cmake/platform/web.cmake
Normal file
@@ -0,0 +1,167 @@
|
||||
# Web platform policy for the browser engine target.
|
||||
# This fragment is used by both the top-level Blender CMake configuration and
|
||||
# the isolated web/engine target. It must not change the WITH_BLENDER choice;
|
||||
# the top-level build needs Blender data libraries while the isolated target
|
||||
# intentionally leaves them out.
|
||||
|
||||
if(NOT EMSCRIPTEN)
|
||||
message(FATAL_ERROR "web.cmake requires the Emscripten toolchain")
|
||||
endif()
|
||||
|
||||
set(WITH_WEB ON CACHE BOOL "Build the browser Blender engine" FORCE)
|
||||
add_compile_definitions(WITH_WEB)
|
||||
set(BLENDER_HOST_EXECUTABLE_PREFIX /usr/bin/node CACHE INTERNAL "Run Emscripten host tools with Node.js")
|
||||
set(WITH_PYTHON OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_HEADLESS ON CACHE BOOL "" FORCE)
|
||||
set(WITH_GHOST OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_GHOST_X11 OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_GHOST_WAYLAND OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_GHOST_SDL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_HYDRA OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_MATERIALX OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_DRACO OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_MESHOPTIMIZER OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_USD OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_FFMPEG OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_VULKAN_BACKEND OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_OPENEXR OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_OPENJPEG OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_WEBP OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_TIFF OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_CINEON OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_COMPOSITOR OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENIMAGEDENOISE OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
|
||||
set(WITH_QUADRIFLOW OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_UV_SLIM OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IK_ITASC OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IO_FBX OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IO_GREASE_PENCIL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IO_PLY OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IO_STL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IO_WAVEFRONT_OBJ OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_MANIFOLD OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_GMP ON CACHE BOOL "" FORCE)
|
||||
set(WITH_FFTW3 OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_PUGIXML OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_HARU OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENAL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_TBB OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
|
||||
|
||||
# Several data/editor libraries declare a compositor dependency even when the
|
||||
# compositor source directory is intentionally omitted for the browser build.
|
||||
# Keep the dependency graph valid without linking desktop GPU compositor code.
|
||||
if(NOT TARGET bf_compositor)
|
||||
add_library(bf_compositor INTERFACE)
|
||||
endif()
|
||||
|
||||
# Build compression support from pinned source inside the repository. Native
|
||||
# system libraries cannot be linked into a WebAssembly module, and relying on
|
||||
# compiler-managed downloads would make clean/offline builds non-reproducible.
|
||||
get_filename_component(WEB_BLENDER_SOURCE_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE)
|
||||
|
||||
# Build the Blender-pinned OpenSubdiv source as a CPU-only static dependency.
|
||||
# Browser evaluation does not use OpenSubdiv's GPU backends, examples or tools.
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
||||
set(NO_EXAMPLES ON CACHE BOOL "" FORCE)
|
||||
set(NO_TUTORIALS ON CACHE BOOL "" FORCE)
|
||||
set(NO_REGRESSION ON CACHE BOOL "" FORCE)
|
||||
set(NO_PTEX ON CACHE BOOL "" FORCE)
|
||||
set(NO_DOC ON CACHE BOOL "" FORCE)
|
||||
set(NO_OMP ON CACHE BOOL "" FORCE)
|
||||
set(NO_TBB ON CACHE BOOL "" FORCE)
|
||||
set(NO_CUDA ON CACHE BOOL "" FORCE)
|
||||
set(NO_OPENCL ON CACHE BOOL "" FORCE)
|
||||
set(NO_CLEW ON CACHE BOOL "" FORCE)
|
||||
set(NO_OPENGL ON CACHE BOOL "" FORCE)
|
||||
set(NO_METAL ON CACHE BOOL "" FORCE)
|
||||
set(NO_DX ON CACHE BOOL "" FORCE)
|
||||
set(NO_TESTS ON CACHE BOOL "" FORCE)
|
||||
set(NO_GLTESTS ON CACHE BOOL "" FORCE)
|
||||
set(NO_GLFW ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory(
|
||||
"${WEB_BLENDER_SOURCE_ROOT}/extern/opensubdiv-source"
|
||||
"${CMAKE_BINARY_DIR}/extern/opensubdiv-web"
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
set(OPENSUBDIV_INCLUDE_DIRS "${WEB_BLENDER_SOURCE_ROOT}/extern/opensubdiv-source")
|
||||
set(OPENSUBDIV_LIBRARIES osd_static_cpu)
|
||||
|
||||
# GMP is cross-compiled once with Emscripten from the vendored 6.3.0 source.
|
||||
# Keep both C++ and C archives explicit because Blender's exact Boolean solver
|
||||
# uses mpq_class from libgmpxx on top of libgmp.
|
||||
set(GMP_INCLUDE_DIRS "${WEB_BLENDER_SOURCE_ROOT}/extern/gmp-wasm/include")
|
||||
set(GMP_LIBRARIES
|
||||
"${WEB_BLENDER_SOURCE_ROOT}/extern/gmp-wasm/lib/libgmpxx.a"
|
||||
"${WEB_BLENDER_SOURCE_ROOT}/extern/gmp-wasm/lib/libgmp.a"
|
||||
)
|
||||
|
||||
set(ZLIB_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory(
|
||||
"${WEB_BLENDER_SOURCE_ROOT}/extern/zlib"
|
||||
"${CMAKE_BINARY_DIR}/extern/zlib-web"
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
set(ZLIB_INCLUDE_DIRS
|
||||
"${WEB_BLENDER_SOURCE_ROOT}/extern/zlib"
|
||||
"${CMAKE_BINARY_DIR}/extern/zlib-web"
|
||||
)
|
||||
set(ZLIB_LIBRARIES zlibstatic)
|
||||
|
||||
set(ZSTD_BUILD_PROGRAMS OFF CACHE BOOL "" FORCE)
|
||||
set(ZSTD_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(ZSTD_BUILD_SHARED OFF CACHE BOOL "" FORCE)
|
||||
set(ZSTD_BUILD_STATIC ON CACHE BOOL "" FORCE)
|
||||
set(ZSTD_MULTITHREAD_SUPPORT OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory(
|
||||
"${WEB_BLENDER_SOURCE_ROOT}/extern/zstd/build/cmake"
|
||||
"${CMAKE_BINARY_DIR}/extern/zstd-web"
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
set(ZSTD_INCLUDE_DIRS "${WEB_BLENDER_SOURCE_ROOT}/extern/zstd/lib")
|
||||
set(ZSTD_LIBRARIES libzstd_static)
|
||||
|
||||
# These targets are mandatory in Blender's common dependency target file even
|
||||
# when the corresponding feature is disabled. Emscripten's first-party web
|
||||
# build deliberately supplies empty interface targets so the data-only subset
|
||||
# can configure without desktop/image libraries.
|
||||
foreach(web_target IN ITEMS
|
||||
Eigen3::Eigen
|
||||
OpenColorIO::OpenColorIO
|
||||
OpenImageIO::OpenImageIO
|
||||
OpenEXR::OpenEXR
|
||||
fmt::fmt)
|
||||
if(NOT TARGET ${web_target})
|
||||
add_library(${web_target} INTERFACE IMPORTED GLOBAL)
|
||||
endif()
|
||||
endforeach()
|
||||
set(WEB_FMT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/../../../extern/fmt/include")
|
||||
if(TARGET fmt::fmt AND EXISTS "${WEB_FMT_INCLUDE}/fmt")
|
||||
set_property(TARGET fmt::fmt PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${WEB_FMT_INCLUDE}")
|
||||
set_property(TARGET fmt::fmt PROPERTY INTERFACE_COMPILE_DEFINITIONS FMT_HEADER_ONLY)
|
||||
endif()
|
||||
set(WEB_EIGEN_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/../../../extern/eigen3")
|
||||
if(TARGET Eigen3::Eigen AND EXISTS "${WEB_EIGEN_INCLUDE}/Eigen")
|
||||
set_property(TARGET Eigen3::Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${WEB_EIGEN_INCLUDE}")
|
||||
endif()
|
||||
if(NOT TARGET OpenImageIO::oiiotool)
|
||||
add_executable(OpenImageIO::oiiotool IMPORTED GLOBAL)
|
||||
set_property(TARGET OpenImageIO::oiiotool PROPERTY
|
||||
IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/web-placeholder-oiiotool")
|
||||
endif()
|
||||
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".js")
|
||||
add_compile_options(-fexceptions)
|
||||
add_compile_options(-fsigned-char)
|
||||
add_compile_options(-Wno-c++11-narrowing)
|
||||
add_link_options(
|
||||
-sENVIRONMENT=web,worker
|
||||
-sMODULARIZE=1
|
||||
-sEXPORT_ES6=1
|
||||
-sALLOW_MEMORY_GROWTH=1
|
||||
-sFILESYSTEM=1
|
||||
)
|
||||
Reference in New Issue
Block a user