Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build C++ SDK for Linux ARM64 #5489

Merged
merged 4 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 32 additions & 21 deletions .github/workflows/on_push_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,40 +114,49 @@ jobs:
# -----------------------------------------------------------------------------------
# Build rerun_c library binaries:

build-rerun_c-and-upload-linux:
build-rerun_c-and-upload-linux-arm64:
needs: [checks]
name: "Linux-Arm64: Build & Upload rerun_c"
uses: ./.github/workflows/reusable_build_and_upload_rerun_c.yml
with:
CONCURRENCY: push-linux-arm64-${{ github.ref_name }}
PLATFORM: linux-arm64
secrets: inherit

build-rerun_c-and-upload-linux-x64:
needs: [checks]
name: "Linux-x64: Build & Upload rerun_c"
uses: ./.github/workflows/reusable_build_and_upload_rerun_c.yml
with:
CONCURRENCY: push-linux-${{ github.ref_name }}
PLATFORM: linux
CONCURRENCY: push-linux-x64-${{ github.ref_name }}
PLATFORM: linux-x64
secrets: inherit

build-rerun_c-and-upload-macos-intel:
build-rerun_c-and-upload-macos-x64:
needs: [checks]
name: "Mac-Intel: Build & Upload rerun_c"
uses: ./.github/workflows/reusable_build_and_upload_rerun_c.yml
with:
CONCURRENCY: push-macos-intel-${{ github.ref_name }}
PLATFORM: macos-intel
CONCURRENCY: push-macos-x64-${{ github.ref_name }}
PLATFORM: macos-x64
secrets: inherit

build-rerun_c-and-upload-macos-arm:
build-rerun_c-and-upload-macos-arm64:
needs: [checks]
name: "Mac-Arm: Build & Upload rerun_c"
name: "Mac-Arm64: Build & Upload rerun_c"
uses: ./.github/workflows/reusable_build_and_upload_rerun_c.yml
with:
CONCURRENCY: push-macos-arm-${{ github.ref_name }}
PLATFORM: macos-arm
CONCURRENCY: push-macos-arm64-${{ github.ref_name }}
PLATFORM: macos-arm64
secrets: inherit

build-rerun_c-and-upload-windows:
build-rerun_c-and-upload-windows-x64:
needs: [checks]
name: "Windows-x64: Build & Upload rerun_c"
uses: ./.github/workflows/reusable_build_and_upload_rerun_c.yml
with:
CONCURRENCY: push-windows-${{ github.ref_name }}
PLATFORM: windows
CONCURRENCY: push-windows-x64-${{ github.ref_name }}
PLATFORM: windows-x64
secrets: inherit

# -----------------------------------------------------------------------------------
Expand Down Expand Up @@ -273,10 +282,11 @@ jobs:
name: "Bundle and upload rerun_cpp_sdk.zip"
needs:
[
build-rerun_c-and-upload-linux,
build-rerun_c-and-upload-macos-intel,
build-rerun_c-and-upload-macos-arm,
build-rerun_c-and-upload-windows,
build-rerun_c-and-upload-linux-x64,
build-rerun_c-and-upload-linux-arm64,
build-rerun_c-and-upload-macos-x64,
build-rerun_c-and-upload-macos-arm64,
build-rerun_c-and-upload-windows-x64,
]
uses: ./.github/workflows/reusable_bundle_and_upload_rerun_cpp.yml
secrets: inherit
Expand All @@ -290,10 +300,11 @@ jobs:
[
upload-web,
generate-pip-index,
build-rerun_c-and-upload-linux,
build-rerun_c-and-upload-macos-intel,
build-rerun_c-and-upload-macos-arm,
build-rerun_c-and-upload-windows,
build-rerun_c-and-upload-linux-x64,
build-rerun_c-and-upload-linux-arm64,
build-rerun_c-and-upload-macos-x64,
build-rerun_c-and-upload-macos-arm64,
build-rerun_c-and-upload-windows-x64,
build-rerun-cli-and-upload-linux,
build-rerun-cli-and-upload-macos-intel,
build-rerun-cli-and-upload-macos-arm,
Expand Down
26 changes: 17 additions & 9 deletions .github/workflows/reusable_build_and_upload_rerun_c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,18 @@ on:
workflow_dispatch:
inputs:
ADHOC_NAME:
required: true
required: false
type: string
description: "Name of the adhoc build, used for upload directory"
default: ""
PLATFORM:
type: choice
options:
- linux
- windows
- macos-arm
- macos-intel
- linux-arm64
- linux-x64
- windows-x64
- macos-arm64
- macos-x64
description: "Platform to build for"
required: true
CONCURRENCY:
Expand Down Expand Up @@ -70,25 +72,31 @@ jobs:
shell: bash
run: |
case "${{ inputs.PLATFORM }}" in
linux)
linux-arm64)
runner="buildjet-8vcpu-ubuntu-2204-arm"
target="aarch64-unknown-linux-gnu"
container="null"
lib_name="librerun_c.a"
;;
linux-x64)
runner="ubuntu-latest-16-cores"
target="x86_64-unknown-linux-gnu"
container="{'image': 'rerunio/ci_docker:0.11.0'}"
lib_name="librerun_c.a"
;;
windows)
windows-x64)
runner="windows-latest-8-cores"
target="x86_64-pc-windows-msvc"
container="null"
lib_name="rerun_c.lib"
;;
macos-arm)
macos-arm64)
runner="macos-latest" # Small runners, because building rerun_c is fast
target="aarch64-apple-darwin"
container="null"
lib_name="librerun_c.a"
;;
macos-intel)
macos-x64)
runner="macos-latest" # Small runners, because building rerun_c is fast
target="x86_64-apple-darwin"
container="null"
Expand Down
13 changes: 10 additions & 3 deletions rerun_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,19 @@ if(NOT TARGET rerun_c)
if(APPLE)
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
set(RERUN_C_LIB_DEFAULT ${RERUN_C_DEFAULT_LIB_DIR}/librerun_c__macos_x64.a)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
set(RERUN_C_LIB_DEFAULT ${RERUN_C_DEFAULT_LIB_DIR}/librerun_c__macos_arm64.a)
else()
message(WARNING "Unknown architecture ${CMAKE_SYSTEM_PROCESSOR}, can't find rerun_c library.")
endif()
elseif(UNIX) # if(LINUX) # CMake 3.25
# TODO(andreas): Arm support.
set(RERUN_C_LIB_DEFAULT ${RERUN_C_DEFAULT_LIB_DIR}/librerun_c__linux_x64.a)
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
set(RERUN_C_LIB_DEFAULT ${RERUN_C_DEFAULT_LIB_DIR}/librerun_c__linux_x64.a)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
set(RERUN_C_LIB_DEFAULT ${RERUN_C_DEFAULT_LIB_DIR}/librerun_c__linux_arm64.a)
else()
message(WARNING "Unknown architecture ${CMAKE_SYSTEM_PROCESSOR}, can't find rerun_c library.")
endif()
elseif(WIN32)
# TODO(andreas): Arm support.
set(RERUN_C_LIB_DEFAULT ${RERUN_C_DEFAULT_LIB_DIR}/rerun_c__win_x64.lib)
Expand Down Expand Up @@ -127,8 +132,10 @@ install(TARGETS rerun_sdk
install(DIRECTORY "${RERUN_CPP_SOURCE_DIR}/" TYPE INCLUDE FILES_MATCHING PATTERN "*.hpp")

option(RERUN_INSTALL_RERUN_C "Install rerun_c file." ON)

# if rerun_sdk is a static library it is compulsory to install rerun_c
get_target_property(rerun_sdk_TYPE rerun_sdk TYPE)

if(rerun_sdk_TYPE STREQUAL "STATIC_LIBRARY" AND NOT RERUN_INSTALL_RERUN_C)
message(FATAL_ERROR "It is not possible to disable RERUN_INSTALL_RERUN_C option if rerun_sdk is compiled as static library.")
endif()
Expand Down
1 change: 1 addition & 0 deletions rerun_cpp/cmake_setup_in_detail.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Pre-built libraries can be downloaded from [the release pages](https://github.co

If you want to match the behavior of `rerun_cpp_sdk.zip`, these libraries should be placed in the folder `rerun_cpp/lib`, renamed as:
- Linux, x64: `librerun_c__linux_x64.a`
- Linux, Arm64: `librerun_c__linux_arm64.a`
- Windows, x64: `rerun_c__win_x64.lib`
- Mac, Intel: `librerun_c__macos_x64.a`
- Mac, Apple Silicon: `librerun_c__macos_arm64.a`
Expand Down
11 changes: 7 additions & 4 deletions scripts/ci/bundle_and_upload_rerun_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,18 @@ def download_rerun_c(target_dir: str, git_hash: str, platform_filter: str = None
# See reusable_build_and_upload_rerun_c.yml for available libraries.
# See rerun_cpp_sdk/CMakeLists.txt for library names.
for src, dst in [
("linux/librerun_c.a", "librerun_c__linux_x64.a"),
("macos-arm/librerun_c.a", "librerun_c__macos_arm64.a"),
("macos-intel/librerun_c.a", "librerun_c__macos_x64.a"),
("windows/rerun_c.lib", "rerun_c__win_x64.lib"),
("linux-arm64/librerun_c.a", "librerun_c__linux_arm64.a"),
("linux-x64/librerun_c.a", "librerun_c__linux_x64.a"),
("macos-arm64/librerun_c.a", "librerun_c__macos_arm64.a"),
("macos-x64/librerun_c.a", "librerun_c__macos_x64.a"),
("windows-x64/rerun_c.lib", "rerun_c__win_x64.lib"),
]:
if platform_filter is not None and src.startswith(platform_filter) is False:
continue

blob = bucket.get_blob(f"commit/{git_hash}/rerun_c/{src}")
if blob is None:
raise RuntimeError(f"Blob not found: commit/{git_hash}/rerun_c/{src}")
with open(f"{target_dir}/{dst}", "wb") as f:
logging.info(f"Copying {blob.path} to {target_dir}/{dst}")
blob.download_to_file(f)
Expand Down
Loading