diff --git a/CMakeLists.txt b/CMakeLists.txt index 036765bcffc..9574a9c66f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1267,8 +1267,12 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Release") unset(_is_CONFIG_DEBUG) elseif(COMPILER_ASAN_LIBRARY) set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}") - set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}") - set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}") + set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY}") + set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY}") + if(DEFINED COMPILER_ASAN_LINKER_FLAGS) + set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${COMPILER_ASAN_LINKER_FLAGS}") + set(PLATFORM_LINKFLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG} ${COMPILER_ASAN_LINKER_FLAGS}") + endif() endif() endif() endif() @@ -1434,7 +1438,12 @@ if(WITH_OPENVDB) if(WITH_OPENVDB_BLOSC) list(APPEND OPENVDB_DEFINITIONS -DWITH_OPENVDB_BLOSC) - list(APPEND OPENVDB_LIBRARIES ${BLOSC_LIBRARIES} ${ZLIB_LIBRARIES}) + # Even when `WITH_OPENVDB_BLOSC` is set, `FindBlosc.cmake` isn't running. + # As this might be used at some point, check the libraries are defined. + if(DEFINED BLOSC_LIBRARIES) + list(APPEND OPENVDB_LIBRARIES ${BLOSC_LIBRARIES}) + endif() + list(APPEND OPENVDB_LIBRARIES ${ZLIB_LIBRARIES}) endif() list(APPEND OPENVDB_LIBRARIES ${BOOST_LIBRARIES} ${TBB_LIBRARIES}) diff --git a/build_files/cmake/Modules/FindLevelZero.cmake b/build_files/cmake/Modules/FindLevelZero.cmake index fa959d95e78..45326890589 100644 --- a/build_files/cmake/Modules/FindLevelZero.cmake +++ b/build_files/cmake/Modules/FindLevelZero.cmake @@ -11,8 +11,13 @@ # This can also be an environment variable. # LEVEL_ZERO_FOUND, If false, then don't try to use L0. -IF(NOT LEVEL_ZERO_ROOT_DIR AND NOT $ENV{LEVEL_ZERO_ROOT_DIR} STREQUAL "") +# If `LEVEL_ZERO_ROOT_DIR` was defined in the environment, use it. +IF(DEFINED LEVEL_ZERO_ROOT_DIR) + # Pass. +ELSEIF(DEFINED ENV{LEVEL_ZERO_ROOT_DIR}) SET(LEVEL_ZERO_ROOT_DIR $ENV{LEVEL_ZERO_ROOT_DIR}) +ELSE() + SET(LEVEL_ZERO_ROOT_DIR "") ENDIF() SET(_level_zero_search_dirs diff --git a/build_files/cmake/Modules/FindOSL.cmake b/build_files/cmake/Modules/FindOSL.cmake index 7d0af2724ba..95cb0f73762 100644 --- a/build_files/cmake/Modules/FindOSL.cmake +++ b/build_files/cmake/Modules/FindOSL.cmake @@ -24,6 +24,13 @@ ELSE() SET(OSL_ROOT_DIR "") ENDIF() +# If `OSLHOME` was defined in the environment, use it. +IF(DEFINED ENV{OSLHOME}) + SET(OSL_HOME_DIR $ENV{OSLHOME}) +ELSE() + SET(OSL_HOME_DIR "") +ENDIF() + SET(_osl_FIND_COMPONENTS oslnoise oslcomp @@ -83,7 +90,7 @@ FIND_PATH(OSL_SHADER_DIR HINTS ${OSL_ROOT_DIR} ${OSL_SHADER_HINT} - $ENV{OSLHOME} + ${OSL_HOME_DIR} /usr/share/OSL/ /usr/include/OSL/ PATH_SUFFIXES diff --git a/build_files/cmake/Modules/FindUSD.cmake b/build_files/cmake/Modules/FindUSD.cmake index ccd9c24bc46..1752523a3b9 100644 --- a/build_files/cmake/Modules/FindUSD.cmake +++ b/build_files/cmake/Modules/FindUSD.cmake @@ -37,6 +37,10 @@ FIND_PATH(USD_INCLUDE_DIR DOC "Universal Scene Description (USD) header files" ) +IF(NOT DEFINED PXR_LIB_PREFIX) + SET(PXR_LIB_PREFIX "") +ENDIF() + # Since USD 21.11 the libraries are prefixed with "usd_", i.e. # "libusd_m.a" became "libusd_usd_m.a". # See https://github.com/PixarAnimationStudios/USD/blob/release/CHANGELOG.md#2111---2021-11-01 diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake index b160ca2653e..70ff58bb331 100644 --- a/build_files/cmake/platform/platform_apple.cmake +++ b/build_files/cmake/platform/platform_apple.cmake @@ -516,7 +516,11 @@ if(PLATFORM_BUNDLED_LIBRARIES) # Environment variables to run precompiled executables that needed libraries. list(JOIN PLATFORM_BUNDLED_LIBRARY_DIRS ":" _library_paths) - set(PLATFORM_ENV_BUILD "DYLD_LIBRARY_PATH=\"${_library_paths};${DYLD_LIBRARY_PATH}\"") + if(DEFINED DYLD_LIBRARY_PATH) + set(PLATFORM_ENV_BUILD "DYLD_LIBRARY_PATH=\"${_library_paths};${DYLD_LIBRARY_PATH}\"") + else() + set(PLATFORM_ENV_BUILD "DYLD_LIBRARY_PATH=\"${_library_paths}\"") + endif() set(PLATFORM_ENV_INSTALL "DYLD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/Blender.app/Contents/Resources/lib/;$DYLD_LIBRARY_PATH") unset(_library_paths) endif() diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index d8bed47f869..5f9cfadef64 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -1049,7 +1049,11 @@ if(PLATFORM_BUNDLED_LIBRARIES) # Environment variables to run precompiled executables that needed libraries. list(JOIN PLATFORM_BUNDLED_LIBRARY_DIRS ":" _library_paths) - set(PLATFORM_ENV_BUILD "LD_LIBRARY_PATH=\"${_library_paths}:${LD_LIBRARY_PATH}\"") + if(DEFINED LD_LIBRARY_PATH) + set(PLATFORM_ENV_BUILD "LD_LIBRARY_PATH=\"${_library_paths}:${LD_LIBRARY_PATH}\"") + else() + set(PLATFORM_ENV_BUILD "LD_LIBRARY_PATH=\"${_library_paths}\"") + endif() set(PLATFORM_ENV_INSTALL "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/lib/;$LD_LIBRARY_PATH") unset(_library_paths) endif() diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index 0c1dc3ce061..381f6d8ee6a 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -83,7 +83,9 @@ endif() if(WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE) set(AUDASPACE_CMAKE_CFG ${CMAKE_CURRENT_SOURCE_DIR}/audaspace/blender_config.cmake) + set(LIB_SUFFIX "") # Quiet uninitialized warning. add_subdirectory(audaspace) + unset(LIB_SUFFIX) endif() if(WITH_QUADRIFLOW) diff --git a/intern/cycles/cmake/macros.cmake b/intern/cycles/cmake/macros.cmake index 54ee8811c35..0e1e3cc67ea 100644 --- a/intern/cycles/cmake/macros.cmake +++ b/intern/cycles/cmake/macros.cmake @@ -109,7 +109,10 @@ macro(cycles_external_libraries_append libraries) endif() endif() if(WITH_OPENVDB) - list(APPEND ${libraries} ${OPENVDB_LIBRARIES} ${BLOSC_LIBRARIES}) + list(APPEND ${libraries} ${OPENVDB_LIBRARIES}) + if(DEFINED BLOSC_LIBRARIES) + list(APPEND ${libraries} ${BLOSC_LIBRARIES}) + endif() endif() if(WITH_OPENIMAGEDENOISE) list(APPEND ${libraries} ${OPENIMAGEDENOISE_LIBRARIES}) @@ -125,16 +128,17 @@ macro(cycles_external_libraries_append libraries) if(WITH_PATH_GUIDING) list(APPEND ${libraries} ${OPENPGL_LIBRARIES}) endif() + if (WITH_WEBP) + list(APPEND ${libraries} ${WEBP_LIBRARIES}) + endif() if(UNIX AND NOT APPLE) list(APPEND ${libraries} "-lm -lc -lutil") endif() - list(APPEND ${libraries} ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} - ${WEBP_LIBRARIES} ${OPENJPEG_LIBRARIES} ${OPENEXR_LIBRARIES} ${OPENEXR_LIBRARIES} # For circular dependencies between libs. diff --git a/intern/eigen/CMakeLists.txt b/intern/eigen/CMakeLists.txt index 63d7a0ad2cd..8ccd0ff3aeb 100644 --- a/intern/eigen/CMakeLists.txt +++ b/intern/eigen/CMakeLists.txt @@ -27,7 +27,7 @@ set(SRC set(LIB ) -if(WITH_OPENMP_STATIC) +if(WITH_OPENMP AND WITH_OPENMP_STATIC) list(APPEND LIB ${OpenMP_LIBRARIES} ) diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index c7f558b76bc..0dd3c4fca24 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -29,7 +29,9 @@ set(INC ../../../intern/clog ../../../intern/opensubdiv +) +set(INC_SYS ) set(SRC diff --git a/source/blender/editors/curves/CMakeLists.txt b/source/blender/editors/curves/CMakeLists.txt index b7a19d61edb..d5fcf758a33 100644 --- a/source/blender/editors/curves/CMakeLists.txt +++ b/source/blender/editors/curves/CMakeLists.txt @@ -19,6 +19,9 @@ set(INC ${CMAKE_BINARY_DIR}/source/blender/makesrna ) +set(INC_SYS +) + set(SRC intern/curves_add.cc intern/curves_data.cc diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index 9ead2e6df97..fec3f6ac98f 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -23,6 +23,9 @@ set(INC ${CMAKE_BINARY_DIR}/source/blender/makesrna ) +set(INC_SYS +) + set(SRC editface.cc editmesh_add.cc diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt index 1e58b41dc01..85cbdde0b6b 100644 --- a/source/blender/editors/render/CMakeLists.txt +++ b/source/blender/editors/render/CMakeLists.txt @@ -21,6 +21,9 @@ set(INC ${CMAKE_BINARY_DIR}/source/blender/makesrna ) +set(INC_SYS +) + set(SRC render_internal.cc render_opengl.cc diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index e0e974aa500..24cf65cdd91 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -24,6 +24,9 @@ set(INC ${CMAKE_BINARY_DIR}/source/blender/makesrna ) +set(INC_SYS +) + set(SRC curves_sculpt_add.cc curves_sculpt_brush.cc diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt index be0e7bb8be0..8f8887e8f36 100644 --- a/source/blender/editors/space_node/CMakeLists.txt +++ b/source/blender/editors/space_node/CMakeLists.txt @@ -26,6 +26,8 @@ set(INC ${CMAKE_BINARY_DIR}/source/blender/makesrna ) +set(INC_SYS +) set(SRC add_menu_assets.cc diff --git a/source/blender/geometry/CMakeLists.txt b/source/blender/geometry/CMakeLists.txt index 4370ae21694..41d9b290f03 100644 --- a/source/blender/geometry/CMakeLists.txt +++ b/source/blender/geometry/CMakeLists.txt @@ -11,6 +11,9 @@ set(INC ../../../intern/eigen ) +set(INC_SYS +) + set(SRC intern/add_curves_on_mesh.cc intern/curve_constraints.cc diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 8f8d5f06d51..4dce0eabf28 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -72,6 +72,8 @@ set(INC ${CMAKE_BINARY_DIR}/source/blender/makesrna ) +set(INC_SYS +) set(SRC intern/add_node_search.cc diff --git a/source/blender/nodes/geometry/CMakeLists.txt b/source/blender/nodes/geometry/CMakeLists.txt index 4465d20302b..76bb8d93d3e 100644 --- a/source/blender/nodes/geometry/CMakeLists.txt +++ b/source/blender/nodes/geometry/CMakeLists.txt @@ -23,6 +23,8 @@ set(INC ${CMAKE_BINARY_DIR}/source/blender/makesrna ) +set(INC_SYS +) set(SRC nodes/node_geo_accumulate_field.cc diff --git a/source/blender/nodes/shader/CMakeLists.txt b/source/blender/nodes/shader/CMakeLists.txt index 5967f15f519..e28a2c78c5a 100644 --- a/source/blender/nodes/shader/CMakeLists.txt +++ b/source/blender/nodes/shader/CMakeLists.txt @@ -21,6 +21,8 @@ set(INC ${CMAKE_BINARY_DIR}/source/blender/makesrna ) +set(INC_SYS +) set(SRC nodes/node_shader_add_shader.cc diff --git a/source/blender/simulation/CMakeLists.txt b/source/blender/simulation/CMakeLists.txt index 2d6f51d4607..78633e52fd9 100644 --- a/source/blender/simulation/CMakeLists.txt +++ b/source/blender/simulation/CMakeLists.txt @@ -37,7 +37,8 @@ set(LIB PRIVATE bf::intern::guardedalloc ) -if(WITH_OPENMP_STATIC) + +if(WITH_OPENMP AND WITH_OPENMP_STATIC) list(APPEND LIB ${OpenMP_LIBRARIES} )