[Bf-blender-cvs] [c7716f59771] epoxy: use CMake script for libepoxy

Christian Rauch noreply at git.blender.org
Fri Jul 1 11:22:03 CEST 2022


Commit: c7716f59771f421f8d77d34351e4e8fd5b2d4f7c
Author: Christian Rauch
Date:   Wed Jun 29 01:00:17 2022 +0100
Branches: epoxy
https://developer.blender.org/rBc7716f59771f421f8d77d34351e4e8fd5b2d4f7c

use CMake script for libepoxy

===================================================================

M	CMakeLists.txt
A	build_files/cmake/Modules/FindLibEpoxy.cmake

===================================================================

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 88cbc43401d..ac524619809 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1321,9 +1321,10 @@ else()
 endif()
 
 # link libepoxy
-include(FindPkgConfig)
-pkg_check_modules(epoxy REQUIRED epoxy)
-list(APPEND BLENDER_GL_LIBRARIES ${epoxy_LIBRARIES})
+set(EPOXY_ROOT_DIR ${LIBDIR}/libepoxy)
+find_package(LibEpoxy REQUIRED)
+list(APPEND BLENDER_GL_LIBRARIES ${LibEpoxy_LIBRARIES})
+include_directories(${LibEpoxy_INCLUDE_DIRS})
 
 #-----------------------------------------------------------------------------
 # Configure Metal.
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
+)



More information about the Bf-blender-cvs mailing list