1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
| | From ceaa23fd1834ad56fe5f74d544b650be9a55360b Mon Sep 17 00:00:00 2001
From: AwesomeAdam54321 <adam.faiz@disroot.org>
Date: Sat, 26 Aug 2023 16:38:13 +0800
Subject: [PATCH] glad: Add package configuration files.
* glad.pc.in: Add pkg-config file.
* gladConfig.cmake: Add CMake package file for detection by external packages.
---
glad.pc.in | 11 +++++
gladConfig.cmake | 104 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 115 insertions(+)
create mode 100644 glad.pc
create mode 100644 gladConfig.cmake
diff --git a/glad.pc.in b/glad.pc.in
new file mode 100644
index 0000000..5c29fcd
--- /dev/null
+++ b/glad.pc.in
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@ # this defines a variable
+exec_prefix=${prefix} # defining another variable with a substitution
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: glad
+Description: OpenGL(3.3) Loader Library
+Version: 0
+URL: https://github.com/arrayfire/glad
+Libs: -L${libdir} -lglad
+Cflags: -I${includedir}/glad
\ No newline at end of file
diff --git a/gladConfig.cmake b/gladConfig.cmake
new file mode 100644
index 0000000..1213d3e
--- /dev/null
+++ b/gladConfig.cmake
@@ -0,0 +1,104 @@
+# Finds the glad libraries
+#
+# Sets the following variables:
+# glad_FOUND
+# glad_INCLUDE_DIR
+# glad_DYNAMIC_LIBRARY
+# glad_STATIC_LIBRARY
+#
+# Usage:
+# find_package(glad)
+# if (glad_FOUND)
+# target_link_libraries(mylib PRIVATE glad::glad)
+# endif (glad_FOUND)
+#
+# OR if you want to link against the static library:
+#
+# find_package(glad)
+# if (glad_FOUND)
+# target_link_libraries(mylib PRIVATE glad::glad_STATIC)
+# endif (glad_FOUND)
+#
+# NOTE: You do not need to include the glad include directories since they
+# will be included as part of the target_link_libraries command
+
+set(PX ${CMAKE_STATIC_LIBRARY_PREFIX})
+set(SX ${CMAKE_STATIC_LIBRARY_SUFFIX})
+
+# use pkg-config to get the directories and then use these values
+# in the find_path() and find_library() calls
+if (NOT WIN32)
+ find_package(PkgConfig)
+ pkg_check_modules(gladPkg REQUIRED glad)
+endif (NOT WIN32)
+
+find_path(glad_INCLUDE_DIR
+ NAMES glad.h
+ PATHS
+ /usr/include
+ /usr/local/include
+ /sw/include
+ /opt/local/include
+ HINTS
+ ${gladPkg_INCLUDE_DIRS} # Generated by pkg-config
+ )
+
+find_library(glad_DYNAMIC_LIBRARY
+ NAMES glad fontconfig ${gladPkg_LIBRARY}
+ PATHS
+ /usr/local
+ /usr/X11
+ /usr
+ /sw
+ /opt/local
+ /usr/lib/x86_64-linux-gnu
+ HINTS
+ ${gladPkg_LIBRARY_DIRS} # Generated by pkg-config
+ PATH_SUFFIXES
+ lib64
+ lib
+ )
+
+find_library(glad_STATIC_LIBRARY
+ NAMES ${PX}fontconfig${SX} ${PX}glad${SX} ${PX}${gladPkg_LIBRARY}${SX}
+ PATHS
+ /usr/local
+ /usr/X11
+ /usr
+ /sw
+ /opt/local
+ /usr/lib/x86_64-linux-gnu
+ HINTS
+ ${gladPkg_LIBRARY_DIRS} # Generated by pkg-config
+ PATH_SUFFIXES
+ lib64
+ lib
+ )
+
+mark_as_advanced(
+ glad_INCLUDE_DIR
+ glad_DYNAMIC_LIBRARY
+ glad_STATIC_LIBRARY
+ )
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(glad
+ REQUIRED_VARS glad_DYNAMIC_LIBRARY glad_INCLUDE_DIR
+ )
+
+if (glad_FOUND AND NOT TARGET glad::glad)
+ add_library(glad::glad UNKNOWN IMPORTED)
+ set_target_properties(glad::glad PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGE "C"
+ IMPORTED_LOCATION ${glad_DYNAMIC_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${glad_INCLUDE_DIR})
+
+ if (glad_STATIC_LIBRARY)
+ add_library(glad::glad_STATIC UNKNOWN IMPORTED)
+ set_target_properties(glad::glad_STATIC PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGE "C"
+ IMPORTED_LOCATION "${glad_STATIC_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${glad_INCLUDE_DIR}")
+ endif (glad_STATIC_LIBRARY)
+endif ()
--
2.41.0
|