Skip to content

Commit eb07c27

Browse files
cortinicofacebook-github-bot
authored andcommitted
Enable INTERPROCEDURAL_OPTIMIZATION for React Native (#50529)
Summary: This enables INTERPROCEDURAL_OPTIMIZATION for the CMake build of React Native. Changelog: [Android] [Changed] - Enable INTERPROCEDURAL_OPTIMIZATION for React Native Reviewed By: NickGerleman Differential Revision: D72574119
1 parent ee85957 commit eb07c27

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

Diff for: .github/actions/build-android/action.yml

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ runs:
1919
uses: ./.github/actions/setup-node
2020
- name: Install node dependencies
2121
uses: ./.github/actions/yarn-install
22+
- name: Install llvm-13-linker-tools
23+
run: sudo apt update && sudo apt install llvm-13-linker-tools
2224
- name: Set React Native Version
2325
shell: bash
2426
run: node ./scripts/releases/set-rn-artifacts-version.js --build-type ${{ inputs.release-type }}

Diff for: packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ android {
230230
arguments(
231231
"--log-level=ERROR",
232232
"-Wno-dev",
233+
"-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True",
233234
"-DHERMES_IS_ANDROID=True",
234235
"-DANDROID_STL=c++_shared",
235236
"-DANDROID_PIE=True",

Diff for: packages/react-native/ReactAndroid/src/main/jni/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ set(CMAKE_VERBOSE_MAKEFILE on)
88

99
project(ReactAndroid)
1010

11+
include(CheckIPOSupported)
12+
check_ipo_supported(RESULT IPO_SUPPORT)
13+
if (IPO_SUPPORT)
14+
message(STATUS "LTO support is enabled")
15+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
16+
endif()
17+
1118
include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)
1219

1320
# Convert input paths to CMake format (with forward slashes)

0 commit comments

Comments
 (0)