Skip to content

Commit

Permalink
Add IGC riscv64 build
Browse files Browse the repository at this point in the history
Add CMake configuration required to build on a riscv64 host

Signed-off-by: Francois Dugast <francois.dugast@intel.com>
Co-authored-by: Yong Li <yong.li@intel.com>
  • Loading branch information
2 people authored and igcbot committed Aug 8, 2024
1 parent 03a6d27 commit b6e2dea
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
32 changes: 32 additions & 0 deletions IGC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions IGC/cmake/igc_arch_utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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)
Expand All @@ -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.
Expand All @@ -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()
Expand Down

0 comments on commit b6e2dea

Please sign in to comment.