diff --git a/IGC/CMakeLists.txt b/IGC/CMakeLists.txt index 748f81668c4b..798e8ddb8972 100644 --- a/IGC/CMakeLists.txt +++ b/IGC/CMakeLists.txt @@ -928,6 +928,38 @@ foreach(_compilerFlagName IN ITEMS "CMAKE_CXX_FLAGS" "CMAKE_C_FLAGS") -fPIC -Bsymbolic ) + elseif("${IGC_OPTION__ARCHITECTURE_TARGET}" STREQUAL "LinuxRISCV") + igc_config_flag_apply_settings( + CompilerOptions + "${_compilerFlagName}" + ALL_PATTERN "" + SET_RAW + -pipe + -fmessage-length=0 + -march=rv64gc + -fms-extensions + -Werror + -Wno-unused-parameter + -Wno-missing-field-initializers + -Wwrite-strings + -Wno-long-long + -Wswitch + -Wno-sign-compare + -Wno-unused-result + -Wno-enum-compare + -Wno-type-limits + -Wno-ignored-qualifiers + -Wno-shadow + -Wformat + -Wformat-security + -Wno-extra + -Wno-write-strings + -finline + -fno-strict-aliasing + -Wno-unknown-pragmas + -fPIC + -Bsymbolic + ) else() igc_config_flag_apply_settings( CompilerOptions diff --git a/IGC/cmake/igc_arch_utils.cmake b/IGC/cmake/igc_arch_utils.cmake index fb3fccf75af3..5e0459cb569b 100644 --- a/IGC/cmake/igc_arch_utils.cmake +++ b/IGC/cmake/igc_arch_utils.cmake @@ -13,7 +13,7 @@ include_guard(DIRECTORY) # Detects host and target architecture. # # Currently supports: Windows32, Windows64, WindowsARM, Android32, Android64, AndroidMIPS, AndroidARM, -# Linux32, Linux64, LinuxMIPS, LinuxARM +# Linux32, Linux64, LinuxMIPS, LinuxRISCV, LinuxARM # # @param targetArchVarName Name of variable placeholder for target architecture. # @param hostArchVarName Name of variable placeholder for host architecture. @@ -45,6 +45,8 @@ function(igc_arch_detect targetArchVarName hostArchVarName) set(_targetArchitecture "${_targetArchOS}32") elseif(_cmakeTargetProcessor MATCHES "mips") set(_targetArchitecture "${_targetArchOS}MIPS") + elseif(_cmakeTargetProcessor MATCHES "riscv64") + set(_targetArchitecture "${_targetArchOS}RISCV") else() set(_targetArchitecture "${_targetArchOS}ARM") endif() @@ -80,6 +82,8 @@ function(igc_arch_detect targetArchVarName hostArchVarName) set(_hostArchitecture "${_hostArchOS}32") elseif(_osArchitecture MATCHES "mips") set(_hostArchitecture "${_hostArchOS}MIPS") + elseif(_osArchitecture MATCHES "riscv64") + set(_hostArchitecture "${_hostArchOS}RISCV") else() set(_hostArchitecture "${_hostArchOS}ARM") endif() @@ -101,7 +105,8 @@ function(igc_arch_validate retVarName arch) set(__allowedArchs "Windows32" "Windows64" "WindowsARM" "Android32" "Android64" "AndroidMIPS" "AndroidARM" - "Linux32" "Linux64" "LinuxMIPS" "LinuxARM" + "Linux32" "Linux64" "LinuxMIPS" "LinuxRISCV" + "LinuxARM" ) list(FIND __allowedArchs "${arch}" _allowedArchIdx) @@ -117,7 +122,7 @@ endfunction() # the "Unknown-NOTFOUND" will be returned. # # Currently supports: Windows32, Windows64, WindowsARM, Android32, Android64, AndroidMIPS, AndroidARM, -# Linux32, Linux64, LinuxMIPS, LinuxARM +# Linux32, Linux64, LinuxMIPS, LinuxRISCV, LinuxARM # # @param retValName Name of variable placeholder where result will be returned. # @param arch Architecture name to normalize / filter. @@ -141,6 +146,8 @@ function(igc_arch_normalize retVarName arch) set(_cpuPart "32") elseif(_arch MATCHES "mips^") set(_cpuPart "MIPS") + elseif(_arch MATCHES "riscv^") + set(_cpuPart "RISCV") elseif(_arch MATCHES "arm|aarch64") set(_cpuPart "ARM") else()