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

Add pkg-config files #2083

Closed
wants to merge 2 commits into from
Closed
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
5 changes: 5 additions & 0 deletions SPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ target_include_directories(SPIRV PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

set(SPIRV_NAME spirv)
set(SPIRV_VERSION 1.5)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? We seem to be increasing the number of random places that will need to be changed when SPIR-V is updated.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the better way for this is create a cmake function which read from where Spirv set the version and set automagically by cmake

a example:

# Get FOO_VERSION property from 'foo/bar/file'
file(READ "foo/bar/file" versioning)
string(REGEX MATCH "FOO_MAJOR_VER     ([0-9]*)" _ ${versioning})
set(version_major ${CMAKE_MATCH_1})
string(REGEX MATCH "FOO_MINOR_VER     ([0-9]*)" _ ${versioning})
set(version_minor ${CMAKE_MATCH_1})
string(REGEX MATCH "FOO_BUGFIX_VER    ([0-9]*)" _ ${versioning})
set(version_bugfix ${CMAKE_MATCH_1})
set(FOO_VERSION ${version_major}.${version_minor}.${version_bugfix})

with this, only need set the version in one place

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is needed to set a version in the spirv.pc file. What could be done is to pass SPIRV version from cmake to spirv.hpp.


if (ENABLE_SPVREMAPPER)
add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
set_property(TARGET SPVRemapper PROPERTY FOLDER glslang)
Expand Down Expand Up @@ -96,6 +99,8 @@ if(ENABLE_GLSLANG_INSTALL)
endif()

install(EXPORT SPIRVTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/spirv.pc.in ${CMAKE_CURRENT_BINARY_DIR}/spirv.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/spirv.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SPIRV/)
install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/SPIRV/)
Expand Down
13 changes: 13 additions & 0 deletions SPIRV/spirv.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@

Name: @SPIRV_NAME@
Description: SPIR-V is a binary intermediate language for representing graphical-shader stages and compute kernels for multiple Khronos APIs, including OpenCL, OpenGL, and Vulkan
Requires:
Version: @SPIRV_VERSION@
URL: https://github.com/KhronosGroup/glslang

Libs: -L${libdir} -lSPIRV
Cflags: -I${includedir}
4 changes: 4 additions & 0 deletions glslang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ set(HEADERS
MachineIndependent/preprocessor/PpContext.h
MachineIndependent/preprocessor/PpTokens.h)

set(VERSION 8.13.3559)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This number is already out of date...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as avobe. with a own cmake function can do this automagic

greetings

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here.

glslang_pch(SOURCES MachineIndependent/pch.cpp)

add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS})
Expand Down Expand Up @@ -117,6 +118,9 @@ if(ENABLE_GLSLANG_INSTALL)
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
install(EXPORT glslangTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/glslang.pc.in ${CMAKE_CURRENT_BINARY_DIR}/glslang.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/glslang.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

endif(ENABLE_GLSLANG_INSTALL)

if(ENABLE_GLSLANG_INSTALL)
Expand Down
13 changes: 13 additions & 0 deletions glslang/glslang.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@

Name: @PROJECT_NAME@
Description: OpenGL and OpenGL ES shader front end and validator
Requires:
Version: @VERSION@
URL: https://github.com/KhronosGroup/glslang

Libs: -L${libdir} -lglslang -lOSDependent -lHLSL -lOGLCompiler -lSPVRemapper
Cflags: -I${includedir}