From be7cfc2b7698dc28fbedf01afd1942b7d24fd358 Mon Sep 17 00:00:00 2001 From: SpikeHD <25207995+SpikeHD@users.noreply.github.com> Date: Mon, 21 Oct 2024 20:21:24 -0700 Subject: [PATCH] fix: theoretical cmake cross compilation --- .github/workflows/build.yml | 20 +++++++++++++++++-- .../extension_webkit/toolchain-arm64.cmake | 14 +++++++++++++ .../extension_webkit/toolchain-armv7.cmake | 14 +++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 src-tauri/extension_webkit/toolchain-arm64.cmake create mode 100644 src-tauri/extension_webkit/toolchain-armv7.cmake diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64aa849e..228de82b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -146,9 +146,25 @@ jobs: env: RUSTFLAGS: -Awarnings - - name: (Linux) Build Webkit extension - if: matrix.config.platform == 'ubuntu-22.04' + - name: (Linux x86_64) Build Webkit extension + if: matrix.config.target == 'x86_64-unknown-linux-gnu' + run: cd src-tauri/extension_webkit && cmake . && cmake --build . + + - name: (Linux ARMv7) Build Webkit extension + if: matrix.config.target == 'armv7-unknown-linux-gnueabihf' run: cd src-tauri/extension_webkit && cmake . && cmake --build . + env: + CC: arm-linux-gnueabihf-gcc + PKG_CONFIG_SYSROOT_DIR: /usr/lib/arm-linux-gnueabihf + PKG_CONFIG_PATH: /usr/lib/arm-linux-gnueabihf/pkgconfig + + - name: (Linux ARM64) Build Webkit extension + if: matrix.config.target == 'aarch64-unknown-linux-gnu' + run: cd src-tauri/extension_webkit && cmake . && cmake --build . + env: + CC: aarch64-linux-gnu-gcc + PKG_CONFIG_SYSROOT_DIR: /usr/lib/aarch64-linux-gnu + PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig - name: Install dependencies run: pnpm install && pnpm shupdate diff --git a/src-tauri/extension_webkit/toolchain-arm64.cmake b/src-tauri/extension_webkit/toolchain-arm64.cmake new file mode 100644 index 00000000..2e1e351b --- /dev/null +++ b/src-tauri/extension_webkit/toolchain-arm64.cmake @@ -0,0 +1,14 @@ +# Target system +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR aarch64) + +# Cross-compilation toolchain +set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) +set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) +set(CMAKE_SYSROOT /usr/lib/aarch64-linux-gnu) + +# Library paths +set(CMAKE_FIND_ROOT_PATH /usr/lib/aarch64-linux-gnu) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/src-tauri/extension_webkit/toolchain-armv7.cmake b/src-tauri/extension_webkit/toolchain-armv7.cmake new file mode 100644 index 00000000..c6a2d9eb --- /dev/null +++ b/src-tauri/extension_webkit/toolchain-armv7.cmake @@ -0,0 +1,14 @@ +# Target system +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR arm) + +# Cross-compilation toolchain +set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) +set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) +set(CMAKE_SYSROOT /usr/lib/arm-linux-gnueabihf) + +# Library paths +set(CMAKE_FIND_ROOT_PATH /usr/lib/arm-linux-gnueabihf) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file