diff options
author | Ray Molenkamp <github@lazydodo.com> | 2022-10-25 19:10:14 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2022-10-25 19:10:14 +0300 |
commit | 269a903c15463a891c9e2b0eb0a81ae2eb88ec8f (patch) | |
tree | 75e37469f8a530f81c3d470beba79b6fc176ad5e /build_files/cmake/platform/platform_unix.cmake | |
parent | 9c1dec0d1863b3a14dbcf567a3244940f651bc7f (diff) | |
parent | 9d188740834017992967a9b91286e2e9b366edd3 (diff) |
Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023
Diffstat (limited to 'build_files/cmake/platform/platform_unix.cmake')
-rw-r--r-- | build_files/cmake/platform/platform_unix.cmake | 226 |
1 files changed, 64 insertions, 162 deletions
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index 180adbb2cab..b0448a31348 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -161,35 +161,28 @@ endif() if(WITH_IMAGE_OPENEXR) find_package_wrapper(OpenEXR) # our own module - if(OPENEXR_FOUND) + set_and_warn_library_found("OpenEXR" OPENEXR_FOUND WITH_IMAGE_OPENEXR) + if(WITH_IMAGE_OPENEXR) add_bundled_libraries(openexr/lib) add_bundled_libraries(imath/lib) - else() - set(WITH_IMAGE_OPENEXR OFF) endif() endif() if(WITH_IMAGE_OPENJPEG) find_package_wrapper(OpenJPEG) - if(NOT OPENJPEG_FOUND) - set(WITH_IMAGE_OPENJPEG OFF) - endif() + set_and_warn_library_found("OpenJPEG" OPENJPEG_FOUND WITH_IMAGE_OPENJPEG) endif() if(WITH_IMAGE_TIFF) # XXX Linking errors with debian static tiff :/ # find_package_wrapper(TIFF) find_package(TIFF) - if(NOT TIFF_FOUND) - set(WITH_IMAGE_TIFF OFF) - endif() + set_and_warn_library_found("TIFF" TIFF_FOUND WITH_IMAGE_TIFF) endif() if(WITH_OPENAL) find_package_wrapper(OpenAL) - if(NOT OPENAL_FOUND) - set(WITH_OPENAL OFF) - endif() + set_and_warn_library_found("OpenAL" OPENAL_FOUND WITH_OPENAL) endif() if(WITH_SDL) @@ -211,18 +204,14 @@ if(WITH_SDL) SDL_LIBRARY ) # unset(SDLMAIN_LIBRARY CACHE) - if(NOT SDL_FOUND) - set(WITH_SDL OFF) + set_and_warn_library_found("SDL" SDL_FOUND WITH_SDL) endif() - endif() endif() # Codecs if(WITH_CODEC_SNDFILE) find_package_wrapper(SndFile) - if(NOT SNDFILE_FOUND) - set(WITH_CODEC_SNDFILE OFF) - endif() + set_and_warn_library_found("libsndfile" SNDFILE_FOUND WITH_CODEC_SNDFILE) endif() if(WITH_CODEC_FFMPEG) @@ -250,17 +239,12 @@ if(WITH_CODEC_FFMPEG) endif() find_package(FFmpeg) - if(NOT FFMPEG_FOUND) - set(WITH_CODEC_FFMPEG OFF) - message(STATUS "FFmpeg not found, disabling it") - endif() + set_and_warn_library_found("FFmpeg" FFMPEG_FOUND WITH_CODEC_FFMPEG) endif() if(WITH_FFTW3) find_package_wrapper(Fftw3) - if(NOT FFTW3_FOUND) - set(WITH_FFTW3 OFF) - endif() + set_and_warn_library_found("fftw3" FFTW3_FOUND WITH_FFTW3) endif() if(WITH_OPENCOLLADA) @@ -275,25 +259,23 @@ if(WITH_OPENCOLLADA) endif() find_package_wrapper(XML2) else() - set(WITH_OPENCOLLADA OFF) + set_and_warn_library_found("OpenCollada" OPENCOLLADA_FOUND WITH_OPENCOLLADA) endif() endif() if(WITH_MEM_JEMALLOC) find_package_wrapper(JeMalloc) - if(NOT JEMALLOC_FOUND) - set(WITH_MEM_JEMALLOC OFF) - endif() + set_and_warn_library_found("JeMalloc" JEMALLOC_FOUND WITH_MEM_JEMALLOC) endif() if(WITH_INPUT_NDOF) find_package_wrapper(Spacenav) + set_and_warn_library_found("SpaceNav" SPACENAV_FOUND WITH_INPUT_NDOF) + if(SPACENAV_FOUND) # use generic names within blenders buildsystem. set(NDOF_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIRS}) set(NDOF_LIBRARIES ${SPACENAV_LIBRARIES}) - else() - set(WITH_INPUT_NDOF OFF) endif() endif() @@ -303,6 +285,8 @@ if(WITH_CYCLES AND WITH_CYCLES_OSL) set(OSL_ROOT ${CYCLES_OSL}) endif() find_package_wrapper(OSL) + set_and_warn_library_found("OSL" OSL_FOUND WITH_CYCLES_OSL) + if(OSL_FOUND) if(${OSL_LIBRARY_VERSION_MAJOR} EQUAL "1" AND ${OSL_LIBRARY_VERSION_MINOR} LESS "6") # Note: --whole-archive is needed to force loading of all symbols in liboslexec, @@ -313,13 +297,10 @@ if(WITH_CYCLES AND WITH_CYCLES_OSL) -Wl,--no-whole-archive ${OSL_OSLQUERY_LIBRARY} ) endif() - else() - message(STATUS "OSL not found, disabling it from Cycles") - set(WITH_CYCLES_OSL OFF) endif() endif() -if(WITH_CYCLES_DEVICE_ONEAPI) +if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI) set(CYCLES_LEVEL_ZERO ${LIBDIR}/level-zero CACHE PATH "Path to Level Zero installation") if(EXISTS ${CYCLES_LEVEL_ZERO} AND NOT LEVEL_ZERO_ROOT_DIR) set(LEVEL_ZERO_ROOT_DIR ${CYCLES_LEVEL_ZERO}) @@ -331,39 +312,28 @@ if(WITH_CYCLES_DEVICE_ONEAPI) endif() file(GLOB _sycl_runtime_libraries ${SYCL_ROOT_DIR}/lib/libsycl.so - ${SYCL_ROOT_DIR}/lib/libsycl.so.[0-9] - ${SYCL_ROOT_DIR}/lib/libsycl.so.[0-9].[0-9].[0-9]-[0-9] + ${SYCL_ROOT_DIR}/lib/libsycl.so.* ${SYCL_ROOT_DIR}/lib/libpi_level_zero.so ) + list(FILTER _sycl_runtime_libraries EXCLUDE REGEX ".*\.py") list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_sycl_runtime_libraries}) unset(_sycl_runtime_libraries) endif() if(WITH_OPENVDB) find_package(OpenVDB) - find_package_wrapper(Blosc) + set_and_warn_library_found("OpenVDB" OPENVDB_FOUND WITH_OPENVDB) if(OPENVDB_FOUND) - add_bundled_libraries(openvdb/lib) - - if(NOT EXISTS ${LIBDIR} AND NOT BLOSC_FOUND) - set(WITH_OPENVDB_BLOSC OFF) - message(STATUS "Blosc not found, disabling it for OpenVBD") - endif() - else() - set(WITH_OPENVDB OFF) - set(WITH_OPENVDB_BLOSC OFF) - message(STATUS "OpenVDB not found, disabling it") + add_bundled_libraries(openvdb/lib) + find_package_wrapper(Blosc) + set_and_warn_library_found("Blosc" BLOSC_FOUND WITH_OPENVDB_BLOSC) endif() endif() if(WITH_NANOVDB) find_package_wrapper(NanoVDB) - - if(NOT NANOVDB_FOUND) - set(WITH_NANOVDB OFF) - message(STATUS "NanoVDB not found, disabling it") - endif() + set_and_warn_library_found("NanoVDB" NANOVDB_FOUND WITH_NANOVDB) endif() if(WITH_CPU_SIMD AND SUPPORT_NEON_BUILD) @@ -372,21 +342,15 @@ endif() if(WITH_ALEMBIC) find_package_wrapper(Alembic) - - if(NOT ALEMBIC_FOUND) - set(WITH_ALEMBIC OFF) - endif() + set_and_warn_library_found("Alembic" ALEMBIC_FOUND WITH_ALEMBIC) endif() if(WITH_USD) - find_package(USD) - - if(USD_FOUND) + find_package_wrapper(USD) + set_and_warn_library_found("USD" USD_FOUND WITH_USD) + if(WITH_USD) add_bundled_libraries(usd/lib) - else() - set(WITH_USD OFF) - endif() -endif() + endif()endif() if(WITH_BOOST) # uses in build instructions to override include and library variables @@ -443,20 +407,13 @@ endif() if(WITH_PUGIXML) find_package_wrapper(PugiXML) - - if(NOT PUGIXML_FOUND) - set(WITH_PUGIXML OFF) - message(STATUS "PugiXML not found, disabling WITH_PUGIXML") - endif() + set_and_warn_library_found("PugiXML" PUGIXML_FOUND WITH_PUGIXML) endif() if(WITH_IMAGE_WEBP) set(WEBP_ROOT_DIR ${LIBDIR}/webp) find_package_wrapper(WebP) - if(NOT WEBP_FOUND) - set(WITH_IMAGE_WEBP OFF) - message(WARNING "WebP not found, disabling WITH_IMAGE_WEBP") - endif() + set_and_warn_library_found("WebP" WEBP_FOUND WITH_IMAGE_WEBP) endif() if(WITH_OPENIMAGEIO) @@ -480,13 +437,10 @@ if(WITH_OPENIMAGEIO) list(APPEND OPENIMAGEIO_LIBRARIES "${WEBP_LIBRARIES}") endif() - if(OPENIMAGEIO_FOUND) + set_and_warn_library_found("OPENIMAGEIO" OPENIMAGEIO_FOUND WITH_OPENIMAGEIO) + if(WITH_OPENIMAGEIO) add_bundled_libraries(openimageio/lib) - else() - set(WITH_OPENIMAGEIO OFF) - message(STATUS "OpenImageIO not found, disabling WITH_CYCLES") - endif() -endif() + endif()endif() if(WITH_OPENCOLORIO) find_package_wrapper(OpenColorIO 2.0.0) @@ -495,10 +449,7 @@ if(WITH_OPENCOLORIO) set(OPENCOLORIO_LIBPATH) # TODO, remove and reference the absolute path everywhere set(OPENCOLORIO_DEFINITIONS) - if(NOT OPENCOLORIO_FOUND) - set(WITH_OPENCOLORIO OFF) - message(STATUS "OpenColorIO not found") - endif() + set_and_warn_library_found("OpenColorIO" OPENCOLORIO_FOUND WITH_OPENCOLORIO) endif() if(WITH_CYCLES AND WITH_CYCLES_EMBREE) @@ -507,11 +458,7 @@ endif() if(WITH_OPENIMAGEDENOISE) find_package_wrapper(OpenImageDenoise) - - if(NOT OPENIMAGEDENOISE_FOUND) - set(WITH_OPENIMAGEDENOISE OFF) - message(STATUS "OpenImageDenoise not found") - endif() + set_and_warn_library_found("OpenImageDenoise" OPENIMAGEDENOISE_FOUND WITH_OPENIMAGEDENOISE) endif() if(WITH_LLVM) @@ -520,82 +467,60 @@ if(WITH_LLVM) endif() find_package_wrapper(LLVM) + set_and_warn_library_found("LLVM" LLVM_FOUND WITH_LLVM) + + if(LLVM_FOUND) if(WITH_CLANG) find_package_wrapper(Clang) + set_and_warn_library_found("Clang" CLANG_FOUND WITH_CLANG) endif() + # Symbol conflicts with same UTF library used by OpenCollada if(EXISTS ${LIBDIR}) if(WITH_OPENCOLLADA AND (${LLVM_VERSION} VERSION_LESS "4.0.0")) list(REMOVE_ITEM OPENCOLLADA_LIBRARIES ${OPENCOLLADA_UTF_LIBRARY}) endif() endif() - - if(NOT LLVM_FOUND) - set(WITH_LLVM OFF) - set(WITH_CLANG OFF) - message(STATUS "LLVM not found") - else() - if(NOT CLANG_FOUND) - set(WITH_CLANG OFF) - message(STATUS "Clang not found") endif() - endif() endif() if(WITH_OPENSUBDIV) find_package(OpenSubdiv) - if(OPENSUBDIV_FOUND) - add_bundled_libraries(opensubdiv/lib) - else() - set(WITH_OPENSUBDIV OFF) - message(STATUS "OpenSubdiv not found") - endif() -endif() + set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBRARIES}) + set(OPENSUBDIV_LIBPATH) # TODO, remove and reference the absolute path everywhere + + set_and_warn_library_found("OpenSubdiv" OPENSUBDIV_FOUND WITH_OPENSUBDIV) + if(WITH_OPENSUBDIV) + add_bundled_libraries(opensubdiv/lib) endif()endif() if(WITH_TBB) find_package_wrapper(TBB) - if(TBB_FOUND) - add_bundled_libraries(tbb/lib) - elseif(EXISTS ${LIBDIR}) - message(WARNING "TBB not found, disabling WITH_TBB") - set(WITH_TBB OFF) - endif() -endif() + set_and_warn_library_found("TBB" TBB_FOUND WITH_TBB) + if(WITH_TBB) + add_bundled_libraries(tbb/lib) endif()endif() if(WITH_XR_OPENXR) find_package(XR_OpenXR_SDK) - if(NOT XR_OPENXR_SDK_FOUND) - message(WARNING "OpenXR-SDK not found, disabling WITH_XR_OPENXR") - set(WITH_XR_OPENXR OFF) - endif() + set_and_warn_library_found("OpenXR-SDK" XR_OPENXR_SDK_FOUND WITH_XR_OPENXR) endif() if(WITH_GMP) find_package_wrapper(GMP) - if(NOT GMP_FOUND) - message(WARNING "GMP not found, disabling WITH_GMP") - set(WITH_GMP OFF) - endif() + set_and_warn_library_found("GMP" GMP_FOUND WITH_GMP) endif() if(WITH_POTRACE) find_package_wrapper(Potrace) - if(NOT POTRACE_FOUND) - message(WARNING "potrace not found, disabling WITH_POTRACE") - set(WITH_POTRACE OFF) - endif() + set_and_warn_library_found("Potrace" POTRACE_FOUND WITH_POTRACE) endif() if(WITH_HARU) find_package_wrapper(Haru) - if(NOT HARU_FOUND) - message(WARNING "Haru not found, disabling WITH_HARU") - set(WITH_HARU OFF) - endif() + set_and_warn_library_found("Haru" HARU_FOUND WITH_HARU) endif() -if(WITH_CYCLES_PATH_GUIDING) +if(WITH_CYCLES AND WITH_CYCLES_PATH_GUIDING) find_package_wrapper(openpgl) if(openpgl_FOUND) get_target_property(OPENPGL_LIBRARIES openpgl::openpgl LOCATION) @@ -679,25 +604,20 @@ endif() # Jack is intended to use the system library. if(WITH_JACK) find_package_wrapper(Jack) - if(NOT JACK_FOUND) - set(WITH_JACK OFF) - endif() + set_and_warn_library_found("JACK" JACK_FOUND WITH_JACK) endif() # Pulse is intended to use the system library. if(WITH_PULSEAUDIO) find_package_wrapper(Pulse) - if(NOT PULSE_FOUND) - set(WITH_PULSEAUDIO OFF) - endif() + set_and_warn_library_found("PulseAudio" PULSE_FOUND WITH_PULSEAUDIO) endif() # Audio IO if(WITH_SYSTEM_AUDASPACE) find_package_wrapper(Audaspace) - if(NOT AUDASPACE_FOUND OR NOT AUDASPACE_C_FOUND) - message(FATAL_ERROR "Audaspace external library not found!") - endif() + set(AUDASPACE_FOUND ${AUDASPACE_FOUND} AND ${AUDASPACE_C_FOUND}) + set_and_warn_library_found("External Audaspace" AUDASPACE_FOUND WITH_SYSTEM_AUDASPACE) endif() if(WITH_GHOST_WAYLAND) @@ -743,30 +663,12 @@ if(WITH_GHOST_WAYLAND) set(wayland-cursor_FOUND ON) endif() - 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() + set_and_warn_library_found("wayland-client" wayland-client_FOUND WITH_GHOST_WAYLAND) + set_and_warn_library_found("wayland-egl" wayland-egl_FOUND WITH_GHOST_WAYLAND) + set_and_warn_library_found("wayland-scanner" wayland-scanner_FOUND WITH_GHOST_WAYLAND) + set_and_warn_library_found("wayland-cursor" wayland-cursor_FOUND WITH_GHOST_WAYLAND) + set_and_warn_library_found("wayland-protocols" wayland-protocols_FOUND WITH_GHOST_WAYLAND) + set_and_warn_library_found("xkbcommon" xkbcommon_FOUND WITH_GHOST_WAYLAND) if(WITH_GHOST_WAYLAND) if(WITH_GHOST_WAYLAND_DBUS) |