This is needed because we are currently cross-compiling the toolchain
for riscv64 on x86_64. However, cmake does not take the time to figure
out what it should actually be doing and needs to be explicitely told.
So that we don't have to reinvent the wheel more than one we create the
configuration file at the beginning and automatically extend the cmake
command line with the settings that we need.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
GRUB_ARCH = arm64
endif
+CMAKE = cmake
+
+# In the toolchain, we might be cross-compiling and need cmake to know
+ifeq "$(TOOLCHAIN)" "1"
+ CMAKE += \
+ -D CMAKE_TOOLCHAIN_FILE=$(TOOLS_DIR)/share/cmake/toolchain.cmake
+endif
+
# Go
export GOARCH
export GOOS = linux
ln -svf . $(TOOLS_DIR)/lib/lp64d
endif
+ # Write a cmake toolchain file so cmake knows we're targeting $(BUILD_ARCH)
+ -mkdir -pv $(TOOLS_DIR)/share/cmake
+ echo "set(CMAKE_SYSTEM_NAME Linux)" > \
+ $(TOOLS_DIR)/share/cmake/toolchain.cmake
+ echo "set(CMAKE_SYSTEM_PROCESSOR $(BUILD_ARCH))" >> \
+ $(TOOLS_DIR)/share/cmake/toolchain.cmake
+ echo "set(CMAKE_C_COMPILER $(TOOLS_DIR)/bin/cc)" >> \
+ $(TOOLS_DIR)/share/cmake/toolchain.cmake
+ echo "set(CMAKE_CXX_COMPILER $(TOOLS_DIR)/bin/c++)" >> \
+ $(TOOLS_DIR)/share/cmake/toolchain.cmake
+
@$(POSTBUILD)