From 9dfbf95db02054204defbe422099c02b790a19fc Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 22 Oct 2026 01:56:23 +0900 Subject: internal/rosa: initial cross-compilation support This successfully cross-compiles the toolchain. More work is needed to support cross-compilation on all native helpers and existing packages. Signed-off-by: Ophestra --- internal/rosa/cmake.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'internal/rosa/cmake.go') diff --git a/internal/rosa/cmake.go b/internal/rosa/cmake.go index 2a262e6e..c037a239 100644 --- a/internal/rosa/cmake.go +++ b/internal/rosa/cmake.go @@ -86,12 +86,25 @@ func (attr *CMakeHelper) script(t Toolchain, name string) string { } cache = append(cache, attr.Cache...) + var cross string + if t.cross() { + cross = ` + -DCMAKE_SYSTEM_NAME=Linux \ + -DCMAKE_SYSROOT=/system/` + t.arch + ` \ + -DCMAKE_C_COMPILER=/system/bin/clang \ + -DCMAKE_CXX_COMPILER=/system/bin/clang++ \ + -DCMAKE_ASM_COMPILER=/system/bin/clang \` + } + return ` cmake -G ` + generate + ` \ - -Wno-author -Wno-unused-cli \ + -Wno-author -Wno-unused-cli \` + cross + ` -DCMAKE_C_COMPILER_TARGET='` + target + `' \ + -DCMAKE_C_FLAGS='--target=` + target + `' \ -DCMAKE_CXX_COMPILER_TARGET='` + target + `' \ + -DCMAKE_CXX_FLAGS='--target=` + target + `' \ -DCMAKE_ASM_COMPILER_TARGET='` + target + `' \ + -DCMAKE_ASM_FLAGS='--target=` + target + `' \ -DCMAKE_INSTALL_LIBDIR=lib \ ` + strings.Join(slices.Collect(func(yield func(string) bool) { for _, v := range cache { -- cgit v1.3.1