Skip to content

Commit

Permalink
Use addon prebuilds
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperisager committed Aug 28, 2024
1 parent 8532a2e commit 98348d4
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:
java-version: 21
- run: npm install -g bare-dev
- run: bare-dev android sdk licenses accept
- run: bare-dev build
- run: bare-dev build --gradle
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.cxx/
.idea/
build/
prebuilds/
node_modules/
package-lock.json
local.properties
Expand Down
31 changes: 19 additions & 12 deletions app/CMakeLists.txt → CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,41 @@ project(bare_android C)

include(bare)

set(BARE_USE_SYSTEM_LOG ON CACHE BOOL "Use system logging" FORCE)

install_node_modules(WORKING_DIRECTORY ..)

add_subdirectory(../vendor/bare-kit vendor/bare-kit EXCLUDE_FROM_ALL)
install_node_modules()

add_bare_bundle(
bare_android_bundle
ENTRY app/src/main/js/app.js
OUT app/src/main/assets/app.bundle
WORKING_DIRECTORY ..
)

add_library(bare_android SHARED)

add_dependencies(bare_android bare_android_bundle)

set_target_properties(
bare_android
PROPERTIES
C_STANDARD 99
POSITION_INDEPENDENT_CODE ON
LINKER_LANGUAGE C
OUTPUT_NAME app
)

add_dependencies(bare_android bare_android_bundle)
target_sources(
bare_android
PUBLIC
app/src/main/assets/app.bundle
)

link_bare_modules(
bare_android
PREBUILDS
DESTINATION app/src/main/jniLibs/${ANDROID_ABI}
)

find_package(bare-kit REQUIRED CONFIG)

target_link_libraries(
bare_android
PUBLIC
bare_kit
bare-kit::bare_kit
)

link_bare_modules(bare_android WORKING_DIRECTORY ..)
10 changes: 7 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
android {
namespace 'to.holepunch.bare.android'
compileSdk 34
ndkVersion '27.0.11718014'
ndkVersion '27.0.12077973'

defaultConfig {
applicationId 'to.holepunch.bare.android'
Expand All @@ -17,11 +17,15 @@ android {
externalNativeBuild {
cmake {
targets 'bare_android'
arguments "-DCMAKE_MODULE_PATH=$System.env.CMAKE_MODULE_PATH"
arguments "-DCMAKE_MODULE_PATH=" + "bare-dev paths cmake".execute().text, "-DANDROID_STL=none"
}
}
}

buildFeatures {
prefab true
}

buildTypes {
release {
signingConfig signingConfigs.debug
Expand All @@ -31,7 +35,7 @@ android {
externalNativeBuild {
cmake {
version '3.25.0+'
path 'CMakeLists.txt'
path '../CMakeLists.txt'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class MainActivity extends Activity {
static {
System.loadLibrary("bare_android");
System.loadLibrary("app");
}

Worklet worklet;
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/jniLibs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore

0 comments on commit 98348d4

Please sign in to comment.