Skip to content
Draft
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
16 changes: 16 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Enable platform-specific config
common --enable_platform_specific_config

# GCC/Clang warnings
build:unix --copt=-Wall --copt=-Wextra --copt=-Wpedantic --copt=-Werror --copt=-std=c++17
# MSVC warnings
# build:msvc --copt=/W4 --copt=/WX

# Map configs to platforms/toolchains
build:macos --config=unix
build:linux --config=unix
# build:windows --config=msvc

# Compilation mode configs (optional)
build:debug --compilation_mode=dbg
build:release --compilation_mode=opt
33 changes: 33 additions & 0 deletions .github/workflows/build-bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: build bazel

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
build:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-latest
# - ubuntu-latest
steps:
- uses: bazel-contrib/[email protected]
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
external-cache: true

- name: Checkout repository
uses: actions/checkout@v4

- name: Build (fastbuild)
run: bazel build //...

# - name: Test (fastbuild)
# run: bazel test //...
200 changes: 61 additions & 139 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,155 +2,77 @@ name: build-all-configs
on: [push, pull_request]
jobs:
build-on-osx-for-objectiveC:
runs-on: macos-11
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v1
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_OBJC=ON -G Xcode
- name: Build release
run: cmake --build build --parallel $(sysctl -n hw.ncpu) --config Release
- name: Run tests
working-directory: build/test-suite
run: ctest -C Release -V
- name: Install files
run: cmake --build build --parallel $(sysctl -n hw.ncpu) --config Release --target install -- DESTDIR=check_install_root
- name: List installed files
working-directory: build/check_install_root
run: du -a | tail -r | awk -F ' ' '{print $2}'
- name: Test if expected files have been installed
working-directory: build/check_install_root
run: diff -u ../../test/objc_list.txt <(du -a | tail -r | awk -F ' ' '{print $2}')

build-on-osx-for-python:
runs-on: macos-11
strategy:
matrix:
python-version: ["3.7.12", "3.10.4"] # oldest and newest, rest assumed to work
steps:
- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
uses: py-actions/py-dependency-install@v3
with:
path: "requirements.txt"
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_PYTHON=ON
- name: Build release
run: cmake --build build --parallel $(sysctl -n hw.ncpu) --config Release
- name: Run tests
working-directory: build/test-suite
run: ctest -C Release -V
- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v4
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_OBJC=ON -DCMAKE_OSX_SYSROOT=$(xcodebuild -version -sdk macosx Path) -G Xcode
- name: Build release
run: cmake --build build --parallel $(sysctl -n hw.ncpu) --config Release
- name: Run tests
working-directory: build/test-suite
run: ctest -C Release -V
- name: Install files
run: cmake --build build --parallel $(sysctl -n hw.ncpu) --config Release --target install -- DESTDIR=check_install_root
- name: List installed files
working-directory: build/check_install_root
run: du -a | tail -r | awk -F ' ' '{print $2}'
- name: Test if expected files have been installed
working-directory: build/check_install_root
run: diff -u ../../test/objc_list.txt <(du -a | tail -r | awk -F ' ' '{print $2}')

build-on-ubuntu-for-jni:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v1
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_JNI=ON
- name: Build release
run: cmake --build build --parallel $(nproc) --config Release
- name: Run tests
working-directory: build/test-suite
run: ctest -C Release -V
- name: Install files
run: cmake --build build --parallel $(nproc) --config Release --target install -- DESTDIR=check_install_root
- name: List installed files
working-directory: build/check_install_root
run: du -a | tac | awk -F ' ' '{print $2}' | sort
- name: Test if expected files have been installed
working-directory: build/check_install_root
run: diff -u ../../test/jni_list.txt <(du -a | tac | awk -F ' ' '{print $2}' | sort)
- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v4
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_JNI=ON
- name: Build release
run: cmake --build build --parallel $(nproc) --config Release
- name: Run tests
working-directory: build/test-suite
run: ctest -C Release -V
- name: Install files
run: cmake --build build --parallel $(nproc) --config Release --target install -- DESTDIR=check_install_root
- name: List installed files
working-directory: build/check_install_root
run: du -a | tac | awk -F ' ' '{print $2}' | sort
- name: Test if expected files have been installed
working-directory: build/check_install_root
run: diff -u ../../test/jni_list.txt <(du -a | tac | awk -F ' ' '{print $2}' | sort)

build-on-ubuntu-for-jni-with-thread-attach:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v1
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_JNI=ON -DJNI_CPP_THREAD_ATTACH=ON -DCMAKE_BUILD_TYPE=Release
- name: Build release
run: cmake --build build --parallel $(nproc)
- name: Run tests
working-directory: build/test-suite
run: ctest -C Release -V

- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v4
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_JNI=ON -DJNI_CPP_THREAD_ATTACH=ON -DCMAKE_BUILD_TYPE=Release
- name: Build release
run: cmake --build build --parallel $(nproc)
- name: Run tests
working-directory: build/test-suite
run: ctest -C Release -V

build-on-ubuntu-for-android_arm32-with-thread-attach:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v1
- uses: ashutoshvarma/setup-ninja@master
with:
version: 1.10.2
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_JNI=ON -DJNI_CPP_THREAD_ATTACH=ON -DCMAKE_BUILD_TYPE=Release -DJINNI_BUILD_TESTING=OFF -DCMAKE_TOOLCHAIN_FILE=${ANDROID_SDK_ROOT}/ndk/$(ls ${ANDROID_SDK_ROOT}/ndk -C1 | sort -r | head -1)/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-26 -DANDROID_NATIVE_API_LEVEL=26 -DANDROID_ABI=armeabi-v7a -G Ninja
- name: Build release
run: cmake --build build --parallel $(nproc)

build-on-ubuntu-for-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v1
- name: Install dependencies
uses: py-actions/py-dependency-install@v3
with:
path: "requirements.txt"
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_PYTHON=ON
- name: Build release
run: cmake --build build --parallel $(nproc) --config Release
- name: Run tests
working-directory: build/test-suite
run: ctest -C Release -V


build-on-windows-for-cppcli:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: install djinni
run: |
$VERSION = 'v' + [regex]::Match((Get-Content .tool-versions), '^djinni (\d+.\d+.\d+)').captures.groups[1].value
$URL = 'https://github.com/cross-language-cpp/djinni-generator/releases/download/' + $VERSION + '/djinni.bat'
Invoke-WebRequest -Uri $URL -OutFile djinni.bat
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_CPPCLI=ON -DCMAKE_INSTALL_PREFIX=build/check_install_root -DDJINNI_EXECUTABLE="$(((Get-Location).Path) -replace "\\","/")/djinni.bat" -G "Visual Studio 17 2022"
- name: Install nuget dependencies
working-directory: build/test-suite
run: dotnet restore DjinniCppCliTest.csproj --runtime win-x64
- name: Build release
run: cmake --build build --config Release
- name: Run tests
working-directory: build/test-suite
run: dotnet test Release/DjinniCppCliTest.dll
- name: Install files
run: cmake --build build --config Release --target install
- name: List installed files
working-directory: build/check_install_root
run: Resolve-Path -Path (Get-ChildItem -Recurse).FullName -Relative
- name: Test if expected files have been installed
working-directory: build/check_install_root
run: if((Compare-Object (Get-Content ..\..\test\cppcli_list.txt) (Resolve-Path -Path (Get-ChildItem -Recurse).FullName -Relative))) { Write-Error "file list not equal" }

- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v4
- uses: ashutoshvarma/setup-ninja@master
with:
version: 1.10.2
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_JNI=ON -DJNI_CPP_THREAD_ATTACH=ON -DCMAKE_BUILD_TYPE=Release -DJINNI_BUILD_TESTING=OFF -DCMAKE_TOOLCHAIN_FILE=${ANDROID_SDK_ROOT}/ndk/$(ls ${ANDROID_SDK_ROOT}/ndk -C1 | sort -r | head -1)/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-26 -DANDROID_NATIVE_API_LEVEL=26 -DANDROID_ABI=armeabi-v7a -G Ninja
- name: Build release
run: cmake --build build --parallel $(nproc)
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ build/*
cmake-build-debug/
check_install_root/
.vscode/

# Bazel
/bazel-*
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
djinni 1.3.1
java zulu-11.41.23
djinni 1.4.1
java openjdk-25
Loading