diff options
Diffstat (limited to 'build_files/cmake/platform')
-rw-r--r-- | build_files/cmake/platform/platform_apple.cmake | 100 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_unix.cmake | 204 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_win32.cmake | 25 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_win32_bundle_crt.cmake | 26 |
4 files changed, 254 insertions, 101 deletions
diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake index f84be3c5238..27fcaf823e8 100644 --- a/build_files/cmake/platform/platform_apple.cmake +++ b/build_files/cmake/platform/platform_apple.cmake @@ -21,9 +21,25 @@ function(print_found_status endif() endfunction() +# Utility to install precompiled shared libraries. +macro(add_bundled_libraries library) + if(EXISTS ${LIBDIR}) + set(_library_dir ${LIBDIR}/${library}/lib) + file(GLOB _all_library_versions ${_library_dir}/*\.dylib*) + list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_all_library_versions}) + list(APPEND PLATFORM_BUNDLED_LIBRARY_DIRS ${_library_dir}) + unset(_all_library_versions) + unset(_library_dir) + endif() +endmacro() + # ------------------------------------------------------------------------ # Find system provided libraries. +# Avoid searching for headers since this would otherwise override our lib +# directory as well as PYTHON_ROOT_DIR. +set(CMAKE_FIND_FRAMEWORK NEVER) + # Find system ZLIB, not the pre-compiled one supplied with OpenCollada. set(ZLIB_ROOT /usr) find_package(ZLIB REQUIRED) @@ -63,6 +79,11 @@ if(NOT EXISTS "${LIBDIR}/") message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'") endif() +# Optionally use system Python if PYTHON_ROOT_DIR is specified. +if(WITH_PYTHON AND (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR)) + find_package(PythonLibsUnix REQUIRED) +endif() + # Prefer lib directory paths file(GLOB LIB_SUBDIRS ${LIBDIR}/*) set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS}) @@ -111,34 +132,8 @@ if(WITH_CODEC_SNDFILE) unset(_sndfile_VORBISENC_LIBRARY) endif() -if(WITH_PYTHON) - # Use precompiled libraries by default. - set(PYTHON_VERSION 3.10) - if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK) - # Normally cached but not since we include them with blender. - set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}") - set(PYTHON_EXECUTABLE "${LIBDIR}/python/bin/python${PYTHON_VERSION}") - set(PYTHON_LIBRARY ${LIBDIR}/python/lib/libpython${PYTHON_VERSION}.a) - set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}") - else() - # Module must be compiled against Python framework. - set(_py_framework "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}") - set(PYTHON_INCLUDE_DIR "${_py_framework}/include/python${PYTHON_VERSION}") - set(PYTHON_EXECUTABLE "${_py_framework}/bin/python${PYTHON_VERSION}") - set(PYTHON_LIBPATH "${_py_framework}/lib/python${PYTHON_VERSION}") - unset(_py_framework) - endif() - - # uncached vars - set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") - set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}") - - # needed for Audaspace, numpy is installed into python site-packages - set(PYTHON_NUMPY_INCLUDE_DIRS "${PYTHON_LIBPATH}/site-packages/numpy/core/include") - - if(NOT EXISTS "${PYTHON_EXECUTABLE}") - message(FATAL_ERROR "Python executable missing: ${PYTHON_EXECUTABLE}") - endif() +if(WITH_PYTHON AND NOT (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR)) + find_package(PythonLibsUnix REQUIRED) endif() if(WITH_FFTW3) @@ -201,11 +196,6 @@ if(WITH_JACK) string(APPEND PLATFORM_LINKFLAGS " -F/Library/Frameworks -weak_framework jackmp") endif() -if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK) - # force cmake to link right framework - string(APPEND PLATFORM_LINKFLAGS " /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python") -endif() - if(WITH_OPENCOLLADA) find_package(OpenCOLLADA) find_library(PCRE_LIBRARIES NAMES pcre HINTS ${LIBDIR}/opencollada/lib) @@ -226,6 +216,9 @@ if(WITH_SDL) endif() endif() +set(EPOXY_ROOT_DIR ${LIBDIR}/epoxy) +find_package(Epoxy REQUIRED) + set(PNG_ROOT ${LIBDIR}/png) find_package(PNG REQUIRED) @@ -359,10 +352,6 @@ endif() if(WITH_CYCLES AND WITH_CYCLES_EMBREE) find_package(Embree 3.8.0 REQUIRED) - # Increase stack size for Embree, only works for executables. - if(NOT WITH_PYTHON_MODULE) - string(APPEND PLATFORM_LINKFLAGS " -Wl,-stack_size,0x100000") - endif() # Embree static library linking can mix up SSE and AVX symbols, causing # crashes on macOS systems with older CPUs that don't have AVX. Using @@ -412,6 +401,7 @@ if(WITH_OPENMP) set(OpenMP_LIBRARY_DIR "${LIBDIR}/openmp/lib/") set(OpenMP_LINKER_FLAGS "-L'${OpenMP_LIBRARY_DIR}' -lomp") set(OpenMP_LIBRARY "${OpenMP_LIBRARY_DIR}/libomp.dylib") + add_bundled_libraries(openmp) endif() endif() @@ -446,6 +436,9 @@ if(EXISTS ${LIBDIR}) without_system_libs_end() endif() +# Restore to default. +set(CMAKE_FIND_FRAMEWORK FIRST) + # --------------------------------------------------------------------- # Set compiler and linker flags. @@ -478,6 +471,9 @@ string(APPEND PLATFORM_LINKFLAGS string(APPEND CMAKE_CXX_FLAGS " -stdlib=libc++") string(APPEND PLATFORM_LINKFLAGS " -stdlib=libc++") +# 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 T48250) set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>") set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>") @@ -501,17 +497,27 @@ if(WITH_COMPILER_CCACHE) endif() endif() -# For binaries that are built but not installed (also not distributed) (datatoc, -# makesdna, tests, etc.), we add an rpath to the OpenMP library dir through -# CMAKE_BUILD_RPATH. This avoids having to make many copies of the dylib next to each binary. -# -# For the installed Python module and installed Blender executable, CMAKE_INSTALL_RPATH -# is modified to find the dylib in an adjacent folder. Install step puts the libraries there. -set(CMAKE_SKIP_BUILD_RPATH FALSE) -list(APPEND CMAKE_BUILD_RPATH "${OpenMP_LIBRARY_DIR}") +if(WITH_COMPILER_ASAN) + list(APPEND PLATFORM_BUNDLED_LIBRARIES ${COMPILER_ASAN_LIBRARY}) +endif() -set(CMAKE_SKIP_INSTALL_RPATH FALSE) -list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../Resources/${BLENDER_VERSION}/lib") +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 makesdan 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}) +endif() # Same as `CFBundleIdentifier` in Info.plist. set(CMAKE_XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.blenderfoundation.blender") diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index 0d7ed9d618c..bfbc6b76b40 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -16,9 +16,16 @@ if(NOT DEFINED LIBDIR) # Choose the best suitable libraries. if(EXISTS ${LIBDIR_NATIVE_ABI}) set(LIBDIR ${LIBDIR_NATIVE_ABI}) + set(WITH_LIBC_MALLOC_HOOK_WORKAROUND True) elseif(EXISTS ${LIBDIR_CENTOS7_ABI}) set(LIBDIR ${LIBDIR_CENTOS7_ABI}) set(WITH_CXX11_ABI OFF) + if(WITH_MEM_JEMALLOC) + # jemalloc provides malloc hooks. + set(WITH_LIBC_MALLOC_HOOK_WORKAROUND False) + else() + set(WITH_LIBC_MALLOC_HOOK_WORKAROUND True) + endif() if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS 9.3) @@ -81,6 +88,15 @@ macro(find_package_wrapper) endif() endmacro() +# Utility to install precompiled shared libraries. +macro(add_bundled_libraries library) + if(EXISTS ${LIBDIR}) + file(GLOB _all_library_versions ${LIBDIR}/${library}/lib/*\.so*) + list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_all_library_versions}) + unset(_all_library_versions) + endif() +endmacro() + # ---------------------------------------------------------------------------- # Precompiled Libraries # @@ -95,12 +111,13 @@ find_package_wrapper(JPEG REQUIRED) find_package_wrapper(PNG REQUIRED) find_package_wrapper(ZLIB REQUIRED) find_package_wrapper(Zstd REQUIRED) +find_package_wrapper(Epoxy REQUIRED) function(check_freetype_for_brotli) include(CheckSymbolExists) set(CMAKE_REQUIRED_INCLUDES ${FREETYPE_INCLUDE_DIRS}) - check_symbol_exists(FT_CONFIG_OPTION_USE_BROTLI - "freetype/config/ftconfig.h" HAVE_BROTLI) + check_symbol_exists(FT_CONFIG_OPTION_USE_BROTLI "freetype/config/ftconfig.h" HAVE_BROTLI) + unset(CMAKE_REQUIRED_INCLUDES) if(NOT HAVE_BROTLI) unset(HAVE_BROTLI CACHE) message(FATAL_ERROR "Freetype needs to be compiled with brotli support!") @@ -126,14 +143,38 @@ if(NOT WITH_SYSTEM_FREETYPE) endif() if(WITH_PYTHON) - # No way to set py35, remove for now. - # find_package(PythonLibs) + # This could be used, see: D14954 for details. + # `find_package(PythonLibs)` - # Use our own instead, since without py is such a rare case, - # require this package - # XXX Linking errors with debian static python :/ -# find_package_wrapper(PythonLibsUnix REQUIRED) + # Use our own instead, since without Python is such a rare case, + # require this package. + # XXX: Linking errors with Debian static Python (sigh). + # find_package_wrapper(PythonLibsUnix REQUIRED) find_package(PythonLibsUnix REQUIRED) + + if(WITH_PYTHON_MODULE AND NOT WITH_INSTALL_PORTABLE) + # Installing into `site-packages`, warn when installing into `./../lib/` + # which script authors almost certainly don't want. + if(EXISTS ${LIBDIR}) + cmake_path(IS_PREFIX LIBDIR "${PYTHON_SITE_PACKAGES}" NORMALIZE _is_prefix) + if(_is_prefix) + message(WARNING " +Building Blender with the following configuration: + - WITH_PYTHON_MODULE=ON + - WITH_INSTALL_PORTABLE=OFF + - LIBDIR=\"${LIBDIR}\" + - PYTHON_SITE_PACKAGES=\"${PYTHON_SITE_PACKAGES}\" +In this case you may want to either: + - Use the system Python's site-packages, see: + python -c \"import site; print(site.getsitepackages()[0])\" + - Set WITH_INSTALL_PORTABLE=ON to create a stand-alone \"bpy\" module + which you will need to ensure is in Python's module search path. +Proceeding with PYTHON_SITE_PACKAGES install target, you have been warned!" + ) + endif() + unset(_is_prefix) + endif() + endif() endif() if(WITH_IMAGE_OPENEXR) @@ -643,46 +684,125 @@ endif() if(WITH_GHOST_WAYLAND) find_package(PkgConfig) - pkg_check_modules(wayland-client REQUIRED wayland-client>=1.12) - pkg_check_modules(wayland-egl REQUIRED wayland-egl) - pkg_check_modules(wayland-scanner REQUIRED wayland-scanner) - pkg_check_modules(xkbcommon REQUIRED xkbcommon) - pkg_check_modules(wayland-cursor REQUIRED wayland-cursor) + pkg_check_modules(wayland-client wayland-client>=1.12) + pkg_check_modules(wayland-egl wayland-egl) + pkg_check_modules(wayland-scanner wayland-scanner) + pkg_check_modules(xkbcommon xkbcommon) + pkg_check_modules(wayland-cursor wayland-cursor) + pkg_check_modules(wayland-protocols wayland-protocols>=1.15) + + if(${wayland-protocols_FOUND}) + pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir) + else() + # CentOS 7 packages have too old a version, a newer version exist in the + # precompiled libraries. + find_path(WAYLAND_PROTOCOLS_DIR + NAMES unstable/xdg-decoration/xdg-decoration-unstable-v1.xml + PATH_SUFFIXES share/wayland-protocols + PATHS ${LIBDIR}/wayland-protocols + ) - if(WITH_GHOST_WAYLAND_DBUS) - pkg_check_modules(dbus REQUIRED dbus-1) + if(EXISTS ${WAYLAND_PROTOCOLS_DIR}) + set(wayland-protocols_FOUND ON) + endif() endif() - if(WITH_GHOST_WAYLAND_LIBDECOR) - pkg_check_modules(libdecor REQUIRED libdecor-0>=0.1) + if (NOT ${wayland-client_FOUND}) + message(STATUS "wayland-client not found, disabling WITH_GHOST_WAYLAND") + set(WITH_GHOST_WAYLAND OFF) + endif() + if (NOT ${wayland-egl_FOUND}) + message(STATUS "wayland-egl not found, disabling WITH_GHOST_WAYLAND") + set(WITH_GHOST_WAYLAND OFF) + endif() + if (NOT ${wayland-scanner_FOUND}) + message(STATUS "wayland-scanner not found, disabling WITH_GHOST_WAYLAND") + set(WITH_GHOST_WAYLAND OFF) + endif() + if (NOT ${wayland-cursor_FOUND}) + message(STATUS "wayland-cursor not found, disabling WITH_GHOST_WAYLAND") + set(WITH_GHOST_WAYLAND OFF) + endif() + if (NOT ${wayland-protocols_FOUND}) + message(STATUS "wayland-protocols not found, disabling WITH_GHOST_WAYLAND") + set(WITH_GHOST_WAYLAND OFF) + endif() + if (NOT ${xkbcommon_FOUND}) + message(STATUS "xkbcommon not found, disabling WITH_GHOST_WAYLAND") + set(WITH_GHOST_WAYLAND OFF) endif() - list(APPEND PLATFORM_LINKLIBS - ${xkbcommon_LINK_LIBRARIES} - ) + if(WITH_GHOST_WAYLAND) + if(WITH_GHOST_WAYLAND_DBUS) + pkg_check_modules(dbus REQUIRED dbus-1) + endif() - if(NOT WITH_GHOST_WAYLAND_DYNLOAD) - list(APPEND PLATFORM_LINKLIBS - ${wayland-client_LINK_LIBRARIES} - ${wayland-egl_LINK_LIBRARIES} - ${wayland-cursor_LINK_LIBRARIES} - ) - endif() + if(WITH_GHOST_WAYLAND_LIBDECOR) + pkg_check_modules(libdecor REQUIRED libdecor-0>=0.1) + endif() - if(WITH_GHOST_WAYLAND_DBUS) list(APPEND PLATFORM_LINKLIBS - ${dbus_LINK_LIBRARIES} + ${xkbcommon_LINK_LIBRARIES} ) - add_definitions(-DWITH_GHOST_WAYLAND_DBUS) - endif() - if(WITH_GHOST_WAYLAND_LIBDECOR) if(NOT WITH_GHOST_WAYLAND_DYNLOAD) list(APPEND PLATFORM_LINKLIBS - ${libdecor_LIBRARIES} + ${wayland-client_LINK_LIBRARIES} + ${wayland-egl_LINK_LIBRARIES} + ${wayland-cursor_LINK_LIBRARIES} + ) + endif() + + if(WITH_GHOST_WAYLAND_DBUS) + list(APPEND PLATFORM_LINKLIBS + ${dbus_LINK_LIBRARIES} + ) + add_definitions(-DWITH_GHOST_WAYLAND_DBUS) + endif() + + if(WITH_GHOST_WAYLAND_LIBDECOR) + if(NOT WITH_GHOST_WAYLAND_DYNLOAD) + list(APPEND PLATFORM_LINKLIBS + ${libdecor_LIBRARIES} + ) + endif() + add_definitions(-DWITH_GHOST_WAYLAND_LIBDECOR) + endif() + + pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner) + + # When using dynamic loading, headers generated + # from older versions of `wayland-scanner` aren't compatible. + if(WITH_GHOST_WAYLAND_DYNLOAD) + execute_process( + COMMAND ${WAYLAND_SCANNER} --version + # The version is written to the `stderr`. + ERROR_VARIABLE _wayland_scanner_out + ERROR_STRIP_TRAILING_WHITESPACE ) + if(NOT "${_wayland_scanner_out}" STREQUAL "") + string( + REGEX REPLACE + "^wayland-scanner[ \t]+([0-9]+)\.([0-9]+).*" + "\\1.\\2" + _wayland_scanner_ver + "${_wayland_scanner_out}" + ) + if("${_wayland_scanner_ver}" VERSION_LESS "1.20") + message( + FATAL_ERROR + "Found ${WAYLAND_SCANNER} version \"${_wayland_scanner_ver}\", " + "the minimum version is 1.20!" + ) + endif() + unset(_wayland_scanner_ver) + else() + message(WARNING "Unable to access the version from ${WAYLAND_SCANNER}, continuing.") + endif() + unset(_wayland_scanner_out) endif() - add_definitions(-DWITH_GHOST_WAYLAND_LIBDECOR) + # End wayland-scanner version check. + endif() endif() @@ -956,6 +1076,7 @@ function(CONFIGURE_ATOMIC_LIB_IF_NEEDED) set(CMAKE_REQUIRED_LIBRARIES atomic) check_cxx_source_compiles("${_source}" ATOMIC_OPS_WITH_LIBATOMIC) + unset(CMAKE_REQUIRED_LIBRARIES) if(ATOMIC_OPS_WITH_LIBATOMIC) set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -latomic" PARENT_SCOPE) @@ -968,4 +1089,17 @@ function(CONFIGURE_ATOMIC_LIB_IF_NEEDED) endif() endfunction() -CONFIGURE_ATOMIC_LIB_IF_NEEDED() +configure_atomic_lib_if_needed() + +if(PLATFORM_BUNDLED_LIBRARIES) + # For the installed Python module and installed Blender executable, we set the + # rpath to the relative path where the install step will copy the shared libraries. + set(CMAKE_SKIP_INSTALL_RPATH FALSE) + list(APPEND CMAKE_INSTALL_RPATH $ORIGIN/lib) + + # For executables that are built but not installed (mainly tests) we set an absolute + # rpath to the lib folder. 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 $ORIGIN/lib ${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/lib) +endif() diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index e81582f0460..eeec4760b80 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -26,7 +26,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang") set(OPENMP_FOUND ON) set(OpenMP_C_FLAGS "/clang:-fopenmp") set(OpenMP_CXX_FLAGS "/clang:-fopenmp") - GET_FILENAME_COMPONENT(LLVMROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\LLVM\\LLVM;]" ABSOLUTE CACHE) + get_filename_component(LLVMROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\LLVM\\LLVM;]" ABSOLUTE CACHE) set(CLANG_OPENMP_DLL "${LLVMROOT}/bin/libomp.dll") set(CLANG_OPENMP_LIB "${LLVMROOT}/lib/libomp.lib") if(NOT EXISTS "${CLANG_OPENMP_DLL}") @@ -323,6 +323,13 @@ if(NOT JPEG_FOUND) set(JPEG_LIBRARIES ${LIBDIR}/jpeg/lib/libjpeg.lib) endif() +set(EPOXY_ROOT_DIR ${LIBDIR}/epoxy) +windows_find_package(Epoxy REQUIRED) +if(NOT EPOXY_FOUND) + set(Epoxy_INCLUDE_DIRS ${LIBDIR}/epoxy/include) + set(Epoxy_LIBRARIES ${LIBDIR}/epoxy/lib/epoxy.lib) +endif() + set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include) set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC3.lib) @@ -497,12 +504,16 @@ if(WITH_JACK) endif() if(WITH_PYTHON) - set(PYTHON_VERSION 3.10) # CACHE STRING) + # Cache version for make_bpy_wheel.py to detect. + unset(PYTHON_VERSION CACHE) + set(PYTHON_VERSION "3.10" CACHE STRING "Python version") string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION}) set(PYTHON_LIBRARY ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/libs/python${_PYTHON_VERSION_NO_DOTS}.lib) set(PYTHON_LIBRARY_DEBUG ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/libs/python${_PYTHON_VERSION_NO_DOTS}_d.lib) + set(PYTHON_EXECUTABLE ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/bin/python$<$<CONFIG:Debug>:_d>.exe) + set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/include) set(PYTHON_NUMPY_INCLUDE_DIRS ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/lib/site-packages/numpy/core/include) set(NUMPY_FOUND ON) @@ -756,7 +767,7 @@ if(WITH_TBB) endif() # used in many places so include globally, like OpenGL -blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}") +include_directories(SYSTEM "${PTHREADS_INCLUDE_DIRS}") set(WINTAB_INC ${LIBDIR}/wintab/include) @@ -863,8 +874,8 @@ endif() if(WINDOWS_PYTHON_DEBUG) # Include the system scripts in the blender_python_system_scripts project. - FILE(GLOB_RECURSE inFiles "${CMAKE_SOURCE_DIR}/release/scripts/*.*" ) - ADD_CUSTOM_TARGET(blender_python_system_scripts SOURCES ${inFiles}) + file(GLOB_RECURSE inFiles "${CMAKE_SOURCE_DIR}/release/scripts/*.*" ) + add_custom_target(blender_python_system_scripts SOURCES ${inFiles}) foreach(_source IN ITEMS ${inFiles}) get_filename_component(_source_path "${_source}" PATH) string(REPLACE "${CMAKE_SOURCE_DIR}/release/scripts/" "" _source_path "${_source_path}") @@ -884,8 +895,8 @@ if(WINDOWS_PYTHON_DEBUG) endif() file(TO_CMAKE_PATH ${USER_SCRIPTS_ROOT} USER_SCRIPTS_ROOT) - FILE(GLOB_RECURSE inFiles "${USER_SCRIPTS_ROOT}/*.*" ) - ADD_CUSTOM_TARGET(blender_python_user_scripts SOURCES ${inFiles}) + file(GLOB_RECURSE inFiles "${USER_SCRIPTS_ROOT}/*.*" ) + add_custom_target(blender_python_user_scripts SOURCES ${inFiles}) foreach(_source IN ITEMS ${inFiles}) get_filename_component(_source_path "${_source}" PATH) string(REPLACE "${USER_SCRIPTS_ROOT}" "" _source_path "${_source_path}") diff --git a/build_files/cmake/platform/platform_win32_bundle_crt.cmake b/build_files/cmake/platform/platform_win32_bundle_crt.cmake index f5dd0c8c7bc..f197498d97b 100644 --- a/build_files/cmake/platform/platform_win32_bundle_crt.cmake +++ b/build_files/cmake/platform/platform_win32_bundle_crt.cmake @@ -3,20 +3,22 @@ # First generate the manifest for tests since it will not need the dependency on the CRT. configure_file(${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.exe.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/tests.exe.manifest @ONLY) -if(WITH_WINDOWS_BUNDLE_CRT) - set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE) - set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE) - set(CMAKE_INSTALL_OPENMP_LIBRARIES ${WITH_OPENMP}) - - # This sometimes can change when updates are installed and the compiler version - # changes, so test if it exists and if not, give InstallRequiredSystemLibraries - # another chance to figure out the path. - if(MSVC_REDIST_DIR AND NOT EXISTS "${MSVC_REDIST_DIR}") - unset(MSVC_REDIST_DIR CACHE) - endif() +# Always detect system libraries, since they are also used by oneAPI. +# But don't always install them, only for WITH_WINDOWS_BUNDLE_CRT=ON. +set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE) +set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE) +set(CMAKE_INSTALL_OPENMP_LIBRARIES ${WITH_OPENMP}) + +# This sometimes can change when updates are installed and the compiler version +# changes, so test if it exists and if not, give InstallRequiredSystemLibraries +# another chance to figure out the path. +if(MSVC_REDIST_DIR AND NOT EXISTS "${MSVC_REDIST_DIR}") + unset(MSVC_REDIST_DIR CACHE) +endif() - include(InstallRequiredSystemLibraries) +include(InstallRequiredSystemLibraries) +if(WITH_WINDOWS_BUNDLE_CRT) # ucrtbase(d).dll cannot be in the manifest, due to the way windows 10 handles # redirects for this dll, for details see T88813. foreach(lib ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}) |