Skip to content

Commit

Permalink
cmake: only install public headers
Browse files Browse the repository at this point in the history
Only the headers that are part of glslang's public interface are
installed. Previously, all of its headers were installed, which exposed
a lot of internal implementation details and made it difficult to
maintain backward compatiblity. This reduces the API surface somewhat
and will make it easier to maintain API and ABI compatibility.
  • Loading branch information
arcady-lunarg committed Nov 9, 2023
1 parent cbfb81b commit cd8fa65
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
9 changes: 8 additions & 1 deletion SPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ set(SPVREMAP_HEADERS
SPVRemapper.h
doc.h)

set(PUBLIC_HEADERS
GlslangToSpv.h
disassemble.h
Logger.h
spirv.h
SPVRemapper.h)

add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS})
set_target_properties(SPIRV PROPERTIES
FOLDER glslang
Expand Down Expand Up @@ -148,5 +155,5 @@ if(ENABLE_GLSLANG_INSTALL)
")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SPIRVTargets.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)

install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/SPIRV/)
install(FILES ${PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/SPIRV/)
endif()
16 changes: 10 additions & 6 deletions glslang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ set(GLSLANG_HEADERS
Include/SpirvIntrinsics.h
Include/Types.h)

add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${GLSLANG_SOURCES} ${GLSLANG_HEADERS})
add_library(glslang ${LIB_TYPE} ${GLSLANG_SOURCES} ${GLSLANG_HEADERS})
set_target_properties(glslang PROPERTIES
FOLDER glslang
POSITION_INDEPENDENT_CODE ON
Expand Down Expand Up @@ -247,12 +247,16 @@ if(ENABLE_GLSLANG_INSTALL)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/glslangTargets.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
endif()

set(ALL_HEADERS
${GLSLANG_HEADERS}
${MACHINEINDEPENDENT_HEADERS}
${RESOURCELIMITS_HEADERS})
set(PUBLIC_HEADERS
Public/ResourceLimits.h
Public/ShaderLang.h
Public/resource_limits_c.h
Include/glslang_c_interface.h
Include/glslang_c_shader_types.h
Include/ResourceLimits.h
MachineIndependent/Versions.h)

foreach(file ${ALL_HEADERS})
foreach(file ${PUBLIC_HEADERS})
get_filename_component(dir ${file} DIRECTORY)
install(FILES ${file} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/${dir})
endforeach()
Expand Down

0 comments on commit cd8fa65

Please sign in to comment.