Skip to content

Commit

Permalink
Simplify ASAN settings. There is a master switch at top-level build.g…
Browse files Browse the repository at this point in the history
…radle.kts.

It however does not cover "wrap.sh" copying bash script (yet?).
  • Loading branch information
atsushieno committed Feb 16, 2022
1 parent 658a930 commit 5fad570
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
3 changes: 2 additions & 1 deletion androidaudioplugin-midi-device-service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ val kotlin_version: String by rootProject
val dokka_version: String by rootProject
val compose_version: String by rootProject
val aap_version: String by rootProject
val enable_asan: Boolean by rootProject

android {
this.ext["description"] = "AndroidAudioPlugin - MidiDeviceService support"
Expand All @@ -22,7 +23,7 @@ android {
externalNativeBuild {
cmake {
// https://github.com/google/prefab/blob/bccf5a6a75b67add30afbb6d4f7a7c50081d2d86/api/src/main/kotlin/com/google/prefab/api/Android.kt#L243
arguments ("-DANDROID_STL=c++_shared")
arguments ("-DANDROID_STL=c++_shared", "-DAAP_ENABLE_ASAN=" + (if (enable_asan) "1" else "0"))
cppFlags ("-Werror")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ target_link_libraries (aapmidideviceservice
)


# set non-zero this if you want to debug with AddressSanitizer
set(AAP_DEBUG_WITH_ASAN 0)

if (AAP_DEBUG_WITH_ASAN)
# You can set it via build.gradle
if (${AAP_ENABLE_ASAN})
target_compile_options (aapmidideviceservice
PUBLIC
-fsanitize=address -fno-omit-frame-pointer
Expand Down
3 changes: 2 additions & 1 deletion androidaudioplugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ val kotlin_version: String by rootProject
val dokka_version: String by rootProject
val compose_version: String by rootProject
val aap_version: String by rootProject
val enable_asan: Boolean by rootProject

android {
this.ext["description"] = "AndroidAudioPlugin - core"
Expand All @@ -24,7 +25,7 @@ android {
externalNativeBuild {
cmake {
// https://github.com/google/prefab/blob/bccf5a6a75b67add30afbb6d4f7a7c50081d2d86/api/src/main/kotlin/com/google/prefab/api/Android.kt#L243
arguments ("-DANDROID_STL=c++_shared")
arguments ("-DANDROID_STL=c++_shared", "-DAAP_ENABLE_ASAN=" + (if (enable_asan) "1" else "0"))
cppFlags ("-Werror")
}
}
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ buildscript {
val dokka_version: String by extra("1.6.10")
val compose_version: String by extra("1.1.0")
val aap_version: String by extra("0.6.26")
val enable_asan: Boolean by extra(false)

repositories {
google()
Expand Down
6 changes: 2 additions & 4 deletions native/androidaudioplugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ target_link_libraries (androidaudioplugin
${androidaudioplugin_LIBS}
)

# set non-zero this if you want to debug with AddressSanitizer
set(AAP_DEBUG_WITH_ASAN 0)

if (AAP_DEBUG_WITH_ASAN)
# You can set it via build.gradle.
if (${AAP_ENABLE_ASAN})
target_compile_options (androidaudioplugin
PUBLIC
-fsanitize=address -fno-omit-frame-pointer
Expand Down

0 comments on commit 5fad570

Please sign in to comment.