Skip to content

Commit

Permalink
feat: fix cmake paths
Browse files Browse the repository at this point in the history
  • Loading branch information
jpudysz committed Dec 4, 2023
1 parent 6476dd1 commit 8e61a1e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
7 changes: 3 additions & 4 deletions android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ add_library(unistyles
SHARED
../cxx/UnistylesRuntime.cpp
./src/main/cxx/cpp-adapter.cpp
../node_modules/react-native/ReactCommon/jsi/jsi/jsi.cpp
)

include_directories(
../cxx
../node_modules/react-native/React
../node_modules/react-native/React/Base
../node_modules/react-native/ReactCommon/jsi
)

set_target_properties(unistyles PROPERTIES
Expand All @@ -23,6 +19,9 @@ set_target_properties(unistyles PROPERTIES
POSITION_INDEPENDENT_CODE ON
)

find_package(ReactAndroid REQUIRED CONFIG)

target_link_libraries(unistyles
ReactAndroid::jsi
android
)
26 changes: 26 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,45 @@ buildscript {
apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'

def resolveBuildType() {
Gradle gradle = getGradle()
String tskReqStr = gradle.getStartParameter().getTaskRequests()['args'].toString()

return tskReqStr.contains('Release') ? 'release' : 'debug'
}

android {
compileSdkVersion safeExtGet('compileSdkVersion', 33)
namespace "com.unistyles"

defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 21)
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=c++_shared"
}
}
}

buildFeatures {
prefab true
}

externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}

packagingOptions {
doNotStrip resolveBuildType() == 'debug' ? "**/**/*.so" : ''
excludes = [
"META-INF",
"META-INF/**",
"**/libjsi.so",
"**/libc++_shared.so"
]
}
}

repositories {
Expand Down

0 comments on commit 8e61a1e

Please sign in to comment.