Add Chromium-only Blender WebEngine parity work

This commit is contained in:
mes123456
2026-08-12 04:47:48 -04:00
commit 9fd26010f6
18225 changed files with 11622124 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
# SPDX-FileCopyrightText: 2016 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find Alembic library
# Find the native Alembic includes and libraries
# This module defines
# ALEMBIC_INCLUDE_DIRS, where to find Alembic headers, Set when
# ALEMBIC_INCLUDE_DIR is found.
# ALEMBIC_LIBRARIES, libraries to link against to use Alembic.
# ALEMBIC_ROOT_DIR, The base directory to search for Alembic.
# This can also be an environment variable.
# ALEMBIC_FOUND, If false, do not try to use Alembic.
#
# If `ALEMBIC_ROOT_DIR` was defined in the environment, use it.
if(DEFINED ALEMBIC_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{ALEMBIC_ROOT_DIR})
set(ALEMBIC_ROOT_DIR $ENV{ALEMBIC_ROOT_DIR})
else()
set(ALEMBIC_ROOT_DIR "")
endif()
set(_alembic_SEARCH_DIRS
${ALEMBIC_ROOT_DIR}
/opt/lib/alembic
)
find_path(ALEMBIC_INCLUDE_DIR
NAMES
Alembic/Abc/All.h
HINTS
${_alembic_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(ALEMBIC_LIBRARY
NAMES
Alembic
HINTS
${_alembic_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib lib/static
)
# handle the QUIETLY and REQUIRED arguments and set ALEMBIC_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Alembic DEFAULT_MSG ALEMBIC_LIBRARY ALEMBIC_INCLUDE_DIR)
if(ALEMBIC_FOUND)
set(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARY})
set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
endif()
mark_as_advanced(
ALEMBIC_INCLUDE_DIR
ALEMBIC_LIBRARY
)
unset(_alembic_SEARCH_DIRS)

View File

@@ -0,0 +1,115 @@
# SPDX-FileCopyrightText: 2014 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Try to find audaspace
# Once done, this will define
#
# AUDASPACE_FOUND - system has audaspace
# AUDASPACE_INCLUDE_DIRS - the audaspace include directories
# AUDASPACE_LIBRARIES - link these to use audaspace
# AUDASPACE_C_FOUND - system has audaspace's C binding
# AUDASPACE_C_INCLUDE_DIRS - the audaspace's C binding include directories
# AUDASPACE_C_LIBRARIES - link these to use audaspace's C binding
# AUDASPACE_PY_FOUND - system has audaspace's python binding
# AUDASPACE_PY_INCLUDE_DIRS - the audaspace's python binding include directories
# AUDASPACE_PY_LIBRARIES - link these to use audaspace's python binding
if(NOT AUDASPACE_ROOT_DIR AND NOT $ENV{AUDASPACE_ROOT_DIR} STREQUAL "")
set(AUDASPACE_ROOT_DIR $ENV{AUDASPACE_ROOT_DIR})
endif()
set(_audaspace_SEARCH_DIRS
${AUDASPACE_ROOT_DIR}
)
# Use pkg-config to get hints about paths
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(AUDASPACE_PKGCONF audaspace)
endif()
# Include dir
find_path(AUDASPACE_INCLUDE_DIR
NAMES ISound.h
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_INCLUDE_DIRS}
PATH_SUFFIXES include/audaspace
)
# Library
find_library(AUDASPACE_LIBRARY
NAMES audaspace
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_LIBRARY_DIRS}
PATH_SUFFIXES lib lib64
)
# Include dir
find_path(AUDASPACE_C_INCLUDE_DIR
NAMES AUD_Sound.h
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_INCLUDE_DIRS}
PATH_SUFFIXES include/audaspace
)
# Library
find_library(AUDASPACE_C_LIBRARY
NAMES audaspace-c
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_LIBRARY_DIRS}
PATH_SUFFIXES lib lib64
)
# Include dir
find_path(AUDASPACE_PY_INCLUDE_DIR
NAMES python/PyAPI.h
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_INCLUDE_DIRS}
PATH_SUFFIXES include/audaspace
)
# Library
find_library(AUDASPACE_PY_LIBRARY
NAMES audaspace-py
HINTS ${_audaspace_SEARCH_DIRS}
PATHS ${AUDASPACE_PKGCONF_LIBRARY_DIRS}
PATH_SUFFIXES lib lib64
)
find_package(PackageHandleStandardArgs)
find_package_handle_standard_args(Audaspace DEFAULT_MSG AUDASPACE_LIBRARY AUDASPACE_INCLUDE_DIR)
find_package_handle_standard_args(Audaspace_C DEFAULT_MSG AUDASPACE_C_LIBRARY AUDASPACE_C_INCLUDE_DIR)
find_package_handle_standard_args(Audaspace_Py DEFAULT_MSG AUDASPACE_PY_LIBRARY AUDASPACE_PY_INCLUDE_DIR)
if(AUDASPACE_FOUND)
set(AUDASPACE_LIBRARIES ${AUDASPACE_LIBRARY})
set(AUDASPACE_INCLUDE_DIRS ${AUDASPACE_INCLUDE_DIR})
endif()
if(AUDASPACE_C_FOUND)
set(AUDASPACE_C_LIBRARIES ${AUDASPACE_C_LIBRARY})
set(AUDASPACE_C_INCLUDE_DIRS ${AUDASPACE_C_INCLUDE_DIR})
endif()
if(AUDASPACE_PY_FOUND)
set(AUDASPACE_PY_LIBRARIES ${AUDASPACE_PY_LIBRARY})
set(AUDASPACE_PY_INCLUDE_DIRS ${AUDASPACE_PY_INCLUDE_DIR})
endif()
mark_as_advanced(
AUDASPACE_LIBRARY
AUDASPACE_LIBRARIES
AUDASPACE_INCLUDE_DIR
AUDASPACE_INCLUDE_DIRS
AUDASPACE_C_LIBRARY
AUDASPACE_C_LIBRARIES
AUDASPACE_C_INCLUDE_DIR
AUDASPACE_C_INCLUDE_DIRS
AUDASPACE_PY_LIBRARY
AUDASPACE_PY_LIBRARIES
AUDASPACE_PY_INCLUDE_DIR
AUDASPACE_PY_INCLUDE_DIRS
)
unset(_audaspace_SEARCH_DIRS)

View File

@@ -0,0 +1,68 @@
# SPDX-FileCopyrightText: 2018 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find Blosc library
# Find the native Blosc includes and library
# This module defines
# BLOSC_INCLUDE_DIRS, where to find blosc.h, Set when
# Blosc is found.
# BLOSC_LIBRARIES, libraries to link against to use Blosc.
# BLOSC_ROOT_DIR, The base directory to search for Blosc.
# This can also be an environment variable.
# BLOSC_FOUND, If false, do not try to use Blosc.
#
# also defined, but not for general use are
# BLOSC_LIBRARY, where to find the Blosc library.
# If `BLOSC_ROOT_DIR` was defined in the environment, use it.
if(DEFINED BLOSC_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{BLOSC_ROOT_DIR})
set(BLOSC_ROOT_DIR $ENV{BLOSC_ROOT_DIR})
else()
set(BLOSC_ROOT_DIR "")
endif()
set(_blosc_SEARCH_DIRS
${BLOSC_ROOT_DIR}
/opt/lib/blosc
)
find_path(BLOSC_INCLUDE_DIR
NAMES
blosc.h
HINTS
${_blosc_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(BLOSC_LIBRARY
NAMES
blosc
HINTS
${_blosc_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set BLOSC_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Blosc DEFAULT_MSG
BLOSC_LIBRARY BLOSC_INCLUDE_DIR)
if(BLOSC_FOUND)
set(BLOSC_LIBRARIES ${BLOSC_LIBRARY})
set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIR})
else()
set(BLOSC_FOUND FALSE)
endif()
mark_as_advanced(
BLOSC_INCLUDE_DIR
BLOSC_LIBRARY
)
unset(_blosc_SEARCH_DIRS)

View File

@@ -0,0 +1,84 @@
# SPDX-FileCopyrightText: 2022 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find Brotli library (compression for freetype/woff2).
# This module defines
# BROTLI_INCLUDE_DIRS, where to find Brotli headers, Set when
# BROTLI_INCLUDE_DIR is found.
# BROTLI_LIBRARIES, libraries to link against to use Brotli.
# BROTLI_ROOT_DIR, The base directory to search for Brotli.
# This can also be an environment variable.
# BROTLI_FOUND, If false, do not try to use Brotli.
#
# If `BROTLI_ROOT_DIR` was defined in the environment, use it.
if(DEFINED BROTLI_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{BROTLI_ROOT_DIR})
set(BROTLI_ROOT_DIR $ENV{BROTLI_ROOT_DIR})
else()
set(BROTLI_ROOT_DIR "")
endif()
set(_brotli_SEARCH_DIRS
${BROTLI_ROOT_DIR}
)
find_path(BROTLI_INCLUDE_DIR
NAMES
brotli/decode.h
HINTS
${_brotli_SEARCH_DIRS}
PATH_SUFFIXES
include
DOC "Brotli header files"
)
find_library(BROTLI_LIBRARY_COMMON
NAMES
# Some builds use a special `-static` postfix in their static libraries names.
brotlicommon-static
brotlicommon
HINTS
${_brotli_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib lib/static
DOC "Brotli static common library"
)
find_library(BROTLI_LIBRARY_DEC
NAMES
# Some builds use a special `-static` postfix in their static libraries names.
brotlidec-static
brotlidec
HINTS
${_brotli_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib lib/static
DOC "Brotli static decode library"
)
if((NOT BROTLI_LIBRARY_COMMON) OR (NOT BROTLI_LIBRARY_DEC))
set(BROTLI_FOUND FALSE)
else()
# handle the QUIETLY and REQUIRED arguments and set BROTLI_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Brotli DEFAULT_MSG BROTLI_LIBRARY_COMMON BROTLI_LIBRARY_DEC BROTLI_INCLUDE_DIR)
if(BROTLI_FOUND)
get_filename_component(BROTLI_LIBRARY_DIR ${BROTLI_LIBRARY_COMMON} DIRECTORY)
set(BROTLI_INCLUDE_DIRS ${BROTLI_INCLUDE_DIR})
set(BROTLI_LIBRARIES ${BROTLI_LIBRARY_DEC} ${BROTLI_LIBRARY_COMMON})
endif()
endif()
mark_as_advanced(
BROTLI_INCLUDE_DIR
BROTLI_LIBRARY_COMMON
BROTLI_LIBRARY_DEC
BROTLI_LIBRARY_DIR
)
unset(_brotli_SEARCH_DIRS)

View File

@@ -0,0 +1,130 @@
# SPDX-FileCopyrightText: 2011 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find Clang library
# Find the native Clang includes and library
# This module defines
# CLANG_INCLUDE_DIRS, where to find AST/AST.h, Set when
# CLANG_INCLUDE_DIR is found.
# CLANG_LIBRARIES, libraries to link against to use Clang.
# CLANG_ROOT_DIR, The base directory to search for Clang.
# This can also be an environment variable.
# CLANG_FOUND, If false, do not try to use Clang.
# If `CLANG_ROOT_DIR` was defined in the environment, use it.
if(DEFINED CLANG_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{CLANG_ROOT_DIR})
set(CLANG_ROOT_DIR $ENV{CLANG_ROOT_DIR})
else()
set(CLANG_ROOT_DIR "")
endif()
if(NOT LLVM_ROOT_DIR)
if(DEFINED LLVM_VERSION)
message(STATUS "Running llvm-config-${LLVM_VERSION}")
find_program(LLVM_CONFIG llvm-config-${LLVM_VERSION})
endif()
if(NOT LLVM_CONFIG)
find_program(LLVM_CONFIG llvm-config)
endif()
execute_process(COMMAND ${LLVM_CONFIG} --prefix
OUTPUT_VARIABLE LLVM_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(LLVM_ROOT_DIR ${LLVM_ROOT_DIR} CACHE PATH "Path to the LLVM installation")
endif()
set(_clang_SEARCH_DIRS
${CLANG_ROOT_DIR}
${LLVM_ROOT_DIR}
/opt/lib/clang
)
find_path(CLANG_INCLUDE_DIR
NAMES
AST/AST.h
HINTS
${_clang_SEARCH_DIRS}
PATH_SUFFIXES
include
include/clang
)
set(_clang_FIND_COMPONENTS
clangDependencyScanning
clangDynamicASTMatchers
clangFrontendTool
clangStaticAnalyzerFrontend
clangHandleCXX
clangStaticAnalyzerCheckers
clangStaticAnalyzerCore
clangToolingASTDiff
clangToolingRefactoring
clangToolingSyntax
clangARCMigrate
clangCodeGen
clangCrossTU
clangIndex
clangTooling
clangFormat
clangToolingInclusions
clangRewriteFrontend
clangFrontend
clangSerialization
clangDriver
clangToolingCore
clangParse
clangRewrite
clangSema
clangEdit
clangAnalysis
clangASTMatchers
clangAST
clangLex
clangBasic
)
set(_clang_LIBRARIES "")
foreach(COMPONENT ${_clang_FIND_COMPONENTS})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
find_library(CLANG_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}
HINTS
${_clang_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
if(CLANG_${UPPERCOMPONENT}_LIBRARY)
list(APPEND _clang_LIBRARIES "${CLANG_${UPPERCOMPONENT}_LIBRARY}")
endif()
endforeach()
# Handle the QUIETLY and REQUIRED arguments and set CLANG_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Clang DEFAULT_MSG
_clang_LIBRARIES CLANG_INCLUDE_DIR)
if(CLANG_FOUND)
set(CLANG_LIBRARIES ${_clang_LIBRARIES})
set(CLANG_INCLUDE_DIRS ${CLANG_INCLUDE_DIR})
endif()
mark_as_advanced(
CLANG_INCLUDE_DIR
)
foreach(COMPONENT ${_clang_FIND_COMPONENTS})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
mark_as_advanced(CLANG_${UPPERCOMPONENT}_LIBRARY)
endforeach()
unset(_clang_SEARCH_DIRS)
unset(_clang_FIND_COMPONENTS)
unset(_clang_LIBRARIES)

View File

@@ -0,0 +1,108 @@
# SPDX-FileCopyrightText: 2020 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find clang-tidy executable
#
# Find the native clang-tidy executable
#
# This module defines
# CLANG_TIDY_EXECUTABLE, the full path to clang-tidy executable
#
# CLANG_TIDY_VERSION, the full version of the clang-tidy in the
# major,minor.patch format
#
# CLANG_TIDY_VERSION_MAJOR,
# CLANG_TIDY_VERSION_MINOR,
# CLANG_TIDY_VERSION_PATCH, individual components of the clang-tidy version.
#
# CLANG_TIDY_FOUND, If false, do not try to use clang-tidy.
# If `CLANG_TIDY_ROOT_DIR` was defined in the environment, use it.
if(DEFINED CLANG_TIDY_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{CLANG_TIDY_ROOT_DIR})
set(CLANG_TIDY_ROOT_DIR $ENV{CLANG_TIDY_ROOT_DIR})
else()
set(CLANG_TIDY_ROOT_DIR "")
endif()
set(_clang_tidy_SEARCH_DIRS
${CLANG_TIDY_ROOT_DIR}
/usr/local/bin
)
# TODO(sergey): Find more reliable way of finding the latest clang-tidy.
find_program(CLANG_TIDY_EXECUTABLE
NAMES
clang-tidy-12
clang-tidy-11
clang-tidy-10
clang-tidy-9
clang-tidy-8
clang-tidy-7
clang-tidy
HINTS
${_clang_tidy_SEARCH_DIRS}
)
if(CLANG_TIDY_EXECUTABLE AND NOT EXISTS "${CLANG_TIDY_EXECUTABLE}")
message(WARNING "Cached or directly specified Clang-Tidy executable does not exist.")
set(CLANG_TIDY_FOUND FALSE)
elseif(CLANG_TIDY_EXECUTABLE)
# Mark clang-tidy as found.
set(CLANG_TIDY_FOUND TRUE)
# Setup fallback values.
set(CLANG_TIDY_VERSION_MAJOR 0)
set(CLANG_TIDY_VERSION_MINOR 0)
set(CLANG_TIDY_VERSION_PATCH 0)
# Get version from the output.
#
# NOTE: Don't use name of the executable file since that only includes a
# major version. Also, even the major version might be missing in the
# executable name.
execute_process(COMMAND ${CLANG_TIDY_EXECUTABLE} -version
OUTPUT_VARIABLE CLANG_TIDY_VERSION_RAW
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Parse parts.
if(CLANG_TIDY_VERSION_RAW MATCHES "LLVM version .*")
# Strip the LLVM prefix and get list of individual version components.
string(REGEX REPLACE
".*LLVM version ([.0-9]+).*" "\\1"
CLANG_SEMANTIC_VERSION "${CLANG_TIDY_VERSION_RAW}")
string(REPLACE "." ";" CLANG_VERSION_PARTS "${CLANG_SEMANTIC_VERSION}")
list(LENGTH CLANG_VERSION_PARTS NUM_CLANG_TIDY_VERSION_PARTS)
# Extract components into corresponding variables.
if(NUM_CLANG_TIDY_VERSION_PARTS GREATER 0)
list(GET CLANG_VERSION_PARTS 0 CLANG_TIDY_VERSION_MAJOR)
endif()
if(NUM_CLANG_TIDY_VERSION_PARTS GREATER 1)
list(GET CLANG_VERSION_PARTS 1 CLANG_TIDY_VERSION_MINOR)
endif()
if(NUM_CLANG_TIDY_VERSION_PARTS GREATER 2)
list(GET CLANG_VERSION_PARTS 2 CLANG_TIDY_VERSION_PATCH)
endif()
# Unset temp variables.
unset(NUM_CLANG_TIDY_VERSION_PARTS)
unset(CLANG_SEMANTIC_VERSION)
unset(CLANG_VERSION_PARTS)
endif()
# Construct full semantic version.
set(CLANG_TIDY_VERSION "${CLANG_TIDY_VERSION_MAJOR}.\
${CLANG_TIDY_VERSION_MINOR}.\
${CLANG_TIDY_VERSION_PATCH}")
unset(CLANG_TIDY_VERSION_RAW)
message(STATUS "Found clang-tidy ${CLANG_TIDY_EXECUTABLE} (${CLANG_TIDY_VERSION})")
else()
set(CLANG_TIDY_FOUND FALSE)
endif()
unset(_clang_tidy_SEARCH_DIRS)

View File

@@ -0,0 +1,136 @@
# SPDX-FileCopyrightText: 2018 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find Embree library
# Find the native Embree includes and library
# This module defines
# EMBREE_INCLUDE_DIRS, where to find rtcore.h, Set when
# EMBREE_INCLUDE_DIR is found.
# EMBREE_LIBRARIES, libraries to link against to use Embree.
# EMBREE_ROOT_DIR, The base directory to search for Embree.
# This can also be an environment variable.
# EMBREE_FOUND, If false, do not try to use Embree.
# If `EMBREE_ROOT_DIR` was defined in the environment, use it.
if(DEFINED EMBREE_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{EMBREE_ROOT_DIR})
set(EMBREE_ROOT_DIR $ENV{EMBREE_ROOT_DIR})
else()
set(EMBREE_ROOT_DIR "")
endif()
set(_embree_SEARCH_DIRS
${EMBREE_ROOT_DIR}
/opt/lib/embree
)
find_path(EMBREE_INCLUDE_DIR
NAMES
embree4/rtcore.h
embree3/rtcore.h
HINTS
${_embree_SEARCH_DIRS}
PATH_SUFFIXES
include
)
if(EXISTS ${EMBREE_INCLUDE_DIR}/embree4/rtcore_config.h)
set(EMBREE_MAJOR_VERSION 4)
else()
set(EMBREE_MAJOR_VERSION 3)
endif()
if(EMBREE_INCLUDE_DIR)
file(READ ${EMBREE_INCLUDE_DIR}/embree${EMBREE_MAJOR_VERSION}/rtcore_config.h _embree_config_header)
if(_embree_config_header MATCHES "#define EMBREE_STATIC_LIB")
set(EMBREE_STATIC_LIB TRUE)
else()
set(EMBREE_STATIC_LIB FALSE)
endif()
if(_embree_config_header MATCHES "#define EMBREE_SYCL_SUPPORT")
set(EMBREE_SYCL_SUPPORT TRUE)
else()
set(EMBREE_SYCL_SUPPORT FALSE)
endif()
unset(_embree_config_header)
endif()
if(EMBREE_STATIC_LIB)
if((CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64") OR (APPLE AND (CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")))
set(_embree_SIMD_COMPONENTS
embree_sse42
embree_avx
embree_avx2
)
endif()
if(EMBREE_SYCL_SUPPORT)
set(_embree_GPU_COMPONENTS
embree4_sycl
embree_rthwif
)
endif()
set(_embree_FIND_COMPONENTS
embree${EMBREE_MAJOR_VERSION}
${_embree_SIMD_COMPONENTS}
${_embree_GPU_COMPONENTS}
lexers
math
simd
sys
tasking
)
else()
set(_embree_FIND_COMPONENTS
embree${EMBREE_MAJOR_VERSION}
)
if(EMBREE_SYCL_SUPPORT)
list(APPEND _embree_FIND_COMPONENTS
embree4_sycl
)
endif()
endif()
set(_embree_LIBRARIES "")
foreach(COMPONENT ${_embree_FIND_COMPONENTS})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
find_library(EMBREE_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}
HINTS
${_embree_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
list(APPEND _embree_LIBRARIES "${EMBREE_${UPPERCOMPONENT}_LIBRARY}")
endforeach()
# handle the QUIETLY and REQUIRED arguments and set EMBREE_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Embree DEFAULT_MSG
_embree_LIBRARIES EMBREE_INCLUDE_DIR)
if(EMBREE_FOUND)
set(EMBREE_LIBRARIES ${_embree_LIBRARIES})
set(EMBREE_INCLUDE_DIRS ${EMBREE_INCLUDE_DIR})
endif()
mark_as_advanced(
EMBREE_INCLUDE_DIR
EMBREE_MAJOR_VERSION
EMBREE_SYCL_SUPPORT
EMBREE_STATIC_LIB
)
foreach(COMPONENT ${_embree_FIND_COMPONENTS})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
mark_as_advanced(EMBREE_${UPPERCOMPONENT}_LIBRARY)
endforeach()
unset(_embree_SEARCH_DIRS)
unset(_embree_FIND_COMPONENTS)
unset(_embree_LIBRARIES)

View File

@@ -0,0 +1,53 @@
# SPDX-FileCopyrightText: 2022 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# This module defines
# EPOXY_INCLUDE_DIRS, where to find epoxy/gl.h
# EPOXY_LIBRARIES, where to find the epoxy library.
# EPOXY_ROOT_DIR, The base directory to search for epoxy.
# This can also be an environment variable.
# EPOXY_FOUND, If false, do not try to use epoxy.
# If `EPOXY_ROOT_DIR` was defined in the environment, use it.
if(DEFINED EPOXY_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{EPOXY_ROOT_DIR})
set(EPOXY_ROOT_DIR $ENV{EPOXY_ROOT_DIR})
else()
set(EPOXY_ROOT_DIR "")
endif()
find_path(EPOXY_INCLUDE_DIR
NAMES
epoxy/gl.h
HINTS
${EPOXY_ROOT_DIR}
PATH_SUFFIXES
include
)
find_library(EPOXY_LIBRARY
NAMES
epoxy
HINTS
${EPOXY_ROOT_DIR}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set EPOXY_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Epoxy DEFAULT_MSG
EPOXY_LIBRARY EPOXY_INCLUDE_DIR)
if(EPOXY_FOUND)
set(EPOXY_INCLUDE_DIRS ${EPOXY_INCLUDE_DIR})
set(EPOXY_LIBRARIES ${EPOXY_LIBRARY})
endif()
mark_as_advanced(
EPOXY_INCLUDE_DIR
EPOXY_LIBRARY
)

View File

@@ -0,0 +1,93 @@
# SPDX-FileCopyrightText: 2020 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find FFmpeg library and includes.
# Set FFMPEG_FIND_COMPONENTS to the canonical names of the libraries
# before using the module.
# This module defines
# FFMPEG_INCLUDE_DIRS, where to find libavcodec/ac3_parser.h.
# FFMPEG_LIBRARIES, libraries to link against to use FFmpeg.
# FFMPEG_ROOT_DIR, The base directory to search for FFmpeg.
# This can also be an environment variable.
# FFMPEG_FOUND, If false, do not try to use FFmpeg.
# FFMPEG_<COMPONENT>_LIBRARY, the given individual component libraries.
# If `FFMPEG_ROOT_DIR` was defined in the environment, use it.
if(DEFINED FFMPEG_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{FFMPEG_ROOT_DIR})
set(FFMPEG_ROOT_DIR $ENV{FFMPEG_ROOT_DIR})
else()
set(FFMPEG_ROOT_DIR "")
endif()
set(_ffmpeg_SEARCH_DIRS
${FFMPEG_ROOT_DIR}
/opt/lib/ffmpeg
)
if(NOT FFMPEG_FIND_COMPONENTS)
set(FFMPEG_FIND_COMPONENTS
# List taken from http://ffmpeg.org/download.html#build-mac
avcodec
avdevice
avfilter
avformat
avutil
swscale
swresample
)
endif()
find_path(_ffmpeg_INCLUDE_DIR
NAMES
libavcodec/ac3_parser.h
HINTS
${_ffmpeg_SEARCH_DIRS}
PATH_SUFFIXES
include
# Used by `ffmpeg-devel` on Fedora (see #147952).
include/ffmpeg
)
set(_ffmpeg_LIBRARIES "")
foreach(_component ${FFMPEG_FIND_COMPONENTS})
string(TOUPPER ${_component} _upper_COMPONENT)
find_library(FFMPEG_${_upper_COMPONENT}_LIBRARY
NAMES
${_component}
HINTS
${_ffmpeg_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
if(NOT FFMPEG_${_upper_COMPONENT}_LIBRARY)
message(WARNING "Could NOT find FFmpeg ${_upper_COMPONENT}.")
endif()
list(APPEND _ffmpeg_LIBRARIES ${FFMPEG_${_upper_COMPONENT}_LIBRARY})
mark_as_advanced(FFMPEG_${_upper_COMPONENT}_LIBRARY)
endforeach()
unset(_component)
unset(_upper_COMPONENT)
# handle the QUIETLY and REQUIRED arguments and set FFMPEG_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FFmpeg DEFAULT_MSG
_ffmpeg_LIBRARIES _ffmpeg_INCLUDE_DIR)
if(FFMPEG_FOUND)
set(FFMPEG_LIBRARIES ${_ffmpeg_LIBRARIES})
set(FFMPEG_INCLUDE_DIRS ${_ffmpeg_INCLUDE_DIR})
endif()
mark_as_advanced(
FFMPEG_INCLUDE_DIR
)
unset(_ffmpeg_SEARCH_DIRS)
unset(_ffmpeg_LIBRARIES)
# In cmake version 3.21 and up, we can instead use the NO_CACHE option for
# find_path so we don't need to clear it from the cache here.
unset(_ffmpeg_INCLUDE_DIR CACHE)

View File

@@ -0,0 +1,88 @@
# SPDX-FileCopyrightText: 2011 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find Fftw3 library
# Find the native Fftw3 includes and library
# This module defines
# FFTW3_INCLUDE_DIRS, where to find fftw3.h, Set when
# FFTW3_INCLUDE_DIR is found.
# FFTW3_LIBRARIES, libraries to link against to use Fftw3.
# FFTW3_ROOT_DIR, The base directory to search for Fftw3.
# This can also be an environment variable.
# FFTW3_FOUND, If false, do not try to use Fftw3.
#
# also defined, but not for general use are
# FFTW3_LIBRARY_F, where to find the Fftw3 library (single precision float).
# FFTW3_LIBRARY_THREADS_F, where to find the Fftw3 threads library (single precision float).
# FFTW3_LIBRARY_D, where to find the Fftw3 library (double precision float).
# If `FFTW3_ROOT_DIR` was defined in the environment, use it.
if(DEFINED FFTW3_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{FFTW3_ROOT_DIR})
set(FFTW3_ROOT_DIR $ENV{FFTW3_ROOT_DIR})
else()
set(FFTW3_ROOT_DIR "")
endif()
set(_fftw3_SEARCH_DIRS
${FFTW3_ROOT_DIR}
)
find_path(FFTW3_INCLUDE_DIR
NAMES
fftw3.h
HINTS
${_fftw3_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(FFTW3_LIBRARY_F
NAMES
fftw3f
HINTS
${_fftw3_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
find_library(FFTW3_LIBRARY_THREADS_F
NAMES
fftw3f_threads
HINTS
${_fftw3_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
find_library(FFTW3_LIBRARY_D
NAMES
fftw3
HINTS
${_fftw3_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Fftw3 DEFAULT_MSG
FFTW3_LIBRARY_F FFTW3_LIBRARY_THREADS_F FFTW3_LIBRARY_D FFTW3_INCLUDE_DIR)
if(FFTW3_FOUND)
set(FFTW3_LIBRARIES ${FFTW3_LIBRARY_F} ${FFTW3_LIBRARY_D} ${FFTW3_LIBRARY_THREADS_F})
set(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR})
endif()
mark_as_advanced(
FFTW3_INCLUDE_DIR
FFTW3_LIBRARY_F
FFTW3_LIBRARY_THREADS_F
FFTW3_LIBRARY_D
)
unset(_fftw3_SEARCH_DIRS)

View File

@@ -0,0 +1,59 @@
# SPDX-FileCopyrightText: 2023 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find Fribidi library
# Find the native fribidi includes and library
# This module defines
# LIBFRIBIDI_INCLUDE_DIRS, where to find fribidi/fribidi.h, Set when
# LIBFRIBIDI_INCLUDE_DIR is found.
# LIBFRIBIDI_LIBRARIES, libraries to link against to use fribidi.
# LIBFRIBIDI_ROOT_DIR, The base directory to search for Fribidi.
# This can also be an environment variable.
# FRIBIDI_FOUND, If false, do not try to use Fribidi.
#
# also defined, but not for general use are
# LIBFRIBIDI_LIBRARY, where to find the Fribidi library.
# If LIBFRIBIDI_ROOT_DIR was defined in the environment, use it.
if(NOT LIBFRIBIDI_ROOT_DIR AND NOT $ENV{LIBFRIBIDI_ROOT_DIR} STREQUAL "")
set(LIBFRIBIDI_ROOT_DIR $ENV{LIBFRIBIDI_ROOT_DIR})
endif()
set(_fribidi_SEARCH_DIRS
${LIBFRIBIDI_ROOT_DIR}
)
find_path(LIBFRIBIDI_INCLUDE_DIR fribidi/fribidi.h
HINTS
${_fribidi_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(LIBFRIBIDI_LIBRARY
NAMES
fribidi
HINTS
${_fribidi_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set FRIBIDI_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Fribidi DEFAULT_MSG
LIBFRIBIDI_LIBRARY LIBFRIBIDI_INCLUDE_DIR)
if(FRIBIDI_FOUND)
set(LIBFRIBIDI_LIBRARIES ${LIBFRIBIDI_LIBRARY})
set(LIBFRIBIDI_INCLUDE_DIRS ${LIBFRIBIDI_INCLUDE_DIR})
endif()
mark_as_advanced(
LIBFRIBIDI_INCLUDE_DIR
LIBFRIBIDI_LIBRARY
)
unset(_fribidi_SEARCH_DIRS)

View File

@@ -0,0 +1,95 @@
# SPDX-FileCopyrightText: 2011 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find GMP library
# Find the native GMP includes and library
# This module defines
# GMP_INCLUDE_DIRS, where to find gmp.h, Set when
# GMP_INCLUDE_DIR is found.
# GMP_LIBRARIES, libraries to link against to use GMP.
# GMP_ROOT_DIR, The base directory to search for GMP.
# This can also be an environment variable.
# GMP_FOUND, If false, do not try to use GMP.
#
# also defined, but not for general use are
# GMP_LIBRARY, where to find the GMP library.
# If `GMP_ROOT_DIR` was defined in the environment, use it.
if(DEFINED GMP_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{GMP_ROOT_DIR})
set(GMP_ROOT_DIR $ENV{GMP_ROOT_DIR})
else()
set(GMP_ROOT_DIR "")
endif()
set(_gmp_SEARCH_DIRS
${GMP_ROOT_DIR}
/opt/lib/gmp
)
find_path(GMP_INCLUDE_DIR
NAMES
gmp.h
HINTS
${_gmp_SEARCH_DIRS}
PATH_SUFFIXES
include/gmp
)
find_path(GMPXX_INCLUDE_DIR
NAMES
gmpxx.h
HINTS
${_gmp_SEARCH_DIRS}
PATH_SUFFIXES
include/gmp
)
find_library(GMP_LIBRARY
NAMES
gmp
HINTS
${_gmp_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
find_library(GMPXX_LIBRARY
NAMES
gmpxx
HINTS
${_gmp_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
if(GMP_INCLUDE_DIR)
set(_version_regex "^#define[ \t]+__GNU_MP_VERSION[ \t]+([0-9]+).*")
file(STRINGS "${GMP_INCLUDE_DIR}/gmp.h"
GMP_VERSION REGEX "${_version_regex}")
string(REGEX REPLACE "${_version_regex}" "\\1"
GMP_VERSION "${GMP_VERSION}")
unset(_version_regex)
endif()
# handle the QUIETLY and REQUIRED arguments and set GMP_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GMP DEFAULT_MSG
GMP_LIBRARY GMPXX_LIBRARY GMP_INCLUDE_DIR GMPXX_INCLUDE_DIR)
if(GMP_FOUND)
set(GMP_LIBRARIES ${GMPXX_LIBRARY} ${GMP_LIBRARY})
set(GMP_INCLUDE_DIRS ${GMP_INCLUDE_DIR} ${GMPXX_INCLUDE_DIR})
endif()
mark_as_advanced(
GMP_INCLUDE_DIR
GMP_LIBRARY
GMPXX_INCLUDE_DIR
GMPXX_LIBRARY
)
unset(_gmp_SEARCH_DIRS)

View File

@@ -0,0 +1,581 @@
# SPDX-FileCopyrightText: 2015 Google Inc. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
# Ceres Solver - A fast non-linear least squares minimizer http://ceres-solver.org/
# Author: Alex Stewart <alexs.mac@gmail.com>
# FindGflags.cmake - Find Google gflags logging library.
#
# This module will attempt to find gflags, either via an exported CMake
# configuration (generated by gflags >= 2.1 which are built with CMake), or
# by performing a standard search for all gflags components. The order of
# precedence for these two methods of finding gflags is controlled by:
# GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION.
#
# This module defines the following variables:
#
# GFLAGS_FOUND: TRUE iff gflags is found.
# GFLAGS_INCLUDE_DIRS: Include directories for gflags.
# GFLAGS_LIBRARIES: Libraries required to link gflags.
# GFLAGS_NAMESPACE: The namespace in which gflags is defined. In versions of
# gflags < 2.1, this was google, for versions >= 2.1 it is
# by default gflags, although can be configured when building
# gflags to be something else (i.e. google for legacy
# compatibility).
#
# The following variables control the behavior of this module when an exported
# gflags CMake configuration is not found.
#
# GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION: TRUE/FALSE, iff TRUE
# then prefer using an exported CMake configuration
# generated by gflags >= 2.1 over searching for the
# gflags components manually. Otherwise (FALSE)
# ignore any exported gflags CMake configurations and
# always perform a manual search for the components.
# Default: TRUE iff user does not define this variable
# before we are called, and does NOT specify either
# GFLAGS_INCLUDE_DIR_HINTS or GFLAGS_LIBRARY_DIR_HINTS
# otherwise FALSE.
# GFLAGS_INCLUDE_DIR_HINTS: List of additional directories in which to
# search for gflags includes, e.g: /timbuktu/include.
# GFLAGS_LIBRARY_DIR_HINTS: List of additional directories in which to
# search for gflags libraries, e.g: /timbuktu/lib.
# GFLAGS_ROOT_DIR, The base directory to search for Gflags.
# This can also be an environment variable.
#
# The following variables are also defined by this module, but in line with
# CMake recommended FindPackage() module style should NOT be referenced directly
# by callers (use the plural variables detailed above instead). These variables
# do however affect the behavior of the module via FIND_[PATH/LIBRARY]() which
# are NOT re-called (i.e. search for library is not repeated) if these variables
# are set with valid values _in the CMake cache_. This means that if these
# variables are set directly in the cache, either by the user in the CMake GUI,
# or by the user passing -DVAR=VALUE directives to CMake when called (which
# explicitly defines a cache variable), then they will be used verbatim,
# bypassing the HINTS variables and other hard-coded search locations.
#
# GFLAGS_INCLUDE_DIR: Include directory for gflags, not including the
# include directory of any dependencies.
# GFLAGS_LIBRARY: gflags library, not including the libraries of any
# dependencies.
# If `GFLAGS_ROOT_DIR` was defined in the environment, use it.
if(DEFINED GFLAGS_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{GFLAGS_ROOT_DIR})
set(GFLAGS_ROOT_DIR $ENV{GFLAGS_ROOT_DIR})
else()
set(GFLAGS_ROOT_DIR "")
endif()
if(DEFINED GFLAGS_ROOT_DIR)
set(GFLAGS_ROOT_DIR_INCLUDE "${GFLAGS_ROOT_DIR}/include")
set(GFLAGS_ROOT_DIR_LIB "${GFLAGS_ROOT_DIR}/lib")
endif()
# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when FindGflags was
# invoked, necessary for MSVC.
#
# NOTE: must be a macro, modifies `CMAKE_FIND_LIBRARY_PREFIXES`
# in the caller's scope to restore the original value.
macro(GFLAGS_RESET_FIND_LIBRARY_PREFIX)
if(MSVC)
set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
endif()
endmacro()
# Called if we failed to find gflags or any of its required dependencies,
# unsets all public (designed to be used externally) variables and reports
# error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument.
#
# NOTE: must be a macro, uses `return()` to exit the calling Find module's
# scope. A function's `return()` would only exit the function itself.
macro(GFLAGS_REPORT_NOT_FOUND REASON_MSG)
unset(GFLAGS_FOUND)
unset(GFLAGS_INCLUDE_DIRS)
unset(GFLAGS_LIBRARIES)
# Do not use unset, as we want to keep GFLAGS_NAMESPACE in the cache,
# but simply clear its value.
set(GFLAGS_NAMESPACE "" CACHE STRING
"gflags namespace (google or gflags)" FORCE)
# Make results of search visible in the CMake GUI if gflags has not
# been found so that user does not have to toggle to advanced view.
mark_as_advanced(CLEAR GFLAGS_INCLUDE_DIR
GFLAGS_LIBRARY
GFLAGS_NAMESPACE)
gflags_reset_find_library_prefix()
# Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage()
# use the camelcase library name, not uppercase.
if(Gflags_FIND_QUIETLY)
message(STATUS "Failed to find gflags - " ${REASON_MSG} ${ARGN})
elseif(Gflags_FIND_REQUIRED)
message(FATAL_ERROR "Failed to find gflags - " ${REASON_MSG} ${ARGN})
else()
# Neither QUIETLY nor REQUIRED, use no priority which emits a message
# but continues configuration and allows generation.
message(STATUS "Failed to find gflags - " ${REASON_MSG} ${ARGN})
endif()
return()
endmacro()
# Verify that all variable names passed as arguments are defined (can be empty
# but must be defined) or raise a fatal error.
function(GFLAGS_CHECK_VARS_DEFINED)
foreach(CHECK_VAR ${ARGN})
if(NOT DEFINED ${CHECK_VAR})
message(FATAL_ERROR "Ceres Bug: ${CHECK_VAR} is not defined.")
endif()
endforeach()
endfunction()
# Use check_cxx_source_compiles() to compile trivial test programs to determine
# the gflags namespace. This works on all OSs except Windows. If using Visual
# Studio, it fails because msbuild forces check_cxx_source_compiles() to use
# CMAKE_BUILD_TYPE=Debug for the test project, which usually breaks detection
# because MSVC requires that the test project use the same build type as gflags,
# which would normally be built in Release.
#
# Defines: GFLAGS_NAMESPACE in the caller's scope with the detected namespace,
# which is blank (empty string, will test FALSE is CMake conditionals)
# if detection failed.
function(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE)
# Verify that all required variables are defined.
gflags_check_vars_defined(
GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY)
# Ensure that GFLAGS_NAMESPACE is always unset on completion unless
# we explicitly set if after having the correct namespace.
set(GFLAGS_NAMESPACE "" PARENT_SCOPE)
include(CheckCXXSourceCompiles)
# Setup include path & link library for gflags for CHECK_CXX_SOURCE_COMPILES.
set(CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
# First try the (older) google namespace. Note that the output variable
# MUST be unique to the build type as otherwise the test is not repeated as
# it is assumed to have already been performed.
check_cxx_source_compiles(
"#include <gflags/gflags.h>
int main(int argc, char * argv[]) {
google::ParseCommandLineFlags(&argc, &argv, true);
return 0;
}"
GFLAGS_IN_GOOGLE_NAMESPACE)
if(GFLAGS_IN_GOOGLE_NAMESPACE)
set(GFLAGS_NAMESPACE google PARENT_SCOPE)
return()
endif()
# Try (newer) gflags namespace instead. Note that the output variable
# MUST be unique to the build type as otherwise the test is not repeated as
# it is assumed to have already been performed.
set(CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
check_cxx_source_compiles(
"#include <gflags/gflags.h>
int main(int argc, char * argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
return 0;
}"
GFLAGS_IN_GFLAGS_NAMESPACE)
if(GFLAGS_IN_GFLAGS_NAMESPACE)
set(GFLAGS_NAMESPACE gflags PARENT_SCOPE)
return()
endif()
endfunction()
# Use regex on the gflags headers to attempt to determine the gflags namespace.
# Checks both gflags.h (contained namespace on versions < 2.1.2) and
# gflags_declare.h, which contains the namespace on versions >= 2.1.2.
# In general, this method should only be used when
# GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE() cannot be used, or has
# failed.
#
# Defines: GFLAGS_NAMESPACE in the caller's scope with the detected namespace,
# which is blank (empty string, will test FALSE is CMake conditionals)
# if detection failed.
function(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_REGEX)
# Verify that all required variables are defined.
gflags_check_vars_defined(GFLAGS_INCLUDE_DIR)
# Ensure that GFLAGS_NAMESPACE is always undefined on completion unless
# we explicitly set if after having the correct namespace.
set(GFLAGS_NAMESPACE "" PARENT_SCOPE)
# Scan gflags.h to identify what namespace gflags was built with. On
# versions of gflags < 2.1.2, gflags.h was configured with the namespace
# directly, on >= 2.1.2, gflags.h uses the GFLAGS_NAMESPACE #define which
# is defined in gflags_declare.h, we try each location in turn.
set(GFLAGS_HEADER_FILE ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
if(NOT EXISTS ${GFLAGS_HEADER_FILE})
gflags_report_not_found(
"Could not find file: ${GFLAGS_HEADER_FILE} "
"containing namespace information in gflags install located at: "
"${GFLAGS_INCLUDE_DIR}.")
endif()
file(READ ${GFLAGS_HEADER_FILE} GFLAGS_HEADER_FILE_CONTENTS)
string(REGEX MATCH "namespace [A-Za-z]+"
GFLAGS_NAMESPACE "${GFLAGS_HEADER_FILE_CONTENTS}")
string(REGEX REPLACE "namespace ([A-Za-z]+)" "\\1"
GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}")
if(NOT GFLAGS_NAMESPACE)
gflags_report_not_found(
"Failed to extract gflags namespace from header file: "
"${GFLAGS_HEADER_FILE}.")
endif()
if(GFLAGS_NAMESPACE STREQUAL "google" OR
GFLAGS_NAMESPACE STREQUAL "gflags")
# Found valid gflags namespace from gflags.h.
set(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" PARENT_SCOPE)
return()
endif()
# Failed to find gflags namespace from gflags.h, gflags is likely a new
# version, check gflags_declare.h, which in newer versions (>= 2.1.2) contains
# the GFLAGS_NAMESPACE #define, which is then referenced in gflags.h.
set(GFLAGS_DECLARE_FILE ${GFLAGS_INCLUDE_DIR}/gflags/gflags_declare.h)
if(NOT EXISTS ${GFLAGS_DECLARE_FILE})
gflags_report_not_found(
"Could not find file: ${GFLAGS_DECLARE_FILE} "
"containing namespace information in gflags install located at: "
"${GFLAGS_INCLUDE_DIR}.")
endif()
file(READ ${GFLAGS_DECLARE_FILE} GFLAGS_DECLARE_FILE_CONTENTS)
string(REGEX MATCH "#define GFLAGS_NAMESPACE [A-Za-z]+"
GFLAGS_NAMESPACE "${GFLAGS_DECLARE_FILE_CONTENTS}")
string(REGEX REPLACE "#define GFLAGS_NAMESPACE ([A-Za-z]+)" "\\1"
GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}")
if(NOT GFLAGS_NAMESPACE)
gflags_report_not_found(
"Failed to extract gflags namespace from declare file: "
"${GFLAGS_DECLARE_FILE}.")
endif()
if(GFLAGS_NAMESPACE STREQUAL "google" OR
GFLAGS_NAMESPACE STREQUAL "gflags")
# Found valid gflags namespace from gflags.h.
set(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" PARENT_SCOPE)
return()
endif()
endfunction()
# -----------------------------------------------------------------
# By default, if the user has expressed no preference for using an exported
# gflags CMake configuration over performing a search for the installed
# components, and has not specified any hints for the search locations, then
# prefer a gflags exported configuration if available.
if(NOT DEFINED GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION
AND NOT GFLAGS_INCLUDE_DIR_HINTS
AND NOT GFLAGS_LIBRARY_DIR_HINTS)
message(STATUS "No preference for use of exported gflags CMake configuration "
"set, and no hints for include/library directories provided. "
"Defaulting to preferring an installed/exported gflags CMake configuration "
"if available.")
set(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION TRUE)
endif()
if(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION)
# Try to find an exported CMake configuration for gflags, as generated by
# gflags versions >= 2.1.
#
# We search twice, s/t we can invert the ordering of precedence used by
# find_package() for exported package build directories, and installed
# packages (found via CMAKE_SYSTEM_PREFIX_PATH), listed as items 6) and 7)
# respectively in [1].
#
# By default, exported build directories are (in theory) detected first, and
# this is usually the case on Windows. However, on OS X & Linux, the install
# path (/usr/local) is typically present in the PATH environment variable
# which is checked in item 4) in [1] (i.e. before both of the above, unless
# NO_SYSTEM_ENVIRONMENT_PATH is passed). As such on those OSs installed
# packages are usually detected in preference to exported package build
# directories.
#
# To ensure a more consistent response across all OSs, and as users usually
# want to prefer an installed version of a package over a locally built one
# where both exist (esp. as the exported build directory might be removed
# after installation), we first search with NO_CMAKE_PACKAGE_REGISTRY which
# means any build directories exported by the user are ignored, and thus
# installed directories are preferred. If this fails to find the package
# we then research again, but without NO_CMAKE_PACKAGE_REGISTRY, so any
# exported build directories will now be detected.
#
# To prevent confusion on Windows, we also pass NO_CMAKE_BUILDS_PATH (which
# is item 5) in [1]), to not preferentially use projects that were built
# recently with the CMake GUI to ensure that we always prefer an installed
# version if available.
#
# [1] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:find_package
find_package(gflags QUIET
NO_MODULE
NO_CMAKE_PACKAGE_REGISTRY
NO_CMAKE_BUILDS_PATH)
if(gflags_FOUND)
message(STATUS "Found installed version of gflags: ${gflags_DIR}")
else()
# Failed to find an installed version of gflags, repeat search allowing
# exported build directories.
message(STATUS "Failed to find installed gflags CMake configuration, "
"searching for gflags build directories exported with CMake.")
# Again pass NO_CMAKE_BUILDS_PATH, as we know that gflags is exported and
# do not want to treat projects built with the CMake GUI preferentially.
find_package(gflags QUIET
NO_MODULE
NO_CMAKE_BUILDS_PATH)
if(gflags_FOUND)
message(STATUS "Found exported gflags build directory: ${gflags_DIR}")
endif()
endif()
set(FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION ${gflags_FOUND})
# gflags v2.1 - 2.1.2 shipped with a bug in their gflags-config.cmake [1]
# whereby gflags_LIBRARIES = "gflags", but there was no imported target
# called "gflags", they were called: gflags[_nothreads]-[static/shared].
# As this causes linker errors when gflags is not installed in a location
# on the current library paths, detect if this problem is present and
# fix it.
#
# [1] https://github.com/gflags/gflags/issues/110
if(gflags_FOUND)
# NOTE: This is not written as additional conditions in the outer
# if(gflags_FOUND) as the NOT TARGET "${gflags_LIBRARIES}"
# condition causes problems if gflags is not found.
if(${gflags_VERSION} VERSION_LESS 2.1.3 AND
NOT TARGET "${gflags_LIBRARIES}")
message(STATUS "Detected broken gflags install in: ${gflags_DIR}, "
"version: ${gflags_VERSION} <= 2.1.2 which defines gflags_LIBRARIES = "
"${gflags_LIBRARIES} which is not an imported CMake target, see: "
"https://github.com/gflags/gflags/issues/110. Attempting to fix by "
"detecting correct gflags target.")
# Ordering here expresses preference for detection, specifically we do not
# want to use the _nothreads variants if the full library is available.
list(APPEND CHECK_GFLAGS_IMPORTED_TARGET_NAMES
gflags-shared gflags-static
gflags_nothreads-shared gflags_nothreads-static)
foreach(CHECK_GFLAGS_TARGET ${CHECK_GFLAGS_IMPORTED_TARGET_NAMES})
if(TARGET ${CHECK_GFLAGS_TARGET})
message(STATUS "Found valid gflags target: ${CHECK_GFLAGS_TARGET}, "
"updating gflags_LIBRARIES.")
set(gflags_LIBRARIES ${CHECK_GFLAGS_TARGET})
break()
endif()
endforeach()
if(NOT TARGET ${gflags_LIBRARIES})
message(STATUS "Failed to fix detected broken gflags install in: "
"${gflags_DIR}, version: ${gflags_VERSION} <= 2.1.2, none of the "
"imported targets for gflags: ${CHECK_GFLAGS_IMPORTED_TARGET_NAMES} "
"are defined. Will continue with a manual search for gflags "
"components. We recommend you build/install a version of gflags > "
"2.1.2 (or master).")
set(FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION FALSE)
endif()
endif()
endif()
if(FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION)
message(STATUS "Detected gflags version: ${gflags_VERSION}")
set(GFLAGS_FOUND ${gflags_FOUND})
set(GFLAGS_INCLUDE_DIR ${gflags_INCLUDE_DIR})
set(GFLAGS_LIBRARY ${gflags_LIBRARIES})
# gflags does not export the namespace in their CMake configuration, so
# use our function to determine what it should be, as it can be either
# gflags or google dependent upon version & configuration.
#
# NOTE: We use the regex method to determine the namespace here, as
# check_cxx_source_compiles() will not use imported targets, which
# is what gflags will be in this case.
gflags_check_gflags_namespace_using_regex()
if(NOT GFLAGS_NAMESPACE)
gflags_report_not_found(
"Failed to determine gflags namespace using regex for gflags "
"version: ${gflags_VERSION} exported here: ${gflags_DIR} using CMake.")
endif()
else()
message(STATUS "Failed to find an installed/exported CMake configuration "
"for gflags, will perform search for installed gflags components.")
endif()
endif()
if(NOT GFLAGS_FOUND)
# Either failed to find an exported gflags CMake configuration, or user
# told us not to use one. Perform a manual search for all gflags components.
# Handle possible presence of lib prefix for libraries on MSVC, see
# also GFLAGS_RESET_FIND_LIBRARY_PREFIX().
if(MSVC)
# Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES
# s/t we can set it back before returning.
set(CALLERS_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
# The empty string in this list is important, it represents the case when
# the libraries have no prefix (shared libraries / DLLs).
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}")
endif()
# Search user-installed locations first, so that we prefer user installs
# to system installs where both exist.
list(APPEND GFLAGS_CHECK_INCLUDE_DIRS
${GFLAGS_ROOT_DIR_INCLUDE}
/usr/local/include
/usr/local/homebrew/include # Mac OS X
/opt/local/var/macports/software # Mac OS X.
/opt/local/include
/usr/include
/opt/lib/gflags/include)
list(APPEND GFLAGS_CHECK_PATH_SUFFIXES
gflags/include # Windows (for C:/Program Files prefix).
gflags/Include) # Windows (for C:/Program Files prefix).
list(APPEND GFLAGS_CHECK_LIBRARY_DIRS
${GFLAGS_ROOT_DIR_LIB}
/usr/local/lib
/usr/local/homebrew/lib # Mac OS X.
/opt/local/lib
/usr/lib
/opt/lib/gflags/lib)
list(APPEND GFLAGS_CHECK_LIBRARY_SUFFIXES
gflags/lib # Windows (for C:/Program Files prefix).
gflags/Lib) # Windows (for C:/Program Files prefix).
# Search supplied hint directories first if supplied.
find_path(GFLAGS_INCLUDE_DIR
NAMES gflags/gflags.h
PATHS ${GFLAGS_INCLUDE_DIR_HINTS}
${GFLAGS_CHECK_INCLUDE_DIRS}
PATH_SUFFIXES ${GFLAGS_CHECK_PATH_SUFFIXES})
if(NOT GFLAGS_INCLUDE_DIR OR
NOT EXISTS ${GFLAGS_INCLUDE_DIR})
gflags_report_not_found(
"Could not find gflags include directory, set GFLAGS_INCLUDE_DIR "
"to directory containing gflags/gflags.h")
endif()
find_library(GFLAGS_LIBRARY NAMES gflags
PATHS ${GFLAGS_LIBRARY_DIR_HINTS}
${GFLAGS_CHECK_LIBRARY_DIRS}
PATH_SUFFIXES ${GFLAGS_CHECK_LIBRARY_SUFFIXES})
if(NOT GFLAGS_LIBRARY OR
NOT EXISTS ${GFLAGS_LIBRARY})
gflags_report_not_found(
"Could not find gflags library, set GFLAGS_LIBRARY "
"to full path to libgflags.")
endif()
# gflags typically requires a threading library (which is OS dependent), note
# that this defines the CMAKE_THREAD_LIBS_INIT variable. If we are able to
# detect threads, we assume that gflags requires it.
find_package(Threads QUIET)
set(GFLAGS_LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
# On Windows (including MinGW), the Shlwapi library is used by gflags if
# available.
if(WIN32)
include(CheckIncludeFileCXX)
check_include_file_cxx("shlwapi.h" HAVE_SHLWAPI)
if(HAVE_SHLWAPI)
list(APPEND GFLAGS_LINK_LIBRARIES shlwapi.lib)
endif()
endif()
# Mark internally as found, then verify. GFLAGS_REPORT_NOT_FOUND() unsets
# if called.
set(GFLAGS_FOUND TRUE)
# Identify what namespace gflags was built with.
if(GFLAGS_INCLUDE_DIR AND NOT GFLAGS_NAMESPACE)
# To handle Windows peculiarities / CMake bugs on MSVC we try two approaches
# to detect the gflags namespace:
#
# 1) Try to use check_cxx_source_compiles() to compile a trivial program
# with the two choices for the gflags namespace.
#
# 2) [In the event 1) fails] Use regex on the gflags headers to try to
# determine the gflags namespace. Whilst this is less robust than 1),
# it does avoid any interaction with msbuild.
gflags_check_gflags_namespace_using_try_compile()
if(NOT GFLAGS_NAMESPACE)
# Failed to determine gflags namespace using check_cxx_source_compiles()
# method, try and obtain it using regex on the gflags headers instead.
message(STATUS "Failed to find gflags namespace using "
"check_cxx_source_compiles(), trying namespace regex instead, "
"this is expected on Windows.")
gflags_check_gflags_namespace_using_regex()
if(NOT GFLAGS_NAMESPACE)
gflags_report_not_found(
"Failed to determine gflags namespace either by "
"check_cxx_source_compiles(), or namespace regex.")
endif()
endif()
endif()
# Make the GFLAGS_NAMESPACE a cache variable s/t the user can view it, and could
# overwrite it in the CMake GUI.
set(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" CACHE STRING
"gflags namespace (google or gflags)" FORCE)
# gflags does not seem to provide any record of the version in its
# source tree, thus cannot extract version.
# Catch case when caller has set GFLAGS_NAMESPACE in the cache / GUI
# with an invalid value.
if(GFLAGS_NAMESPACE AND
NOT GFLAGS_NAMESPACE STREQUAL "google" AND
NOT GFLAGS_NAMESPACE STREQUAL "gflags")
gflags_report_not_found(
"Caller defined GFLAGS_NAMESPACE:"
" ${GFLAGS_NAMESPACE} is not valid, not google or gflags.")
endif()
# Catch case when caller has set GFLAGS_INCLUDE_DIR in the cache / GUI and
# thus FIND_[PATH/LIBRARY] are not called, but specified locations are
# invalid, otherwise we would report the library as found.
if(GFLAGS_INCLUDE_DIR AND
NOT EXISTS ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
gflags_report_not_found(
"Caller defined GFLAGS_INCLUDE_DIR:"
" ${GFLAGS_INCLUDE_DIR} does not contain gflags/gflags.h header.")
endif()
# TODO: This regex for gflags library is pretty primitive, we use lowercase
# for comparison to handle Windows using CamelCase library names, could
# this check be better?
string(TOLOWER "${GFLAGS_LIBRARY}" LOWERCASE_GFLAGS_LIBRARY)
if(GFLAGS_LIBRARY AND
NOT "${LOWERCASE_GFLAGS_LIBRARY}" MATCHES ".*gflags[^/]*")
gflags_report_not_found(
"Caller defined GFLAGS_LIBRARY: "
"${GFLAGS_LIBRARY} does not match gflags.")
endif()
gflags_reset_find_library_prefix()
endif()
# Set standard CMake FindPackage variables if found.
if(GFLAGS_FOUND)
set(GFLAGS_INCLUDE_DIRS ${GFLAGS_INCLUDE_DIR})
set(GFLAGS_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
endif()
# Handle REQUIRED / QUIET optional arguments.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GFLAGS DEFAULT_MSG
GFLAGS_INCLUDE_DIRS GFLAGS_LIBRARIES GFLAGS_NAMESPACE)
# Only mark internal variables as advanced if we found gflags, otherwise
# leave them visible in the standard GUI for the user to set manually.
if(GFLAGS_FOUND)
mark_as_advanced(FORCE GFLAGS_INCLUDE_DIR
GFLAGS_LIBRARY
GFLAGS_NAMESPACE
gflags_DIR) # Autogenerated by find_package(gflags)
endif()

View File

@@ -0,0 +1,208 @@
# SPDX-FileCopyrightText: 2015 Google Inc. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
# Ceres Solver - A fast non-linear least squares minimizer http://ceres-solver.org/
# Author: Alex Stewart <alexs.mac@gmail.com>
# FindGlog.cmake - Find Google glog logging library.
#
# This module defines the following variables:
#
# GLOG_FOUND: TRUE iff glog is found.
# GLOG_INCLUDE_DIRS: Include directories for glog.
# GLOG_LIBRARIES: Libraries required to link glog.
#
# The following variables control the behaviour of this module:
#
# GLOG_INCLUDE_DIR_HINTS: List of additional directories in which to
# search for glog includes, e.g: /timbuktu/include.
# GLOG_LIBRARY_DIR_HINTS: List of additional directories in which to
# search for glog libraries, e.g: /timbuktu/lib.
# GLOG_ROOT_DIR, The base directory to search for Glog.
# This can also be an environment variable.
#
# The following variables are also defined by this module, but in line with
# CMake recommended FindPackage() module style should NOT be referenced directly
# by callers (use the plural variables detailed above instead). These variables
# do however affect the behaviour of the module via FIND_[PATH/LIBRARY]() which
# are NOT re-called (i.e. search for library is not repeated) if these variables
# are set with valid values _in the CMake cache_. This means that if these
# variables are set directly in the cache, either by the user in the CMake GUI,
# or by the user passing -DVAR=VALUE directives to CMake when called (which
# explicitly defines a cache variable), then they will be used verbatim,
# bypassing the HINTS variables and other hard-coded search locations.
#
# GLOG_INCLUDE_DIR: Include directory for glog, not including the
# include directory of any dependencies.
# GLOG_LIBRARY: glog library, not including the libraries of any
# dependencies.
# If `GLOG_ROOT_DIR` was defined in the environment, use it.
if(DEFINED GLOG_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{GLOG_ROOT_DIR})
set(GLOG_ROOT_DIR $ENV{GLOG_ROOT_DIR})
else()
set(GLOG_ROOT_DIR "")
endif()
if(DEFINED GLOG_ROOT_DIR)
set(GLOG_ROOT_DIR_INCLUDE "${GLOG_ROOT_DIR}/include")
set(GLOG_ROOT_DIR_LIB "${GLOG_ROOT_DIR}/lib")
endif()
# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when
# FindGlog was invoked.
#
# NOTE: must be a macro, modifies `CMAKE_FIND_LIBRARY_PREFIXES`
# in the caller's scope to restore the original value.
macro(GLOG_RESET_FIND_LIBRARY_PREFIX)
if(MSVC)
set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
endif()
endmacro()
# Called if we failed to find glog or any of its required dependencies,
# unsets all public (designed to be used externally) variables and reports
# error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument.
#
# NOTE: must be a macro, uses `return()` to exit the calling Find module's
# scope. A function's `return()` would only exit the function itself.
macro(GLOG_REPORT_NOT_FOUND REASON_MSG)
unset(GLOG_FOUND)
unset(GLOG_INCLUDE_DIRS)
unset(GLOG_LIBRARIES)
# Make results of search visible in the CMake GUI if glog has not
# been found so that user does not have to toggle to advanced view.
mark_as_advanced(CLEAR GLOG_INCLUDE_DIR
GLOG_LIBRARY)
glog_reset_find_library_prefix()
# Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage()
# use the camelcase library name, not uppercase.
if(Glog_FIND_QUIETLY)
message(STATUS "Failed to find glog - " ${REASON_MSG} ${ARGN})
elseif(Glog_FIND_REQUIRED)
message(FATAL_ERROR "Failed to find glog - " ${REASON_MSG} ${ARGN})
else()
# Neither QUIETLY nor REQUIRED, use no priority which emits a message
# but continues configuration and allows generation.
message(STATUS "Failed to find glog - " ${REASON_MSG} ${ARGN})
endif()
return()
endmacro()
# Handle possible presence of lib prefix for libraries on MSVC, see
# also GLOG_RESET_FIND_LIBRARY_PREFIX().
if(MSVC)
# Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES
# s/t we can set it back before returning.
set(CALLERS_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
# The empty string in this list is important, it represents the case when
# the libraries have no prefix (shared libraries / DLLs).
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}")
endif()
# Search user-installed locations first, so that we prefer user installs
# to system installs where both exist.
list(APPEND GLOG_CHECK_INCLUDE_DIRS
${GLOG_ROOT_DIR_INCLUDE}
/usr/local/include
/usr/local/homebrew/include # Mac OS X
/opt/local/var/macports/software # Mac OS X.
/opt/local/include
/usr/include
/opt/lib/glog/include)
# Windows (for C:/Program Files prefix).
list(APPEND GLOG_CHECK_PATH_SUFFIXES
glog/include
glog/Include
Glog/include
Glog/Include)
list(APPEND GLOG_CHECK_LIBRARY_DIRS
${GLOG_ROOT_DIR_LIB}
/usr/local/lib
/usr/local/homebrew/lib # Mac OS X.
/opt/local/lib
/usr/lib
/opt/lib/glog/lib)
# Windows (for C:/Program Files prefix).
list(APPEND GLOG_CHECK_LIBRARY_SUFFIXES
glog/lib
glog/Lib
Glog/lib
Glog/Lib)
# Search supplied hint directories first if supplied.
find_path(GLOG_INCLUDE_DIR
NAMES glog/logging.h
PATHS ${GLOG_INCLUDE_DIR_HINTS}
${GLOG_CHECK_INCLUDE_DIRS}
PATH_SUFFIXES ${GLOG_CHECK_PATH_SUFFIXES})
if(NOT GLOG_INCLUDE_DIR OR
NOT EXISTS ${GLOG_INCLUDE_DIR})
glog_report_not_found(
"Could not find glog include directory, set GLOG_INCLUDE_DIR "
"to directory containing glog/logging.h")
endif()
find_library(GLOG_LIBRARY NAMES glog
PATHS ${GLOG_LIBRARY_DIR_HINTS}
${GLOG_CHECK_LIBRARY_DIRS}
PATH_SUFFIXES ${GLOG_CHECK_LIBRARY_SUFFIXES})
if(NOT GLOG_LIBRARY OR
NOT EXISTS ${GLOG_LIBRARY})
glog_report_not_found(
"Could not find glog library, set GLOG_LIBRARY "
"to full path to libglog.")
endif()
# Mark internally as found, then verify. GLOG_REPORT_NOT_FOUND() unsets
# if called.
set(GLOG_FOUND TRUE)
# Glog does not seem to provide any record of the version in its
# source tree, thus cannot extract version.
# Catch case when caller has set GLOG_INCLUDE_DIR in the cache / GUI and
# thus FIND_[PATH/LIBRARY] are not called, but specified locations are
# invalid, otherwise we would report the library as found.
if(GLOG_INCLUDE_DIR AND
NOT EXISTS ${GLOG_INCLUDE_DIR}/glog/logging.h)
glog_report_not_found(
"Caller defined GLOG_INCLUDE_DIR:"
" ${GLOG_INCLUDE_DIR} does not contain glog/logging.h header.")
endif()
# TODO: This regex for glog library is pretty primitive, we use lowercase
# for comparison to handle Windows using CamelCase library names, could
# this check be better?
string(TOLOWER "${GLOG_LIBRARY}" LOWERCASE_GLOG_LIBRARY)
if(GLOG_LIBRARY AND
NOT "${LOWERCASE_GLOG_LIBRARY}" MATCHES ".*glog[^/]*")
glog_report_not_found(
"Caller defined GLOG_LIBRARY: "
"${GLOG_LIBRARY} does not match glog.")
endif()
# Set standard CMake FindPackage variables if found.
if(GLOG_FOUND)
set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR})
set(GLOG_LIBRARIES ${GLOG_LIBRARY})
endif()
glog_reset_find_library_prefix()
# Handle REQUIRED / QUIET optional arguments.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLOG DEFAULT_MSG
GLOG_INCLUDE_DIRS GLOG_LIBRARIES)
# Only mark internal variables as advanced if we found glog, otherwise
# leave them visible in the standard GUI for the user to set manually.
if(GLOG_FOUND)
mark_as_advanced(FORCE GLOG_INCLUDE_DIR
GLOG_LIBRARY)
endif()

View File

@@ -0,0 +1,77 @@
# SPDX-FileCopyrightText: 2021 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# Find HIP compiler. This module defines
# HIP_HIPCC_EXECUTABLE, the full path to the hipcc executable
# HIP_VERSION, the HIP compiler version
# HIP_FOUND, if the HIP toolkit is found.
if(NOT (DEFINED HIP_ROOT_DIR))
set(HIP_ROOT_DIR "")
endif()
# If `HIP_ROOT_DIR` was defined in the environment, use it.
if(HIP_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{HIP_ROOT_DIR})
set(HIP_ROOT_DIR $ENV{HIP_ROOT_DIR})
elseif(DEFINED ENV{HIP_PATH})
# Built-in environment variable from SDK.
set(HIP_ROOT_DIR $ENV{HIP_PATH})
endif()
set(_hip_SEARCH_DIRS
${HIP_ROOT_DIR}
/opt/rocm
/opt/rocm/hip
"C:/Program Files/AMD/ROCm/*"
)
find_program(HIP_HIPCC_EXECUTABLE
NAMES
hipcc
HINTS
${_hip_SEARCH_DIRS}
PATH_SUFFIXES
bin
)
if(HIP_HIPCC_EXECUTABLE)
if(NOT HIP_ROOT_DIR)
get_filename_component(HIP_ROOT_DIR ${HIP_HIPCC_EXECUTABLE} DIRECTORY)
get_filename_component(HIP_ROOT_DIR ${HIP_ROOT_DIR} DIRECTORY)
endif()
set(HIP_VERSION_MAJOR 0)
set(HIP_VERSION_MINOR 0)
set(HIP_VERSION_PATCH 0)
# Get version from the header.
set(_hip_version_file "${HIP_ROOT_DIR}/include/hip/hip_version.h")
if(EXISTS ${_hip_version_file})
file(STRINGS ${_hip_version_file} _tmp REGEX "^#define HIP_VERSION_MAJOR.*$")
string(REGEX MATCHALL "[0-9]+" HIP_VERSION_MAJOR ${_tmp})
file(STRINGS ${_hip_version_file} _tmp REGEX "^#define HIP_VERSION_MINOR.*$")
string(REGEX MATCHALL "[0-9]+" HIP_VERSION_MINOR ${_tmp})
file(STRINGS ${_hip_version_file} _tmp REGEX "^#define HIP_VERSION_PATCH.*$")
string(REGEX MATCHALL "[0-9]+" HIP_VERSION_PATCH ${_tmp})
unset(_tmp)
endif()
unset(_hip_version_file)
# Construct full semantic version.
set(HIP_VERSION "${HIP_VERSION_MAJOR}.${HIP_VERSION_MINOR}.${HIP_VERSION_PATCH}")
set(HIP_VERSION_SHORT "${HIP_VERSION_MAJOR}.${HIP_VERSION_MINOR}")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HIP
REQUIRED_VARS HIP_HIPCC_EXECUTABLE
VERSION_VAR HIP_VERSION)
mark_as_advanced(
HIP_HIPCC_EXECUTABLE
)
unset(_hip_SEARCH_DIRS)

View File

@@ -0,0 +1,108 @@
# SPDX-FileCopyrightText: 2021 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# Find HIPRT SDK. This module defines:
# HIPRT_INCLUDE_DIRS, path to HIPRT include directory
# HIPRT_LIBRARIES, libraries to link against to use HIPRT.
# HIPRT_VERSION, the HIPRT library version string.
# HIPRT_FOUND, if SDK found
#
# also defined, but not for general use are
# HIPRT_INCLUDE_DIR, path to HIPRT include directory
# HIPRT_LIBRARY, where to find the HIPRT library.
if(NOT (DEFINED HIPRT_ROOT_DIR))
set(HIPRT_ROOT_DIR "")
endif()
# If `HIPRT_ROOT_DIR` was defined in the environment, use it.
if(HIPRT_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{HIPRT_ROOT_DIR})
set(HIPRT_ROOT_DIR $ENV{HIPRT_ROOT_DIR})
elseif(DEFINED ENV{HIP_PATH})
# Built-in environment variable from SDK.
set(HIPRT_ROOT_DIR $ENV{HIP_PATH})
endif()
set(_hiprt_SEARCH_DIRS
${HIPRT_ROOT_DIR}
/opt/lib/hiprt
)
find_path(HIPRT_INCLUDE_DIR
NAMES
hiprt/hiprt.h
HINTS
${_hiprt_SEARCH_DIRS}
PATH_SUFFIXES
include
)
set(HIPRT_VERSION "")
if(HIPRT_INCLUDE_DIR)
file(STRINGS "${HIPRT_INCLUDE_DIR}/hiprt/hiprt.h" _hiprt_version
REGEX "^#define HIPRT_VERSION_STR[ \t]\".*\"$")
string(REGEX MATCHALL "[0-9]+[.0-9]+" HIPRT_VERSION ${_hiprt_version})
unset(_hiprt_version)
endif()
# Special code that side-steps annoyance of updating to a newer HIP-RT version: CMake caches the
# library path variable and it does include an API in the file path. Without any extra logic manual
# steps of updating local CMakeCache.txt would be needed.
# The code checks that the API of the cached variable is what it is expected to be based on the
# headers. If the API mismatches and the library exists skip the logic, assuming developers
# requested such configuration explicitly.
if(HIPRT_LIBRARY AND NOT EXISTS "${HIPRT_LIBRARY}")
get_filename_component(hiprt_library_name_we "${HIPRT_LIBRARY}" NAME_WE)
# The file name is not guaranteed to have API in it. Check for it to explicitly set the API to an
# empty string. Conditional group in the regex could help, but it is not trivial to address it in
# the replacement string.
if("${hiprt_library_name_we}" MATCHES "^(lib)?hiprt([0-9]+)64$")
string(REGEX REPLACE "^(lib)?hiprt([0-9]+)64$" "\\2"
hiprt_library_api "${hiprt_library_name_we}")
else()
set(hiprt_library_api "")
endif()
if(NOT "${HIPRT_VERSION}" STREQUAL "${hiprt_library_api}")
message(STATUS "${HIPRT_LIBRARY} does not exist and has wrong API."
"Forcing re-discovery."
)
unset(HIPRT_LIBRARY CACHE)
endif()
unset(hiprt_library_name_we)
unset(hiprt_library_api)
endif()
find_library(HIPRT_LIBRARY
NAMES
hiprt64
hiprt${HIPRT_VERSION}64
HINTS
${_hiprt_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib bin
# Skip CMake install prefix to prevent library from being found under
# `bin/lib/libhiprt<api>64.so` in the build folder.
NO_CMAKE_INSTALL_PREFIX
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HIPRT
REQUIRED_VARS HIPRT_LIBRARY HIPRT_INCLUDE_DIR
VERSION_VAR HIPRT_VERSION)
if(HIPRT_FOUND)
set(HIPRT_LIBRARIES ${HIPRT_LIBRARY})
set(HIPRT_INCLUDE_DIRS ${HIPRT_INCLUDE_DIR})
endif()
mark_as_advanced(
HIPRT_INCLUDE_DIR
HIPRT_LIBRARY
)
unset(_hiprt_SEARCH_DIRS)

View File

@@ -0,0 +1,59 @@
# SPDX-FileCopyrightText: 2023 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find Harfbuzz library
# Find the native harfbuzz includes and library
# This module defines
# LIBHARFBUZZ_INCLUDE_DIRS, where to find hb.h, Set when
# LIBHARFBUZZ_INCLUDE_DIR is found.
# LIBHARFBUZZ_LIBRARIES, libraries to link against to use harfbuzz.
# LIBHARFBUZZ_ROOT_DIR, The base directory to search for Harfbuzz.
# This can also be an environment variable.
# HARFBUZZ_FOUND, If false, do not try to use Harfbuzz.
#
# also defined, but not for general use are
# LIBHARFBUZZ_LIBRARY, where to find the Harfbuzz library.
# If LIBHARFBUZZ_ROOT_DIR was defined in the environment, use it.
if(NOT LIBHARFBUZZ_ROOT_DIR AND NOT $ENV{LIBHARFBUZZ_ROOT_DIR} STREQUAL "")
set(LIBHARFBUZZ_ROOT_DIR $ENV{LIBHARFBUZZ_ROOT_DIR})
endif()
set(_harfbuzz_SEARCH_DIRS
${LIBHARFBUZZ_ROOT_DIR}
)
find_path(LIBHARFBUZZ_INCLUDE_DIR harfbuzz/hb.h
HINTS
${_harfbuzz_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(LIBHARFBUZZ_LIBRARY
NAMES
harfbuzz
HINTS
${_harfbuzz_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set HARFBUZZ_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Harfbuzz DEFAULT_MSG
LIBHARFBUZZ_LIBRARY LIBHARFBUZZ_INCLUDE_DIR)
if(HARFBUZZ_FOUND)
set(LIBHARFBUZZ_LIBRARIES ${LIBHARFBUZZ_LIBRARY})
set(LIBHARFBUZZ_INCLUDE_DIRS ${LIBHARFBUZZ_INCLUDE_DIR})
endif()
mark_as_advanced(
LIBHARFBUZZ_INCLUDE_DIR
LIBHARFBUZZ_LIBRARY
)
unset(_harfbuzz_SEARCH_DIRS)

View File

@@ -0,0 +1,67 @@
# SPDX-FileCopyrightText: 2021 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find HARU library
# Find the native Haru includes and library
# This module defines
# HARU_INCLUDE_DIRS, where to find hpdf.h, set when
# HARU_INCLUDE_DIR is found.
# HARU_LIBRARIES, libraries to link against to use Haru.
# HARU_ROOT_DIR, The base directory to search for Haru.
# This can also be an environment variable.
# HARU_FOUND, If false, do not try to use Haru.
#
# also defined, but not for general use are
# HARU_LIBRARY, where to find the Haru library.
# If `HARU_ROOT_DIR` was defined in the environment, use it.
if(DEFINED HARU_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{HARU_ROOT_DIR})
set(HARU_ROOT_DIR $ENV{HARU_ROOT_DIR})
else()
set(HARU_ROOT_DIR "")
endif()
set(_haru_SEARCH_DIRS
${HARU_ROOT_DIR}
/opt/lib/haru
)
find_path(HARU_INCLUDE_DIR
NAMES
hpdf.h
HINTS
${_haru_SEARCH_DIRS}
PATH_SUFFIXES
include/haru
include
)
find_library(HARU_LIBRARY
NAMES
hpdfs
hpdf
HINTS
${_haru_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# Handle the QUIETLY and REQUIRED arguments and set HARU_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Haru DEFAULT_MSG HARU_LIBRARY HARU_INCLUDE_DIR)
if(HARU_FOUND)
set(HARU_LIBRARIES ${HARU_LIBRARY})
set(HARU_INCLUDE_DIRS ${HARU_INCLUDE_DIR})
endif()
mark_as_advanced(
HARU_INCLUDE_DIR
HARU_LIBRARY
)
unset(_haru_SEARCH_DIRS)

View File

@@ -0,0 +1,141 @@
# SPDX-FileCopyrightText: 2012 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find static icu libraries
# Find the native static icu libraries (needed for static boost_locale :/ ).
# This module defines
# ICU_LIBRARIES, libraries to link against to use icu.
# ICU_ROOT_DIR, The base directory to search for icu.
# This can also be an environment variable.
# ICU_FOUND, If false, do not try to use icu.
#
# also defined, but not for general use are
# ICU_LIBRARY_xxx, where to find the icu libraries.
# If `ICU_ROOT_DIR` was defined in the environment, use it.
if(DEFINED ICU_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{ICU_ROOT_DIR})
set(ICU_ROOT_DIR $ENV{ICU_ROOT_DIR})
else()
set(ICU_ROOT_DIR "")
endif()
if(Boost_USE_STATIC_LIBS)
set(_icu_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif()
set(_icu_SEARCH_DIRS
${ICU_ROOT_DIR}
)
# We don't need includes, only libs to link against...
# find_path(ICU_INCLUDE_DIR
# NAMES
# utf.h
# HINTS
# ${_icu_SEARCH_DIRS}
# PATH_SUFFIXES
# include/unicode
# )
find_library(ICU_LIBRARY_DATA
NAMES
icudata
HINTS
${_icu_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
find_library(ICU_LIBRARY_I18N
NAMES
icui18n
HINTS
${_icu_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
find_library(ICU_LIBRARY_IO
NAMES
icuio
HINTS
${_icu_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
find_library(ICU_LIBRARY_LE
NAMES
icule
HINTS
${_icu_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
find_library(ICU_LIBRARY_LX
NAMES
iculx
HINTS
${_icu_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
find_library(ICU_LIBRARY_TU
NAMES
icutu
HINTS
${_icu_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
find_library(ICU_LIBRARY_UC
NAMES
icuuc
HINTS
${_icu_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# Restore the original find library ordering
if(Boost_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_icu_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
endif()
# handle the QUIETLY and REQUIRED arguments and set ICU_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Icu DEFAULT_MSG
ICU_LIBRARY_DATA
ICU_LIBRARY_I18N
ICU_LIBRARY_IO
ICU_LIBRARY_LE
ICU_LIBRARY_LX
ICU_LIBRARY_TU
ICU_LIBRARY_UC
)
if(ICU_FOUND)
set(ICU_LIBRARIES ${ICU_LIBRARY_DATA} ${ICU_LIBRARY_I18N} ${ICU_LIBRARY_IO} ${ICU_LIBRARY_LE} ${ICU_LIBRARY_LX} ${ICU_LIBRARY_TU} ${ICU_LIBRARY_UC})
set(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
endif()
mark_as_advanced(
ICU_INCLUDE_DIR
ICU_LIBRARY_DATA
ICU_LIBRARY_I18N
ICU_LIBRARY_IO
ICU_LIBRARY_LE
ICU_LIBRARY_LX
ICU_LIBRARY_TU
ICU_LIBRARY_UC
)
unset(_icu_SEARCH_DIRS)

View File

@@ -0,0 +1,65 @@
# SPDX-FileCopyrightText: 2011 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find JACK library
# Find the native JACK includes and library
# This module defines
# JACK_INCLUDE_DIRS, where to find jack.h, Set when
# JACK_INCLUDE_DIR is found.
# JACK_LIBRARIES, libraries to link against to use JACK.
# JACK_ROOT_DIR, The base directory to search for JACK.
# This can also be an environment variable.
# JACK_FOUND, If false, do not try to use JACK.
#
# also defined, but not for general use are
# JACK_LIBRARY, where to find the JACK library.
# If `JACK_ROOT_DIR` was defined in the environment, use it.
if(DEFINED JACK_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{JACK_ROOT_DIR})
set(JACK_ROOT_DIR $ENV{JACK_ROOT_DIR})
else()
set(JACK_ROOT_DIR "")
endif()
set(_jack_SEARCH_DIRS
${JACK_ROOT_DIR}
)
find_path(JACK_INCLUDE_DIR
NAMES
jack.h
HINTS
${_jack_SEARCH_DIRS}
PATH_SUFFIXES
include/jack
)
find_library(JACK_LIBRARY
NAMES
jack
HINTS
${_jack_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set JACK_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Jack DEFAULT_MSG
JACK_LIBRARY JACK_INCLUDE_DIR)
if(JACK_FOUND)
set(JACK_LIBRARIES ${JACK_LIBRARY})
set(JACK_INCLUDE_DIRS ${JACK_INCLUDE_DIR})
endif()
mark_as_advanced(
JACK_INCLUDE_DIR
JACK_LIBRARY
)
unset(_jack_SEARCH_DIRS)

View File

@@ -0,0 +1,92 @@
# SPDX-FileCopyrightText: 2015 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find LLVM library
# Find the native LLVM includes and library
# This module defines
# LLVM_INCLUDE_DIRS, where to find LLVM.h, Set when LLVM_INCLUDE_DIR is found.
# LLVM_LIBRARIES, libraries to link against to use LLVM.
# LLVM_ROOT_DIR, The base directory to search for LLVM.
# This can also be an environment variable.
# LLVM_FOUND, If false, do not try to use LLVM.
#
# also defined, but not for general use are
# LLVM_LIBRARY, where to find the LLVM library.
if(LLVM_ROOT_DIR)
if(DEFINED LLVM_VERSION)
find_program(LLVM_CONFIG llvm-config-${LLVM_VERSION} HINTS ${LLVM_ROOT_DIR}/bin NO_CMAKE_PATH)
endif()
if(NOT LLVM_CONFIG)
find_program(LLVM_CONFIG llvm-config HINTS ${LLVM_ROOT_DIR}/bin NO_CMAKE_PATH)
endif()
else()
if(DEFINED LLVM_VERSION)
message(STATUS "Running llvm-config-${LLVM_VERSION}")
find_program(LLVM_CONFIG llvm-config-${LLVM_VERSION})
endif()
if(NOT LLVM_CONFIG)
find_program(LLVM_CONFIG llvm-config)
endif()
endif()
execute_process(COMMAND ${LLVM_CONFIG} --includedir
OUTPUT_VARIABLE LLVM_INCLUDE_DIRS
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT DEFINED LLVM_VERSION)
execute_process(COMMAND ${LLVM_CONFIG} --version
OUTPUT_VARIABLE LLVM_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(LLVM_VERSION ${LLVM_VERSION} CACHE STRING "Version of LLVM to use")
endif()
if(NOT LLVM_ROOT_DIR)
execute_process(COMMAND ${LLVM_CONFIG} --prefix
OUTPUT_VARIABLE LLVM_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(LLVM_ROOT_DIR ${LLVM_ROOT_DIR} CACHE PATH "Path to the LLVM installation")
endif()
if(NOT LLVM_LIBPATH)
execute_process(COMMAND ${LLVM_CONFIG} --libdir
OUTPUT_VARIABLE LLVM_LIBPATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(LLVM_LIBPATH ${LLVM_LIBPATH} CACHE PATH "Path to the LLVM library path")
mark_as_advanced(LLVM_LIBPATH)
endif()
if(LLVM_STATIC)
find_library(LLVM_LIBRARY
NAMES LLVMAnalysis # first of a whole bunch of libs to get
PATHS ${LLVM_LIBPATH})
else()
find_library(LLVM_LIBRARY
NAMES
LLVM-${LLVM_VERSION}
LLVMAnalysis # check for the static library as a fall-back
PATHS ${LLVM_LIBPATH})
endif()
if(LLVM_LIBRARY AND LLVM_ROOT_DIR AND LLVM_LIBPATH)
if(LLVM_STATIC)
# if static LLVM libraries were requested, use llvm-config to generate
# the list of what libraries we need, and substitute that in the right
# way for LLVM_LIBRARY.
execute_process(COMMAND ${LLVM_CONFIG} --libfiles
OUTPUT_VARIABLE LLVM_LIBRARY
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE " " ";" LLVM_LIBRARY "${LLVM_LIBRARY}")
endif()
endif()
# handle the QUIETLY and REQUIRED arguments and set LLVM_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LLVM DEFAULT_MSG
LLVM_LIBRARY)
mark_as_advanced(
LLVM_LIBRARY
)

View File

@@ -0,0 +1,63 @@
# SPDX-FileCopyrightText: 2015 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find LZO library
# Find the native LZO includes and library
# This module defines
# LZO_INCLUDE_DIRS, where to find lzo1x.h, Set when
# LZO_INCLUDE_DIR is found.
# LZO_LIBRARIES, libraries to link against to use LZO.
# LZO_ROOT_DIR, The base directory to search for LZO.
# This can also be an environment variable.
# LZO_FOUND, If false, do not try to use LZO.
#
# also defined, but not for general use are
# LZO_LIBRARY, where to find the LZO library.
# If `LZO_ROOT_DIR` was defined in the environment, use it.
if(DEFINED LZO_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{LZO_ROOT_DIR})
set(LZO_ROOT_DIR $ENV{LZO_ROOT_DIR})
else()
set(LZO_ROOT_DIR "")
endif()
set(_lzo_SEARCH_DIRS
${LZO_ROOT_DIR}
)
find_path(LZO_INCLUDE_DIR lzo/lzo1x.h
HINTS
${_lzo_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(LZO_LIBRARY
NAMES
lzo2
HINTS
${_lzo_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set LZO_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LZO DEFAULT_MSG
LZO_LIBRARY LZO_INCLUDE_DIR)
if(LZO_FOUND)
set(LZO_LIBRARIES ${LZO_LIBRARY})
set(LZO_INCLUDE_DIRS ${LZO_INCLUDE_DIR})
endif()
mark_as_advanced(
LZO_INCLUDE_DIR
LZO_LIBRARY
)
unset(_lzo_SEARCH_DIRS)

View File

@@ -0,0 +1,64 @@
# SPDX-FileCopyrightText: 2021-2022 Intel Corporation
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find Level Zero library
# Find Level Zero headers and libraries needed by oneAPI implementation
# This module defines
# LEVEL_ZERO_LIBRARY, libraries to link against in order to use L0.
# LEVEL_ZERO_INCLUDE_DIR, directories where L0 headers can be found.
# LEVEL_ZERO_ROOT_DIR, The base directory to search for L0 files.
# This can also be an environment variable.
# LEVEL_ZERO_FOUND, If false, then don't try to use L0.
# 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
${LEVEL_ZERO_ROOT_DIR}
/usr/lib
/usr/local/lib
)
find_library(LEVEL_ZERO_LIBRARY
NAMES
ze_loader
HINTS
${_level_zero_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
find_path(LEVEL_ZERO_INCLUDE_DIR
NAMES
level_zero/ze_api.h
HINTS
${_level_zero_SEARCH_DIRS}
PATH_SUFFIXES
include
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LevelZero DEFAULT_MSG LEVEL_ZERO_LIBRARY LEVEL_ZERO_INCLUDE_DIR)
if(LevelZero_FOUND)
set(LEVEL_ZERO_FOUND TRUE)
else()
unset(LEVEL_ZERO_LIBRARY)
unset(LEVEL_ZERO_INCLUDE_DIR)
set(LEVEL_ZERO_FOUND FALSE)
endif()
mark_as_advanced(
LEVEL_ZERO_LIBRARY
LEVEL_ZERO_INCLUDE_DIR
)
unset(_level_zero_SEARCH_DIRS)

View File

@@ -0,0 +1,48 @@
# SPDX-FileCopyrightText: 2022 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# This module defines
# LIBEPOXY_INCLUDE_DIRS, where to find epoxy/gl.h
# LIBEPOXY_LIBRARIES, where to find the epoxy library.
# LIBEPOXY_ROOT_DIR, The base directory to search for libepoxy.
# This can also be an environment variable.
# LIBEPOXY_FOUND, If false, do not try to use libepoxy.
if(NOT EPOXY_ROOT_DIR AND NOT $ENV{EPOXY_ROOT_DIR} STREQUAL "")
set(EPOXY_ROOT_DIR $ENV{EPOXY_ROOT_DIR})
endif()
find_path(LIBEPOXY_INCLUDE_DIR
NAMES
epoxy/gl.h
HINTS
${EPOXY_ROOT_DIR}
PATH_SUFFIXES
include
)
find_library(LIBEPOXY_LIBRARY
NAMES
epoxy
HINTS
${EPOXY_ROOT_DIR}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set LIBEPOXY_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibEpoxy DEFAULT_MSG
LIBEPOXY_LIBRARY LIBEPOXY_INCLUDE_DIR)
if(LIBEPOXY_FOUND)
set(LIBEPOXY_INCLUDE_DIRS ${LIBEPOXY_INCLUDE_DIR})
set(LIBEPOXY_LIBRARIES ${LIBEPOXY_LIBRARY})
endif()
mark_as_advanced(
LIBEPOXY_INCLUDE_DIR
LIBEPOXY_LIBRARY
)

View File

@@ -0,0 +1,50 @@
# SPDX-FileCopyrightText: 2020 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find NanoVDB library
# Find the native NanoVDB includes and library
# This module defines
# NANOVDB_INCLUDE_DIRS, where to find nanovdb.h, Set when
# NANOVDB_INCLUDE_DIR is found.
# NANOVDB_ROOT_DIR, The base directory to search for NanoVDB.
# This can also be an environment variable.
# NANOVDB_FOUND, If false, do not try to use NanoVDB.
# If `NANOVDB_ROOT_DIR` was defined in the environment, use it.
if(DEFINED NANOVDB_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{NANOVDB_ROOT_DIR})
set(NANOVDB_ROOT_DIR $ENV{NANOVDB_ROOT_DIR})
else()
set(NANOVDB_ROOT_DIR "")
endif()
set(_nanovdb_SEARCH_DIRS
${NANOVDB_ROOT_DIR}
)
find_path(NANOVDB_INCLUDE_DIR
NAMES
nanovdb/NanoVDB.h
HINTS
${_nanovdb_SEARCH_DIRS}
PATH_SUFFIXES
include
)
# handle the QUIETLY and REQUIRED arguments and set NANOVDB_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(NanoVDB DEFAULT_MSG
NANOVDB_INCLUDE_DIR)
if(NANOVDB_FOUND)
set(NANOVDB_INCLUDE_DIRS ${NANOVDB_INCLUDE_DIR})
endif()
mark_as_advanced(
NANOVDB_INCLUDE_DIR
)
unset(_nanovdb_SEARCH_DIRS)

View File

@@ -0,0 +1,128 @@
# SPDX-FileCopyrightText: 2019 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find OpenImageDenoise library
# Find the native OpenImageDenoise includes and library
# This module defines
# OPENIMAGEDENOISE_INCLUDE_DIRS, where to find oidn.h, Set when
# OPENIMAGEDENOISE is found.
# OPENIMAGEDENOISE_LIBRARIES, libraries to link against to use OpenImageDenoise.
# OPENIMAGEDENOISE_ROOT_DIR, The base directory to search for OpenImageDenoise.
# This can also be an environment variable.
# OPENIMAGEDENOISE_FOUND, If false, do not try to use OpenImageDenoise.
#
# also defined, but not for general use are
# OPENIMAGEDENOISE_LIBRARY, where to find the OpenImageDenoise library.
# If `OPENIMAGEDENOISE_ROOT_DIR` was defined in the environment, use it.
if(DEFINED OPENIMAGEDENOISE_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{OPENIMAGEDENOISE_ROOT_DIR})
set(OPENIMAGEDENOISE_ROOT_DIR $ENV{OPENIMAGEDENOISE_ROOT_DIR})
else()
set(OPENIMAGEDENOISE_ROOT_DIR "")
endif()
set(_openimagedenoise_SEARCH_DIRS
${OPENIMAGEDENOISE_ROOT_DIR}
/opt/lib/openimagedenoise
)
find_path(OPENIMAGEDENOISE_INCLUDE_DIR
NAMES
OpenImageDenoise/oidn.h
HINTS
${_openimagedenoise_SEARCH_DIRS}
PATH_SUFFIXES
include
)
set(_openimagedenoise_FIND_COMPONENTS
OpenImageDenoise
)
# These are needed when building statically
set(_openimagedenoise_FIND_STATIC_COMPONENTS
common
# These additional library names change between versions, we list all of them
# so builds work with multiple versions. Missing libraries are skipped.
dnnl_cpu
dnnl_common
dnnl_cpu # Second time because of circular dependency
mkldnn
dnnl
)
set(_openimagedenoise_LIBRARIES "")
foreach(COMPONENT ${_openimagedenoise_FIND_COMPONENTS})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
find_library(OPENIMAGEDENOISE_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}
HINTS
${_openimagedenoise_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
list(APPEND _openimagedenoise_LIBRARIES "${OPENIMAGEDENOISE_${UPPERCOMPONENT}_LIBRARY}")
endforeach()
foreach(COMPONENT ${_openimagedenoise_FIND_STATIC_COMPONENTS})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
find_library(OPENIMAGEDENOISE_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}
HINTS
${_openimagedenoise_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
mark_as_advanced(OPENIMAGEDENOISE_${UPPERCOMPONENT}_LIBRARY)
if(OPENIMAGEDENOISE_${UPPERCOMPONENT}_LIBRARY)
list(APPEND _openimagedenoise_LIBRARIES "${OPENIMAGEDENOISE_${UPPERCOMPONENT}_LIBRARY}")
endif()
endforeach()
find_library(OPENIMAGEDENOISE_LIBRARY
NAMES
OpenImageDenoise
HINTS
${_openimagedenoise_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set OPENIMAGEDENOISE_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenImageDenoise DEFAULT_MSG
OPENIMAGEDENOISE_LIBRARY OPENIMAGEDENOISE_INCLUDE_DIR)
if(OPENIMAGEDENOISE_FOUND)
set(OPENIMAGEDENOISE_LIBRARIES ${_openimagedenoise_LIBRARIES})
set(OPENIMAGEDENOISE_INCLUDE_DIRS ${OPENIMAGEDENOISE_INCLUDE_DIR})
else()
set(OPENIMAGEDENOISE_FOUND FALSE)
endif()
mark_as_advanced(
OPENIMAGEDENOISE_INCLUDE_DIR
OPENIMAGEDENOISE_LIBRARY
)
foreach(COMPONENT ${_openimagedenoise_FIND_COMPONENTS})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
mark_as_advanced(OPENIMAGEDENOISE_${UPPERCOMPONENT}_LIBRARY)
endforeach()
unset(COMPONENT)
unset(UPPERCOMPONENT)
unset(_openimagedenoise_FIND_COMPONENTS)
unset(_openimagedenoise_FIND_STATIC_COMPONENTS)
unset(_openimagedenoise_LIBRARIES)
unset(_openimagedenoise_SEARCH_DIRS)

View File

@@ -0,0 +1,76 @@
# SPDX-FileCopyrightText: 2011 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find OpenJPEG library
# Find the native OpenJPEG includes and library
# This module defines
# OPENJPEG_INCLUDE_DIRS, where to find openjpeg.h, Set when
# OPENJPEG_INCLUDE_DIR is found.
# OPENJPEG_LIBRARIES, libraries to link against to use OpenJPEG.
# OPENJPEG_ROOT_DIR, The base directory to search for OpenJPEG.
# This can also be an environment variable.
# OPENJPEG_FOUND, If false, do not try to use OpenJPEG.
#
# also defined, but not for general use are
# OPENJPEG_LIBRARY, where to find the OpenJPEG library.
# If `OPENJPEG_ROOT_DIR` was defined in the environment, use it.
if(DEFINED OPENJPEG_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{OPENJPEG_ROOT_DIR})
set(OPENJPEG_ROOT_DIR $ENV{OPENJPEG_ROOT_DIR})
else()
set(OPENJPEG_ROOT_DIR "")
endif()
set(_openjpeg_SEARCH_DIRS
${OPENJPEG_ROOT_DIR}
)
find_path(OPENJPEG_INCLUDE_DIR
NAMES
openjpeg.h
HINTS
${_openjpeg_SEARCH_DIRS}
PATH_SUFFIXES
include
# Support future versions
openjpeg-2.9
openjpeg-2.8
openjpeg-2.7
openjpeg-2.6
openjpeg-2.5
openjpeg-2.4
openjpeg-2.3
openjpeg-2.2
openjpeg-2.1
openjpeg-2.0
)
find_library(OPENJPEG_LIBRARY
NAMES
openjp2
HINTS
${_openjpeg_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set OPENJPEG_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenJPEG DEFAULT_MSG
OPENJPEG_LIBRARY OPENJPEG_INCLUDE_DIR)
if(OPENJPEG_FOUND)
set(OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARY})
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_DIR})
endif()
mark_as_advanced(
OPENJPEG_INCLUDE_DIR
OPENJPEG_LIBRARY
)
unset(_openjpeg_SEARCH_DIRS)

View File

@@ -0,0 +1,96 @@
# SPDX-FileCopyrightText: 2013 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find OpenSubdiv library
# Find the native OpenSubdiv includes and library
# This module defines
# OPENSUBDIV_INCLUDE_DIRS, where to find OpenSubdiv headers, Set when
# OPENSUBDIV_INCLUDE_DIR is found.
# OPENSUBDIV_LIBRARIES, libraries to link against to use OpenSubdiv.
# OPENSUBDIV_ROOT_DIR, the base directory to search for OpenSubdiv.
# This can also be an environment variable.
# OPENSUBDIV_FOUND, if false, do not try to use OpenSubdiv.
# If `OPENSUBDIV_ROOT_DIR` was defined in the environment, use it.
if(DEFINED OPENSUBDIV_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{OPENSUBDIV_ROOT_DIR})
set(OPENSUBDIV_ROOT_DIR $ENV{OPENSUBDIV_ROOT_DIR})
else()
set(OPENSUBDIV_ROOT_DIR "")
endif()
set(_opensubdiv_FIND_COMPONENTS
osdGPU
osdCPU
)
set(_opensubdiv_SEARCH_DIRS
${OPENSUBDIV_ROOT_DIR}
/opt/lib/opensubdiv
/opt/lib/osd # install_deps.sh
)
find_path(OPENSUBDIV_INCLUDE_DIR
NAMES
opensubdiv/osd/mesh.h
HINTS
${_opensubdiv_SEARCH_DIRS}
PATH_SUFFIXES
include
)
set(_opensubdiv_LIBRARIES "")
foreach(COMPONENT ${_opensubdiv_FIND_COMPONENTS})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
find_library(OPENSUBDIV_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}
HINTS
${_opensubdiv_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
list(APPEND _opensubdiv_LIBRARIES "${OPENSUBDIV_${UPPERCOMPONENT}_LIBRARY}")
endforeach()
# Return values:
# - `${variable_name}`: `TRUE` if the controller include file exists.
function(OPENSUBDIV_CHECK_CONTROLLER
controller_include_file
variable_name)
if(EXISTS "${OPENSUBDIV_INCLUDE_DIR}/opensubdiv/osd/${controller_include_file}")
set(${variable_name} TRUE PARENT_SCOPE)
else()
set(${variable_name} FALSE PARENT_SCOPE)
endif()
endfunction()
# handle the QUIETLY and REQUIRED arguments and set OPENSUBDIV_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenSubdiv DEFAULT_MSG
_opensubdiv_LIBRARIES OPENSUBDIV_INCLUDE_DIR)
if(OPENSUBDIV_FOUND)
set(OPENSUBDIV_LIBRARIES ${_opensubdiv_LIBRARIES})
set(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_INCLUDE_DIR})
endif()
mark_as_advanced(
OPENSUBDIV_INCLUDE_DIR
)
foreach(COMPONENT ${_opensubdiv_FIND_COMPONENTS})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
mark_as_advanced(OPENSUBDIV_${UPPERCOMPONENT}_LIBRARY)
endforeach()
unset(COMPONENT)
unset(UPPERCOMPONENT)
unset(_opensubdiv_FIND_COMPONENTS)
unset(_opensubdiv_SEARCH_DIRS)
unset(_opensubdiv_LIBRARIES)

View File

@@ -0,0 +1,66 @@
# SPDX-FileCopyrightText: 2015 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find OPENVDB library
# Find the native OPENVDB includes and library
# This module defines
# OPENVDB_INCLUDE_DIRS, where to find openvdb.h, Set when
# OPENVDB_INCLUDE_DIR is found.
# OPENVDB_LIBRARIES, libraries to link against to use OPENVDB.
# OPENVDB_ROOT_DIR, The base directory to search for OPENVDB.
# This can also be an environment variable.
# OPENVDB_FOUND, If false, do not try to use OPENVDB.
#
# also defined, but not for general use are
# OPENVDB_LIBRARY, where to find the OPENVDB library.
# If `OPENVDB_ROOT_DIR` was defined in the environment, use it.
if(DEFINED OPENVDB_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{OPENVDB_ROOT_DIR})
set(OPENVDB_ROOT_DIR $ENV{OPENVDB_ROOT_DIR})
else()
set(OPENVDB_ROOT_DIR "")
endif()
set(_openvdb_SEARCH_DIRS
${OPENVDB_ROOT_DIR}
/opt/lib/openvdb
)
find_path(OPENVDB_INCLUDE_DIR
NAMES
openvdb/openvdb.h
HINTS
${_openvdb_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(OPENVDB_LIBRARY
NAMES
openvdb
HINTS
${_openvdb_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set OPENVDB_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenVDB DEFAULT_MSG
OPENVDB_LIBRARY OPENVDB_INCLUDE_DIR)
if(OPENVDB_FOUND)
set(OPENVDB_LIBRARIES ${OPENVDB_LIBRARY})
set(OPENVDB_INCLUDE_DIRS ${OPENVDB_INCLUDE_DIR})
endif()
mark_as_advanced(
OPENVDB_INCLUDE_DIR
OPENVDB_LIBRARY
)
unset(_openvdb_SEARCH_DIRS)

View File

@@ -0,0 +1,65 @@
# SPDX-FileCopyrightText: 2019 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find OptiX library
# Find the native OptiX includes and library
# This module defines
# OPTIX_INCLUDE_DIRS, where to find optix.h, Set when
# OPTIX_INCLUDE_DIR is found.
# OPTIX_ROOT_DIR, The base directory to search for OptiX.
# This can also be an environment variable.
# OPTIX_FOUND, If false, do not try to use OptiX.
if(NOT (DEFINED OPTIX_ROOT_DIR))
set(OPTIX_ROOT_DIR "")
endif()
# If `OPTIX_ROOT_DIR` was defined in the environment, use it.
if(OPTIX_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{OPTIX_ROOT_DIR})
set(OPTIX_ROOT_DIR $ENV{OPTIX_ROOT_DIR})
endif()
set(_optix_SEARCH_DIRS
${OPTIX_ROOT_DIR}
)
find_path(OPTIX_INCLUDE_DIR
NAMES
optix.h
HINTS
${_optix_SEARCH_DIRS}
PATH_SUFFIXES
include
)
if(EXISTS "${OPTIX_INCLUDE_DIR}/optix.h")
file(STRINGS "${OPTIX_INCLUDE_DIR}/optix.h" _optix_version REGEX "^#define OPTIX_VERSION[ \t].*$")
string(REGEX MATCHALL "[0-9]+" _optix_version ${_optix_version})
math(EXPR _optix_version_major "${_optix_version} / 10000")
math(EXPR _optix_version_minor "(${_optix_version} % 10000) / 100")
math(EXPR _optix_version_patch "${_optix_version} % 100")
set(OPTIX_VERSION "${_optix_version_major}.${_optix_version_minor}.${_optix_version_patch}")
endif()
# handle the QUIETLY and REQUIRED arguments and set OPTIX_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OptiX
REQUIRED_VARS OPTIX_INCLUDE_DIR
VERSION_VAR OPTIX_VERSION)
if(OPTIX_FOUND)
set(OPTIX_INCLUDE_DIRS ${OPTIX_INCLUDE_DIR})
endif()
mark_as_advanced(
OPTIX_INCLUDE_DIR
OPTIX_VERSION
)
unset(_optix_SEARCH_DIRS)

View File

@@ -0,0 +1,68 @@
# SPDX-FileCopyrightText: 2020 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find potrace library
# Find the potrace include and library
# This module defines
# POTRACE_INCLUDE_DIRS, where to find potracelib.h, Set when
# POTRACE is found.
# POTRACE_LIBRARIES, libraries to link against to use POTRACE.
# POTRACE_ROOT_DIR, The base directory to search for POTRACE.
# This can also be an environment variable.
# POTRACE_FOUND, If false, do not try to use POTRACE.
#
# also defined, but not for general use are
# POTRACE_LIBRARY, where to find the POTRACE library.
# If `POTRACE_ROOT_DIR` was defined in the environment, use it.
if(DEFINED POTRACE_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{POTRACE_ROOT_DIR})
set(POTRACE_ROOT_DIR $ENV{POTRACE_ROOT_DIR})
else()
set(POTRACE_ROOT_DIR "")
endif()
set(_potrace_SEARCH_DIRS
${POTRACE_ROOT_DIR}
/opt/lib/potrace
/usr/include
/usr/local/include
)
find_path(POTRACE_INCLUDE_DIR
NAMES
potracelib.h
HINTS
${_potrace_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(POTRACE_LIBRARY
NAMES
potrace
HINTS
${_potrace_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set POTRACE_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Potrace DEFAULT_MSG
POTRACE_LIBRARY POTRACE_INCLUDE_DIR)
if(POTRACE_FOUND)
set(POTRACE_LIBRARIES ${POTRACE_LIBRARY})
set(POTRACE_INCLUDE_DIRS ${POTRACE_INCLUDE_DIR})
endif()
mark_as_advanced(
POTRACE_INCLUDE_DIR
POTRACE_LIBRARY
)
unset(_potrace_SEARCH_DIRS)

View File

@@ -0,0 +1,68 @@
# SPDX-FileCopyrightText: 2014 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find PugiXML library
# Find the native PugiXML includes and library
# This module defines
# PUGIXML_INCLUDE_DIRS, where to find pugixml.hpp, Set when
# PugiXML is found.
# PUGIXML_LIBRARIES, libraries to link against to use PugiXML.
# PUGIXML_ROOT_DIR, The base directory to search for PugiXML.
# This can also be an environment variable.
# PUGIXML_FOUND, If false, do not try to use PugiXML.
#
# also defined, but not for general use are
# PUGIXML_LIBRARY, where to find the PugiXML library.
# If `PUGIXML_ROOT_DIR` was defined in the environment, use it.
if(DEFINED PUGIXML_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{PUGIXML_ROOT_DIR})
set(PUGIXML_ROOT_DIR $ENV{PUGIXML_ROOT_DIR})
else()
set(PUGIXML_ROOT_DIR "")
endif()
set(_pugixml_SEARCH_DIRS
${PUGIXML_ROOT_DIR}
/opt/lib/oiio
)
find_path(PUGIXML_INCLUDE_DIR
NAMES
pugixml.hpp
HINTS
${_pugixml_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(PUGIXML_LIBRARY
NAMES
pugixml
HINTS
${_pugixml_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set PUGIXML_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PugiXML DEFAULT_MSG
PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
if(PUGIXML_FOUND)
set(PUGIXML_LIBRARIES ${PUGIXML_LIBRARY})
set(PUGIXML_INCLUDE_DIRS ${PUGIXML_INCLUDE_DIR})
else()
set(PUGIXML_FOUND FALSE)
endif()
mark_as_advanced(
PUGIXML_INCLUDE_DIR
PUGIXML_LIBRARY
)
unset(_pugixml_SEARCH_DIRS)

View File

@@ -0,0 +1,63 @@
# SPDX-FileCopyrightText: 2021 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find PulseAudio library
# Find the native PulseAudio includes and library
# This module defines
# LIBPULSE_INCLUDE_DIRS, where to find pulse/pulseaudio.h, Set when
# LIBPULSE_INCLUDE_DIR is found.
# LIBPULSE_LIBRARIES, libraries to link against to use PulseAudio.
# LIBPULSE_ROOT_DIR, The base directory to search for PulseAudio.
# This can also be an environment variable.
# PULSE_FOUND, If false, do not try to use PulseAudio.
#
# also defined, but not for general use are
# LIBPULSE_LIBRARY, where to find the PulseAudio library.
# If `LIBPULSE_ROOT_DIR` was defined in the environment, use it.
if(DEFINED LIBPULSE_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{LIBPULSE_ROOT_DIR})
set(LIBPULSE_ROOT_DIR $ENV{LIBPULSE_ROOT_DIR})
else()
set(LIBPULSE_ROOT_DIR "")
endif()
set(_pulse_SEARCH_DIRS
${LIBPULSE_ROOT_DIR}
)
find_path(LIBPULSE_INCLUDE_DIR pulse/pulseaudio.h
HINTS
${_pulse_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(LIBPULSE_LIBRARY
NAMES
pulse
HINTS
${_pulse_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set PULSE_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Pulse DEFAULT_MSG
LIBPULSE_LIBRARY LIBPULSE_INCLUDE_DIR)
if(PULSE_FOUND)
set(LIBPULSE_LIBRARIES ${LIBPULSE_LIBRARY})
set(LIBPULSE_INCLUDE_DIRS ${LIBPULSE_INCLUDE_DIR})
endif()
mark_as_advanced(
LIBPULSE_INCLUDE_DIR
LIBPULSE_LIBRARY
)
unset(_pulse_SEARCH_DIRS)

View File

@@ -0,0 +1,297 @@
# SPDX-FileCopyrightText: 2011 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find Python libraries
# Find the native Python includes and library
#
# Note:, This is not _yet_ intended to be a general python module for other
# projects to use since its hard coded to fixed Python version
# as Blender only supports a single Python version at the moment.
#
# Note:
# this is for Blender/Unix Python only.
#
# This module defines
# PYTHON_VERSION
# PYTHON_VERSION_NO_DOTS
# PYTHON_INCLUDE_DIRS
# PYTHON_INCLUDE_CONFIG_DIR
# PYTHON_LIBRARIES
# PYTHON_LIBPATH, Used for installation
# PYTHON_SITE_PACKAGES, Used for installation (as a Python module)
# PYTHON_LINKFLAGS
# PYTHON_ROOT_DIR, The base directory to search for Python.
# This can also be an environment variable.
#
# also defined, but not for general use are
# PYTHON_LIBRARY, where to find the python library.
# If `PYTHON_ROOT_DIR` was defined in the environment, use it.
if(DEFINED PYTHON_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{PYTHON_ROOT_DIR})
set(PYTHON_ROOT_DIR $ENV{PYTHON_ROOT_DIR})
else()
set(PYTHON_ROOT_DIR "")
endif()
set(_PYTHON_VERSION_SUPPORTED 3.13)
set(PYTHON_VERSION ${_PYTHON_VERSION_SUPPORTED} CACHE STRING "Python Version (major and minor only)")
mark_as_advanced(PYTHON_VERSION)
if(APPLE)
if(WITH_PYTHON_MODULE)
set(PYTHON_LINKFLAGS "-undefined dynamic_lookup")
else()
set(PYTHON_LINKFLAGS "")
endif()
else()
# See: http://docs.python.org/extending/embedding.html#linking-requirements
set(PYTHON_LINKFLAGS "-Xlinker -export-dynamic" CACHE STRING "Linker flags for python")
mark_as_advanced(PYTHON_LINKFLAGS)
endif()
# if the user passes these defines as args, we don't want to overwrite
set(_IS_INC_DEF OFF)
set(_IS_INC_CONF_DEF OFF)
set(_IS_LIB_DEF OFF)
set(_IS_LIB_PATH_DEF OFF)
if(DEFINED PYTHON_INCLUDE_DIR)
set(_IS_INC_DEF ON)
endif()
if(DEFINED PYTHON_INCLUDE_CONFIG_DIR)
set(_IS_INC_CONF_DEF ON)
endif()
if(DEFINED PYTHON_LIBRARY)
set(_IS_LIB_DEF ON)
endif()
if(DEFINED PYTHON_LIBPATH)
set(_IS_LIB_PATH_DEF ON)
endif()
string(REPLACE "." "" PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
set(_PYTHON_ABI_FLAGS "")
set(_python_SEARCH_DIRS
${PYTHON_ROOT_DIR}
"$ENV{HOME}/py${PYTHON_VERSION_NO_DOTS}"
"/opt/lib/python-${PYTHON_VERSION}"
)
# only search for the dirs if we haven't already
if((NOT _IS_INC_DEF) OR (NOT _IS_INC_CONF_DEF) OR (NOT _IS_LIB_DEF) OR (NOT _IS_LIB_PATH_DEF))
# When PYTHON_ROOT_DIR is set, remove matching paths from CMAKE_IGNORE_PATH
# so system Python installations (e.g. /usr) can be found.
if(PYTHON_ROOT_DIR AND CMAKE_IGNORE_PATH)
set(_cmake_ignore_path_backup ${CMAKE_IGNORE_PATH})
# Strip trailing slash and match with "/" suffix to avoid
# false matches (e.g. "/usr" matching "/usrfoo").
string(REGEX REPLACE "/$" "" _python_root_rstrip_slash "${PYTHON_ROOT_DIR}")
list(FILTER CMAKE_IGNORE_PATH EXCLUDE REGEX "^${_python_root_rstrip_slash}/")
unset(_python_root_rstrip_slash)
endif()
set(_PYTHON_ABI_FLAGS_TEST
"u; " # release
"du;d" # debug
)
foreach(_CURRENT_ABI_FLAGS ${_PYTHON_ABI_FLAGS_TEST})
# if(CMAKE_BUILD_TYPE STREQUAL Debug)
# set(_CURRENT_ABI_FLAGS "d${_CURRENT_ABI_FLAGS}")
# endif()
string(REPLACE " " "" _CURRENT_ABI_FLAGS ${_CURRENT_ABI_FLAGS})
set(_python_INCLUDE_PATH_SUFFIXES
include/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
)
if(DEFINED CMAKE_LIBRARY_ARCHITECTURE)
if(CMAKE_LIBRARY_ARCHITECTURE)
list(APPEND _python_INCLUDE_PATH_SUFFIXES
include/${CMAKE_LIBRARY_ARCHITECTURE}/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
)
endif()
endif()
if(NOT DEFINED PYTHON_INCLUDE_DIR)
find_path(PYTHON_INCLUDE_DIR
NAMES
Python.h
HINTS
${_python_SEARCH_DIRS}
PATH_SUFFIXES
${_python_INCLUDE_PATH_SUFFIXES}
)
endif()
if(NOT DEFINED PYTHON_INCLUDE_CONFIG_DIR)
find_path(PYTHON_INCLUDE_CONFIG_DIR
NAMES
pyconfig.h
HINTS
${_python_SEARCH_DIRS}
PATH_SUFFIXES
${_python_INCLUDE_PATH_SUFFIXES}
)
if((NOT PYTHON_INCLUDE_CONFIG_DIR) AND PYTHON_INCLUDE_DIR)
# Fallback...
unset(PYTHON_INCLUDE_CONFIG_DIR CACHE)
set(PYTHON_INCLUDE_CONFIG_DIR ${PYTHON_INCLUDE_DIR} CACHE PATH "")
endif()
endif()
if(NOT DEFINED PYTHON_LIBRARY)
find_library(PYTHON_LIBRARY
NAMES
"python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}"
HINTS
${_python_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
endif()
if(NOT DEFINED PYTHON_LIBPATH)
find_path(PYTHON_LIBPATH
NAMES
"python${PYTHON_VERSION}/abc.py" # This is a bit hackish! :/
HINTS
${_python_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
if((NOT PYTHON_LIBPATH) AND PYTHON_LIBRARY)
# Fallback...
unset(PYTHON_LIBPATH CACHE)
get_filename_component(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
endif()
endif()
if(PYTHON_LIBRARY AND PYTHON_LIBPATH AND PYTHON_INCLUDE_DIR AND PYTHON_INCLUDE_CONFIG_DIR)
set(_PYTHON_ABI_FLAGS "${_CURRENT_ABI_FLAGS}")
break()
else()
# ensure we don't find values from 2 different ABI versions
if(NOT _IS_INC_DEF)
unset(PYTHON_INCLUDE_DIR CACHE)
endif()
if(NOT _IS_INC_CONF_DEF)
unset(PYTHON_INCLUDE_CONFIG_DIR CACHE)
endif()
if(NOT _IS_LIB_DEF)
unset(PYTHON_LIBRARY CACHE)
endif()
if(NOT _IS_LIB_PATH_DEF)
unset(PYTHON_LIBPATH CACHE)
endif()
endif()
endforeach()
unset(_CURRENT_ABI_FLAGS)
unset(_CURRENT_PATH)
unset(_python_INCLUDE_PATH_SUFFIXES)
unset(_PYTHON_ABI_FLAGS_TEST)
# Restore CMAKE_IGNORE_PATH if it was modified.
if(DEFINED _cmake_ignore_path_backup)
set(CMAKE_IGNORE_PATH ${_cmake_ignore_path_backup})
unset(_cmake_ignore_path_backup)
endif()
endif()
unset(_IS_INC_DEF)
unset(_IS_INC_CONF_DEF)
unset(_IS_LIB_DEF)
unset(_IS_LIB_PATH_DEF)
# handle the QUIETLY and REQUIRED arguments and SET PYTHONLIBSUNIX_FOUND to TRUE IF
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
# NOTE(@ideasman42): Instead of `DEFAULT_MSG` use a custom message because users
# may have newer versions Python and not be using pre-compiled libraries
# (on other UNIX systems or using an esoteric architecture).
# Some Python developers might want to use the newer features of Python too.
# While we could automatically detect and use newer versions but this would result in
# developers using a configuration which isn't officially supported without realizing it.
# So warn that the officially supported Python version is not found and let the developer
# explicitly set the newer version if they wish.
# From a maintenance perspective it's typically not a problem to support newer versions,
# doing so can help ease the process of upgrading too, nevertheless these versions don't
# have the same level of testing & support.
if(${_PYTHON_VERSION_SUPPORTED} STREQUAL ${PYTHON_VERSION})
# Default version.
set(_python_MISSING_MSG
"\
'PYTHON_VERSION=${_PYTHON_VERSION_SUPPORTED}' not found! \
This is the only officially supported version. \
If you wish to use a newer Python version you may set 'PYTHON_VERSION' \
however we do not guarantee full compatibility in this case."
)
else()
# Default version overridden, use a different message.
set(_python_MISSING_MSG
"\
'PYTHON_VERSION=${PYTHON_VERSION}' not found! \
This is *not* the officially supported version. \
Either configure 'PYTHON_ROOT_DIR' to point to the Python installation \
or use the officially supported version ('${_PYTHON_VERSION_SUPPORTED}') \
which may have pre-compiled binaries for your platform."
)
endif()
find_package_handle_standard_args(PythonLibsUnix
"${_python_MISSING_MSG}"
PYTHON_LIBRARY PYTHON_LIBPATH PYTHON_INCLUDE_DIR PYTHON_INCLUDE_CONFIG_DIR)
unset(_python_MISSING_MSG)
if(PYTHONLIBSUNIX_FOUND)
# Assign cache items
set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR} ${PYTHON_INCLUDE_CONFIG_DIR})
if(NOT WITH_PYTHON_MODULE)
set(PYTHON_LIBRARIES ${PYTHON_LIBRARY})
endif()
find_file(PYTHON_SITE_PACKAGES
NAMES
# debian specific
dist-packages
site-packages
HINTS
${PYTHON_LIBPATH}/python${PYTHON_VERSION}
)
# we need this for installation
# XXX No more valid with debian-like py3.5 packages...
# get_filename_component(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
# not required for build, just used when bundling Python.
find_program(
PYTHON_EXECUTABLE
NAMES
"python${PYTHON_VERSION}${_PYTHON_ABI_FLAGS}"
"python${PYTHON_VERSION}"
"python"
HINTS
${_python_SEARCH_DIRS}
PATH_SUFFIXES bin
)
endif()
mark_as_advanced(
PYTHON_INCLUDE_DIR
PYTHON_INCLUDE_CONFIG_DIR
PYTHON_LIBRARY
PYTHON_LIBPATH
PYTHON_SITE_PACKAGES
PYTHON_EXECUTABLE
)
unset(_PYTHON_ABI_FLAGS)
unset(_PYTHON_VERSION_SUPPORTED)
unset(_python_SEARCH_DIRS)

View File

@@ -0,0 +1,63 @@
# SPDX-FileCopyrightText: 2025 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find Rubberband libraries
# Find the Rubberband includes and libraries
# This module defines
# RUBBERBAND_INCLUDE_DIRS, where to find Rubberband headers, Set when
# RUBBERBAND_INCLUDE_DIR is found.
# RUBBERBAND_LIBRARIES, libraries to link against to use Rubberband.
# RUBBERBAND_ROOT_DIR, The base directory to search for Rubberband.
# This can also be an environment variable.
# RUBBERBAND_FOUND, If false, do not try to use the Rubberband library.
#
# also defined, but not for general use are
# RUBBERBAND_LIBRARY, where to find the Rubberband library.
if(DEFINED RUBBERBAND_ROOT_DIR)
elseif(DEFINED ENV{RUBBERBAND_ROOT_DIR})
set(RUBBERBAND_ROOT_DIR $ENV{RUBBERBAND_ROOT_DIR})
else()
set(RUBBERBAND_ROOT_DIR "")
endif()
set(_rubberband_SEARCH_DIRS
${RUBBERBAND_ROOT_DIR}
)
find_path(RUBBERBAND_INCLUDE_DIR
NAMES
rubberband/RubberBandStretcher.h
HINTS
${_rubberband_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(RUBBERBAND_LIBRARY
NAMES
rubberband
HINTS
${_rubberband_SEARCH_DIRS}
PATH_SUFFIXES
lib lib64
)
# handle the QUIETLY and REQUIRED arguments and set RUBBERBAND_FOUND to TRUE if
# all listed variables are TRUE
find_package(PackageHandleStandardArgs)
find_package_handle_standard_args(Rubberband DEFAULT_MSG RUBBERBAND_LIBRARY RUBBERBAND_INCLUDE_DIR)
if(RUBBERBAND_FOUND)
set(RUBBERBAND_LIBRARIES ${RUBBERBAND_LIBRARY})
set(RUBBERBAND_INCLUDE_DIRS ${RUBBERBAND_INCLUDE_DIR})
endif()
mark_as_advanced(
RUBBERBAND_LIBRARY
RUBBERBAND_INCLUDE_DIR
)
unset(_rubberband_SEARCH_DIRS)

View File

@@ -0,0 +1,139 @@
# SPDX-FileCopyrightText: 2021-2022 Intel Corporation
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find SYCL library
# Find the native SYCL header and libraries needed by oneAPI implementation
# This module defines
# SYCL_COMPILER, compiler which will be used for compilation of SYCL code
# SYCL_LIBRARY, libraries to link against in order to use SYCL.
# SYCL_INCLUDE_DIR, directories where SYCL headers can be found
# SYCL_ROOT_DIR, The base directory to search for SYCL files.
# This can also be an environment variable.
# SYCL_FOUND, If false, then don't try to use SYCL.
if(NOT (DEFINED SYCL_ROOT_DIR))
set(SYCL_ROOT_DIR "")
endif()
if(SYCL_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{SYCL_ROOT_DIR} AND NOT $ENV{SYCL_ROOT_DIR} STREQUAL "")
set(SYCL_ROOT_DIR $ENV{SYCL_ROOT_DIR})
endif()
set(_sycl_SEARCH_DIRS
${SYCL_ROOT_DIR}
/usr/lib
/usr/local/lib
/opt/intel/oneapi/compiler/latest/linux/
C:/Program\ Files\ \(x86\)/Intel/oneAPI/compiler/latest/windows
)
# Find DPC++ compiler.
# Since the compiler name is possibly conflicting with the system-wide
# CLang start with looking for either dpcpp or clang binary in the given
# list of search paths only. If that fails, try to look for a system-wide
# dpcpp binary.
find_program(SYCL_COMPILER
NAMES
icpx
dpcpp
clang++
HINTS
${_sycl_SEARCH_DIRS}
PATH_SUFFIXES
bin
NO_CMAKE_FIND_ROOT_PATH
NAMES_PER_DIR
)
# NOTE: No clang++ here so that we do not pick up a system-wide CLang
# compiler.
if(NOT SYCL_COMPILER)
find_program(SYCL_COMPILER
NAMES
icpx
dpcpp
HINTS
${_sycl_SEARCH_DIRS}
PATH_SUFFIXES
bin
)
endif()
find_library(SYCL_LIBRARY
NAMES
sycl10
sycl9
sycl8
sycl7
sycl6
sycl
HINTS
${_sycl_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
if(WIN32)
find_library(SYCL_LIBRARY_DEBUG
NAMES
sycl10d
sycl9d
sycl8d
sycl7d
sycl6d
sycld
HINTS
${_sycl_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
endif()
find_path(SYCL_INCLUDE_DIR
NAMES
sycl/sycl.hpp
HINTS
${_sycl_SEARCH_DIRS}
PATH_SUFFIXES
include
)
if(EXISTS "${SYCL_INCLUDE_DIR}/sycl/version.hpp")
file(STRINGS "${SYCL_INCLUDE_DIR}/sycl/version.hpp" _libsycl_major_version REGEX "^#define __LIBSYCL_MAJOR_VERSION[ \t].*$")
string(REGEX MATCHALL "[0-9]+" _libsycl_major_version ${_libsycl_major_version})
file(STRINGS "${SYCL_INCLUDE_DIR}/sycl/version.hpp" _libsycl_minor_version REGEX "^#define __LIBSYCL_MINOR_VERSION[ \t].*$")
string(REGEX MATCHALL "[0-9]+" _libsycl_minor_version ${_libsycl_minor_version})
file(STRINGS "${SYCL_INCLUDE_DIR}/sycl/version.hpp" _libsycl_patch_version REGEX "^#define __LIBSYCL_PATCH_VERSION[ \t].*$")
string(REGEX MATCHALL "[0-9]+" _libsycl_patch_version ${_libsycl_patch_version})
set(SYCL_VERSION "${_libsycl_major_version}.${_libsycl_minor_version}.${_libsycl_patch_version}")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SYCL
REQUIRED_VARS SYCL_LIBRARY SYCL_INCLUDE_DIR
VERSION_VAR SYCL_VERSION
)
if(SYCL_FOUND)
set(SYCL_INCLUDE_DIR ${SYCL_INCLUDE_DIR} ${SYCL_INCLUDE_DIR}/sycl)
if(WIN32 AND SYCL_LIBRARY_DEBUG)
set(SYCL_LIBRARIES optimized ${SYCL_LIBRARY} debug ${SYCL_LIBRARY_DEBUG})
else()
set(SYCL_LIBRARIES ${SYCL_LIBRARY})
endif()
else()
set(SYCL_FOUND FALSE)
endif()
mark_as_advanced(
SYCL_COMPILER
SYCL_INCLUDE_DIR
SYCL_LIBRARY
)
unset(_sycl_SEARCH_DIRS)

View File

@@ -0,0 +1,62 @@
# SPDX-FileCopyrightText: 2023 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find ShaderC libraries
# Find the ShaderC includes and libraries
# This module defines
# SHADERC_INCLUDE_DIRS, where to find ShaderC headers, Set when
# SHADERC_INCLUDE_DIR is found.
# SHADERC_LIBRARIES, libraries to link against to use ShaderC.
# SHADERC_ROOT_DIR, The base directory to search for ShaderC.
# This can also be an environment variable.
# SHADERC_FOUND, If false, do not try to use ShaderC.
#
# If `SHADERC_ROOT_DIR` was defined in the environment, use it.
if(DEFINED SHADERC_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{SHADERC_ROOT_DIR})
set(SHADERC_ROOT_DIR $ENV{SHADERC_ROOT_DIR})
else()
set(SHADERC_ROOT_DIR "")
endif()
set(_shaderc_SEARCH_DIRS
${SHADERC_ROOT_DIR}
)
find_path(SHADERC_INCLUDE_DIR
NAMES
shaderc/shaderc.h
HINTS
${_shaderc_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(SHADERC_LIBRARY
NAMES
shaderc_combined
HINTS
${_shaderc_SEARCH_DIRS}
PATH_SUFFIXES
lib
)
# handle the QUIETLY and REQUIRED arguments and set SHADERC_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ShaderC DEFAULT_MSG SHADERC_LIBRARY SHADERC_INCLUDE_DIR)
if(SHADERC_FOUND)
set(SHADERC_LIBRARIES ${SHADERC_LIBRARY})
set(SHADERC_INCLUDE_DIRS ${SHADERC_INCLUDE_DIR})
endif()
mark_as_advanced(
SHADERC_INCLUDE_DIR
SHADERC_LIBRARY
)
unset(_shaderc_SEARCH_DIRS)

View File

@@ -0,0 +1,63 @@
# SPDX-FileCopyrightText: 2011 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find SndFile library
# Find the native SndFile includes and library
# This module defines
# LIBSNDFILE_INCLUDE_DIRS, where to find sndfile.h, Set when
# LIBSNDFILE_INCLUDE_DIR is found.
# LIBSNDFILE_LIBRARIES, libraries to link against to use SndFile.
# LIBSNDFILE_ROOT_DIR, The base directory to search for SndFile.
# This can also be an environment variable.
# SNDFILE_FOUND, If false, do not try to use SndFile.
#
# also defined, but not for general use are
# LIBSNDFILE_LIBRARY, where to find the SndFile library.
# If `LIBSNDFILE_ROOT_DIR` was defined in the environment, use it.
if(DEFINED LIBSNDFILE_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{LIBSNDFILE_ROOT_DIR})
set(LIBSNDFILE_ROOT_DIR $ENV{LIBSNDFILE_ROOT_DIR})
else()
set(LIBSNDFILE_ROOT_DIR "")
endif()
set(_sndfile_SEARCH_DIRS
${LIBSNDFILE_ROOT_DIR}
)
find_path(LIBSNDFILE_INCLUDE_DIR sndfile.h
HINTS
${_sndfile_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(LIBSNDFILE_LIBRARY
NAMES
sndfile
HINTS
${_sndfile_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set SNDFILE_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SndFile DEFAULT_MSG
LIBSNDFILE_LIBRARY LIBSNDFILE_INCLUDE_DIR)
if(SNDFILE_FOUND)
set(LIBSNDFILE_LIBRARIES ${LIBSNDFILE_LIBRARY})
set(LIBSNDFILE_INCLUDE_DIRS ${LIBSNDFILE_INCLUDE_DIR})
endif()
mark_as_advanced(
LIBSNDFILE_INCLUDE_DIR
LIBSNDFILE_LIBRARY
)
unset(_sndfile_SEARCH_DIRS)

View File

@@ -0,0 +1,65 @@
# SPDX-FileCopyrightText: 2011 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find Spacenav library
# Find the native Spacenav includes and library
# This module defines
# SPACENAV_INCLUDE_DIRS, where to find spnav.h, Set when
# SPACENAV_INCLUDE_DIR is found.
# SPACENAV_LIBRARIES, libraries to link against to use Spacenav.
# SPACENAV_ROOT_DIR, The base directory to search for Spacenav.
# This can also be an environment variable.
# SPACENAV_FOUND, If false, do not try to use Spacenav.
#
# also defined, but not for general use are
# SPACENAV_LIBRARY, where to find the Spacenav library.
# If `SPACENAV_ROOT_DIR` was defined in the environment, use it.
if(DEFINED SPACENAV_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{SPACENAV_ROOT_DIR})
set(SPACENAV_ROOT_DIR $ENV{SPACENAV_ROOT_DIR})
else()
set(SPACENAV_ROOT_DIR "")
endif()
set(_spacenav_SEARCH_DIRS
${SPACENAV_ROOT_DIR}
)
find_path(SPACENAV_INCLUDE_DIR
NAMES
spnav.h
HINTS
${_spacenav_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(SPACENAV_LIBRARY
NAMES
spnav
HINTS
${_spacenav_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set SPACENAV_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Spacenav DEFAULT_MSG
SPACENAV_LIBRARY SPACENAV_INCLUDE_DIR)
if(SPACENAV_FOUND)
set(SPACENAV_LIBRARIES ${SPACENAV_LIBRARY})
set(SPACENAV_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIR})
endif()
mark_as_advanced(
SPACENAV_INCLUDE_DIR
SPACENAV_LIBRARY
)
unset(_spacenav_SEARCH_DIRS)

View File

@@ -0,0 +1,83 @@
# SPDX-FileCopyrightText: 2019 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find Universal Scene Description (USD) library
# Find the native USD includes and libraries
# This module defines
# USD_INCLUDE_DIRS, where to find USD headers, Set when
# USD_INCLUDE_DIR is found.
# USD_LIBRARIES, libraries to link against to use USD.
# USD_ROOT_DIR, The base directory to search for USD.
# This can also be an environment variable.
# USD_FOUND, If false, do not try to use USD.
#
# If `USD_ROOT_DIR` was defined in the environment, use it.
if(DEFINED USD_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{USD_ROOT_DIR})
set(USD_ROOT_DIR $ENV{USD_ROOT_DIR})
else()
set(USD_ROOT_DIR "")
endif()
set(_usd_SEARCH_DIRS
${USD_ROOT_DIR}
/opt/lib/usd
)
find_path(USD_INCLUDE_DIR
NAMES
pxr/usd/usd/api.h
HINTS
${_usd_SEARCH_DIRS}
PATH_SUFFIXES
include
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
find_library(USD_LIBRARY
NAMES
usd_usd_m usd_usd_ms usd_m usd_ms
${PXR_LIB_PREFIX}usd
NAMES_PER_DIR
HINTS
${_usd_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib lib/static
DOC "Universal Scene Description (USD) monolithic library"
)
if(NOT USD_LIBRARY)
set(USD_FOUND FALSE)
else()
# handle the QUIETLY and REQUIRED arguments and set USD_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(USD DEFAULT_MSG USD_LIBRARY USD_INCLUDE_DIR)
if(USD_FOUND)
get_filename_component(USD_LIBRARY_DIR ${USD_LIBRARY} DIRECTORY)
set(USD_INCLUDE_DIRS ${USD_INCLUDE_DIR})
set(USD_LIBRARIES ${USD_LIBRARY})
if(EXISTS ${USD_INCLUDE_DIR}/pxr/base/tf/pyModule.h)
set(USD_PYTHON_SUPPORT ON)
endif()
endif()
endif()
mark_as_advanced(
USD_INCLUDE_DIR
USD_LIBRARY_DIR
USD_LIBRARY
)
unset(_usd_SEARCH_DIRS)

View File

@@ -0,0 +1,62 @@
# SPDX-FileCopyrightText: 2023 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find Vulkan libraries
# Find the Vulkan includes and libraries
# This module defines
# VULKAN_INCLUDE_DIRS, where to find Vulkan headers, Set when
# VULKAN_INCLUDE_DIR is found.
# VULKAN_LIBRARIES, libraries to link against to use Vulkan.
# VULKAN_ROOT_DIR, The base directory to search for Vulkan.
# This can also be an environment variable.
# VULKAN_FOUND, If false, do not try to use Vulkan.
#
# If `VULKAN_ROOT_DIR` was defined in the environment, use it.
if(DEFINED VULKAN_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{VULKAN_ROOT_DIR})
set(VULKAN_ROOT_DIR $ENV{VULKAN_ROOT_DIR})
else()
set(VULKAN_ROOT_DIR "")
endif()
set(_vulkan_SEARCH_DIRS
${VULKAN_ROOT_DIR}
)
find_path(VULKAN_INCLUDE_DIR
NAMES
vulkan/vulkan.h
HINTS
${_vulkan_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(VULKAN_LIBRARY
NAMES
vulkan
HINTS
${_vulkan_SEARCH_DIRS}
PATH_SUFFIXES
lib
)
# handle the QUIETLY and REQUIRED arguments and set VULKAN_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vulkan DEFAULT_MSG VULKAN_LIBRARY VULKAN_INCLUDE_DIR)
if(VULKAN_FOUND)
set(VULKAN_LIBRARIES ${VULKAN_LIBRARY})
set(VULKAN_INCLUDE_DIRS ${VULKAN_INCLUDE_DIR})
endif()
mark_as_advanced(
VULKAN_INCLUDE_DIR
VULKAN_LIBRARY
)
unset(_vulkan_SEARCH_DIRS)

View File

@@ -0,0 +1,95 @@
# SPDX-FileCopyrightText: 2022 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find WebP library
# Find the native WebP includes and library
# This module defines
# WEBP_INCLUDE_DIRS, where to find WebP headers, Set when WebP is found.
# WEBP_LIBRARIES, libraries to link against to use WebP.
# WEBP_ROOT_DIR, The base directory to search for WebP.
# This can also be an environment variable.
# WEBP_FOUND, If false, do not try to use WebP.
#
# also defined, but not for general use are
# WEBP_LIBRARY, where to find the WEBP library.
# If `WEBP_ROOT_DIR` was defined in the environment, use it.
if(DEFINED WEBP_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{WEBP_ROOT_DIR})
set(WEBP_ROOT_DIR $ENV{WEBP_ROOT_DIR})
else()
set(WEBP_ROOT_DIR "")
endif()
set(_webp_SEARCH_DIRS
${WEBP_ROOT_DIR}
/opt/lib/webp
)
find_path(WEBP_INCLUDE_DIR
NAMES
webp/types.h
HINTS
${_webp_SEARCH_DIRS}
PATH_SUFFIXES
include
)
set(_webp_FIND_COMPONENTS
webp
webpmux
webpdemux
sharpyuv # New in 1.3
)
set(_webp_LIBRARIES "")
foreach(COMPONENT ${_webp_FIND_COMPONENTS})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
find_library(WEBP_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}
NAMES_PER_DIR
HINTS
${_webp_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib lib/static
)
if(WEBP_${UPPERCOMPONENT}_LIBRARY)
list(APPEND _webp_LIBRARIES "${WEBP_${UPPERCOMPONENT}_LIBRARY}")
endif()
endforeach()
if(NOT WEBP_WEBP_LIBRARY)
set(WEBP_FOUND FALSE)
else()
# handle the QUIETLY and REQUIRED arguments and set WEBP_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WebP DEFAULT_MSG _webp_LIBRARIES WEBP_INCLUDE_DIR)
if(WEBP_FOUND)
get_filename_component(WEBP_LIBRARY_DIR ${WEBP_WEBP_LIBRARY} DIRECTORY)
set(WEBP_INCLUDE_DIRS ${WEBP_INCLUDE_DIR})
set(WEBP_LIBRARIES ${_webp_LIBRARIES})
else()
set(WEBP_FOUND FALSE)
endif()
endif()
mark_as_advanced(
WEBP_INCLUDE_DIR
WEBP_LIBRARY_DIR
# Generated names.
WEBP_WEBPDEMUX_LIBRARY
WEBP_WEBPMUX_LIBRARY
WEBP_WEBP_LIBRARY
WEBP_SHARPYUV_LIBRARY
)
unset(_webp_FIND_COMPONENTS)
unset(_webp_LIBRARIES)
unset(_webp_SEARCH_DIRS)

View File

@@ -0,0 +1,63 @@
# SPDX-FileCopyrightText: 2011 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find XML2 library
# Find the native XML2 includes and library
# This module defines
# XML2_INCLUDE_DIRS, where to find xml2.h, Set when
# XML2_INCLUDE_DIR is found.
# XML2_LIBRARIES, libraries to link against to use XML2.
# XML2_ROOT_DIR, The base directory to search for XML2.
# This can also be an environment variable.
# XML2_FOUND, If false, do not try to use XML2.
#
# also defined, but not for general use are
# XML2_LIBRARY, where to find the XML2 library.
# If `XML2_ROOT_DIR` was defined in the environment, use it.
if(DEFINED XML2_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{XML2_ROOT_DIR})
set(XML2_ROOT_DIR $ENV{XML2_ROOT_DIR})
else()
set(XML2_ROOT_DIR "")
endif()
set(_xml2_SEARCH_DIRS
${XML2_ROOT_DIR}
)
find_path(XML2_INCLUDE_DIR libxml2/libxml/xpath.h
HINTS
${_xml2_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(XML2_LIBRARY
NAMES
xml2
HINTS
${_xml2_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set XML2_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(XML2 DEFAULT_MSG
XML2_LIBRARY XML2_INCLUDE_DIR)
if(XML2_FOUND)
set(XML2_LIBRARIES ${XML2_LIBRARY})
set(XML2_INCLUDE_DIRS ${XML2_INCLUDE_DIR})
endif()
mark_as_advanced(
XML2_INCLUDE_DIR
XML2_LIBRARY
)
unset(_xml2_SEARCH_DIRS)

View File

@@ -0,0 +1,74 @@
# SPDX-FileCopyrightText: 2020-2022 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find OpenXR-SDK libraries
# Find the native OpenXR-SDK includes and libraries
#
# Note that there is a distinction between the OpenXR standard and the SDK. The
# latter provides utilities to use the standard but is not part of it. Most
# importantly, it contains C headers and a loader library, which manages
# dynamic linking to OpenXR runtimes like Monado, Windows Mixed Reality or
# Oculus. See the repository for more details:
# https://github.com/KhronosGroup/OpenXR-SDK
#
# This module defines
# XR_OPENXR_SDK_INCLUDE_DIRS, where to find OpenXR-SDK headers, Set when
# XR_OPENXR_SDK_INCLUDE_DIR is found.
# XR_OPENXR_SDK_LIBRARIES, libraries to link against to use OpenXR.
# XR_OPENXR_SDK_ROOT_DIR, the base directory to search for OpenXR-SDK.
# This can also be an environment variable.
# XR_OPENXR_SDK_FOUND, if false, do not try to use OpenXR-SDK.
#
# also defined, but not for general use are
# XR_OPENXR_SDK_LOADER_LIBRARY, where to find the OpenXR-SDK loader library.
# If `XR_OPENXR_SDK_ROOT_DIR` was defined in the environment, use it.
if(DEFINED XR_OPENXR_SDK_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{XR_OPENXR_SDK_ROOT_DIR})
set(XR_OPENXR_SDK_ROOT_DIR $ENV{XR_OPENXR_SDK_ROOT_DIR})
else()
set(XR_OPENXR_SDK_ROOT_DIR "")
endif()
set(_xr_openxr_sdk_SEARCH_DIRS
${XR_OPENXR_SDK_ROOT_DIR}
/opt/lib/xr-openxr-sdk
)
find_path(XR_OPENXR_SDK_INCLUDE_DIR
NAMES
openxr/openxr.h
HINTS
${_xr_openxr_sdk_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(XR_OPENXR_SDK_LOADER_LIBRARY
NAMES
openxr_loader
HINTS
${_xr_openxr_sdk_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set XR_OPENXR_SDK_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(XR_OpenXR_SDK DEFAULT_MSG
XR_OPENXR_SDK_LOADER_LIBRARY XR_OPENXR_SDK_INCLUDE_DIR)
if(XR_OPENXR_SDK_FOUND)
set(XR_OPENXR_SDK_LIBRARIES ${XR_OPENXR_SDK_LOADER_LIBRARY})
set(XR_OPENXR_SDK_INCLUDE_DIRS ${XR_OPENXR_SDK_INCLUDE_DIR})
endif()
mark_as_advanced(
XR_OPENXR_SDK_INCLUDE_DIR
XR_OPENXR_SDK_LOADER_LIBRARY
)
unset(_xr_openxr_sdk_SEARCH_DIRS)

View File

@@ -0,0 +1,65 @@
# SPDX-FileCopyrightText: 2019 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find Zstd library
# Find the native Zstd includes and library
# This module defines
# ZSTD_INCLUDE_DIRS, where to find zstd.h, Set when
# ZSTD_INCLUDE_DIR is found.
# ZSTD_LIBRARIES, libraries to link against to use Zstd.
# ZSTD_ROOT_DIR, The base directory to search for Zstd.
# This can also be an environment variable.
# ZSTD_FOUND, If false, do not try to use Zstd.
#
# also defined, but not for general use are
# ZSTD_LIBRARY, where to find the Zstd library.
# If `ZSTD_ROOT_DIR` was defined in the environment, use it.
if(DEFINED ZSTD_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{ZSTD_ROOT_DIR})
set(ZSTD_ROOT_DIR $ENV{ZSTD_ROOT_DIR})
else()
set(ZSTD_ROOT_DIR "")
endif()
set(_zstd_SEARCH_DIRS
${ZSTD_ROOT_DIR}
)
find_path(ZSTD_INCLUDE_DIR
NAMES
zstd.h
HINTS
${_zstd_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(ZSTD_LIBRARY
NAMES
zstd
HINTS
${_zstd_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set ZSTD_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Zstd DEFAULT_MSG
ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
if(ZSTD_FOUND)
set(ZSTD_LIBRARIES ${ZSTD_LIBRARY})
set(ZSTD_INCLUDE_DIRS ${ZSTD_INCLUDE_DIR})
endif()
mark_as_advanced(
ZSTD_INCLUDE_DIR
ZSTD_LIBRARY
)
unset(_zstd_SEARCH_DIRS)

View File

@@ -0,0 +1,50 @@
# SPDX-FileCopyrightText: 2020 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find sse2neon library
# Find the native sse2neon includes and library
# This module defines
# SSE2NEON_INCLUDE_DIRS, where to find sse2neon.h, Set when
# SSE2NEON_INCLUDE_DIR is found.
# SSE2NEON_ROOT_DIR, The base directory to search for sse2neon.
# This can also be an environment variable.
# SSE2NEON_FOUND, If false, do not try to use sse2neon.
# If `SSE2NEON_ROOT_DIR` was defined in the environment, use it.
if(DEFINED SSE2NEON_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{SSE2NEON_ROOT_DIR})
set(SSE2NEON_ROOT_DIR $ENV{SSE2NEON_ROOT_DIR})
else()
set(SSE2NEON_ROOT_DIR "")
endif()
set(_sse2neon_SEARCH_DIRS
${SSE2NEON_ROOT_DIR}
)
find_path(SSE2NEON_INCLUDE_DIR
NAMES
sse2neon.h
HINTS
${_sse2neon_SEARCH_DIRS}
PATH_SUFFIXES
include
)
# handle the QUIETLY and REQUIRED arguments and set SSE2NEON_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(sse2neon DEFAULT_MSG
SSE2NEON_INCLUDE_DIR)
if(SSE2NEON_FOUND)
set(SSE2NEON_INCLUDE_DIRS ${SSE2NEON_INCLUDE_DIR})
endif()
mark_as_advanced(
SSE2NEON_INCLUDE_DIR
)
unset(_sse2neon_SEARCH_DIRS)

View File

@@ -0,0 +1,412 @@
# SPDX-FileCopyrightText: 2020-2022 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
#[=======================================================================[.rst:
GoogleTest
----------
.. versionadded:: 3.9
This module defines functions to help use the Google Test infrastructure. Two
mechanisms for adding tests are provided. :command:`gtest_add_tests` has been
around for some time, originally via ``find_package(GTest)``.
:command:`gtest_discover_tests` was introduced in CMake 3.10.
The (older) :command:`gtest_add_tests` scans source files to identify tests.
This is usually effective, with some caveats, including in cross-compiling
environments, and makes setting additional properties on tests more convenient.
However, its handling of parameterized tests is less comprehensive, and it
requires re-running CMake to detect changes to the list of tests.
The (newer) :command:`gtest_discover_tests` discovers tests by asking the
compiled test executable to enumerate its tests. This is more robust and
provides better handling of parameterized tests, and does not require CMake
to be re-run when tests change. However, it may not work in a cross-compiling
environment, and setting test properties is less convenient.
More details can be found in the documentation of the respective functions.
Both commands are intended to replace use of :command:`add_test` to register
tests, and will create a separate CTest test for each Google Test test case.
Note that this is in some cases less efficient, as common set-up and tear-down
logic cannot be shared by multiple test cases executing in the same instance.
However, it provides more fine-grained pass/fail information to CTest, which is
usually considered as more beneficial. By default, the CTest test name is the
same as the Google Test name (i.e. ``suite.testcase``); see also
``TEST_PREFIX`` and ``TEST_SUFFIX``.
.. command:: gtest_add_tests
Automatically add tests with CTest by scanning source code for Google Test
macros::
gtest_add_tests(TARGET target
[SOURCES src1...]
[EXTRA_ARGS arg1...]
[WORKING_DIRECTORY dir]
[TEST_PREFIX prefix]
[TEST_SUFFIX suffix]
[SKIP_DEPENDENCY]
[TEST_LIST outVar]
)
``gtest_add_tests`` attempts to identify tests by scanning source files.
Although this is generally effective, it uses only a basic regular expression
match, which can be defeated by atypical test declarations, and is unable to
fully "split" parameterized tests. Additionally, it requires that CMake be
re-run to discover any newly added, removed or renamed tests (by default,
this means that CMake is re-run when any test source file is changed, but see
``SKIP_DEPENDENCY``). However, it has the advantage of declaring tests at
CMake time, which somewhat simplifies setting additional properties on tests,
and always works in a cross-compiling environment.
The options are:
``TARGET target``
Specifies the Google Test executable, which must be a known CMake
executable target. CMake will substitute the location of the built
executable when running the test.
``SOURCES src1...``
When provided, only the listed files will be scanned for test cases. If
this option is not given, the :prop_tgt:`SOURCES` property of the
specified ``target`` will be used to obtain the list of sources.
``EXTRA_ARGS arg1...``
Any extra arguments to pass on the command line to each test case.
``WORKING_DIRECTORY dir``
Specifies the directory in which to run the discovered test cases. If this
option is not provided, the current binary directory is used.
``TEST_PREFIX prefix``
Specifies a ``prefix`` to be prepended to the name of each discovered test
case. This can be useful when the same source files are being used in
multiple calls to ``gtest_add_test()`` but with different ``EXTRA_ARGS``.
``TEST_SUFFIX suffix``
Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of
every discovered test case. Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` may
be specified.
``SKIP_DEPENDENCY``
Normally, the function creates a dependency which will cause CMake to be
re-run if any of the sources being scanned are changed. This is to ensure
that the list of discovered tests is updated. If this behavior is not
desired (as may be the case while actually writing the test cases), this
option can be used to prevent the dependency from being added.
``TEST_LIST outVar``
The variable named by ``outVar`` will be populated in the calling scope
with the list of discovered test cases. This allows the caller to do
things like manipulate test properties of the discovered tests.
.. code-block:: cmake
include(GoogleTest)
add_executable(FooTest FooUnitTest.cxx)
gtest_add_tests(TARGET FooTest
TEST_SUFFIX .noArgs
TEST_LIST noArgsTests
)
gtest_add_tests(TARGET FooTest
EXTRA_ARGS --someArg someValue
TEST_SUFFIX .withArgs
TEST_LIST withArgsTests
)
set_tests_properties(${noArgsTests} PROPERTIES TIMEOUT 10)
set_tests_properties(${withArgsTests} PROPERTIES TIMEOUT 20)
For backward compatibility, the following form is also supported::
gtest_add_tests(exe args files...)
``exe``
The path to the test executable or the name of a CMake target.
``args``
A ;-list of extra arguments to be passed to executable. The entire
list must be passed as a single argument. Enclose it in quotes,
or pass ``""`` for no arguments.
``files...``
A list of source files to search for tests and test fixtures.
Alternatively, use ``AUTO`` to specify that ``exe`` is the name
of a CMake executable target whose sources should be scanned.
.. code-block:: cmake
include(GoogleTest)
set(FooTestArgs --foo 1 --bar 2)
add_executable(FooTest FooUnitTest.cxx)
gtest_add_tests(FooTest "${FooTestArgs}" AUTO)
.. command:: gtest_discover_tests
Automatically add tests with CTest by querying the compiled test executable
for available tests::
gtest_discover_tests(target
[EXTRA_ARGS arg1...]
[WORKING_DIRECTORY dir]
[TEST_PREFIX prefix]
[TEST_SUFFIX suffix]
[NO_PRETTY_TYPES] [NO_PRETTY_VALUES]
[PROPERTIES name1 value1...]
[TEST_LIST var]
[DISCOVERY_TIMEOUT seconds]
[XML_OUTPUT_DIR dir]
[DISCOVERY_MODE <POST_BUILD|PRE_TEST>]
)
``gtest_discover_tests()`` sets up a post-build command on the test executable
that generates the list of tests by parsing the output from running the test
with the ``--gtest_list_tests`` argument. Compared to the source parsing
approach of :command:`gtest_add_tests`, this ensures that the full list of
tests, including instantiations of parameterized tests, is obtained. Since
test discovery occurs at build time, it is not necessary to re-run CMake when
the list of tests changes.
However, it requires that :prop_tgt:`CROSSCOMPILING_EMULATOR` is properly set
in order to function in a cross-compiling environment.
Additionally, setting properties on tests is somewhat less convenient, since
the tests are not available at CMake time. Additional test properties may be
assigned to the set of tests as a whole using the ``PROPERTIES`` option. If
more fine-grained test control is needed, custom content may be provided
through an external CTest script using the :prop_dir:`TEST_INCLUDE_FILES`
directory property. The set of discovered tests is made accessible to such a
script via the ``<target>_TESTS`` variable.
The options are:
``target``
Specifies the Google Test executable, which must be a known CMake
executable target. CMake will substitute the location of the built
executable when running the test.
``EXTRA_ARGS arg1...``
Any extra arguments to pass on the command line to each test case.
``WORKING_DIRECTORY dir``
Specifies the directory in which to run the discovered test cases. If this
option is not provided, the current binary directory is used.
``TEST_PREFIX prefix``
Specifies a ``prefix`` to be prepended to the name of each discovered test
case. This can be useful when the same test executable is being used in
multiple calls to ``gtest_discover_tests()`` but with different
``EXTRA_ARGS``.
``TEST_SUFFIX suffix``
Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of
every discovered test case. Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` may
be specified.
``NO_PRETTY_TYPES``
By default, the type index of type-parameterized tests is replaced by the
actual type name in the CTest test name. If this behavior is undesirable
(e.g. because the type names are unwieldy), this option will suppress this
behavior.
``NO_PRETTY_VALUES``
By default, the value index of value-parameterized tests is replaced by the
actual value in the CTest test name. If this behavior is undesirable
(e.g. because the value strings are unwieldy), this option will suppress
this behavior.
``PROPERTIES name1 value1...``
Specifies additional properties to be set on all tests discovered by this
invocation of ``gtest_discover_tests()``.
``TEST_LIST var``
Make the list of tests available in the variable ``var``, rather than the
default ``<target>_TESTS``. This can be useful when the same test
executable is being used in multiple calls to ``gtest_discover_tests()``.
Note that this variable is only available in CTest.
``DISCOVERY_TIMEOUT num``
Specifies how long (in seconds) CMake will wait for the test to enumerate
available tests. If the test takes longer than this, discovery (and your
build) will fail. Most test executables will enumerate their tests very
quickly, but under some exceptional circumstances, a test may require a
longer timeout. The default is 5. See also the ``TIMEOUT`` option of
:command:`execute_process`.
.. note::
In CMake versions 3.10.1 and 3.10.2, this option was called ``TIMEOUT``.
This clashed with the ``TIMEOUT`` test property, which is one of the
common properties that would be set with the ``PROPERTIES`` keyword,
usually leading to legal but unintended behavior. The keyword was
changed to ``DISCOVERY_TIMEOUT`` in CMake 3.10.3 to address this
problem. The ambiguous behavior of the ``TIMEOUT`` keyword in 3.10.1
and 3.10.2 has not been preserved.
``XML_OUTPUT_DIR dir``
If specified, the parameter is passed along with ``--gtest_output=xml:``
to test executable. The actual file name is the same as the test target,
including prefix and suffix. This should be used instead of
``EXTRA_ARGS --gtest_output=xml`` to avoid race conditions writing the
XML result output when using parallel test execution.
``DISCOVERY_MODE``
Provides greater control over when ``gtest_discover_tests()`` performs test
discovery. By default, ``POST_BUILD`` sets up a post-build command
to perform test discovery at build time. In certain scenarios, like
cross-compiling, this ``POST_BUILD`` behavior is not desirable.
By contrast, ``PRE_TEST`` delays test discovery until just prior to test
execution. This way test discovery occurs in the target environment
where the test has a better chance at finding appropriate runtime
dependencies.
``DISCOVERY_MODE`` defaults to the value of the
``CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE`` variable if it is not
passed when calling ``gtest_discover_tests()``. This provides a mechanism
for globally selecting a preferred test discovery behavior without having
to modify each call site.
#]=======================================================================]
# Save project's policies
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
# -----------------------------------------------------------------------------
function(gtest_add_tests)
if(ARGC LESS 1)
message(FATAL_ERROR "No arguments supplied to gtest_add_tests()")
endif()
set(options
SKIP_DEPENDENCY
)
set(oneValueArgs
TARGET
WORKING_DIRECTORY
TEST_PREFIX
TEST_SUFFIX
TEST_LIST
)
set(multiValueArgs
SOURCES
EXTRA_ARGS
)
set(allKeywords ${options} ${oneValueArgs} ${multiValueArgs})
unset(sources)
if("${ARGV0}" IN_LIST allKeywords)
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(autoAddSources YES)
else()
# Non-keyword syntax, convert to keyword form
if(ARGC LESS 3)
message(FATAL_ERROR "gtest_add_tests() without keyword options requires at least 3 arguments")
endif()
set(ARGS_TARGET "${ARGV0}")
set(ARGS_EXTRA_ARGS "${ARGV1}")
if(NOT "${ARGV2}" STREQUAL "AUTO")
set(ARGS_SOURCES "${ARGV}")
list(REMOVE_AT ARGS_SOURCES 0 1)
endif()
endif()
# The non-keyword syntax allows the first argument to be an arbitrary
# executable rather than a target if source files are also provided. In all
# other cases, both forms require a target.
if(NOT TARGET "${ARGS_TARGET}" AND NOT ARGS_SOURCES)
message(FATAL_ERROR "${ARGS_TARGET} does not define an existing CMake target")
endif()
if(NOT ARGS_WORKING_DIRECTORY)
unset(workDir)
else()
set(workDir WORKING_DIRECTORY "${ARGS_WORKING_DIRECTORY}")
endif()
if(NOT ARGS_SOURCES)
get_property(ARGS_SOURCES TARGET ${ARGS_TARGET} PROPERTY SOURCES)
endif()
unset(testList)
set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+) *, *([A-Za-z_0-9]+) *\\).*")
set(gtest_test_type_regex "(TYPED_TEST|TEST_?[FP]?)")
# This will get a filter for each test suite.
set(test_filters "")
foreach(source IN LISTS ARGS_SOURCES)
if(NOT ARGS_SKIP_DEPENDENCY)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${source})
endif()
file(READ "${source}" contents)
string(REGEX MATCHALL "${gtest_test_type_regex} *\\(([A-Za-z_0-9 ,]+)\\)" found_tests "${contents}")
foreach(hit ${found_tests})
string(REGEX MATCH "${gtest_test_type_regex}" test_type ${hit})
# Parameterized tests have a different signature for the filter
if("x${test_type}" STREQUAL "xTEST_P")
string(REGEX REPLACE ${gtest_case_name_regex} "\\1.\\2/*" gtest_test_name ${hit})
elseif("x${test_type}" STREQUAL "xTEST_F" OR "x${test_type}" STREQUAL "xTEST")
string(REGEX REPLACE ${gtest_case_name_regex} "\\1.\\2" gtest_test_name ${hit})
elseif("x${test_type}" STREQUAL "xTYPED_TEST")
string(REGEX REPLACE ${gtest_case_name_regex} "\\1/*.\\2" gtest_test_name ${hit})
else()
message(WARNING "Could not parse GTest ${hit} for adding to CTest.")
continue()
endif()
# Make sure tests disabled in GTest get disabled in CTest
if(gtest_test_name MATCHES "(^|\\.)DISABLED_")
# Add the disabled test if CMake is new enough
# Note that this check is to allow backwards compatibility so this
# module can be copied locally in projects to use with older CMake
# versions
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.8.20170401)
string(REGEX REPLACE
"(^|\\.)DISABLED_" "\\1"
orig_test_name "${gtest_test_name}"
)
set(ctest_test_name
${ARGS_TEST_PREFIX}${orig_test_name}${ARGS_TEST_SUFFIX}
)
add_test(NAME ${ctest_test_name}
${workDir}
COMMAND ${ARGS_TARGET}
--gtest_also_run_disabled_tests
--gtest_filter=${gtest_test_name}
${ARGS_EXTRA_ARGS}
)
set_tests_properties(${ctest_test_name} PROPERTIES DISABLED TRUE)
list(APPEND testList ${ctest_test_name})
endif()
else()
# BLENDER: collect tests named "suite.testcase" as list of "suite.*" filters.
string(REGEX REPLACE "\\..*$" "" gtest_suite_name ${gtest_test_name})
list(APPEND test_filters "${gtest_suite_name}.*")
endif()
endforeach()
endforeach()
# Join all found GTest suite names into one big filter.
list(REMOVE_DUPLICATES test_filters)
list(JOIN test_filters ":" gtest_filter)
add_test(NAME ${ARGS_TEST_PREFIX}
${workDir}
COMMAND ${ARGS_TARGET}
--gtest_filter=${gtest_filter}
${ARGS_EXTRA_ARGS}
)
list(APPEND testList ${ARGS_TEST_PREFIX})
if(ARGS_TEST_LIST)
set(${ARGS_TEST_LIST} ${testList} PARENT_SCOPE)
endif()
endfunction()
# BLENDER: remove the discovery function gtest_discover_tests(). It's not used,
# as it generates too many test invocations.
# Restore project's policies
cmake_policy(POP)