# Copyright Advanced Micro Devices, Inc., or its affiliates. # SPDX-License-Identifier: MIT set(GFX_SOURCES GpuArchManager.cpp InstDefDSL.cpp ) # Add all STINKYTOFU_ARCHS cpp files to GFX_SOURCES (each in its own Gfx***/ folder) foreach(arch ${STINKYTOFU_ARCHS_TO_BUILD}) list(APPEND GFX_SOURCES "${arch}/${arch}.cpp") endforeach() list(TRANSFORM GFX_SOURCES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/src/gfx/") ##===----------------------------------------------------------------------===## # GfxXXX.hpp, ArchHelper_includes.inc, GfxArchDefines.cpp, *_block.inc are generated # by tablegen_inst_gen from Formats.def + Instructions.def (DEF_ARCH in Formats.def). # gfxisa depends on instruction_generated (see parent CMakeLists.txt). ##===----------------------------------------------------------------------===## file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/generated") # GfxArchDefines.cpp and GfxLogicalMaps.cpp are produced by tablegen_inst_gen list(APPEND GFX_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/generated/GfxArchDefines.cpp") list(APPEND GFX_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/generated/GfxLogicalMaps.cpp") set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/generated/GfxArchDefines.cpp" PROPERTIES GENERATED TRUE) set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/generated/GfxLogicalMaps.cpp" PROPERTIES GENERATED TRUE) add_library(gfxisa STATIC ${GFX_SOURCES}) target_link_libraries(gfxisa PRIVATE stinkytofu-warnings) target_include_directories(gfxisa PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/../include $ # For generated files ${CMAKE_BINARY_DIR} # For GfxArchDefines.cpp #include "hardware/generated/*_block.inc" ) # Export for stinkytofu: directory containing arch_headers so "arch_headers/ArchHelper_includes.inc" resolves # (arch_headers/*.hpp and ArchHelper_includes.inc are generated by tablegen_inst_gen) set(HW_ARCH_HEADERS_DIR "${CMAKE_CURRENT_BINARY_DIR}" PARENT_SCOPE) # Note: gfxisa is only needed by tablegen. # stinkytofu depends on tablegen_generated target which are generated by tablegen.