Updating for Snow Leopard. Cleaning up the sample code. Updating the README with instructions for installation from the command line.

This commit is contained in:
preston.a.jackson 2009-08-28 22:11:18 +00:00
parent b5936af65c
commit cb2b1640b2
5 changed files with 69 additions and 87 deletions

63
README
View File

@ -202,9 +202,9 @@ defaults to xcode/build). Alternatively, at the command line, enter:
xcodebuild
This will build the "Release" configuration of the gtest.framework, but you can
select the "Debug" configuration with a command line option. See the
"xcodebuild" man page for more information.
This will build the "Release" configuration of gtest.framework in your
default build location. See the "xcodebuild" man page for more information about
building different configurations and building in different locations.
To test the gtest.framework in Xcode, change the active target to "Check" and
then build. This target builds all of the tests and then runs them. Don't worry
@ -212,21 +212,39 @@ if you see some errors. Xcode reports all test failures (even the intentional
ones) as errors. However, you should see a "Build succeeded" message at the end
of the build log. To run all of the tests from the command line, enter:
xcodebuid -target Check
xcodebuild -target Check
Installation with xcodebuild requires specifying an installation desitination
directory, known as the DSTROOT. Three items will be installed when using
xcodebuild:
$DSTROOT/Library/Frameworks/gtest.framework
$DSTROOT/usr/local/lib/libgtest.a
$DSTROOT/usr/local/lib/libgtest_main.a
You specify the installation directory on the command line with the other
xcodebuild options. Here's how you would install in a user-visible location:
xcodebuild install DSTROOT=~
To perform a system-wide inistall, escalate to an administrator and specify
the file system root as the DSTROOT:
sudo xcodebuild install DSTROOT=/
To uninstall gtest.framework via the command line, you need to delete the three
items listed above. Remember to escalate to an administrator if deleting these
from the system-wide location using the commands listed below:
sudo rm -r /Library/Frameworks/gtest.framework
sudo rm /usr/local/lib/libgtest.a
sudo rm /usr/local/lib/libgtest_main.a
It is also possible to build and execute individual tests within Xcode. Each
test has its own Xcode "Target" and Xcode "Executable". To build any of the
tests, change the active target and the active executable to the test of
interest and then build and run.
NOTE: Several tests use a Python script to run the test executable. These can be
run from Xcode by creating a "Custom Executable". For example, to run the Python
script which executes the gtest_color_test, select the Project->New Custom
Executable... menu item. When prompted, set the "Executable Name" to something
like "run_gtest_color_test" and set the "Executable Path" to the path of the
gtest_color_test.py script. Finally, choose "Run" from the Run menu and check
the Console for the results.
Individual tests can be built from the command line using:
xcodebuild -target <test_name>
@ -235,21 +253,14 @@ These tests can be executed from the command line by moving to the build
directory and then (in bash)
export DYLD_FRAMEWORK_PATH=`pwd`
./<test_name> # (if it is not a python test, e.g. ./gtest_unittest)
# OR
./<test_name>.py # (if it is a python test, e.g. ./gtest_color_test.py)
./<test_name> # (e.g. ./gtest_unittest)
To use the gtest.framework for your own tests, first, add the framework to Xcode
project. Next, create a new executable target and add the framework to the
"Link Binary With Libraries" build phase. Select "Edit Active Executable" from
the "Project" menu. In the "Arguments" tab, add
"DYLD_FRAMEWORK_PATH" : "/real/framework/path"
in the "Variables to be set in the environment:" list, where you replace
"/real/framework/path" with the actual location of the gtest.framework. Now
when you run your executable, it will load the framework and your test will
run as expected.
To use gtest.framework for your own tests, first, install the framework using
the steps described above. Then add it to your Xcode project by selecting
Project->Add to Project... from the main menu. Next, add libgtest_main.a from
gtest.framework/Resources directory using the same menu command. Finally,
create a new executable target and add gtest.framework and libgtest_main.a to
the "Link Binary With Libraries" build phase.
### Using GNU Make ###
The make/ directory contains a Makefile that you can use to build

View File

@ -13,5 +13,5 @@ GCC_DYNAMIC_NO_PIC = NO
// Dynamic libs should not have their external symbols stripped.
STRIP_STYLE = non-global
// Installation Directory
INSTALL_PATH = @loader_path/../Frameworks
// Let the user install by specifying the $DSTROOT with xcodebuild
SKIP_INSTALL = NO

View File

@ -13,3 +13,6 @@ GCC_DYNAMIC_NO_PIC = NO
// Static libs should not have their internal globals or external symbols
// stripped.
STRIP_STYLE = debugging
// Let the user install by specifying the $DSTROOT with xcodebuild
SKIP_INSTALL = NO

View File

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
@ -11,10 +11,8 @@
3B7EB1260E5AEE3500C7F239 /* widget.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B7EB1240E5AEE3500C7F239 /* widget.h */; settings = {ATTRIBUTES = (Public, ); }; };
3B7EB1280E5AEE4600C7F239 /* widget_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B7EB1270E5AEE4600C7F239 /* widget_test.cc */; };
3B7EB1480E5AF3B400C7F239 /* Widget.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D07F2C80486CC7A007CD1D0 /* Widget.framework */; };
3B7F0C8D0E567CC5009CA236 /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BA867DC0E561B7C00326077 /* gtest.framework */; };
40C849E8101A426E0083642A /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 40C849E7101A426E0083642A /* libgtest_main.a */; };
40C849EF101A42C80083642A /* gtest.framework in Copy Test Framework */ = {isa = PBXBuildFile; fileRef = 3BA867DC0E561B7C00326077 /* gtest.framework */; };
40C849F2101A42CC0083642A /* libgtest_main.a in Copy Test Framework */ = {isa = PBXBuildFile; fileRef = 40C849E7101A426E0083642A /* libgtest_main.a */; };
408BEC281046D72200DEF522 /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 408BEC271046D72200DEF522 /* gtest.framework */; };
408BEC431046D7B300DEF522 /* libgtest_main.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 408BEC421046D7B300DEF522 /* libgtest_main.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -27,28 +25,13 @@
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
40C849F5101A42EA0083642A /* Copy Test Framework */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 16;
files = (
40C849F2101A42CC0083642A /* libgtest_main.a in Copy Test Framework */,
40C849EF101A42C80083642A /* gtest.framework in Copy Test Framework */,
);
name = "Copy Test Framework";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
3B07BDEA0E3F3F9E00647869 /* WidgetFrameworkTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = WidgetFrameworkTest; sourceTree = BUILT_PRODUCTS_DIR; };
3B7EB1230E5AEE3500C7F239 /* widget.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = widget.cc; sourceTree = "<group>"; };
3B7EB1240E5AEE3500C7F239 /* widget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = widget.h; sourceTree = "<group>"; };
3B7EB1270E5AEE4600C7F239 /* widget_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = widget_test.cc; sourceTree = "<group>"; };
3BA867DC0E561B7C00326077 /* gtest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = gtest.framework; path = ../../build/Debug/gtest.framework; sourceTree = "<group>"; };
40C849E7101A426E0083642A /* libgtest_main.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgtest_main.a; path = ../../build/Debug/gtest.framework/Versions/A/Resources/libgtest_main.a; sourceTree = SOURCE_ROOT; };
408BEC271046D72200DEF522 /* gtest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = gtest.framework; path = /Library/Frameworks/gtest.framework; sourceTree = "<absolute>"; };
408BEC421046D7B300DEF522 /* libgtest_main.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgtest_main.a; path = /Library/Frameworks/gtest.framework/Versions/A/Resources/libgtest_main.a; sourceTree = "<absolute>"; };
8D07F2C70486CC7A007CD1D0 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D07F2C80486CC7A007CD1D0 /* Widget.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Widget.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
@ -59,8 +42,8 @@
buildActionMask = 2147483647;
files = (
3B7EB1480E5AF3B400C7F239 /* Widget.framework in Frameworks */,
3B7F0C8D0E567CC5009CA236 /* gtest.framework in Frameworks */,
40C849E8101A426E0083642A /* libgtest_main.a in Frameworks */,
408BEC281046D72200DEF522 /* gtest.framework in Frameworks */,
408BEC431046D7B300DEF522 /* libgtest_main.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -98,8 +81,8 @@
0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = {
isa = PBXGroup;
children = (
3BA867DC0E561B7C00326077 /* gtest.framework */,
40C849E7101A426E0083642A /* libgtest_main.a */,
408BEC421046D7B300DEF522 /* libgtest_main.a */,
408BEC271046D72200DEF522 /* gtest.framework */,
);
name = "External Frameworks and Libraries";
sourceTree = "<group>";
@ -149,7 +132,6 @@
buildPhases = (
3B07BDE70E3F3F9E00647869 /* Sources */,
3B07BDE80E3F3F9E00647869 /* Frameworks */,
40C849F5101A42EA0083642A /* Copy Test Framework */,
);
buildRules = (
);
@ -187,7 +169,7 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject "WidgetFramework" */;
compatibilityVersion = "Xcode 3.1";
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 0867D691FE84028FC02AAC07 /* gTestExample */;
productRefGroup = 034768DDFF38A45A11DB9C8B /* Products */;
@ -251,16 +233,6 @@
3B07BDEC0E3F3F9F00647869 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/externals/googletest/xcode/build/Debug\"",
"\"$(SRCROOT)/../../build/Debug\"",
);
INSTALL_PATH = /usr/local/bin;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../../build/Debug/gtest.framework/Versions/A/Resources\"",
);
PRODUCT_NAME = WidgetFrameworkTest;
};
name = Debug;
@ -268,16 +240,6 @@
3B07BDED0E3F3F9F00647869 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/externals/googletest/xcode/build/Debug\"",
"\"$(SRCROOT)/../../build/Debug\"",
);
INSTALL_PATH = /usr/local/bin;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../../build/Debug/gtest.framework/Versions/A/Resources\"",
);
PRODUCT_NAME = WidgetFrameworkTest;
};
name = Release;
@ -290,10 +252,7 @@
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@loader_path/../Frameworks";
LIBRARY_STYLE = DYNAMIC;
MACH_O_TYPE = mh_dylib;
PRODUCT_NAME = Widget;
WRAPPER_EXTENSION = framework;
};
name = Debug;
};
@ -305,27 +264,23 @@
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@loader_path/../Frameworks";
LIBRARY_STYLE = DYNAMIC;
MACH_O_TYPE = mh_dylib;
PRODUCT_NAME = Widget;
WRAPPER_EXTENSION = framework;
};
name = Release;
};
4FADC24708B4156D00ABE55E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx10.5;
GCC_VERSION = 4.0;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Debug;
};
4FADC24808B4156D00ABE55E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
SDKROOT = macosx10.5;
GCC_VERSION = 4.0;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Release;
};

View File

@ -95,6 +95,13 @@
remoteGlobalIDString = 4089A0120FFACEFC000B29AE;
remoteInfo = sample1_unittest;
};
408BEC0F1046CFE900DEF522 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 40C848F9101A209C0083642A;
remoteInfo = "gtest-static";
};
40C44AE50E379922008FCC51 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
@ -555,6 +562,7 @@
);
dependencies = (
40C44AE60E379922008FCC51 /* PBXTargetDependency */,
408BEC101046CFE900DEF522 /* PBXTargetDependency */,
40C8499C101A36DC0083642A /* PBXTargetDependency */,
);
name = "gtest-framework";
@ -716,6 +724,11 @@
target = 4089A0120FFACEFC000B29AE /* sample1_unittest-framework */;
targetProxy = 4089A0970FFAD34A000B29AE /* PBXContainerItemProxy */;
};
408BEC101046CFE900DEF522 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 40C848F9101A209C0083642A /* gtest-static */;
targetProxy = 408BEC0F1046CFE900DEF522 /* PBXContainerItemProxy */;
};
40C44AE60E379922008FCC51 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 40C44ADC0E3798F4008FCC51 /* Version Info */;