diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-10-22 01:56:23 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-10-22 11:10:01 +0900 |
| commit | 9dfbf95db02054204defbe422099c02b790a19fc (patch) | |
| tree | f8c318ebfc5c824b2eb5e7a8aac3b835ee05a4ed /internal/rosa/cmake.go | |
| parent | 29f86b3446c9fe35d2a359df45471abdaa35cea4 (diff) | |
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 <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/cmake.go')
| -rw-r--r-- | internal/rosa/cmake.go | 15 |
1 files changed, 14 insertions, 1 deletions
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 { |
