]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix cmake detection of risc-v (32 and 64 bit)
authorVladimir Smirnov <civiloid@google.com>
Sun, 2 May 2021 12:56:16 +0000 (14:56 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 6 May 2021 12:03:30 +0000 (14:03 +0200)
Add a case to detect risc-v architectures.

Fixes #941

cmake/detect-arch.c
cmake/detect-arch.cmake

index 571553582affc7acbcf04116d024ba42fca528bd..c8bad4beda35b8ae0e7f26d50400f5f0cc495e26 100644 (file)
 #elif defined(__THW_RS6000)
     #error archfound rs6000
 
+// RISC-V
+#elif defined(__riscv) 
+    #if __riscv_xlen == 64
+        #error archfound riscv64
+    #elif __riscv_xlen == 32
+        #error archfound riscv32
+
 // return 'unrecognized' if we do not know what architecture this is
 #else
     #error archfound unrecognized
index 69475da38d84926c55b57576ee3a72f302460c4d..76b52b9f3654544f780565554fdf217f700caf9c 100644 (file)
@@ -85,6 +85,9 @@ elseif("${ARCH}" MATCHES "parisc")
 elseif("${ARCH}" MATCHES "rs6000")
     set(BASEARCH "rs6000")
     set(BASEARCH_RS6000_FOUND TRUE)
+elseif("${ARCH}" MATCHES "riscv(32|64)")
+    set(BASEARCH "riscv")
+    set(BASEARCH_RISCV_FOUND TRUE)
 else()
     set(BASEARCH "x86")
     set(BASEARCH_X86_FOUND TRUE)