Skip to content

Commit

Permalink
Android extra flags not applied on initial CMake generation
Browse files Browse the repository at this point in the history
CMAKE_CXX_FLAGS was overwritten if not already in the cache (i.e. when first built).  Presumably down to toolchain loading order.

Also removed the -DANDROID=1 define as it suffers the same issue, but the Android toolchain defines it so it isn't used anyway.
  • Loading branch information
cmannett85-arm committed Nov 7, 2023
1 parent b711a05 commit cf9ebb5
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions util/test/demos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ if(BUILD_ANDROID)
# Default to arm64 if nothing is specified on the command line.
# Options are {armeabi-v7a,arm64-v8a}
set(ANDROID_ABI "arm64-v8a" CACHE STRING "The Android ABI to build for")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DANDROID=1")

# The version of fmt used will not build due to std::char_traits support of non-std types being
# deprecated in the version of LLVM used by NDK v26
if(NOT "${ANDROID_NDK_VERSION}" VERSION_LESS "26.0.0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
endif()
endif()

set(PROJECT demos)
Expand Down Expand Up @@ -311,6 +303,12 @@ if(APPLE)
elseif(BUILD_ANDROID)
target_compile_definitions(demos PRIVATE -DVK_USE_PLATFORM_ANDROID_KHR=1)
list(APPEND LIBS PRIVATE -llog -landroid -lEGL)

# The version of fmt used will not build due to std::char_traits support of non-std types being
# deprecated in the version of LLVM used by NDK v26
if(NOT "${ANDROID_NDK_VERSION}" VERSION_LESS "26.0.0")
target_compile_options(demos PRIVATE -Wno-deprecated-declarations)
endif()
elseif(UNIX)
target_compile_definitions(demos PRIVATE -DVK_USE_PLATFORM_XCB_KHR=1)
set(LIBS -lX11 -lxcb -lX11-xcb)
Expand Down

0 comments on commit cf9ebb5

Please sign in to comment.