From 03f4b117a3fa899e4036144b824ae97dd490b63e Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Tue, 5 Nov 2024 13:33:25 +0100 Subject: [PATCH] Add freestanding riscv64 toolchain --- cmake/zig-toolchain-riscv64.cmake | 2 ++ cmake/zig-toolchain.cmake | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 cmake/zig-toolchain-riscv64.cmake diff --git a/cmake/zig-toolchain-riscv64.cmake b/cmake/zig-toolchain-riscv64.cmake new file mode 100644 index 0000000..560bff1 --- /dev/null +++ b/cmake/zig-toolchain-riscv64.cmake @@ -0,0 +1,2 @@ +set(ZIG_TARGET "riscv64-freestanding-none") +include(${CMAKE_CURRENT_LIST_DIR}/zig-toolchain.cmake) diff --git a/cmake/zig-toolchain.cmake b/cmake/zig-toolchain.cmake index 2e526c2..1304ae1 100644 --- a/cmake/zig-toolchain.cmake +++ b/cmake/zig-toolchain.cmake @@ -18,8 +18,12 @@ elseif(ZIG_OS STREQUAL "windows") set(CMAKE_SYSTEM_NAME "Windows") elseif(ZIG_OS STREQUAL "macos") set(CMAKE_SYSTEM_NAME "Darwin") +elseif(ZIG_OS STREQUAL "freestanding") + set(CMAKE_SYSTEM_NAME "Generic") else() - message(WARNING "Unknown OS: ${ZIG_OS}") + # NOTE: If this happens, add a new case with one of the following system names: + # https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_NAME.html#system-names-known-to-cmake + message(FATAL_ERROR "Unknown OS: ${ZIG_OS}") endif() set(CMAKE_SYSTEM_VERSION 1)