From facf2ba40eff013c14aa2aeef6a5535616d9ed9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Berg?= Date: Fri, 26 Mar 2010 01:07:24 +0100 Subject: [PATCH] Simplify Xcode's build settings on project and target level by using xcconfigs. Since xcconfigs can include other configs you get the same functionality that Xcode's build settings give you but with much more clarity. And it's much better for SCM, especially decentralized ones like git. Changes: - Archs is set to ppc i386 x86_64 - libgit2 is now compiled including -arch x86_64. - LTO is off (caused a Rel32 address space error when linking) - Default compiler is now LLVM GCC4.2 since Clang is not quite ready for Objective C++. (and we have some .mm files in there) - Based on: settings on Xcode's build settings dialogs are set according to the name of the xcconfig file. (project settings are based on Common.xcconfig) - Deleted all the overwritten settings (bold font display) that are now defined through the xcconfigs. --- Common.xcconfig | 60 ++++++++++++++++++++++ Debug.xcconfig | 33 ++++++++++++ GitX.xcodeproj/project.pbxproj | 92 ++++++++-------------------------- Install.xcconfig | 8 ++- Release.xcconfig | 22 ++++++++ 5 files changed, 143 insertions(+), 72 deletions(-) create mode 100644 Common.xcconfig create mode 100644 Debug.xcconfig create mode 100644 Release.xcconfig diff --git a/Common.xcconfig b/Common.xcconfig new file mode 100644 index 0000000..37b47ec --- /dev/null +++ b/Common.xcconfig @@ -0,0 +1,60 @@ +// +// Common.xcconfig +// GitX +// +// Created by Andre Berg on 25.03.10. +// Copyright 2010 Berg Media. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Archs and Target SDKs + +ARCHS = ppc i386 x86_64 +SDKROOT = macosx10.5 +MACOSX_DEPLOYMENT_TARGET = 10.5 + +// Search Paths + +HEADER_SEARCH_PATHS = libgit2/src +LIBRARY_SEARCH_PATHS = libgit2 +FRAMEWORK_SEARCH_PATHS = $(inherited) "$(SRCROOT)" + +// Info.plist + +INFOPLIST_PREPROCESS = YES +INFOPLIST_OTHER_PREPROCESSOR_FLAGS = -traditional +INFOPLIST_FILE = Info.plist +INFOPLIST_PREFIX_HEADER = $PROJECT_TEMP_DIR/revision // needed for the `git describe --long` output in the about dialog + +// Compiler + +GCC_ENABLE_OBJC_GC = required +// GCC_VERSION = // System Default (GCC 4.2) +GCC_VERSION = com.apple.compilers.llvmgcc42 // LLVM GCC 4.2 +// GCC_VERSION = com.apple.compilers.llvm.clang.1_0 // Clang LLVM 1.0 +GCC_C_LANGUAGE_STANDARD = gnu99 + +// Prefix Header + +GCC_PRECOMPILE_PREFIX_HEADER = YES +GCC_PREFIX_HEADER = GitX_Prefix.pch + +// Linking + +PREBINDING = NO +ZERO_LINK = NO // this is no longer needed + +// Other + +LLVM_LTO = NO // Link-Time Optimization causes a Rel32 address space error when linking (since we now target x86_64 inclusively) + diff --git a/Debug.xcconfig b/Debug.xcconfig new file mode 100644 index 0000000..8bb83ea --- /dev/null +++ b/Debug.xcconfig @@ -0,0 +1,33 @@ +// +// Debug.xcconfig +// GitX +// +// Created by Andre Berg on 25.03.10. +// Copyright 2010 Berg Media. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "Common.xcconfig" + +// Macros + +GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = DEBUG_BUILD + +OTHER_CFLAGS = -fdiagnostics-show-option + +// Warnings + +GCC_WARN_UNUSED_VARIABLE = YES +GCC_WARN_CHECK_SWITCH_STATEMENTS = YES +GCC_WARN_ABOUT_RETURN_TYPE = YES + diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj index 7b948da..0fc0fd9 100644 --- a/GitX.xcodeproj/project.pbxproj +++ b/GitX.xcodeproj/project.pbxproj @@ -30,10 +30,13 @@ 47DBDBCA0E95016F00671A1E /* PBNSURLPathUserDefaultsTransfomer.m in Sources */ = {isa = PBXBuildFile; fileRef = 47DBDBC90E95016F00671A1E /* PBNSURLPathUserDefaultsTransfomer.m */; }; 551BF11E112F376C00265053 /* gitx_askpasswd_main.m in Sources */ = {isa = PBXBuildFile; fileRef = 551BF11D112F376C00265053 /* gitx_askpasswd_main.m */; }; 551BF176112F3F4B00265053 /* gitx_askpasswd in Resources */ = {isa = PBXBuildFile; fileRef = 551BF111112F371800265053 /* gitx_askpasswd */; }; + 6501ABC1115C064A00171062 /* Release.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 6501ABC0115C064A00171062 /* Release.xcconfig */; }; 653D930A109BEAFE00B26705 /* PBGitXErrors.m in Sources */ = {isa = PBXBuildFile; fileRef = 653D9309109BEAFE00B26705 /* PBGitXErrors.m */; }; 654D16E8108C6CA6008D960C /* PBQLOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = F513085A0E0740F2000C8BCD /* PBQLOutlineView.m */; }; 654FEFA0115A2684004C8721 /* NSString_Truncate.m in Sources */ = {isa = PBXBuildFile; fileRef = 654FEF9F115A2684004C8721 /* NSString_Truncate.m */; }; 6552BA27109C4CA8003B4892 /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = 47DBDB690E94EF6500671A1E /* Preferences.xib */; }; + 65604690115BF80F0021E246 /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 6560468F115BF80F0021E246 /* Debug.xcconfig */; }; + 656F3B0B115C042D00CA816E /* Common.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 656F3B0A115C042D00CA816E /* Common.xcconfig */; }; 65C77FA0108BF560003BD3B5 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65C77F9F108BF560003BD3B5 /* Quartz.framework */; }; 65F3544011599F3100235D5B /* AddRemoteBranchTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = 65A102F110A7D9FE0033C593 /* AddRemoteBranchTemplate.png */; }; 65F3555B1159A95700235D5B /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65F3555A1159A95700235D5B /* MainMenu.xib */; }; @@ -243,6 +246,7 @@ 47DBDBC90E95016F00671A1E /* PBNSURLPathUserDefaultsTransfomer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBNSURLPathUserDefaultsTransfomer.m; sourceTree = ""; }; 551BF111112F371800265053 /* gitx_askpasswd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = gitx_askpasswd; sourceTree = BUILT_PRODUCTS_DIR; }; 551BF11D112F376C00265053 /* gitx_askpasswd_main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = gitx_askpasswd_main.m; sourceTree = ""; }; + 6501ABC0115C064A00171062 /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 653D9308109BEAFE00B26705 /* PBGitXErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitXErrors.h; sourceTree = ""; }; 653D9309109BEAFE00B26705 /* PBGitXErrors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitXErrors.m; sourceTree = ""; }; 654D17E7108C90E8008D960C /* html */ = {isa = PBXFileReference; lastKnownFileType = folder; path = html; sourceTree = ""; }; @@ -250,6 +254,8 @@ 654D18F6108C96CB008D960C /* install.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = install.sh; sourceTree = ""; }; 654FEF9F115A2684004C8721 /* NSString_Truncate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSString_Truncate.m; sourceTree = ""; }; 654FEFAF115A2747004C8721 /* NSString_Truncate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSString_Truncate.h; sourceTree = ""; }; + 6560468F115BF80F0021E246 /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + 656F3B0A115C042D00CA816E /* Common.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Common.xcconfig; sourceTree = ""; }; 65A102F110A7D9FE0033C593 /* AddRemoteBranchTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AddRemoteBranchTemplate.png; path = Images/AddRemoteBranchTemplate.png; sourceTree = ""; }; 65C77F9F108BF560003BD3B5 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; }; 770B37EC0679A11B001EADE2 /* GitTest_DataModel.xcdatamodel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.xcdatamodel; path = GitTest_DataModel.xcdatamodel; sourceTree = ""; }; @@ -616,6 +622,9 @@ 654D18EE108C9589008D960C /* Config */ = { isa = PBXGroup; children = ( + 656F3B0A115C042D00CA816E /* Common.xcconfig */, + 6560468F115BF80F0021E246 /* Debug.xcconfig */, + 6501ABC0115C064A00171062 /* Release.xcconfig */, 654D18EF108C9597008D960C /* Install.xcconfig */, ); name = Config; @@ -1133,6 +1142,9 @@ D8083DCD111F918900337480 /* PBCloneRepsitoryToSheet.xib in Resources */, D8FDD9F711432A12005647F6 /* PBCloneRepositoryPanel.xib in Resources */, F58DB56010566E3900CFDF4A /* PBGitSidebarView.xib in Resources */, + 65604690115BF80F0021E246 /* Debug.xcconfig in Resources */, + 656F3B0B115C042D00CA816E /* Common.xcconfig in Resources */, + 6501ABC1115C064A00171062 /* Release.xcconfig in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1192,7 +1204,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "export PATH=$PATH:$HOME/bin:$HOME/local/bin:/sw/bin:/opt/local/bin:`\"$TARGET_BUILD_DIR\"/gitx --git-path`\ngit submodule init\ngit submodule update\ncd libgit2\nrm -f libgit2.a\nmake CFLAGS=\"-arch i386 -arch ppc\"\nranlib libgit2.a"; + shellScript = "export PATH=$PATH:$HOME/bin:$HOME/local/bin:/sw/bin:/opt/local/bin:`\"$TARGET_BUILD_DIR\"/gitx --git-path`\ngit submodule init\ngit submodule update\ncd libgit2\nrm -f libgit2.a\nmake CFLAGS=\"-arch i386 -arch ppc -arch x86_64\"\nranlib libgit2.a"; }; F5CF04A20EAE696C00D75C81 /* Copy HTML files */ = { isa = PBXShellScriptBuildPhase; @@ -1456,58 +1468,27 @@ /* Begin XCBuildConfiguration section */ 26FC0A850875C7B200E6366F /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 6560468F115BF80F0021E246 /* Debug.xcconfig */; buildSettings = { COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)\"", - ); GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = GitX_Prefix.pch; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - HEADER_SEARCH_PATHS = libgit2/src; - INFOPLIST_FILE = Info.plist; - INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional"; - INFOPLIST_PREFIX_HEADER = $PROJECT_TEMP_DIR/revision; - INFOPLIST_PREPROCESS = YES; INSTALL_PATH = "$(HOME)/Applications"; - LIBRARY_SEARCH_PATHS = libgit2; PRODUCT_NAME = GitX; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; - WARNING_CFLAGS = "-Wno-deprecated-declarations"; WRAPPER_EXTENSION = app; - ZERO_LINK = NO; }; name = Debug; }; 26FC0A860875C7B200E6366F /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 6501ABC0115C064A00171062 /* Release.xcconfig */; buildSettings = { - DEBUG_INFORMATION_FORMAT = dwarf; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)\"", - ); - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = GitX_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = ""; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - HEADER_SEARCH_PATHS = libgit2/src; - INFOPLIST_FILE = Info.plist; - INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional"; - INFOPLIST_PREFIX_HEADER = $PROJECT_TEMP_DIR/revision; - INFOPLIST_PREPROCESS = YES; INSTALL_PATH = "$(HOME)/Applications"; - LIBRARY_SEARCH_PATHS = libgit2; - LLVM_LTO = YES; PRODUCT_NAME = GitX; WRAPPER_EXTENSION = app; }; @@ -1515,33 +1496,20 @@ }; 26FC0A890875C7B200E6366F /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 656F3B0A115C042D00CA816E /* Common.xcconfig */; buildSettings = { - GCC_ENABLE_OBJC_GC = required; - GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = DEBUG_BUILD; - GCC_VERSION = com.apple.compilers.llvmgcc42; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_PREPROCESS = YES; - PREBINDING = NO; - SDKROOT = macosx10.5; }; name = Debug; }; 26FC0A8A0875C7B200E6366F /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 656F3B0A115C042D00CA816E /* Common.xcconfig */; buildSettings = { - ARCHS = ( - ppc, - i386, - ); - GCC_ENABLE_OBJC_GC = required; - GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_PREFIX_HEADER = $PROJECT_TEMP_DIR/revision; INFOPLIST_PREPROCESS = YES; PREBINDING = NO; - SDKROOT = macosx10.5; }; name = Release; }; @@ -1613,19 +1581,21 @@ }; 654D1896108C9293008D960C /* Install */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 656F3B0A115C042D00CA816E /* Common.xcconfig */; buildSettings = { ARCHS = ( ppc, i386, + x86_64, ); + GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = required; - GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_PREFIX_HEADER = $PROJECT_TEMP_DIR/revision; INFOPLIST_PREPROCESS = YES; PREBINDING = NO; - SDKROOT = macosx10.5; + SDKROOT = macosx10.6; }; name = Install; }; @@ -1633,29 +1603,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = 654D18EF108C9597008D960C /* Install.xcconfig */; buildSettings = { - DEBUG_INFORMATION_FORMAT = dwarf; - DEPLOYMENT_LOCATION = NO; - DEPLOYMENT_POSTPROCESSING = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)\"", - ); - GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = GitX_Prefix.pch; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; - HEADER_SEARCH_PATHS = libgit2/src; - INFOPLIST_FILE = Info.plist; - INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional"; - INFOPLIST_PREFIX_HEADER = $PROJECT_TEMP_DIR/revision; - INFOPLIST_PREPROCESS = YES; - LIBRARY_SEARCH_PATHS = libgit2; - LLVM_LTO = YES; PRODUCT_NAME = GitX; - STRIP_INSTALLED_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Install; diff --git a/Install.xcconfig b/Install.xcconfig index e9b07ad..fe01bd4 100644 --- a/Install.xcconfig +++ b/Install.xcconfig @@ -19,4 +19,10 @@ // Global settings across build configurations for Install -CUSTOM_INSTALL_DIR = ${DEVELOPER_DIR}/Applications/Utilities/Third-Party \ No newline at end of file +#include "Release.xcconfig" + +CUSTOM_INSTALL_DIR = $(DEVELOPER_DIR)/Applications/Utilities/Third-Party // used with the Install.sh script + +DEPLOYMENT_POSTPROCESSING = YES + +STRIP_INSTALLED_PRODUCT = YES diff --git a/Release.xcconfig b/Release.xcconfig new file mode 100644 index 0000000..596e684 --- /dev/null +++ b/Release.xcconfig @@ -0,0 +1,22 @@ +// +// Release.xcconfig +// GitX +// +// Created by Andre Berg on 25.03.10. +// Copyright 2010 Berg Media. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "Common.xcconfig" + +DEBUG_INFORMATION_FORMAT = dwarf-with-dsym \ No newline at end of file