Skip to content

Commit

Permalink
Simplify Xcode's build settings on project and target level by using …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
andreberg committed Mar 26, 2010
1 parent e004c64 commit facf2ba
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 72 deletions.
60 changes: 60 additions & 0 deletions Common.xcconfig
Original file line number Diff line number Diff line change
@@ -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)

33 changes: 33 additions & 0 deletions Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -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

92 changes: 21 additions & 71 deletions GitX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -243,13 +246,16 @@
47DBDBC90E95016F00671A1E /* PBNSURLPathUserDefaultsTransfomer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBNSURLPathUserDefaultsTransfomer.m; sourceTree = "<group>"; };
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 = "<group>"; };
6501ABC0115C064A00171062 /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
653D9308109BEAFE00B26705 /* PBGitXErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitXErrors.h; sourceTree = "<group>"; };
653D9309109BEAFE00B26705 /* PBGitXErrors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitXErrors.m; sourceTree = "<group>"; };
654D17E7108C90E8008D960C /* html */ = {isa = PBXFileReference; lastKnownFileType = folder; path = html; sourceTree = "<group>"; };
654D18EF108C9597008D960C /* Install.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Install.xcconfig; sourceTree = "<group>"; };
654D18F6108C96CB008D960C /* install.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = install.sh; sourceTree = "<group>"; };
654FEF9F115A2684004C8721 /* NSString_Truncate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSString_Truncate.m; sourceTree = "<group>"; };
654FEFAF115A2747004C8721 /* NSString_Truncate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSString_Truncate.h; sourceTree = "<group>"; };
6560468F115BF80F0021E246 /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
656F3B0A115C042D00CA816E /* Common.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Common.xcconfig; sourceTree = "<group>"; };
65A102F110A7D9FE0033C593 /* AddRemoteBranchTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AddRemoteBranchTemplate.png; path = Images/AddRemoteBranchTemplate.png; sourceTree = "<group>"; };
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 = "<group>"; };
Expand Down Expand Up @@ -616,6 +622,9 @@
654D18EE108C9589008D960C /* Config */ = {
isa = PBXGroup;
children = (
656F3B0A115C042D00CA816E /* Common.xcconfig */,
6560468F115BF80F0021E246 /* Debug.xcconfig */,
6501ABC0115C064A00171062 /* Release.xcconfig */,
654D18EF108C9597008D960C /* Install.xcconfig */,
);
name = Config;
Expand Down Expand Up @@ -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;
};
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1456,92 +1468,48 @@
/* 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;
};
name = Release;
};
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;
};
Expand Down Expand Up @@ -1613,49 +1581,31 @@
};
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;
};
654D1897108C9293008D960C /* Install */ = {
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;
Expand Down
8 changes: 7 additions & 1 deletion Install.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@

// Global settings across build configurations for Install

CUSTOM_INSTALL_DIR = ${DEVELOPER_DIR}/Applications/Utilities/Third-Party
#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
22 changes: 22 additions & 0 deletions Release.xcconfig
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit facf2ba

Please sign in to comment.