Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glslang: add pkg-config file #21006

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion graphics/glslang/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PortGroup cmake 1.1
PortGroup legacysupport 1.1

github.setup KhronosGroup glslang 13.0.0
revision 2
revision 3

categories graphics devel
license {BSD Permissive}
Expand Down Expand Up @@ -36,6 +36,15 @@ compiler.cxx_standard 2017
legacysupport.newest_darwin_requires_legacy 18
legacysupport.use_mp_libcxx yes

# Generate a pkg-config file, so that software projects that use
# pkg-config to locate external dependencies (e.g., Godot 4.x) are able
# to find and link against glslang.
#
# This patch has also been submitted upstream, and when it gets added
# to the glslang codebase, our patchfile can be deleted:
# https://github.com/KhronosGroup/glslang/pull/3371
patchfiles-append create-pkgconfig-file.diff

depends_build-append port:python${py_ver_nodot}
configure.python ${prefix}/bin/python${py_ver}
configure.args-append -DPYTHON_EXECUTABLE:FILEPATH=${configure.python}
Expand Down
37 changes: 37 additions & 0 deletions graphics/glslang/files/create-pkgconfig-file.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
--- CMakeLists.txt.orig 2023-08-23 19:24:25.000000000 -0400
+++ CMakeLists.txt 2023-10-13 18:07:29.000000000 -0400
@@ -361,4 +361,34 @@
DESTINATION
"${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
+
+ # Generate a pkg-config file, so that software projects which use
+ # pkg-config to locate dependencies can find glslang
+
+ # This template is filled-in by CMake's `configure_file(... @ONLY)`.
+ # The `@...@` are substituted by CMake's configure_file(), either
+ # from variables set in CMakeLists.txt or by CMake itself.
+ # (Based on: https://www.scivision.dev/cmake-generate-pkg-config/)
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc.in" [=[
+prefix="@CMAKE_INSTALL_PREFIX@"
+exec_prefix="${prefix}"
+libdir="${prefix}/lib"
+includedir="${prefix}/include"
+
+Name: @PROJECT_NAME@
+Description: official reference compiler front end for the OpenGL ES and OpenGL shading languages
+Version: @PROJECT_VERSION@
+Cflags: -I"${includedir}"
+Libs: -L"${libdir}" -l@PROJECT_NAME@
+ ]=])
+ configure_file(
+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
+ @ONLY)
+ install(
+ FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
+ DESTINATION
+ "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
+ )
endif()