Merge pull request #1273 from orbea/cmake
Add GNUInstallDirs + fixes for the pkg-config file
This commit is contained in:
commit
cb0aca91ef
@ -17,6 +17,8 @@ set(CMAKE_CXX_STANDARD 11)
|
||||
project(SPIRV-Cross LANGUAGES CXX C)
|
||||
enable_testing()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
option(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS "Instead of throwing exceptions assert" OFF)
|
||||
option(SPIRV_CROSS_SHARED "Build the C API as a single shared library." OFF)
|
||||
option(SPIRV_CROSS_STATIC "Build the C and C++ API as static libraries." ON)
|
||||
@ -171,12 +173,12 @@ macro(spirv_cross_add_library name config_name library_type)
|
||||
if (NOT SPIRV_CROSS_SKIP_INSTALL)
|
||||
install(TARGETS ${name}
|
||||
EXPORT ${config_name}Config
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
PUBLIC_HEADER DESTINATION include/spirv_cross)
|
||||
install(FILES ${hdrs} DESTINATION include/spirv_cross)
|
||||
install(EXPORT ${config_name}Config DESTINATION share/${config_name}/cmake)
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/spirv_cross)
|
||||
install(FILES ${hdrs} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/spirv_cross)
|
||||
install(EXPORT ${config_name}Config DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${config_name}/cmake)
|
||||
export(TARGETS ${name} FILE ${config_name}Config.cmake)
|
||||
endif()
|
||||
endmacro()
|
||||
@ -320,14 +322,12 @@ set(spirv-cross-abi-patch 0)
|
||||
|
||||
if (SPIRV_CROSS_SHARED)
|
||||
set(SPIRV_CROSS_VERSION ${spirv-cross-abi-major}.${spirv-cross-abi-minor}.${spirv-cross-abi-patch})
|
||||
set(SPIRV_CROSS_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
set(SPIRV_CROSS_INSTALL_INC_DIR ${CMAKE_INSTALL_PREFIX}/include/spirv_cross)
|
||||
|
||||
if (NOT SPIRV_CROSS_SKIP_INSTALL)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/pkg-config/spirv-cross-c-shared.pc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/spirv-cross-c-shared.pc @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/spirv-cross-c-shared.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pkgconfig)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/spirv-cross-c-shared.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
endif()
|
||||
|
||||
spirv_cross_add_library(spirv-cross-c-shared spirv_cross_c_shared SHARED
|
||||
@ -427,7 +427,7 @@ if (SPIRV_CROSS_CLI)
|
||||
target_compile_definitions(spirv-cross PRIVATE ${spirv-compiler-defines} HAVE_SPIRV_CROSS_GIT_VERSION)
|
||||
set_target_properties(spirv-cross PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}")
|
||||
if (NOT SPIRV_CROSS_SKIP_INSTALL)
|
||||
install(TARGETS spirv-cross RUNTIME DESTINATION bin)
|
||||
install(TARGETS spirv-cross RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
target_link_libraries(spirv-cross PRIVATE
|
||||
spirv-cross-glsl
|
||||
|
@ -1,8 +1,8 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=@CMAKE_INSTALL_PREFIX@
|
||||
libdir=@SPIRV_CROSS_INSTALL_LIB_DIR@
|
||||
sharedlibdir=@SPIRV_CROSS_INSTALL_LIB_DIR@
|
||||
includedir=@SPIRV_CROSS_INSTALL_INC_DIR@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||
sharedlibdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/spirv_cross
|
||||
|
||||
Name: spirv-cross-c-shared
|
||||
Description: C API for SPIRV-Cross
|
||||
|
Loading…
Reference in New Issue
Block a user