#
#
set(IGC_BUILD__PROJ__Compiler       "${IGC_BUILD__PROJ_NAME_PREFIX}Compiler")
set(IGC_BUILD__PROJ__Compiler       "${IGC_BUILD__PROJ__Compiler}" PARENT_SCOPE)
set(IGC_BUILD__PROJ_LABEL__Compiler "${IGC_BUILD__PROJ__Compiler}")

include_directories("${CMAKE_CURRENT_SOURCE_DIR}")


add_subdirectory(CISACodeGen)
igc_sg_define(Compiler__CISACodeGen)

add_subdirectory(DebugInfo)
igc_sg_define(Compiler__DebugInfo)

add_subdirectory(Legalizer)
igc_sg_define(Compiler__Legalizer)

add_subdirectory(MetaDataApi)
igc_sg_define(Compiler__MetaDataApi)

add_subdirectory(Optimizer)
igc_sg_define(Compiler__Optimizer)



set(IGC_BUILD__SRC__Compiler
    "${CMAKE_CURRENT_SOURCE_DIR}/CodeGenContextWrapper.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/compiler_caps.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/CustomSafeOptPass.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/CustomUnsafeOptPass.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/CustomLoopOpt.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/BlendToDiscard.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/PromoteResourceToDirectAS.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/GenTTI.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/FixResourcePtr.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/HandleLoadStoreInstructions.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/igc_workaround.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/LegalizationPass.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/LinkOpt.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/LowPrecisionOptPass.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/MetaDataUtilsWrapper.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/MetaDataUtilsWrapperInitializer.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/SampleCmpToDiscard.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/SPIRMetaDataTranslation.cpp"
	"${CMAKE_CURRENT_SOURCE_DIR}/ACLPrintfTranslation.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/WorkaroundAnalysisPass.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/ThreadCombining.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/GenUpdateCB.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/ConvertMSAAPayloadTo16Bit.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/FindInterestingConstants.cpp"
    "${IGC_BUILD__GFX_DEV_SRC_DIR}/skuwa/ibdw_wa.c"
	"${IGC_BUILD__GFX_DEV_SRC_DIR}/skuwa/ichv_wa.c"
    "${IGC_BUILD__GFX_DEV_SRC_DIR}/skuwa/ibxt_wa.c"
    "${IGC_BUILD__GFX_DEV_SRC_DIR}/skuwa/iCnl_wa.c"
    "${IGC_BUILD__GFX_DEV_SRC_DIR}/skuwa/iskl_wa.c"
    "${IGC_BUILD__GFX_DEV_SRC_DIR}/skuwa/ikbl_wa.c"
    "${IGC_BUILD__GFX_DEV_SRC_DIR}/skuwa/icfl_wa.c"
    "${IGC_BUILD__GFX_DEV_SRC_DIR}/skuwa/iglk_wa.c"
    ${IGC_BUILD__SRC__Compiler_CISACodeGen}
    ${IGC_BUILD__SRC__Compiler_DebugInfo}
    ${IGC_BUILD__SRC__Compiler_Legalizer}
    ${IGC_BUILD__SRC__Compiler_MetaDataApi}
    ${IGC_BUILD__SRC__Compiler_Optimizer}
  )
if(NOT ANDROID)
  set(IGC_BUILD__SRC_Win_Lin_Dar__Compiler
      "${CMAKE_CURRENT_SOURCE_DIR}/VerificationPass.cpp"
    )
endif()

set(IGC_BUILD__HDR__Compiler
    "${CMAKE_CURRENT_SOURCE_DIR}/CodeGenContextWrapper.hpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/CodeGenPublic.h"
    "${CMAKE_CURRENT_SOURCE_DIR}/CodeGenPublicEnums.h"
    "${CMAKE_CURRENT_SOURCE_DIR}/compiler_caps.h"
    "${CMAKE_CURRENT_SOURCE_DIR}/CustomSafeOptPass.hpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/CustomUnsafeOptPass.hpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/CustomLoopOpt.hpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/PromoteResourceToDirectAS.h"
    "${CMAKE_CURRENT_SOURCE_DIR}/GenTTI.h"
    "${CMAKE_CURRENT_SOURCE_DIR}/FixResourcePtr.hpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/HandleLoadStoreInstructions.hpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/IGC_IR_spec.hpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/igc_workaround.h"
    "${CMAKE_CURRENT_SOURCE_DIR}/IGCPassSupport.h"
    "${CMAKE_CURRENT_SOURCE_DIR}/InitializePasses.h"
    "${CMAKE_CURRENT_SOURCE_DIR}/LegalizationPass.hpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/LinkOpt.hpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/LowPrecisionOptPass.hpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/MetaDataUtilsWrapper.h"
    "${CMAKE_CURRENT_SOURCE_DIR}/MetaDataUtilsWrapperInitializer.h"
    "${CMAKE_CURRENT_SOURCE_DIR}/SampleCmpToDiscard.h"
    "${CMAKE_CURRENT_SOURCE_DIR}/SPIRMetaDataTranslation.h"
	"${CMAKE_CURRENT_SOURCE_DIR}/ACLPrintfTranslation.h"
    "${CMAKE_CURRENT_SOURCE_DIR}/ThreadCombining.hpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/GenUpdateCB.h"
    "${CMAKE_CURRENT_SOURCE_DIR}/ConvertMSAAPayloadTo16Bit.hpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/WorkaroundAnalysisPass.h"
    "${CMAKE_CURRENT_SOURCE_DIR}/FindInterestingConstants.h"
    ${IGC_BUILD__HDR__Compiler_CISACodeGen}
    ${IGC_BUILD__HDR__Compiler_DebugInfo}
    ${IGC_BUILD__HDR__Compiler_Legalizer}
    ${IGC_BUILD__HDR__Compiler_MetaDataApi}
    ${IGC_BUILD__HDR__Compiler_Optimizer}
  )
if(NOT ANDROID)
  set(IGC_BUILD__HDR_Win_Lin_Dar__Compiler
      "${CMAKE_CURRENT_SOURCE_DIR}/VerificationPass.hpp"
    )
endif()

add_library("${IGC_BUILD__PROJ__Compiler}" STATIC
    ${IGC_BUILD__SRC__Compiler}
    ${IGC_BUILD__SRC_Win_Lin_Dar__Compiler}
    ${IGC_BUILD__HDR__Compiler}
    ${IGC_BUILD__HDR_Win_Lin_Dar__Compiler}
  )
set_property(TARGET "${IGC_BUILD__PROJ__Compiler}" PROPERTY PROJECT_LABEL "${IGC_BUILD__PROJ_LABEL__Compiler}")

add_dependencies("${IGC_BUILD__PROJ__Compiler}" "${IGC_BUILD__PROJ__GenISAIntrinsics}")

win_static_runtime()

