Export glslang targets on installation

This allows the targets to be used in other cmake projects. See the following for more details:
https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#creating-packages
https://foonathan.net/blog/2016/07/07/cmake-dependency-handling.html
This commit is contained in:
James Rumble
2019-08-06 14:47:51 +01:00
parent 3cea2e5882
commit ab6d1499e1
8 changed files with 28 additions and 15 deletions

View File

@@ -9,6 +9,7 @@ if(WIN32)
endif(WIN32) endif(WIN32)
if(ENABLE_GLSLANG_INSTALL) if(ENABLE_GLSLANG_INSTALL)
install(TARGETS OGLCompiler install(TARGETS OGLCompiler EXPORT OGLCompilerTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT OGLCompilerTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
endif(ENABLE_GLSLANG_INSTALL) endif(ENABLE_GLSLANG_INSTALL)

View File

@@ -80,22 +80,25 @@ endif(WIN32)
if(ENABLE_GLSLANG_INSTALL) if(ENABLE_GLSLANG_INSTALL)
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
if (ENABLE_SPVREMAPPER) if (ENABLE_SPVREMAPPER)
install(TARGETS SPVRemapper install(TARGETS SPVRemapper EXPORT SPVRemapperTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif() endif()
install(TARGETS SPIRV install(TARGETS SPIRV EXPORT SPIRVTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
else() else()
if (ENABLE_SPVREMAPPER) if (ENABLE_SPVREMAPPER)
install(TARGETS SPVRemapper install(TARGETS SPVRemapper EXPORT SPVRemapperTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif() endif()
install(TARGETS SPIRV install(TARGETS SPIRV EXPORT SPIRVTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif() endif()
install(EXPORT SPVRemapperTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
install(EXPORT SPIRVTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SPIRV/) install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SPIRV/)
endif(ENABLE_GLSLANG_INSTALL) endif(ENABLE_GLSLANG_INSTALL)

View File

@@ -40,14 +40,18 @@ if(WIN32)
endif(WIN32) endif(WIN32)
if(ENABLE_GLSLANG_INSTALL) if(ENABLE_GLSLANG_INSTALL)
install(TARGETS glslangValidator install(TARGETS glslangValidator EXPORT glslangValidatorTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS spirv-remap install(TARGETS spirv-remap EXPORT spirv-remapTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(EXPORT glslangValidatorTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
install(EXPORT spirv-remapTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
install(TARGETS glslang-default-resource-limits install(TARGETS glslang-default-resource-limits EXPORT glslang-default-resource-limitsTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT glslang-default-resource-limitsTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
endif() endif()
endif(ENABLE_GLSLANG_INSTALL) endif(ENABLE_GLSLANG_INSTALL)

View File

@@ -106,14 +106,15 @@ endif(WIN32)
if(ENABLE_GLSLANG_INSTALL) if(ENABLE_GLSLANG_INSTALL)
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
install(TARGETS glslang install(TARGETS glslang EXPORT glslangTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
else() else()
install(TARGETS glslang install(TARGETS glslang EXPORT glslangTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif() endif()
install(EXPORT glslangTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
endif(ENABLE_GLSLANG_INSTALL) endif(ENABLE_GLSLANG_INSTALL)
if(ENABLE_GLSLANG_INSTALL) if(ENABLE_GLSLANG_INSTALL)

View File

@@ -20,6 +20,7 @@ else()
endif() endif()
if(ENABLE_GLSLANG_INSTALL) if(ENABLE_GLSLANG_INSTALL)
install(TARGETS OSDependent install(TARGETS OSDependent EXPORT OSDependentTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT OSDependentTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
endif(ENABLE_GLSLANG_INSTALL) endif(ENABLE_GLSLANG_INSTALL)

View File

@@ -15,6 +15,7 @@ if(WIN32)
endif(WIN32) endif(WIN32)
if(ENABLE_GLSLANG_INSTALL) if(ENABLE_GLSLANG_INSTALL)
install(TARGETS OSDependent install(TARGETS OSDependent EXPORT OSDependentTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT OSDependentTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
endif(ENABLE_GLSLANG_INSTALL) endif(ENABLE_GLSLANG_INSTALL)

View File

@@ -31,8 +31,9 @@ if(BUILD_TESTING)
set_property(TARGET glslangtests PROPERTY FOLDER tests) set_property(TARGET glslangtests PROPERTY FOLDER tests)
glslang_set_link_args(glslangtests) glslang_set_link_args(glslangtests)
if(ENABLE_GLSLANG_INSTALL) if(ENABLE_GLSLANG_INSTALL)
install(TARGETS glslangtests install(TARGETS glslangtests EXPORT glslangtestsTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(EXPORT glslangtestsTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
endif(ENABLE_GLSLANG_INSTALL) endif(ENABLE_GLSLANG_INSTALL)
set(GLSLANG_TEST_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../Test") set(GLSLANG_TEST_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../Test")

View File

@@ -33,12 +33,13 @@ endif(WIN32)
if(ENABLE_GLSLANG_INSTALL) if(ENABLE_GLSLANG_INSTALL)
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
install(TARGETS HLSL install(TARGETS HLSL EXPORT HLSLTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
else() else()
install(TARGETS HLSL install(TARGETS HLSL EXPORT HLSLTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif() endif()
install(EXPORT HLSLTargets DESTINATION ${LIB_INSTALL_DIR}/cmake)
endif(ENABLE_GLSLANG_INSTALL) endif(ENABLE_GLSLANG_INSTALL)