From f0afd6e514b60ab8c09ce8b2bafa62561874b949 Mon Sep 17 00:00:00 2001 From: Matthias Fulz Date: Mon, 24 Aug 2020 23:22:51 +0200 Subject: [PATCH] Better auto detection for android deps --- internal/binding/templater/template_cpp.go | 5 +++++ internal/utils/android.go | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/internal/binding/templater/template_cpp.go b/internal/binding/templater/template_cpp.go index 9e24a8f4..63783149 100644 --- a/internal/binding/templater/template_cpp.go +++ b/internal/binding/templater/template_cpp.go @@ -858,6 +858,11 @@ extern "C" int32_t __isPlatformVersionAtLeast(int32_t Platform, int32_t Major, i old() } } + + if target == "android" || target == "android-emulator" { + utils.ADD_ANDROID_MODULES_INCLUDE(strings.TrimPrefix(module, "Qt")) + } + } } diff --git a/internal/utils/android.go b/internal/utils/android.go index 5f8c2fa6..a6848903 100644 --- a/internal/utils/android.go +++ b/internal/utils/android.go @@ -148,3 +148,13 @@ func ANDROID_EXTRA_LIBS() string { func ANDROID_MODULES_INCLUDE() string { return os.Getenv("ANDROID_MODULES_INCLUDE") } + +func ADD_ANDROID_MODULES_INCLUDE(module string) { + val := os.Getenv("ANDROID_MODULES_INCLUDE") + mod := module + + if val != "" { + mod = "," + mod + } + os.Setenv("ANDROID_MODULES_INCLUDE", val+mod) +}