Skip to content

Commit

Permalink
added support for loongarch64 (#3094)
Browse files Browse the repository at this point in the history
Co-authored-by: tsuibin <tsuibin@loongson.cn>
  • Loading branch information
tsuibin and tsuibin committed Jul 20, 2021
1 parent f153366 commit 1699aaa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(riscv)")
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc)")
set(NCNN_TARGET_ARCH powerpc)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(loongarch)")
set(NCNN_TARGET_ARCH loongarch)
else()
set(NCNN_TARGET_ARCH x86)
option(NCNN_SSE2 "optimize x86 platform with sse2" ON)
Expand Down
16 changes: 16 additions & 0 deletions toolchains/loongarch64-linux-gnu.toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR loongarch64)

set(CMAKE_C_COMPILER "loongarch64-linux-gnu-gcc")
set(CMAKE_CXX_COMPILER "loongarch64-linux-gnu-g++")

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(CMAKE_C_FLAGS "-march=loongarch64")
set(CMAKE_CXX_FLAGS "-march=loongarch64")

# cache flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags")

0 comments on commit 1699aaa

Please sign in to comment.