Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[android] Use -Oz to reduce binary size #15984

Merged
merged 4 commits into from
Nov 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions metrics/tests/binary-size/android-arm64-v8a/metrics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"file-size": [
[
"android-arm64-v8a",
"/src/workspace/next-android-arm64-v8a-release/lib/libmapbox-gl.so",
4596040
]
]
}
22 changes: 22 additions & 0 deletions metrics/tests/binary-size/android-arm64-v8a/style.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"version": 8,
"metadata": {
"test": {
"operations": [
["probeFileSize", "android-arm64-v8a", "/src/workspace/next-android-arm64-v8a-release/lib/libmapbox-gl.so", 0.01]
],
"width": 64,
"height": 64
}
},
"sources": {},
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "green"
}
}
]
}
9 changes: 9 additions & 0 deletions metrics/tests/binary-size/android-armeabi-v7a/metrics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"file-size": [
[
"android-armeabi-v7a",
"/src/workspace/next-android-armeabi-v7a-release/lib/libmapbox-gl.so",
3072756
]
]
}
22 changes: 22 additions & 0 deletions metrics/tests/binary-size/android-armeabi-v7a/style.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"version": 8,
"metadata": {
"test": {
"operations": [
["probeFileSize", "android-armeabi-v7a", "/src/workspace/next-android-armeabi-v7a-release/lib/libmapbox-gl.so", 0.01]
],
"width": 64,
"height": 64
}
},
"sources": {},
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "green"
}
}
]
}
Binary file added metrics/tests/binary-size/android-x86/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions metrics/tests/binary-size/android-x86/metrics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"file-size": [
[
"android-x86",
"/src/workspace/next-android-x86-release/lib/libmapbox-gl.so",
4625176
]
]
}
22 changes: 22 additions & 0 deletions metrics/tests/binary-size/android-x86/style.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"version": 8,
"metadata": {
"test": {
"operations": [
["probeFileSize", "android-x86", "/src/workspace/next-android-x86-release/lib/libmapbox-gl.so", 0.01]
],
"width": 64,
"height": 64
}
},
"sources": {},
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "green"
}
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions metrics/tests/binary-size/android-x86_64/metrics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"file-size": [
[
"android-x86_64",
"/src/workspace/next-android-x86_64-release/lib/libmapbox-gl.so",
4874600
]
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"metadata": {
"test": {
"operations": [
["probeFileSize", "android-arm64-v8a", "/src/workspace/next-android-arm64-v8a-release/lib/libmapbox-gl.so", 0.01],
["probeFileSize", "android-armeabi-v7a", "/src/workspace/next-android-armeabi-v7a-release/lib/libmapbox-gl.so", 0.01],
["probeFileSize", "android-x86-release", "/src/workspace/next-android-x86-release/lib/libmapbox-gl.so", 0.01],
["probeFileSize", "android-x86_64", "/src/workspace/next-android-x86_64-release/lib/libmapbox-gl.so", 0.01]
],
"width": 64,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions metrics/tests/binary-size/linux-clang8/metrics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"file-size": [
[
"mbgl-glfw",
"/src/workspace/next-linux-clang8-release/bin/mbgl-glfw",
6225032
],
[
"mbgl-offline",
"/src/workspace/next-linux-clang8-release/bin/mbgl-offline",
5532376
],
[
"mbgl-render",
"/src/workspace/next-linux-clang8-release/bin/mbgl-render",
6151096
]
]
}
24 changes: 24 additions & 0 deletions metrics/tests/binary-size/linux-clang8/style.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": 8,
"metadata": {
"test": {
"operations": [
["probeFileSize", "mbgl-glfw", "/src/workspace/next-linux-clang8-release/bin/mbgl-glfw", 0.01],
["probeFileSize", "mbgl-offline", "/src/workspace/next-linux-clang8-release/bin/mbgl-offline", 0.01],
["probeFileSize", "mbgl-render", "/src/workspace/next-linux-clang8-release/bin/mbgl-render", 0.01]
],
"width": 64,
"height": 64
}
},
"sources": {},
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "green"
}
}
]
}
Binary file added metrics/tests/binary-size/linux-gcc8/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions metrics/tests/binary-size/linux-gcc8/metrics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"file-size": [
[
"mbgl-glfw",
"/src/workspace/next-linux-gcc8-release/bin/mbgl-glfw",
7205192
],
[
"mbgl-offline",
"/src/workspace/next-linux-gcc8-release/bin/mbgl-offline",
6357224
],
[
"mbgl-render",
"/src/workspace/next-linux-gcc8-release/bin/mbgl-render",
7143752
]
]
}
24 changes: 24 additions & 0 deletions metrics/tests/binary-size/linux-gcc8/style.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": 8,
"metadata": {
"test": {
"operations": [
["probeFileSize", "mbgl-glfw", "/src/workspace/next-linux-gcc8-release/bin/mbgl-glfw", 0.01],
["probeFileSize", "mbgl-offline", "/src/workspace/next-linux-gcc8-release/bin/mbgl-offline", 0.01],
["probeFileSize", "mbgl-render", "/src/workspace/next-linux-gcc8-release/bin/mbgl-render", 0.01]
],
"width": 64,
"height": 64
}
},
"sources": {},
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "green"
}
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions metrics/tests/binary-size/macos-xcode11/metrics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"file-size": [
[
"mbgl-glfw",
"/src/workspace/next-macos-xcode11-release/bin/mbgl-glfw",
5439932
],
[
"mbgl-offline",
"/src/workspace/next-macos-xcode11-release/bin/mbgl-offline",
5334136
],
[
"mbgl-render",
"/src/workspace/next-macos-xcode11-release/bin/mbgl-render",
5384420
]
]
}
24 changes: 24 additions & 0 deletions metrics/tests/binary-size/macos-xcode11/style.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": 8,
"metadata": {
"test": {
"operations": [
["probeFileSize", "mbgl-glfw", "/src/workspace/next-macos-xcode11-release/bin/mbgl-glfw", 0.01],
["probeFileSize", "mbgl-offline", "/src/workspace/next-macos-xcode11-release/bin/mbgl-offline", 0.01],
["probeFileSize", "mbgl-render", "/src/workspace/next-macos-xcode11-release/bin/mbgl-render", 0.01]
],
"width": 64,
"height": 64
}
},
"sources": {},
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "green"
}
}
]
}
24 changes: 0 additions & 24 deletions metrics/tests/binary-size/shared-library/metrics.json

This file was deleted.

49 changes: 0 additions & 49 deletions metrics/tests/binary-size/tools/metrics.json

This file was deleted.

30 changes: 0 additions & 30 deletions metrics/tests/binary-size/tools/style.json

This file was deleted.

12 changes: 6 additions & 6 deletions next/platform/android/android.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,11 @@ set_target_properties(mbgl-benchmark-runner PROPERTIES LINK_FLAGS_RELEASE "-fuse
set_target_properties(mbgl-render-test-runner PROPERTIES LINK_FLAGS_RELEASE "-fuse-ld=gold -O2 -flto -Wl,--icf=safe")
set_target_properties(mbgl-test-runner PROPERTIES LINK_FLAGS_RELEASE "-fuse-ld=gold -O2 -flto -Wl,--icf=safe")

target_compile_options(example-custom-layer PRIVATE $<$<CONFIG:Release>:-Qunused-arguments -flto>)
target_compile_options(mapbox-gl PRIVATE $<$<CONFIG:Release>:-Qunused-arguments -flto>)
target_compile_options(mbgl-core PRIVATE $<$<CONFIG:Release>:-Qunused-arguments -flto>)
target_compile_options(mbgl-render-test-runner PRIVATE $<$<CONFIG:Release>:-Qunused-arguments -flto>)
target_compile_options(mbgl-vendor-icu PRIVATE $<$<CONFIG:Release>:-Qunused-arguments -flto>)
target_compile_options(mbgl-vendor-sqlite PRIVATE $<$<CONFIG:Release>:-Qunused-arguments -flto>)
target_compile_options(example-custom-layer PRIVATE $<$<CONFIG:Release>:-Oz -Qunused-arguments -flto>)
target_compile_options(mapbox-gl PRIVATE $<$<CONFIG:Release>:-Oz -Qunused-arguments -flto>)
target_compile_options(mbgl-core PRIVATE $<$<CONFIG:Release>:-Oz -Qunused-arguments -flto>)
target_compile_options(mbgl-render-test-runner PRIVATE $<$<CONFIG:Release>:-Oz -Qunused-arguments -flto>)
target_compile_options(mbgl-vendor-icu PRIVATE $<$<CONFIG:Release>:-Oz -Qunused-arguments -flto>)
target_compile_options(mbgl-vendor-sqlite PRIVATE $<$<CONFIG:Release>:-Oz -Qunused-arguments -flto>)

install(TARGETS mapbox-gl LIBRARY DESTINATION lib)
2 changes: 1 addition & 1 deletion render-test/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ std::vector<std::string> readExpectedImageEntries(const mbgl::filesystem::path&
}

std::vector<std::string> readExpectedMetricEntries(const mbgl::filesystem::path& base) {
static const std::regex regex(".*/metrics.*.json");
static const std::regex regex(".*/metrics.json");
return readExpectedEntries(regex, base);
}

Expand Down