Home | History | Annotate | Download | only in source
      1 # Copyright (c) 2015-2016 The Khronos Group Inc.
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
      4 # you may not use this file except in compliance with the License.
      5 # You may obtain a copy of the License at
      6 #
      7 #     http://www.apache.org/licenses/LICENSE-2.0
      8 #
      9 # Unless required by applicable law or agreed to in writing, software
     10 # distributed under the License is distributed on an "AS IS" BASIS,
     11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
     14 
     15 set(GRAMMAR_PROCESSING_SCRIPT "${spirv-tools_SOURCE_DIR}/utils/generate_grammar_tables.py")
     16 set(VIMSYNTAX_PROCESSING_SCRIPT "${spirv-tools_SOURCE_DIR}/utils/generate_vim_syntax.py")
     17 set(XML_REGISTRY_PROCESSING_SCRIPT "${spirv-tools_SOURCE_DIR}/utils/generate_registry_tables.py")
     18 set(LANG_HEADER_PROCESSING_SCRIPT "${spirv-tools_SOURCE_DIR}/utils/generate_language_headers.py")
     19 
     20 # For now, assume the DebugInfo grammar file is in the current directory.
     21 # It might migrate to SPIRV-Headers.
     22 set(DEBUGINFO_GRAMMAR_JSON_FILE "${CMAKE_CURRENT_SOURCE_DIR}/extinst.debuginfo.grammar.json")
     23 
     24 # macro() definitions are used in the following because we need to append .inc
     25 # file paths into some global lists (*_CPP_DEPENDS). And those global lists are
     26 # later used by set_source_files_properties() calls.
     27 # function() definitions are not suitable because they create new scopes.
     28 macro(spvtools_core_tables CONFIG_VERSION)
     29   set(GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${CONFIG_VERSION}/spirv.core.grammar.json")
     30   set(GRAMMAR_INSTS_INC_FILE "${spirv-tools_BINARY_DIR}/core.insts-${CONFIG_VERSION}.inc")
     31   set(GRAMMAR_KINDS_INC_FILE "${spirv-tools_BINARY_DIR}/operand.kinds-${CONFIG_VERSION}.inc")
     32   add_custom_command(OUTPUT ${GRAMMAR_INSTS_INC_FILE} ${GRAMMAR_KINDS_INC_FILE}
     33     COMMAND ${PYTHON_EXECUTABLE} ${GRAMMAR_PROCESSING_SCRIPT}
     34       --spirv-core-grammar=${GRAMMAR_JSON_FILE}
     35       --extinst-debuginfo-grammar=${DEBUGINFO_GRAMMAR_JSON_FILE}
     36       --core-insts-output=${GRAMMAR_INSTS_INC_FILE}
     37       --operand-kinds-output=${GRAMMAR_KINDS_INC_FILE}
     38     DEPENDS ${GRAMMAR_PROCESSING_SCRIPT} ${GRAMMAR_JSON_FILE} ${DEBUGINFO_GRAMMAR_JSON_FILE}
     39     COMMENT "Generate info tables for SPIR-V v${CONFIG_VERSION} core instructions and operands.")
     40   list(APPEND OPCODE_CPP_DEPENDS ${GRAMMAR_INSTS_INC_FILE})
     41   list(APPEND OPERAND_CPP_DEPENDS ${GRAMMAR_KINDS_INC_FILE})
     42 endmacro(spvtools_core_tables)
     43 
     44 macro(spvtools_enum_string_mapping CONFIG_VERSION)
     45   set(GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${CONFIG_VERSION}/spirv.core.grammar.json")
     46   set(GRAMMAR_EXTENSION_ENUM_INC_FILE "${spirv-tools_BINARY_DIR}/extension_enum.inc")
     47   set(GRAMMAR_ENUM_STRING_MAPPING_INC_FILE "${spirv-tools_BINARY_DIR}/enum_string_mapping.inc")
     48   add_custom_command(OUTPUT ${GRAMMAR_EXTENSION_ENUM_INC_FILE}
     49      ${GRAMMAR_ENUM_STRING_MAPPING_INC_FILE}
     50     COMMAND ${PYTHON_EXECUTABLE} ${GRAMMAR_PROCESSING_SCRIPT}
     51       --spirv-core-grammar=${GRAMMAR_JSON_FILE}
     52       --extinst-debuginfo-grammar=${DEBUGINFO_GRAMMAR_JSON_FILE}
     53       --extension-enum-output=${GRAMMAR_EXTENSION_ENUM_INC_FILE}
     54       --enum-string-mapping-output=${GRAMMAR_ENUM_STRING_MAPPING_INC_FILE}
     55     DEPENDS ${GRAMMAR_PROCESSING_SCRIPT} ${GRAMMAR_JSON_FILE} ${DEBUGINFO_GRAMMAR_JSON_FILE}
     56     COMMENT "Generate enum-string mapping for SPIR-V v${CONFIG_VERSION}.")
     57   list(APPEND EXTENSION_H_DEPENDS ${GRAMMAR_EXTENSION_ENUM_INC_FILE})
     58   list(APPEND ENUM_STRING_MAPPING_CPP_DEPENDS ${GRAMMAR_ENUM_STRING_MAPPING_INC_FILE})
     59 endmacro(spvtools_enum_string_mapping)
     60 
     61 macro(spvtools_vimsyntax CONFIG_VERSION CLVERSION)
     62   set(GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${CONFIG_VERSION}/spirv.core.grammar.json")
     63   set(GLSL_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${CONFIG_VERSION}/extinst.glsl.std.450.grammar.json")
     64   set(OPENCL_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${CONFIG_VERSION}/extinst.opencl.std.100.grammar.json")
     65   set(VIMSYNTAX_FILE "${spirv-tools_BINARY_DIR}/spvasm.vim")
     66   add_custom_command(OUTPUT ${VIMSYNTAX_FILE}
     67       COMMAND ${PYTHON_EXECUTABLE} ${VIMSYNTAX_PROCESSING_SCRIPT}
     68       --spirv-core-grammar=${GRAMMAR_JSON_FILE}
     69       --extinst-debuginfo-grammar=${DEBUGINFO_GRAMMAR_JSON_FILE}
     70       --extinst-glsl-grammar=${GLSL_GRAMMAR_JSON_FILE}
     71       --extinst-opencl-grammar=${OPENCL_GRAMMAR_JSON_FILE}
     72       >${VIMSYNTAX_FILE}
     73     DEPENDS ${VIMSYNTAX_PROCESSING_SCRIPT} ${GRAMMAR_JSON_FILE}
     74             ${GLSL_GRAMMAR_JSON_FILE} ${OPENCL_GRAMMAR_JSON_FILE} ${DEBUGINFO_GRAMMAR_JSON_FILE}
     75     COMMENT "Generate spvasm.vim: Vim syntax file for SPIR-V assembly.")
     76 endmacro(spvtools_vimsyntax)
     77 
     78 macro(spvtools_glsl_tables CONFIG_VERSION)
     79   set(CORE_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${CONFIG_VERSION}/spirv.core.grammar.json")
     80   set(GLSL_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${CONFIG_VERSION}/extinst.glsl.std.450.grammar.json")
     81   set(GRAMMAR_INC_FILE "${spirv-tools_BINARY_DIR}/glsl.std.450.insts.inc")
     82   add_custom_command(OUTPUT ${GRAMMAR_INC_FILE}
     83     COMMAND ${PYTHON_EXECUTABLE} ${GRAMMAR_PROCESSING_SCRIPT}
     84       --extinst-glsl-grammar=${GLSL_GRAMMAR_JSON_FILE}
     85       --glsl-insts-output=${GRAMMAR_INC_FILE}
     86     DEPENDS ${GRAMMAR_PROCESSING_SCRIPT} ${CORE_GRAMMAR_JSON_FILE} ${GLSL_GRAMMAR_JSON_FILE}
     87     COMMENT "Generate info tables for GLSL extended instructions and operands v${CONFIG_VERSION}.")
     88   list(APPEND EXTINST_CPP_DEPENDS ${GRAMMAR_INC_FILE})
     89 endmacro(spvtools_glsl_tables)
     90 
     91 macro(spvtools_opencl_tables CONFIG_VERSION)
     92   set(CORE_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${CONFIG_VERSION}/spirv.core.grammar.json")
     93   set(OPENCL_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${CONFIG_VERSION}/extinst.opencl.std.100.grammar.json")
     94   set(GRAMMAR_INC_FILE "${spirv-tools_BINARY_DIR}/opencl.std.insts.inc")
     95   add_custom_command(OUTPUT ${GRAMMAR_INC_FILE}
     96     COMMAND ${PYTHON_EXECUTABLE} ${GRAMMAR_PROCESSING_SCRIPT}
     97       --extinst-opencl-grammar=${OPENCL_GRAMMAR_JSON_FILE}
     98       --opencl-insts-output=${GRAMMAR_INC_FILE}
     99     DEPENDS ${GRAMMAR_PROCESSING_SCRIPT} ${CORE_GRAMMAR_JSON_FILE} ${OPENCL_GRAMMAR_JSON_FILE}
    100     COMMENT "Generate info tables for OpenCL extended instructions and operands v${CONFIG_VERSION}.")
    101   list(APPEND EXTINST_CPP_DEPENDS ${GRAMMAR_INC_FILE})
    102 endmacro(spvtools_opencl_tables)
    103 
    104 macro(spvtools_vendor_tables VENDOR_TABLE)
    105   set(INSTS_FILE "${spirv-tools_BINARY_DIR}/${VENDOR_TABLE}.insts.inc")
    106   set(GRAMMAR_FILE "${spirv-tools_SOURCE_DIR}/source/extinst.${VENDOR_TABLE}.grammar.json")
    107   add_custom_command(OUTPUT ${INSTS_FILE}
    108     COMMAND ${PYTHON_EXECUTABLE} ${GRAMMAR_PROCESSING_SCRIPT}
    109       --extinst-vendor-grammar=${GRAMMAR_FILE}
    110       --vendor-insts-output=${INSTS_FILE}
    111     DEPENDS ${GRAMMAR_PROCESSING_SCRIPT} ${GRAMMAR_FILE}
    112     COMMENT "Generate extended instruction tables for ${VENDOR_TABLE}.")
    113   add_custom_target(spirv-tools-${VENDOR_TABLE} DEPENDS ${INSTS_FILE})
    114   set_property(TARGET spirv-tools-${VENDOR_TABLE} PROPERTY FOLDER "SPIRV-Tools build")
    115   list(APPEND EXTINST_CPP_DEPENDS spirv-tools-${VENDOR_TABLE})
    116 endmacro(spvtools_vendor_tables)
    117 
    118 macro(spvtools_extinst_lang_headers NAME GRAMMAR_FILE)
    119   set(OUTBASE ${spirv-tools_BINARY_DIR}/${NAME})
    120   set(OUT_H ${OUTBASE}.h)
    121   add_custom_command(OUTPUT ${OUT_H}
    122     COMMAND ${PYTHON_EXECUTABLE} ${LANG_HEADER_PROCESSING_SCRIPT}
    123       --extinst-name=${NAME}
    124       --extinst-grammar=${GRAMMAR_FILE}
    125       --extinst-output-base=${OUTBASE}
    126     DEPENDS ${LANG_HEADER_PROCESSING_SCRIPT} ${GRAMMAR_FILE}
    127     COMMENT "Generate language specific header for ${NAME}.")
    128   add_custom_target(spirv-tools-header-${NAME} DEPENDS ${OUT_H})
    129   set_property(TARGET spirv-tools-header-${NAME} PROPERTY FOLDER "SPIRV-Tools build")
    130   list(APPEND EXTINST_CPP_DEPENDS spirv-tools-header-${NAME})
    131 endmacro(spvtools_extinst_lang_headers)
    132 
    133 spvtools_core_tables("unified1")
    134 spvtools_enum_string_mapping("unified1")
    135 spvtools_opencl_tables("unified1")
    136 spvtools_glsl_tables("unified1")
    137 spvtools_vendor_tables("spv-amd-shader-explicit-vertex-parameter")
    138 spvtools_vendor_tables("spv-amd-shader-trinary-minmax")
    139 spvtools_vendor_tables("spv-amd-gcn-shader")
    140 spvtools_vendor_tables("spv-amd-shader-ballot")
    141 spvtools_vendor_tables("debuginfo")
    142 spvtools_extinst_lang_headers("DebugInfo" ${DEBUGINFO_GRAMMAR_JSON_FILE})
    143 
    144 spvtools_vimsyntax("unified1" "1.0")
    145 add_custom_target(spirv-tools-vimsyntax DEPENDS ${VIMSYNTAX_FILE})
    146 set_property(TARGET spirv-tools-vimsyntax PROPERTY FOLDER "SPIRV-Tools utilities")
    147 
    148 # Extract the list of known generators from the SPIR-V XML registry file.
    149 set(GENERATOR_INC_FILE ${spirv-tools_BINARY_DIR}/generators.inc)
    150 set(SPIRV_XML_REGISTRY_FILE ${SPIRV_HEADER_INCLUDE_DIR}/spirv/spir-v.xml)
    151 add_custom_command(OUTPUT ${GENERATOR_INC_FILE}
    152   COMMAND ${PYTHON_EXECUTABLE} ${XML_REGISTRY_PROCESSING_SCRIPT}
    153     --xml=${SPIRV_XML_REGISTRY_FILE}
    154     --generator-output=${GENERATOR_INC_FILE}
    155   DEPENDS ${XML_REGISTRY_PROCESSING_SCRIPT} ${SPIRV_XML_REGISTRY_FILE}
    156   COMMENT "Generate tables based on the SPIR-V XML registry.")
    157 list(APPEND OPCODE_CPP_DEPENDS ${GENERATOR_INC_FILE})
    158 
    159 # The following .cpp files include the above generated .inc files.
    160 # Add those .inc files as their dependencies.
    161 #
    162 # We need to wrap the .inc files with a custom target to avoid problems when
    163 # multiple targets depend on the same custom command.
    164 add_custom_target(core_tables
    165   DEPENDS ${OPCODE_CPP_DEPENDS} ${OPERAND_CPP_DEPENDS})
    166 add_custom_target(enum_string_mapping
    167   DEPENDS ${EXTENSION_H_DEPENDS} ${ENUM_STRING_MAPPING_CPP_DEPENDS})
    168 add_custom_target(extinst_tables
    169   DEPENDS ${EXTINST_CPP_DEPENDS})
    170 
    171 set_source_files_properties(
    172   ${CMAKE_CURRENT_SOURCE_DIR}/extensions.h
    173   PROPERTIES HEADER_FILE_ONLY TRUE)
    174 
    175 set(SPIRV_TOOLS_BUILD_VERSION_INC
    176   ${spirv-tools_BINARY_DIR}/build-version.inc)
    177 set(SPIRV_TOOLS_BUILD_VERSION_INC_GENERATOR
    178   ${spirv-tools_SOURCE_DIR}/utils/update_build_version.py)
    179 set(SPIRV_TOOLS_CHANGES_FILE
    180   ${spirv-tools_SOURCE_DIR}/CHANGES)
    181 add_custom_command(OUTPUT ${SPIRV_TOOLS_BUILD_VERSION_INC}
    182    COMMAND ${PYTHON_EXECUTABLE}
    183            ${SPIRV_TOOLS_BUILD_VERSION_INC_GENERATOR}
    184            ${spirv-tools_SOURCE_DIR} ${SPIRV_TOOLS_BUILD_VERSION_INC}
    185    DEPENDS ${SPIRV_TOOLS_BUILD_VERSION_INC_GENERATOR}
    186            ${SPIRV_TOOLS_CHANGES_FILE}
    187    COMMENT "Update build-version.inc in the SPIRV-Tools build directory (if necessary).")
    188 # Convenience target for standalone generation of the build-version.inc file.
    189 # This is not required for any dependence chain.
    190 add_custom_target(spirv-tools-build-version
    191    DEPENDS ${SPIRV_TOOLS_BUILD_VERSION_INC})
    192 set_property(TARGET spirv-tools-build-version PROPERTY FOLDER "SPIRV-Tools build")
    193 
    194 list(APPEND PCH_DEPENDS ${ENUM_STRING_MAPPING_CPP_DEPENDS} ${OPCODE_CPP_DEPENDS} ${OPERAND_CPP_DEPENDS} ${EXTENSION_H_DEPENDS} ${EXTINST_CPP_DEPENDS} ${SPIRV_TOOLS_BUILD_VERSION_INC})
    195 set_source_files_properties(
    196   ${CMAKE_CURRENT_SOURCE_DIR}/pch_source.cpp
    197   PROPERTIES OBJECT_DEPENDS "${PCH_DEPENDS}")
    198 
    199 add_subdirectory(comp)
    200 add_subdirectory(opt)
    201 add_subdirectory(reduce)
    202 add_subdirectory(link)
    203 
    204 set(SPIRV_SOURCES
    205   ${spirv-tools_SOURCE_DIR}/include/spirv-tools/libspirv.h
    206 
    207   ${CMAKE_CURRENT_SOURCE_DIR}/util/bitutils.h
    208   ${CMAKE_CURRENT_SOURCE_DIR}/util/bit_vector.h
    209   ${CMAKE_CURRENT_SOURCE_DIR}/util/hex_float.h
    210   ${CMAKE_CURRENT_SOURCE_DIR}/util/make_unique.h
    211   ${CMAKE_CURRENT_SOURCE_DIR}/util/parse_number.h
    212   ${CMAKE_CURRENT_SOURCE_DIR}/util/small_vector.h
    213   ${CMAKE_CURRENT_SOURCE_DIR}/util/string_utils.h
    214   ${CMAKE_CURRENT_SOURCE_DIR}/util/timer.h
    215   ${CMAKE_CURRENT_SOURCE_DIR}/assembly_grammar.h
    216   ${CMAKE_CURRENT_SOURCE_DIR}/binary.h
    217   ${CMAKE_CURRENT_SOURCE_DIR}/cfa.h
    218   ${CMAKE_CURRENT_SOURCE_DIR}/diagnostic.h
    219   ${CMAKE_CURRENT_SOURCE_DIR}/disassemble.h
    220   ${CMAKE_CURRENT_SOURCE_DIR}/enum_set.h
    221   ${CMAKE_CURRENT_SOURCE_DIR}/enum_string_mapping.h
    222   ${CMAKE_CURRENT_SOURCE_DIR}/ext_inst.h
    223   ${CMAKE_CURRENT_SOURCE_DIR}/extensions.h
    224   ${CMAKE_CURRENT_SOURCE_DIR}/id_descriptor.h
    225   ${CMAKE_CURRENT_SOURCE_DIR}/instruction.h
    226   ${CMAKE_CURRENT_SOURCE_DIR}/latest_version_glsl_std_450_header.h
    227   ${CMAKE_CURRENT_SOURCE_DIR}/latest_version_opencl_std_header.h
    228   ${CMAKE_CURRENT_SOURCE_DIR}/latest_version_spirv_header.h
    229   ${CMAKE_CURRENT_SOURCE_DIR}/macro.h
    230   ${CMAKE_CURRENT_SOURCE_DIR}/name_mapper.h
    231   ${CMAKE_CURRENT_SOURCE_DIR}/opcode.h
    232   ${CMAKE_CURRENT_SOURCE_DIR}/operand.h
    233   ${CMAKE_CURRENT_SOURCE_DIR}/parsed_operand.h
    234   ${CMAKE_CURRENT_SOURCE_DIR}/print.h
    235   ${CMAKE_CURRENT_SOURCE_DIR}/spirv_constant.h
    236   ${CMAKE_CURRENT_SOURCE_DIR}/spirv_definition.h
    237   ${CMAKE_CURRENT_SOURCE_DIR}/spirv_endian.h
    238   ${CMAKE_CURRENT_SOURCE_DIR}/spirv_optimizer_options.h
    239   ${CMAKE_CURRENT_SOURCE_DIR}/spirv_reducer_options.h
    240   ${CMAKE_CURRENT_SOURCE_DIR}/spirv_target_env.h
    241   ${CMAKE_CURRENT_SOURCE_DIR}/spirv_validator_options.h
    242   ${CMAKE_CURRENT_SOURCE_DIR}/table.h
    243   ${CMAKE_CURRENT_SOURCE_DIR}/text.h
    244   ${CMAKE_CURRENT_SOURCE_DIR}/text_handler.h
    245   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate.h
    246 
    247   ${CMAKE_CURRENT_SOURCE_DIR}/util/bit_vector.cpp
    248   ${CMAKE_CURRENT_SOURCE_DIR}/util/parse_number.cpp
    249   ${CMAKE_CURRENT_SOURCE_DIR}/util/string_utils.cpp
    250   ${CMAKE_CURRENT_SOURCE_DIR}/assembly_grammar.cpp
    251   ${CMAKE_CURRENT_SOURCE_DIR}/binary.cpp
    252   ${CMAKE_CURRENT_SOURCE_DIR}/diagnostic.cpp
    253   ${CMAKE_CURRENT_SOURCE_DIR}/disassemble.cpp
    254   ${CMAKE_CURRENT_SOURCE_DIR}/enum_string_mapping.cpp
    255   ${CMAKE_CURRENT_SOURCE_DIR}/ext_inst.cpp
    256   ${CMAKE_CURRENT_SOURCE_DIR}/extensions.cpp
    257   ${CMAKE_CURRENT_SOURCE_DIR}/id_descriptor.cpp
    258   ${CMAKE_CURRENT_SOURCE_DIR}/libspirv.cpp
    259   ${CMAKE_CURRENT_SOURCE_DIR}/name_mapper.cpp
    260   ${CMAKE_CURRENT_SOURCE_DIR}/opcode.cpp
    261   ${CMAKE_CURRENT_SOURCE_DIR}/operand.cpp
    262   ${CMAKE_CURRENT_SOURCE_DIR}/parsed_operand.cpp
    263   ${CMAKE_CURRENT_SOURCE_DIR}/print.cpp
    264   ${CMAKE_CURRENT_SOURCE_DIR}/software_version.cpp
    265   ${CMAKE_CURRENT_SOURCE_DIR}/spirv_endian.cpp
    266   ${CMAKE_CURRENT_SOURCE_DIR}/spirv_optimizer_options.cpp
    267   ${CMAKE_CURRENT_SOURCE_DIR}/spirv_reducer_options.cpp
    268   ${CMAKE_CURRENT_SOURCE_DIR}/spirv_target_env.cpp
    269   ${CMAKE_CURRENT_SOURCE_DIR}/spirv_validator_options.cpp
    270   ${CMAKE_CURRENT_SOURCE_DIR}/table.cpp
    271   ${CMAKE_CURRENT_SOURCE_DIR}/text.cpp
    272   ${CMAKE_CURRENT_SOURCE_DIR}/text_handler.cpp
    273   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate.cpp
    274   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_adjacency.cpp
    275   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_annotation.cpp
    276   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_arithmetics.cpp
    277   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_atomics.cpp
    278   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_barriers.cpp
    279   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_bitwise.cpp
    280   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_builtins.cpp
    281   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_capability.cpp
    282   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_cfg.cpp
    283   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_composites.cpp
    284   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_constants.cpp
    285   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_conversion.cpp
    286   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_datarules.cpp
    287   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_debug.cpp
    288   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_decorations.cpp
    289   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_derivatives.cpp
    290   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_extensions.cpp
    291   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_execution_limitations.cpp
    292   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_function.cpp
    293   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_id.cpp
    294   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_image.cpp
    295   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_interfaces.cpp
    296   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_instruction.cpp
    297   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_layout.cpp
    298   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_literals.cpp
    299   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_logicals.cpp
    300   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_memory.cpp
    301   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_memory_semantics.cpp
    302   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_mode_setting.cpp
    303   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_non_uniform.cpp
    304   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_primitives.cpp
    305   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_scopes.cpp
    306   ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_type.cpp
    307   ${CMAKE_CURRENT_SOURCE_DIR}/val/decoration.h
    308   ${CMAKE_CURRENT_SOURCE_DIR}/val/basic_block.cpp
    309   ${CMAKE_CURRENT_SOURCE_DIR}/val/construct.cpp
    310   ${CMAKE_CURRENT_SOURCE_DIR}/val/function.cpp
    311   ${CMAKE_CURRENT_SOURCE_DIR}/val/instruction.cpp
    312   ${CMAKE_CURRENT_SOURCE_DIR}/val/validation_state.cpp)
    313 
    314 if (${SPIRV_TIMER_ENABLED})
    315   set(SPIRV_SOURCES
    316     ${SPIRV_SOURCES}
    317     ${CMAKE_CURRENT_SOURCE_DIR}/util/timer.cpp)
    318 endif()
    319 
    320 # The software_version.cpp file includes build-version.inc.
    321 # Rebuild the software_version.cpp object file if it is older than
    322 # build-version.inc or whenever build-version.inc itself is out of
    323 # date.  In the latter case, rebuild build-version.inc first.
    324 # CMake is not smart enough to detect this dependency automatically.
    325 # Without this, the dependency detection system for #included files
    326 # does not kick in on a clean build for the following reason:  The
    327 # build will fail early because it doesn't know how to build the
    328 # missing source file build-version.inc. That occurs before the
    329 # preprocessor is run on software_version.cpp to detect the
    330 # #include dependency.
    331 set_source_files_properties(
    332   ${CMAKE_CURRENT_SOURCE_DIR}/software_version.cpp
    333   PROPERTIES OBJECT_DEPENDS "${SPIRV_TOOLS_BUILD_VERSION_INC}")
    334 
    335 spvtools_pch(SPIRV_SOURCES pch_source)
    336 
    337 add_library(${SPIRV_TOOLS} ${SPIRV_SOURCES})
    338 spvtools_default_compile_options(${SPIRV_TOOLS})
    339 target_include_directories(${SPIRV_TOOLS}
    340   PUBLIC ${spirv-tools_SOURCE_DIR}/include
    341   PRIVATE ${spirv-tools_BINARY_DIR}
    342   PRIVATE ${SPIRV_HEADER_INCLUDE_DIR}
    343   )
    344 set_property(TARGET ${SPIRV_TOOLS} PROPERTY FOLDER "SPIRV-Tools libraries")
    345 spvtools_check_symbol_exports(${SPIRV_TOOLS})
    346 add_dependencies( ${SPIRV_TOOLS} core_tables enum_string_mapping extinst_tables )
    347 
    348 add_library(${SPIRV_TOOLS}-shared SHARED ${SPIRV_SOURCES})
    349 spvtools_default_compile_options(${SPIRV_TOOLS}-shared)
    350 target_include_directories(${SPIRV_TOOLS}-shared
    351   PUBLIC ${spirv-tools_SOURCE_DIR}/include
    352   PRIVATE ${spirv-tools_BINARY_DIR}
    353   PRIVATE ${SPIRV_HEADER_INCLUDE_DIR}
    354   )
    355 set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES CXX_VISIBILITY_PRESET hidden)
    356 set_property(TARGET ${SPIRV_TOOLS}-shared PROPERTY FOLDER "SPIRV-Tools libraries")
    357 spvtools_check_symbol_exports(${SPIRV_TOOLS}-shared)
    358 target_compile_definitions(${SPIRV_TOOLS}-shared
    359   PRIVATE SPIRV_TOOLS_IMPLEMENTATION
    360   PUBLIC SPIRV_TOOLS_SHAREDLIB
    361 )
    362 add_dependencies( ${SPIRV_TOOLS}-shared core_tables enum_string_mapping extinst_tables )
    363 
    364 if(ENABLE_SPIRV_TOOLS_INSTALL)
    365   install(TARGETS ${SPIRV_TOOLS} ${SPIRV_TOOLS}-shared
    366     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    367     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    368     ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
    369 endif(ENABLE_SPIRV_TOOLS_INSTALL)
    370 
    371 if(MSVC)
    372   # Enable parallel builds across four cores for this lib
    373   add_definitions(/MP4)
    374 endif()
    375