Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'build_files/cmake/Modules')
-rw-r--r--build_files/cmake/Modules/FindEpoxy.cmake47
-rw-r--r--build_files/cmake/Modules/FindGLEW.cmake58
-rw-r--r--build_files/cmake/Modules/FindLevelZero.cmake56
-rw-r--r--build_files/cmake/Modules/FindLibEpoxy.cmake47
-rw-r--r--build_files/cmake/Modules/FindOpenGLES.cmake80
-rw-r--r--build_files/cmake/Modules/FindPythonLibsUnix.cmake16
-rw-r--r--build_files/cmake/Modules/FindSYCL.cmake88
-rw-r--r--build_files/cmake/Modules/GTest.cmake3
8 files changed, 251 insertions, 144 deletions
diff --git a/build_files/cmake/Modules/FindEpoxy.cmake b/build_files/cmake/Modules/FindEpoxy.cmake
new file mode 100644
index 00000000000..7cd26e45398
--- /dev/null
+++ b/build_files/cmake/Modules/FindEpoxy.cmake
@@ -0,0 +1,47 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2022 Blender Foundation.
+
+# This module defines
+# Epoxy_INCLUDE_DIRS, where to find epoxy/gl.h
+# Epoxy_LIBRARY, 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(NOT EPOXY_ROOT_DIR AND NOT $ENV{EPOXY_ROOT_DIR} STREQUAL "")
+ SET(EPOXY_ROOT_DIR $ENV{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
+)
diff --git a/build_files/cmake/Modules/FindGLEW.cmake b/build_files/cmake/Modules/FindGLEW.cmake
deleted file mode 100644
index 33b989ec49e..00000000000
--- a/build_files/cmake/Modules/FindGLEW.cmake
+++ /dev/null
@@ -1,58 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright 2014 Blender Foundation.
-
-# - Find GLEW library
-# Find the native Glew includes and library
-# This module defines
-# GLEW_INCLUDE_DIRS, where to find glew.h, Set when
-# GLEW_INCLUDE_DIR is found.
-# GLEW_ROOT_DIR, The base directory to search for Glew.
-# This can also be an environment variable.
-# GLEW_FOUND, If false, do not try to use Glew.
-#
-# also defined,
-# GLEW_LIBRARY, where to find the Glew library.
-
-# If GLEW_ROOT_DIR was defined in the environment, use it.
-IF(NOT GLEW_ROOT_DIR AND NOT $ENV{GLEW_ROOT_DIR} STREQUAL "")
- SET(GLEW_ROOT_DIR $ENV{GLEW_ROOT_DIR})
-ENDIF()
-
-SET(_glew_SEARCH_DIRS
- ${GLEW_ROOT_DIR}
-)
-
-FIND_PATH(GLEW_INCLUDE_DIR
- NAMES
- GL/glew.h
- HINTS
- ${_glew_SEARCH_DIRS}
- PATH_SUFFIXES
- include
-)
-
-FIND_LIBRARY(GLEW_LIBRARY
- NAMES
- GLEW
- HINTS
- ${_glew_SEARCH_DIRS}
- PATH_SUFFIXES
- lib64 lib
- )
-
-# handle the QUIETLY and REQUIRED arguments and set GLEW_FOUND to TRUE if
-# all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW DEFAULT_MSG
- GLEW_LIBRARY GLEW_INCLUDE_DIR)
-
-IF(GLEW_FOUND)
- SET(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
-ENDIF()
-
-MARK_AS_ADVANCED(
- GLEW_INCLUDE_DIR
- GLEW_LIBRARY
-)
-
-UNSET(_glew_SEARCH_DIRS)
diff --git a/build_files/cmake/Modules/FindLevelZero.cmake b/build_files/cmake/Modules/FindLevelZero.cmake
new file mode 100644
index 00000000000..a60d8ba9978
--- /dev/null
+++ b/build_files/cmake/Modules/FindLevelZero.cmake
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2021-2022 Intel Corporation
+
+# - 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(NOT LEVEL_ZERO_ROOT_DIR AND NOT $ENV{LEVEL_ZERO_ROOT_DIR} STREQUAL "")
+ SET(LEVEL_ZERO_ROOT_DIR $ENV{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_LIBRARY ${_LEVEL_ZERO_LIBRARY})
+ SET(LEVEL_ZERO_INCLUDE_DIR ${_LEVEL_ZERO_INCLUDE_DIR} ${_LEVEL_ZERO_INCLUDE_PARENT_DIR})
+ SET(LEVEL_ZERO_FOUND TRUE)
+ELSE()
+ SET(LEVEL_ZERO_FOUND FALSE)
+ENDIF()
+
+MARK_AS_ADVANCED(
+ LEVEL_ZERO_LIBRARY
+ LEVEL_ZERO_INCLUDE_DIR
+)
diff --git a/build_files/cmake/Modules/FindLibEpoxy.cmake b/build_files/cmake/Modules/FindLibEpoxy.cmake
new file mode 100644
index 00000000000..1da52f95f68
--- /dev/null
+++ b/build_files/cmake/Modules/FindLibEpoxy.cmake
@@ -0,0 +1,47 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2022 Blender Foundation.
+
+# This module defines
+# LibEpoxy_INCLUDE_DIRS, where to find epoxy/gl.h
+# LibEpoxy_LIBRARY, 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
+)
diff --git a/build_files/cmake/Modules/FindOpenGLES.cmake b/build_files/cmake/Modules/FindOpenGLES.cmake
deleted file mode 100644
index 5e82984bed6..00000000000
--- a/build_files/cmake/Modules/FindOpenGLES.cmake
+++ /dev/null
@@ -1,80 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright 2014 Blender Foundation.
-
-# - Try to find OpenGLES
-# Once done this will define
-#
-# OPENGLES_FOUND - system has OpenGLES and EGL
-# OPENGL_EGL_FOUND - system has EGL
-# OPENGLES_INCLUDE_DIR - the GLES include directory
-# OPENGLES_LIBRARY - the GLES library
-# OPENGLES_EGL_INCLUDE_DIR - the EGL include directory
-# OPENGLES_EGL_LIBRARY - the EGL library
-# OPENGLES_LIBRARIES - all libraries needed for OpenGLES
-# OPENGLES_INCLUDES - all includes needed for OpenGLES
-
-# If OPENGLES_ROOT_DIR was defined in the environment, use it.
-IF(NOT OPENGLES_ROOT_DIR AND NOT $ENV{OPENGLES_ROOT_DIR} STREQUAL "")
- SET(OPENGLES_ROOT_DIR $ENV{OPENGLES_ROOT_DIR})
-ENDIF()
-
-SET(_opengles_SEARCH_DIRS
- ${OPENGLES_ROOT_DIR}
-)
-
-FIND_PATH(OPENGLES_INCLUDE_DIR
- NAMES
- GLES2/gl2.h
- HINTS
- ${_opengles_SEARCH_DIRS}
-)
-
-FIND_LIBRARY(OPENGLES_LIBRARY
- NAMES
- GLESv2
- PATHS
- ${_opengles_SEARCH_DIRS}
- PATH_SUFFIXES
- lib64 lib
-)
-
-FIND_PATH(OPENGLES_EGL_INCLUDE_DIR
- NAMES
- EGL/egl.h
- HINTS
- ${_opengles_SEARCH_DIRS}
-)
-
-FIND_LIBRARY(OPENGLES_EGL_LIBRARY
- NAMES
- EGL
- HINTS
- ${_opengles_SEARCH_DIRS}
- PATH_SUFFIXES
- lib64 lib
-)
-
-IF(OPENGLES_EGL_LIBRARY AND OPENGLES_EGL_INCLUDE_DIR)
- SET(OPENGL_EGL_FOUND "YES")
-ELSE()
- SET(OPENGL_EGL_FOUND "NO")
-ENDIF()
-
-IF(OPENGLES_LIBRARY AND OPENGLES_INCLUDE_DIR AND
- OPENGLES_EGL_LIBRARY AND OPENGLES_EGL_INCLUDE_DIR)
- SET(OPENGLES_LIBRARIES ${OPENGLES_LIBRARY} ${OPENGLES_LIBRARIES}
- ${OPENGLES_EGL_LIBRARY})
- SET(OPENGLES_INCLUDES ${OPENGLES_INCLUDE_DIR} ${OPENGLES_EGL_INCLUDE_DIR})
- SET(OPENGLES_FOUND "YES")
-ELSE()
- SET(OPENGLES_FOUND "NO")
-ENDIF()
-
-MARK_AS_ADVANCED(
- OPENGLES_EGL_INCLUDE_DIR
- OPENGLES_EGL_LIBRARY
- OPENGLES_LIBRARY
- OPENGLES_INCLUDE_DIR
-)
-
-UNSET(_opengles_SEARCH_DIRS)
diff --git a/build_files/cmake/Modules/FindPythonLibsUnix.cmake b/build_files/cmake/Modules/FindPythonLibsUnix.cmake
index 1e88621303f..0afe1299330 100644
--- a/build_files/cmake/Modules/FindPythonLibsUnix.cmake
+++ b/build_files/cmake/Modules/FindPythonLibsUnix.cmake
@@ -34,11 +34,17 @@ SET(PYTHON_VERSION 3.10 CACHE STRING "Python Version (major and minor only)")
MARK_AS_ADVANCED(PYTHON_VERSION)
-# See: http://docs.python.org/extending/embedding.html#linking-requirements
-# for why this is needed
-SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic" CACHE STRING "Linker flags for python")
-MARK_AS_ADVANCED(PYTHON_LINKFLAGS)
-
+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)
diff --git a/build_files/cmake/Modules/FindSYCL.cmake b/build_files/cmake/Modules/FindSYCL.cmake
new file mode 100644
index 00000000000..ac90cbfbe43
--- /dev/null
+++ b/build_files/cmake/Modules/FindSYCL.cmake
@@ -0,0 +1,88 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2021-2022 Intel Corporation
+
+# - 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 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
+ 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
+ dpcpp
+ HINTS
+ ${_sycl_search_dirs}
+ PATH_SUFFIXES
+ bin
+ )
+endif()
+
+FIND_LIBRARY(SYCL_LIBRARY
+ NAMES
+ sycl
+ HINTS
+ ${_sycl_search_dirs}
+ PATH_SUFFIXES
+ lib64 lib
+)
+
+FIND_PATH(SYCL_INCLUDE_DIR
+ NAMES
+ CL/sycl.hpp
+ HINTS
+ ${_sycl_search_dirs}
+ PATH_SUFFIXES
+ include
+ include/sycl
+)
+
+INCLUDE(FindPackageHandleStandardArgs)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SYCL DEFAULT_MSG SYCL_LIBRARY SYCL_INCLUDE_DIR)
+
+IF(SYCL_FOUND)
+ get_filename_component(_SYCL_INCLUDE_PARENT_DIR ${SYCL_INCLUDE_DIR} DIRECTORY)
+ SET(SYCL_INCLUDE_DIR ${SYCL_INCLUDE_DIR} ${_SYCL_INCLUDE_PARENT_DIR})
+ELSE()
+ SET(SYCL_SYCL_FOUND FALSE)
+ENDIF()
+
+MARK_AS_ADVANCED(
+ _SYCL_INCLUDE_PARENT_DIR
+)
diff --git a/build_files/cmake/Modules/GTest.cmake b/build_files/cmake/Modules/GTest.cmake
index a38550958fd..5c7fabdcff7 100644
--- a/build_files/cmake/Modules/GTest.cmake
+++ b/build_files/cmake/Modules/GTest.cmake
@@ -268,7 +268,8 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
-#------------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
+
function(gtest_add_tests)
if(ARGC LESS 1)