Skip to content

Commit fe6ef40

Browse files
authored
Enable LTO for Android build (microsoft#21243)
### Description Enable LTO for Android build, which can reduce binary size by 6%.
1 parent 28af544 commit fe6ef40

File tree

5 files changed

+9
-0
lines changed

5 files changed

+9
-0
lines changed

tools/ci_build/github/android/default_full_aar_build_settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"android_min_sdk_version": 21,
99
"android_target_sdk_version": 24,
1010
"build_params": [
11+
"--enable_lto",
1112
"--android",
1213
"--parallel",
1314
"--cmake_generator=Ninja",

tools/ci_build/github/android/training_full_aar_build_settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"android_min_sdk_version": 21,
99
"android_target_sdk_version": 24,
1010
"build_params": [
11+
"--enable_lto",
1112
"--android",
1213
"--parallel",
1314
"--cmake_generator=Ninja",

tools/ci_build/github/azure-pipelines/android-x86_64-crosscompile-ci-pipeline.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ stages:
8585
8686
- script: |
8787
python3 tools/ci_build/build.py \
88+
--enable_lto \
8889
--android \
8990
--build_dir build \
9091
--android_sdk_path $ANDROID_HOME \
@@ -169,6 +170,7 @@ stages:
169170
170171
- script: |
171172
python3 tools/ci_build/build.py \
173+
--enable_lto \
172174
--android \
173175
--build_dir build_nnapi \
174176
--android_sdk_path $ANDROID_HOME \
@@ -264,6 +266,7 @@ stages:
264266

265267
- script: |
266268
python3 tools/ci_build/build.py \
269+
--enable_lto \
267270
--android \
268271
--build_dir build \
269272
--android_sdk_path $ANDROID_HOME \
@@ -329,6 +332,7 @@ stages:
329332

330333
- script: |
331334
python3 tools/ci_build/build.py \
335+
--enable_lto \
332336
--android \
333337
--build_dir build_nnapi \
334338
--android_sdk_path $ANDROID_HOME \
@@ -401,6 +405,7 @@ stages:
401405

402406
- script: |
403407
python3 tools/ci_build/build.py \
408+
--enable_lto \
404409
--android \
405410
--build_dir build_nnapi \
406411
--android_sdk_path $ANDROID_HOME \

tools/ci_build/github/linux/ort_minimal/build_check_binsize_config/android_minimal_baseline.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"os": "android",
44
"arch": "arm64-v8a",
55
"build_params": [
6+
"--enable_lto",
67
"--android",
78
"--android_sdk_path=/android_home",
89
"--android_ndk_path=/ndk_home",

tools/ci_build/github/linux/ort_minimal/build_check_binsize_config/android_minimal_with_mobile_package_ops.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"os": "android",
44
"arch": "arm64-v8a",
55
"build_params": [
6+
"--enable_lto",
67
"--android",
78
"--android_sdk_path=/android_home",
89
"--android_ndk_path=/ndk_home",

0 commit comments

Comments
 (0)