• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1set(SOURCES
2    GlslangToSpv.cpp
3    InReadableOrder.cpp
4    Logger.cpp
5    SpvBuilder.cpp
6    SpvPostProcess.cpp
7    doc.cpp
8    SpvTools.cpp
9    disassemble.cpp)
10
11set(SPVREMAP_SOURCES
12    SPVRemapper.cpp
13    doc.cpp)
14
15set(HEADERS
16    bitutils.h
17    spirv.hpp
18    GLSL.std.450.h
19    GLSL.ext.EXT.h
20    GLSL.ext.KHR.h
21    GlslangToSpv.h
22    hex_float.h
23    Logger.h
24    SpvBuilder.h
25    spvIR.h
26    doc.h
27    SpvTools.h
28    disassemble.h)
29
30set(SPVREMAP_HEADERS
31    SPVRemapper.h
32    doc.h)
33
34if(ENABLE_AMD_EXTENSIONS)
35    list(APPEND
36         HEADERS
37         GLSL.ext.AMD.h)
38endif(ENABLE_AMD_EXTENSIONS)
39
40if(ENABLE_NV_EXTENSIONS)
41    list(APPEND
42         HEADERS
43         GLSL.ext.NV.h)
44endif(ENABLE_NV_EXTENSIONS)
45
46add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS})
47set_property(TARGET SPIRV PROPERTY FOLDER glslang)
48set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON)
49target_include_directories(SPIRV PUBLIC ..)
50
51if (ENABLE_SPVREMAPPER)
52    add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
53    set_property(TARGET SPVRemapper PROPERTY FOLDER glslang)
54    set_property(TARGET SPVRemapper PROPERTY POSITION_INDEPENDENT_CODE ON)
55endif()
56
57if(WIN32 AND BUILD_SHARED_LIBS)
58    set_target_properties(SPIRV PROPERTIES PREFIX "")
59    if (ENABLE_SPVREMAPPER)
60        set_target_properties(SPVRemapper PROPERTIES PREFIX "")
61    endif()
62endif()
63
64if(ENABLE_OPT)
65    target_include_directories(SPIRV
66        PRIVATE ${spirv-tools_SOURCE_DIR}/include
67        PRIVATE ${spirv-tools_SOURCE_DIR}/source
68    )
69    target_link_libraries(SPIRV glslang SPIRV-Tools-opt)
70    target_include_directories(SPIRV PUBLIC ../External)
71else()
72    target_link_libraries(SPIRV glslang)
73endif(ENABLE_OPT)
74
75if(WIN32)
76    source_group("Source" FILES ${SOURCES} ${HEADERS})
77    source_group("Source" FILES ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
78endif(WIN32)
79
80if(ENABLE_GLSLANG_INSTALL)
81    if(BUILD_SHARED_LIBS)
82        if (ENABLE_SPVREMAPPER)
83            install(TARGETS SPVRemapper
84                    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
85                    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
86        endif()
87        install(TARGETS SPIRV
88                ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
89                LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
90    else()
91        if (ENABLE_SPVREMAPPER)
92            install(TARGETS SPVRemapper
93                    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
94        endif()
95        install(TARGETS SPIRV
96                ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
97    endif()
98
99    install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SPIRV/)
100endif(ENABLE_GLSLANG_INSTALL)
101