Skip to content

Commit

Permalink
build: add a workaround for Android builds
Browse files Browse the repository at this point in the history
The android build requires linking to libunwind to prevent underlinking.
This library is squirreled away into the compiler resource directory and
since we do not use the NDK compiler we do not pick it up. Explicitly
add the directory to our linker search path to pick up the necessary
library. This library should really be provided by the NDK as we cannot
ascertain if the unwinder has been modified or contains extensions.
  • Loading branch information
compnerd committed Jun 21, 2024
1 parent 56c1430 commit 0afd713
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ target_include_directories(firebase INTERFACE
if(ANDROID)
target_link_directories(firebase INTERFACE
third_party/firebase-development/usr/libs/android/${CMAKE_ANDROID_ARCH_ABI})
if(CMAKE_ANDROID_ARCH STREQUAL arm64)
target_link_directories(firebase INTERFACE
$ENV{ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/windows-x86_64/lib/clang/17/lib/linux/aarch64)
elseif(CMAKE_ANDROID_ARCH STREQUAL arm)
target_link_directories(firebase INTERFACE
$ENV{ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/windows-x86_64/lib/clang/17/lib/linux/arm)
elseif(CMAKE_ANDROID_ARCH STREQUAL x86)
target_link_directories(firebase INTERFACE
$ENV{ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/windows-x86_64/lib/clang/17/lib/linux/i386)
elseif(CMAKE_ANDROID_ARCH STREQUAL x86_64)
target_link_directories(firebase INTERFACE
$ENV{ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/windows-x86_64/lib/clang/17/lib/linux/x86_64)
else()
message(SEND_ERROR "unsupported architecture for Android")
endif()
elseif(WIN32)
target_link_directories(firebase INTERFACE
third_party/firebase-development/usr/libs/windows
Expand Down

0 comments on commit 0afd713

Please sign in to comment.