Skip to content

Commit

Permalink
fix: warnings in the Android NDK build (#1087)
Browse files Browse the repository at this point in the history
  • Loading branch information
supervacuus authored Nov 21, 2024
1 parent f1699e1 commit ce76b36
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 34 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ if(WIN32)
else()
# The Android tools ship with this ancient version, which we need to support.
cmake_minimum_required (VERSION 3.10)
cmake_policy(SET CMP0077 NEW)
endif()

#read sentry-native version
Expand Down
2 changes: 1 addition & 1 deletion external/libunwindstack-ndk
66 changes: 33 additions & 33 deletions ndk/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Android NDK support for sentry-native

| Package | Maven Central | Minimum Android API Level | Supported ABIs |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- | ------------------------------------------- |
|-------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------|---------------------------------------------|
| `io.sentry:sentry-native-ndk` | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-native-ndk/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-native-ndk) | 19 | "x86", "armeabi-v7a", "x86_64", "arm64-v8a" |

## Resources
Expand Down Expand Up @@ -29,46 +29,46 @@ The `ndk` project uses the Gradle build system in combination with CMake. You ca
1. Set a custom `versionName` in the `ndk/gradle.properties` file
2. Publish the package locally

```shell
cd ndk
./gradlew :sentry-native-ndk:publishToMavenLocal
```
```shell
cd ndk
./gradlew :sentry-native-ndk:publishToMavenLocal
```

3. Consume the build in your app

```
// usually settings.gradle
allprojects {
repositories {
mavenLocal()
}
}
// usually app/build.gradle
android {
buildFeatures {
prefab = true
}
}
dependencies {
implementation("io.sentry:sentry-native-ndk:<version>")
}
```
```
// usually settings.gradle
allprojects {
repositories {
mavenLocal()
}
}
// usually app/build.gradle
android {
buildFeatures {
prefab = true
}
}
dependencies {
implementation("io.sentry:sentry-native-ndk:<version>")
}
```

4. Link the pre-built packages with your native code

```cmake
# usually app/CMakeLists.txt
```cmake
# usually app/CMakeLists.txt
find_package(sentry-native-ndk REQUIRED CONFIG)
find_package(sentry-native-ndk REQUIRED CONFIG)
target_link_libraries(<app> PRIVATE
${LOG_LIB}
sentry-native-ndk::sentry-android
sentry-native-ndk::sentry
)
```
target_link_libraries(<app> PRIVATE
${LOG_LIB}
sentry-native-ndk::sentry-android
sentry-native-ndk::sentry
)
```

## Development

Expand Down
5 changes: 5 additions & 0 deletions src/sentry_value.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4127) // conditional expression is constant
#elif defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wstatic-in-inline"
#endif

#include "../vendor/mpack.h"

#if defined(_MSC_VER)
# pragma warning(pop)
#elif defined(__clang__)
# pragma clang diagnostic pop
#endif

#include "sentry_alloc.h"
Expand Down

0 comments on commit ce76b36

Please sign in to comment.