diff options
author | Teddy Wing | 2018-11-06 06:00:11 +0100 |
---|---|---|
committer | Teddy Wing | 2018-11-06 06:00:11 +0100 |
commit | e9b638521e7c450e4947090d3672aab852c8e758 (patch) | |
tree | 9801e9c09b73f067af99c0b43f969f74434326b1 | |
parent | 2c4c9e9e750cfe8c78fc15e07a405cfeef46d5c8 (diff) | |
download | DomeKey-e9b638521e7c450e4947090d3672aab852c8e758.tar.bz2 |
Add file size optimisations to Release build
* Remove `dome-key-map/target/debug` from Release library search paths.
This was causing the Release build to link against the debug version
of dome-key-map, resulting in a 25 Mb binary.
* Strip debug symbols
* Turn on link-time optimisation
This takes the Release binary down to 1.5 Mb.
Added an `archive` target to the Makefile. This does additional
optimisations (maybe stripping symbols?), and gives us a final binary
size of 1.1 Mb. Much better.
-rw-r--r-- | DomeKey.xcodeproj/project.pbxproj | 19 | ||||
-rw-r--r-- | Makefile | 11 |
2 files changed, 23 insertions, 7 deletions
diff --git a/DomeKey.xcodeproj/project.pbxproj b/DomeKey.xcodeproj/project.pbxproj index 58ec3a0..3b7b7ca 100644 --- a/DomeKey.xcodeproj/project.pbxproj +++ b/DomeKey.xcodeproj/project.pbxproj @@ -16,7 +16,6 @@ D160C2A12118EF9D007D1B50 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D160C2A02118EF9D007D1B50 /* main.m */; }; D18255B12180018C00ABC1E0 /* LicenseHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = D18255B02180018C00ABC1E0 /* LicenseHandler.m */; }; D1C80CA021877E8200011088 /* Sounds.m in Sources */ = {isa = PBXBuildFile; fileRef = D1C80C9F21877E8200011088 /* Sounds.m */; }; - D1E1020B21350BAD00B2CA29 /* libdome_key_map.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D1E1020A21350BAD00B2CA29 /* libdome_key_map.a */; }; D1EAA7A421803BB300A0AC35 /* XDG.m in Sources */ = {isa = PBXBuildFile; fileRef = D1EAA7A321803BB300A0AC35 /* XDG.m */; }; /* End PBXBuildFile section */ @@ -87,7 +86,6 @@ D18255B02180018C00ABC1E0 /* LicenseHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LicenseHandler.m; sourceTree = "<group>"; }; D1C80C9E21877E8200011088 /* Sounds.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Sounds.h; sourceTree = "<group>"; }; D1C80C9F21877E8200011088 /* Sounds.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Sounds.m; sourceTree = "<group>"; }; - D1E1020A21350BAD00B2CA29 /* libdome_key_map.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libdome_key_map.a; path = "lib/dome-key-map/target/debug/libdome_key_map.a"; sourceTree = "<group>"; }; D1E1020C21350D4100B2CA29 /* dome_key_map.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = dome_key_map.h; path = "lib/dome-key-map/dome_key_map.h"; sourceTree = SOURCE_ROOT; }; D1EAA7A221803BB300A0AC35 /* XDG.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XDG.h; sourceTree = "<group>"; }; D1EAA7A321803BB300A0AC35 /* XDG.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XDG.m; sourceTree = "<group>"; }; @@ -99,7 +97,6 @@ buildActionMask = 2147483647; files = ( D110C94A2122F1ED0094F963 /* libddhid.a in Frameworks */, - D1E1020B21350BAD00B2CA29 /* libdome_key_map.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -149,7 +146,6 @@ isa = PBXGroup; children = ( D160C31521197983007D1B50 /* DDHidLib.xcodeproj */, - D1E1020A21350BAD00B2CA29 /* libdome_key_map.a */, ); name = Frameworks; sourceTree = "<group>"; @@ -406,7 +402,10 @@ "$(inherited)", "$(PROJECT_DIR)/lib/dome-key-map/target/debug", ); - OTHER_LDFLAGS = "-ObjC"; + OTHER_LDFLAGS = ( + "-ObjC", + "-ldome_key_map", + ); PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; }; @@ -416,12 +415,18 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/lib/DDHidLib/lib"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/lib/dome-key-map/target/debug", + "$(PROJECT_DIR)/lib/dome-key-map/target/release", + ); + LLVM_LTO = YES; + OTHER_LDFLAGS = ( + "-ObjC", + "-ldome_key_map", ); - OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; }; @@ -40,6 +40,17 @@ $(RUST_LIB_RELEASE): $(RUST_SOURCE_FILES) $(MAKE) -C $(RUST_DIR) $(RUST_LOCAL_LIB_RELEASE) +# Archive + +.PHONY: archive +archive: clean-release + xcodebuild -project DomeKey.xcodeproj \ + -scheme DomeKey \ + -configuration Release \ + archive \ + -archivePath build/Release.xcarchive + + # Sounds DomeKey/sound_data.h: sounds/*.mp3 |