blob: 94d2ebebb3caa4e5639ae3744a24df68afeccb6d [file] [log] [blame]
John Kessenich140f3df2015-06-26 16:58:36 -06001set(SOURCES
2 GlslangToSpv.cpp
Dejan Mircevski44bfb0d2016-01-18 16:18:37 -05003 InReadableOrder.cpp
Lei Zhang17535f72016-05-04 15:55:59 -04004 Logger.cpp
John Kessenich140f3df2015-06-26 16:58:36 -06005 SpvBuilder.cpp
John Kessenichf04c51b2018-08-03 15:56:12 -06006 SpvPostProcess.cpp
John Kessenich140f3df2015-06-26 16:58:36 -06007 doc.cpp
John Kessenich717c80a2018-08-23 15:17:10 -06008 SpvTools.cpp
John Kessenich140f3df2015-06-26 16:58:36 -06009 disassemble.cpp)
10
steve-lunarga8456412016-08-17 16:18:06 -060011set(SPVREMAP_SOURCES
12 SPVRemapper.cpp
13 doc.cpp)
14
John Kessenich140f3df2015-06-26 16:58:36 -060015set(HEADERS
Rex Xuc9e3c3c2016-07-29 16:00:05 +080016 bitutils.h
John Kessenich5e4b1242015-08-06 22:53:06 -060017 spirv.hpp
18 GLSL.std.450.h
Rex Xu81f4c032018-03-02 17:42:37 +080019 GLSL.ext.EXT.h
Rex Xu51596642016-09-21 18:56:12 +080020 GLSL.ext.KHR.h
John Kessenich140f3df2015-06-26 16:58:36 -060021 GlslangToSpv.h
Rex Xuc9e3c3c2016-07-29 16:00:05 +080022 hex_float.h
Lei Zhang17535f72016-05-04 15:55:59 -040023 Logger.h
John Kessenich140f3df2015-06-26 16:58:36 -060024 SpvBuilder.h
John Kessenich140f3df2015-06-26 16:58:36 -060025 spvIR.h
26 doc.h
John Kessenich717c80a2018-08-23 15:17:10 -060027 SpvTools.h
John Kessenicheaf44962019-08-07 01:52:20 -060028 disassemble.h
29 GLSL.ext.AMD.h
30 GLSL.ext.NV.h)
John Kessenich140f3df2015-06-26 16:58:36 -060031
steve-lunarga8456412016-08-17 16:18:06 -060032set(SPVREMAP_HEADERS
33 SPVRemapper.h
34 doc.h)
35
Matthew Albrecht6c5f6492018-03-30 09:32:03 -050036add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS})
Rohith Chandran62060912017-07-04 10:53:45 -040037set_property(TARGET SPIRV PROPERTY FOLDER glslang)
38set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON)
Michael Maltesea895f372017-05-02 16:16:06 -070039target_include_directories(SPIRV PUBLIC ..)
John Kessenich140f3df2015-06-26 16:58:36 -060040
Matthew Albrecht857f25c2018-07-07 16:53:06 -050041if (ENABLE_SPVREMAPPER)
42 add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
43 set_property(TARGET SPVRemapper PROPERTY FOLDER glslang)
44 set_property(TARGET SPVRemapper PROPERTY POSITION_INDEPENDENT_CODE ON)
45endif()
steve-lunarga8456412016-08-17 16:18:06 -060046
Matthew Albrecht6c5f6492018-03-30 09:32:03 -050047if(WIN32 AND BUILD_SHARED_LIBS)
48 set_target_properties(SPIRV PROPERTIES PREFIX "")
Matthew Albrecht857f25c2018-07-07 16:53:06 -050049 if (ENABLE_SPVREMAPPER)
50 set_target_properties(SPVRemapper PROPERTIES PREFIX "")
51 endif()
Matthew Albrecht6c5f6492018-03-30 09:32:03 -050052endif()
53
GregFfd34f0e2017-09-21 16:50:39 -060054if(ENABLE_OPT)
55 target_include_directories(SPIRV
56 PRIVATE ${spirv-tools_SOURCE_DIR}/include
57 PRIVATE ${spirv-tools_SOURCE_DIR}/source
58 )
GregF4bede9e2018-03-26 17:20:10 -060059 target_link_libraries(SPIRV glslang SPIRV-Tools-opt)
John Kesseniche2156222018-06-11 18:12:15 -060060 target_include_directories(SPIRV PUBLIC ../External)
GregFfd34f0e2017-09-21 16:50:39 -060061else()
62 target_link_libraries(SPIRV glslang)
63endif(ENABLE_OPT)
64
John Kessenich140f3df2015-06-26 16:58:36 -060065if(WIN32)
66 source_group("Source" FILES ${SOURCES} ${HEADERS})
steve-lunarga8456412016-08-17 16:18:06 -060067 source_group("Source" FILES ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
John Kessenich140f3df2015-06-26 16:58:36 -060068endif(WIN32)
69
d3x0r4e53d902017-07-04 06:00:35 -070070if(ENABLE_GLSLANG_INSTALL)
Matthew Albrecht1199cf92018-04-26 09:04:25 -050071 if(BUILD_SHARED_LIBS)
Matthew Albrecht857f25c2018-07-07 16:53:06 -050072 if (ENABLE_SPVREMAPPER)
73 install(TARGETS SPVRemapper
74 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
75 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
76 endif()
77 install(TARGETS SPIRV
Matthew Albrecht1199cf92018-04-26 09:04:25 -050078 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
Matthew Albrechtcda52d52019-05-23 19:01:57 -050079 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
80 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
Matthew Albrecht1199cf92018-04-26 09:04:25 -050081 else()
Matthew Albrecht857f25c2018-07-07 16:53:06 -050082 if (ENABLE_SPVREMAPPER)
83 install(TARGETS SPVRemapper
84 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
85 endif()
86 install(TARGETS SPIRV
Matthew Albrecht1199cf92018-04-26 09:04:25 -050087 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
88 endif()
Benjamin Saunders5a074532017-01-29 17:45:12 -080089
d3x0r4e53d902017-07-04 06:00:35 -070090 install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SPIRV/)
91endif(ENABLE_GLSLANG_INSTALL)