Skip to content

Commit 497a1cc

Browse files
authored
fix android CMake so LTO can be turned on (#9797)
our custom build system didn't set CMAKE_ANDROID_NDK_VERSION which is needed for CMake's check_ipo_supported.
1 parent 256a494 commit 497a1cc

File tree

5 files changed

+8
-2
lines changed

5 files changed

+8
-2
lines changed

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,13 @@ endif()
326326
if (FILAMENT_ENABLE_LTO)
327327
include(CheckIPOSupported)
328328

329-
check_ipo_supported(RESULT IPO_SUPPORT)
329+
check_ipo_supported(RESULT IPO_SUPPORT OUTPUT IPO_ERROR)
330330

331331
if (IPO_SUPPORT)
332-
message(STATUS "LTO support is enabled")
332+
message(STATUS "IPO / LTO is enabled")
333333
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
334+
else()
335+
message(WARNING "IPO / LTO is not supported by this architecture: ${IPO_ERROR}")
334336
endif()
335337
endif()
336338

build/toolchain-aarch64-linux-android.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ list(SORT NDK_VERSIONS)
4646
list(GET NDK_VERSIONS -1 NDK_VERSION)
4747
get_filename_component(NDK_VERSION ${NDK_VERSION} NAME)
4848
set(TOOLCHAIN ${ANDROID_HOME_UNIX}/ndk/${NDK_VERSION}/toolchains/llvm/prebuilt/${HOST_NAME_L}-x86_64)
49+
set(CMAKE_ANDROID_NDK_VERSION ${NDK_VERSION})
4950

5051
# specify the cross compiler
5152
set(COMPILER_SUFFIX)

build/toolchain-arm7-linux-android.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ list(SORT NDK_VERSIONS)
4747
list(GET NDK_VERSIONS -1 NDK_VERSION)
4848
get_filename_component(NDK_VERSION ${NDK_VERSION} NAME)
4949
set(TOOLCHAIN ${ANDROID_HOME_UNIX}/ndk/${NDK_VERSION}/toolchains/llvm/prebuilt/${HOST_NAME_L}-x86_64)
50+
set(CMAKE_ANDROID_NDK_VERSION ${NDK_VERSION})
5051

5152
# specify the cross compiler
5253
set(COMPILER_SUFFIX)

build/toolchain-x86-linux-android.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ list(SORT NDK_VERSIONS)
4646
list(GET NDK_VERSIONS -1 NDK_VERSION)
4747
get_filename_component(NDK_VERSION ${NDK_VERSION} NAME)
4848
set(TOOLCHAIN ${ANDROID_HOME_UNIX}/ndk/${NDK_VERSION}/toolchains/llvm/prebuilt/${HOST_NAME_L}-x86_64)
49+
set(CMAKE_ANDROID_NDK_VERSION ${NDK_VERSION})
4950

5051
# specify the cross compiler
5152
set(COMPILER_SUFFIX)

build/toolchain-x86_64-linux-android.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ list(SORT NDK_VERSIONS)
4646
list(GET NDK_VERSIONS -1 NDK_VERSION)
4747
get_filename_component(NDK_VERSION ${NDK_VERSION} NAME)
4848
set(TOOLCHAIN ${ANDROID_HOME_UNIX}/ndk/${NDK_VERSION}/toolchains/llvm/prebuilt/${HOST_NAME_L}-x86_64)
49+
set(CMAKE_ANDROID_NDK_VERSION ${NDK_VERSION})
4950

5051
# specify the cross compiler
5152
set(COMPILER_SUFFIX)

0 commit comments

Comments
 (0)