Skip to content

Commit

Permalink
Merge pull request KhronosGroup#1866 from rumblehhh/master
Browse files Browse the repository at this point in the history
Export glslang targets on installation
  • Loading branch information
johnkslang authored Oct 15, 2019
2 parents 8ba49b8 + c6f7294 commit b03e4fc
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 19 deletions.
3 changes: 2 additions & 1 deletion OGLCompilersDLL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if(WIN32)
endif(WIN32)

if(ENABLE_GLSLANG_INSTALL)
install(TARGETS OGLCompiler
install(TARGETS OGLCompiler EXPORT OGLCompilerTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT OGLCompilerTargets DESTINATION lib/cmake)
endif(ENABLE_GLSLANG_INSTALL)
19 changes: 13 additions & 6 deletions SPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ set(SPVREMAP_HEADERS
add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS})
set_property(TARGET SPIRV PROPERTY FOLDER glslang)
set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON)
target_include_directories(SPIRV PUBLIC ..)
target_include_directories(SPIRV PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

if (ENABLE_SPVREMAPPER)
add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
Expand All @@ -57,7 +59,9 @@ if(ENABLE_OPT)
PRIVATE ${spirv-tools_SOURCE_DIR}/source
)
target_link_libraries(SPIRV glslang SPIRV-Tools-opt)
target_include_directories(SPIRV PUBLIC ../External)
target_include_directories(SPIRV PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
else()
target_link_libraries(SPIRV glslang)
endif(ENABLE_OPT)
Expand All @@ -70,22 +74,25 @@ endif(WIN32)
if(ENABLE_GLSLANG_INSTALL)
if(BUILD_SHARED_LIBS)
if (ENABLE_SPVREMAPPER)
install(TARGETS SPVRemapper
install(TARGETS SPVRemapper EXPORT SPVRemapperTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
install(TARGETS SPIRV
install(TARGETS SPIRV EXPORT SPIRVTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
else()
if (ENABLE_SPVREMAPPER)
install(TARGETS SPVRemapper
install(TARGETS SPVRemapper EXPORT SPVRemapperTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
install(TARGETS SPIRV
install(TARGETS SPIRV EXPORT SPIRVTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

install(EXPORT SPVRemapperTargets DESTINATION lib/cmake)
install(EXPORT SPIRVTargets DESTINATION lib/cmake)

install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/SPIRV/)
endif(ENABLE_GLSLANG_INSTALL)
14 changes: 10 additions & 4 deletions StandAlone/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,27 @@ endif(WIN32)

target_link_libraries(glslangValidator ${LIBRARIES})
target_link_libraries(spirv-remap ${LIBRARIES})
target_include_directories(glslangValidator PUBLIC ../External)
target_include_directories(glslangValidator PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)

if(WIN32)
source_group("Source" FILES ${SOURCES})
endif(WIN32)

if(ENABLE_GLSLANG_INSTALL)
install(TARGETS glslangValidator
install(TARGETS glslangValidator EXPORT glslangValidatorTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

install(TARGETS spirv-remap
install(TARGETS spirv-remap EXPORT spirv-remapTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

install(EXPORT glslangValidatorTargets DESTINATION lib/cmake)
install(EXPORT spirv-remapTargets DESTINATION lib/cmake)

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})
install(EXPORT glslang-default-resource-limitsTargets DESTINATION lib/cmake)
endif()
endif(ENABLE_GLSLANG_INSTALL)
9 changes: 6 additions & 3 deletions glslang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${H
set_property(TARGET glslang PROPERTY FOLDER glslang)
set_property(TARGET glslang PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_libraries(glslang OGLCompiler OSDependent)
target_include_directories(glslang PUBLIC ..)
target_include_directories(glslang PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

if(WIN32 AND BUILD_SHARED_LIBS)
set_target_properties(glslang PROPERTIES PREFIX "")
Expand All @@ -102,14 +104,15 @@ endif(WIN32)

if(ENABLE_GLSLANG_INSTALL)
if(BUILD_SHARED_LIBS)
install(TARGETS glslang
install(TARGETS glslang EXPORT glslangTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
else()
install(TARGETS glslang
install(TARGETS glslang EXPORT glslangTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
install(EXPORT glslangTargets DESTINATION lib/cmake)
endif(ENABLE_GLSLANG_INSTALL)

if(ENABLE_GLSLANG_INSTALL)
Expand Down
3 changes: 2 additions & 1 deletion glslang/OSDependent/Unix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ else()
endif()

if(ENABLE_GLSLANG_INSTALL)
install(TARGETS OSDependent
install(TARGETS OSDependent EXPORT OSDependentTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT OSDependentTargets DESTINATION lib/cmake)
endif(ENABLE_GLSLANG_INSTALL)
3 changes: 2 additions & 1 deletion glslang/OSDependent/Windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ if(WIN32)
endif(WIN32)

if(ENABLE_GLSLANG_INSTALL)
install(TARGETS OSDependent
install(TARGETS OSDependent EXPORT OSDependentTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT OSDependentTargets DESTINATION lib/cmake)
endif(ENABLE_GLSLANG_INSTALL)
3 changes: 2 additions & 1 deletion gtests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ if(BUILD_TESTING)
set_property(TARGET glslangtests PROPERTY FOLDER tests)
glslang_set_link_args(glslangtests)
if(ENABLE_GLSLANG_INSTALL)
install(TARGETS glslangtests
install(TARGETS glslangtests EXPORT glslangtestsTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(EXPORT glslangtestsTargets DESTINATION lib/cmake)
endif(ENABLE_GLSLANG_INSTALL)

set(GLSLANG_TEST_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../Test")
Expand Down
5 changes: 3 additions & 2 deletions hlsl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ endif(WIN32)

if(ENABLE_GLSLANG_INSTALL)
if(BUILD_SHARED_LIBS)
install(TARGETS HLSL
install(TARGETS HLSL EXPORT HLSLTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
else()
install(TARGETS HLSL
install(TARGETS HLSL EXPORT HLSLTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
install(EXPORT HLSLTargets DESTINATION lib/cmake)
endif(ENABLE_GLSLANG_INSTALL)

0 comments on commit b03e4fc

Please sign in to comment.