file(GLOB_RECURSE SPIRV_OPT_SOURCES
  3rdparty/spirv-tools/source/opt/*.cpp
  3rdparty/spirv-tools/source/opt/*.h
  3rdparty/spirv-tools/source/util/bitutils.h
  3rdparty/spirv-tools/source/util/bit_stream.h
  3rdparty/spirv-tools/source/util/hex_float.h
  3rdparty/spirv-tools/source/util/parse_number.h
  3rdparty/spirv-tools/source/util/string_utils.h
  3rdparty/spirv-tools/source/util/timer.h
  3rdparty/spirv-tools/source/assembly_grammar.h
  3rdparty/spirv-tools/source/binary.h
  3rdparty/spirv-tools/source/cfa.h
  3rdparty/spirv-tools/source/diagnostic.h
  3rdparty/spirv-tools/source/disassemble.h
  3rdparty/spirv-tools/source/enum_set.h
  3rdparty/spirv-tools/source/enum_string_mapping.h
  3rdparty/spirv-tools/source/ext_inst.h
  3rdparty/spirv-tools/source/extensions.h
  3rdparty/spirv-tools/source/id_descriptor.h
  3rdparty/spirv-tools/source/instruction.h
  3rdparty/spirv-tools/source/latest_version_glsl_std_450_header.h
  3rdparty/spirv-tools/source/latest_version_opencl_std_header.h
  3rdparty/spirv-tools/source/latest_version_spirv_header.h
  3rdparty/spirv-tools/source/macro.h
  3rdparty/spirv-tools/source/name_mapper.h
  3rdparty/spirv-tools/source/opcode.h
  3rdparty/spirv-tools/source/operand.h
  3rdparty/spirv-tools/source/parsed_operand.h
  3rdparty/spirv-tools/source/print.h
  3rdparty/spirv-tools/source/spirv_constant.h
  3rdparty/spirv-tools/source/spirv_definition.h
  3rdparty/spirv-tools/source/spirv_endian.h
  3rdparty/spirv-tools/source/spirv_target_env.h
  3rdparty/spirv-tools/source/spirv_validator_options.h
  3rdparty/spirv-tools/source/table.h
  3rdparty/spirv-tools/source/text.h
  3rdparty/spirv-tools/source/text_handler.h
  3rdparty/spirv-tools/source/validate.h
  3rdparty/spirv-tools/source/util/bit_stream.cpp
  3rdparty/spirv-tools/source/util/parse_number.cpp
  3rdparty/spirv-tools/source/util/string_utils.cpp
  3rdparty/spirv-tools/source/assembly_grammar.cpp
  3rdparty/spirv-tools/source/binary.cpp
  3rdparty/spirv-tools/source/diagnostic.cpp
  3rdparty/spirv-tools/source/disassemble.cpp
  3rdparty/spirv-tools/source/enum_string_mapping.cpp
  3rdparty/spirv-tools/source/ext_inst.cpp
  3rdparty/spirv-tools/source/extensions.cpp
  3rdparty/spirv-tools/source/id_descriptor.cpp
  3rdparty/spirv-tools/source/libspirv.cpp
  3rdparty/spirv-tools/source/message.cpp
  3rdparty/spirv-tools/source/name_mapper.cpp
  3rdparty/spirv-tools/source/opcode.cpp
  3rdparty/spirv-tools/source/operand.cpp
  3rdparty/spirv-tools/source/parsed_operand.cpp
  3rdparty/spirv-tools/source/print.cpp
  3rdparty/spirv-tools/source/software_version.cpp
  3rdparty/spirv-tools/source/spirv_endian.cpp
  3rdparty/spirv-tools/source/spirv_stats.cpp
  3rdparty/spirv-tools/source/spirv_target_env.cpp
  3rdparty/spirv-tools/source/spirv_validator_options.cpp
  3rdparty/spirv-tools/source/table.cpp
  3rdparty/spirv-tools/source/text.cpp
  3rdparty/spirv-tools/source/text_handler.cpp
  3rdparty/spirv-tools/source/validate.cpp
  3rdparty/spirv-tools/source/validate_adjacency.cpp
  3rdparty/spirv-tools/source/validate_arithmetics.cpp
  3rdparty/spirv-tools/source/validate_atomics.cpp
  3rdparty/spirv-tools/source/validate_barriers.cpp
  3rdparty/spirv-tools/source/validate_bitwise.cpp
  3rdparty/spirv-tools/source/validate_builtins.cpp
  3rdparty/spirv-tools/source/validate_capability.cpp
  3rdparty/spirv-tools/source/validate_cfg.cpp
  3rdparty/spirv-tools/source/validate_composites.cpp
  3rdparty/spirv-tools/source/validate_conversion.cpp
  3rdparty/spirv-tools/source/validate_datarules.cpp
  3rdparty/spirv-tools/source/validate_decorations.cpp
  3rdparty/spirv-tools/source/validate_derivatives.cpp
  3rdparty/spirv-tools/source/validate_ext_inst.cpp
  3rdparty/spirv-tools/source/validate_id.cpp
  3rdparty/spirv-tools/source/validate_image.cpp
  3rdparty/spirv-tools/source/validate_instruction.cpp
  3rdparty/spirv-tools/source/validate_layout.cpp
  3rdparty/spirv-tools/source/validate_literals.cpp
  3rdparty/spirv-tools/source/validate_logicals.cpp
  3rdparty/spirv-tools/source/validate_primitives.cpp
  3rdparty/spirv-tools/source/validate_type_unique.cpp
  3rdparty/spirv-tools/source/val/decoration.h
  3rdparty/spirv-tools/source/val/basic_block.cpp
  3rdparty/spirv-tools/source/val/construct.cpp
  3rdparty/spirv-tools/source/val/function.cpp
  3rdparty/spirv-tools/source/val/instruction.cpp
  3rdparty/spirv-tools/source/val/validation_state.cpp)

add_library(spirv-opt ${SPIRV_OPT_SOURCES})
add_library(bgfx::spirv-opt ALIAS spirv-opt)
target_include_directories(spirv-opt
  PUBLIC
    3rdparty/spirv-tools/include
    3rdparty/spirv-tools/source
  PRIVATE
    3rdparty/spirv-tools/include/generated
    3rdparty/spirv-tools/external/SPIRV-Headers/include)
target_compile_features(spirv-opt PUBLIC cxx_std_11)
