Home | History | Annotate | Download | only in SPIRV
      1 set(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 
     11 set(SPVREMAP_SOURCES
     12     SPVRemapper.cpp
     13     doc.cpp)
     14 
     15 set(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 
     30 set(SPVREMAP_HEADERS
     31     SPVRemapper.h
     32     doc.h)
     33 
     34 if(ENABLE_AMD_EXTENSIONS)
     35     list(APPEND
     36          HEADERS
     37          GLSL.ext.AMD.h)
     38 endif(ENABLE_AMD_EXTENSIONS)
     39 
     40 if(ENABLE_NV_EXTENSIONS)
     41     list(APPEND
     42          HEADERS
     43          GLSL.ext.NV.h)
     44 endif(ENABLE_NV_EXTENSIONS)
     45 
     46 add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS})
     47 set_property(TARGET SPIRV PROPERTY FOLDER glslang)
     48 set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON)
     49 target_include_directories(SPIRV PUBLIC ..)
     50 
     51 if (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)
     55 endif()
     56 
     57 if(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()
     62 endif()
     63 
     64 if(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)
     71 else()
     72     target_link_libraries(SPIRV glslang)
     73 endif(ENABLE_OPT)
     74 
     75 if(WIN32)
     76     source_group("Source" FILES ${SOURCES} ${HEADERS})
     77     source_group("Source" FILES ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
     78 endif(WIN32)
     79 
     80 if(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/)
    100 endif(ENABLE_GLSLANG_INSTALL)
    101