From e9b638521e7c450e4947090d3672aab852c8e758 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 6 Nov 2018 06:00:11 +0100 Subject: 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. --- DomeKey.xcodeproj/project.pbxproj | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'DomeKey.xcodeproj') 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 = ""; }; D1C80C9E21877E8200011088 /* Sounds.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Sounds.h; sourceTree = ""; }; D1C80C9F21877E8200011088 /* Sounds.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Sounds.m; sourceTree = ""; }; - 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 = ""; }; 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 = ""; }; D1EAA7A321803BB300A0AC35 /* XDG.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XDG.m; sourceTree = ""; }; @@ -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 = ""; @@ -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; }; -- cgit v1.2.3