mirror of
https://github.com/Z3Prover/z3
synced 2025-04-04 16:44:07 +00:00
github action: add riscv64/aarch64/powerpc64 cross compile (#5897)
* github action: add riscv64/aarch64/powerpc64 cross compile Signed-off-by: Han Gao <rabenda.cn@gmail.com> * fix: build on non-x86 platform Signed-off-by: Revy <rabenda.cn@gmail.com>
This commit is contained in:
parent
a1517251dd
commit
3d87d86c28
30
.github/workflows/cross-build.yml
vendored
Normal file
30
.github/workflows/cross-build.yml
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container: ubuntu:jammy
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
arch: [ aarch64, riscv64, powerpc64 ]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install cross build tools
|
||||
run: apt update && apt install -y ninja-build cmake python3 g++-11-${{ matrix.arch }}-linux-gnu
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
- name: Configure CMake and build
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_CXX_COMPILER=${{ matrix.arch }}-linux-gnu-g++-11 ../
|
||||
make -j$(nproc)
|
|
@ -431,6 +431,11 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|||
string(APPEND CMAKE_SHARED_LINKER_FLAGS " /RELEASE")
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# Check atomic linking as needed
|
||||
################################################################################
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/check_link_atomic.cmake)
|
||||
|
||||
################################################################################
|
||||
# Report default CMake flags
|
||||
################################################################################
|
||||
|
|
23
cmake/check_link_atomic.cmake
Normal file
23
cmake/check_link_atomic.cmake
Normal file
|
@ -0,0 +1,23 @@
|
|||
set(ATOMIC_TEST_SOURCE "
|
||||
#include <atomic>
|
||||
std::atomic<int> x;
|
||||
std::atomic<short> y;
|
||||
std::atomic<char> z;
|
||||
std::atomic<long long> w;
|
||||
int main() {
|
||||
++z;
|
||||
++y;
|
||||
++w;
|
||||
return ++x;
|
||||
}")
|
||||
CHECK_CXX_SOURCE_COMPILES("${ATOMIC_TEST_SOURCE}" BUILTIN_ATOMIC)
|
||||
if (NOT BUILTIN_ATOMIC)
|
||||
set(CMAKE_REQUIRED_LIBRARIES atomic)
|
||||
CHECK_CXX_SOURCE_COMPILES("${ATOMIC_TEST_SOURCE}" ATOMICS_REQUIRE_LIBATOMIC)
|
||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||
if (ATOMICS_REQUIRE_LIBATOMIC)
|
||||
list(APPEND Z3_DEPENDENT_LIBS atomic)
|
||||
else()
|
||||
message(FATAL_ERROR "Host compiler must support std::atomic!")
|
||||
endif()
|
||||
endif()
|
Loading…
Reference in a new issue