Skip to content

Commit

Permalink
Use c++ modules
Browse files Browse the repository at this point in the history
  • Loading branch information
yujincheng08 committed Apr 28, 2024
1 parent bad5473 commit b3f81b7
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@ jobs:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- uses: seanmiddleditch/gha-setup-ninja@master
with:
version: 1.12.0
- name: Set up ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ runner.os }}-${{ github.sha }}
restore-keys: ${{ runner.os }}
- name: Build with Gradle
run: |
sudo rm -rf $ANDROID_HOME/cmake
echo 'org.gradle.caching=true' >> gradle.properties
echo 'org.gradle.parallel=true' >> gradle.properties
echo 'org.gradle.vfs.watch=true' >> gradle.properties
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ jobs:
distribution: 'temurin'
java-version: 17
cache: 'gradle'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- uses: seanmiddleditch/gha-setup-ninja@master
with:
version: 1.12.0
- name: Retrieve version
run: |
echo VERSION=$(echo ${{ github.event.head_commit.id }} | head -c 10) >> $GITHUB_ENV
Expand All @@ -33,6 +38,7 @@ jobs:
restore-keys: ${{ runner.os }}
- name: Build with Gradle
run: |
sudo rm -rf $ANDROID_HOME/cmake
echo 'org.gradle.caching=true' >> gradle.properties
echo 'org.gradle.parallel=true' >> gradle.properties
echo 'org.gradle.vfs.watch=true' >> gradle.properties
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ android {
namespace = "me.iacn.biliroaming"
compileSdk = 34
buildToolsVersion = "34.0.0"
ndkVersion = "26.0.10792818"
ndkVersion = "27.0.11718014-beta1"

buildFeatures {
prefab = true
Expand Down Expand Up @@ -115,7 +115,7 @@ android {
externalNativeBuild {
cmake {
path("src/main/jni/CMakeLists.txt")
version = "3.22.1+"
version = "3.28.0+"
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 3.4.1)
cmake_minimum_required(VERSION 3.28)
project(biliroaming)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_SCAN_FOR_MODULES ON)

find_package(cxx REQUIRED CONFIG)
link_libraries(cxx::cxx)

Expand Down
5 changes: 4 additions & 1 deletion app/src/main/jni/biliroaming.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <android/log.h>
#include <dex_helper.h>
#include <fcntl.h>
#include <jni.h>
#include <list>
Expand All @@ -8,6 +7,10 @@
#include <sys/stat.h>
#include <unistd.h>
#include <zlib.h>
#include <string>
#include <string_view>

import dex_helper;

#define LOG_TAG "BiliRoaming"
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)
Expand Down

0 comments on commit b3f81b7

Please sign in to comment.