Lines Matching +full:build +full:- +full:and +full:- +full:test
2 ### Generic Build Instructions ###
6 To build Google Test and your tests that use it, you need to tell your
7 build system where to find its headers and source files. The exact
8 way to do it depends on which build system you use, and is usually
11 #### Build #### subsubsection
13 Suppose you put Google Test in directory `${GTEST_DIR}`. To build it,
14 create a library build target (or a project as called by Visual Studio
15 and Xcode) to compile
17 ${GTEST_DIR}/src/gtest-all.cc
19 with `${GTEST_DIR}/include` in the system header search path and `${GTEST_DIR}`
20 in the normal header search path. Assuming a Linux-like system and gcc,
23 g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \
24 -pthread -c ${GTEST_DIR}/src/gtest-all.cc
25 ar -rv libgtest.a gtest-all.o
27 (We need `-pthread` as Google Test uses threads.)
29 Next, you should compile your test source file with
30 `${GTEST_DIR}/include` in the system header search path, and link it
31 with gtest and any other necessary libraries:
33 g++ -isystem ${GTEST_DIR}/include -pthread path/to/your_test.cc libgtest.a \
34 -o your_test
37 use to build Google Test on systems where GNU make is available
38 (e.g. Linux, Mac OS X, and Cygwin). It doesn't try to build Google
39 Test's own tests. Instead, it just builds the Google Test library and
40 a sample test. You can use it as a starting point for your own build
56 Google Test comes with a CMake build script (
58 cross-platform.). If you don't have CMake installed already, you can
61 CMake works by generating native makefiles or build projects that can
65 mkdir mybuild # Create a directory to hold the build output.
67 cmake ${GTEST_DIR} # Generate native build scripts.
69 If you want to build Google Test's samples, you should replace the
72 cmake -Dgtest_build_samples=ON ${GTEST_DIR}
75 current directory. Just type 'make' to build gtest.
77 If you use Windows and have Visual Studio installed, a `gtest.sln` file
78 and several `.vcproj` files will be created. You can then build them
83 ### Legacy Build Scripts ###
85 Before settling on CMake, we have been providing hand-maintained build
86 projects/scripts for Visual Studio, Xcode, and Autotools. While we
89 instructions in the previous two sections to integrate Google Test
90 with your existing build system.
92 If you still need to use the legacy build scripts, here's how:
95 Open the `gtest.sln` or `gtest-md.sln` file using Visual Studio, and you
96 are ready to build Google Test the same way you build any Visual
97 Studio project. Files that have names ending with -md use DLL
101 the same option to compile both gtest and the test code. If you use
102 Visual Studio 2005 or above, we recommend the -md version as /MD is
106 Xcode. Build the "gtest" target. The universal binary framework will
107 end up in your selected build directory (selected in the Xcode
108 "Preferences..." -> "Building" pane and defaults to xcode/build).
113 This will build the "Release" configuration of gtest.framework in your
114 default build location. See the "xcodebuild" man page for more
115 information about building different configurations and building in
118 If you wish to use the Google Test Xcode project with Xcode 4.x and
122 Comment options `SDKROOT`, `MACOS_DEPLOYMENT_TARGET`, and `GCC_VERSION`. If
129 ### Tweaking Google Test ###
131 Google Test can be used in diverse environments. The default
133 some environments. However, you can easily tweak Google Test by
135 these macros are named like `GTEST_XYZ` and you define them to either 1
139 see file [include/gtest/internal/gtest-port.h](include/gtest/internal/gtest-port.h).
143 Some Google Test features require the C++ Technical Report 1 (TR1)
145 good news is that Google Test implements a subset of TR1 tuple that's
146 enough for its own need, and will automatically use this when the
149 Usually you don't need to care about which tuple library Google Test
151 tell Google Test to use the same TR1 tuple library the rest of your
155 -DGTEST_USE_OWN_TR1_TUPLE=0
157 to the compiler flags while compiling Google Test and your tests. If
158 you want to force Google Test to use its own tuple library, just add
160 -DGTEST_USE_OWN_TR1_TUPLE=1
164 If you don't want Google Test to use tuple at all, add
166 -DGTEST_HAS_TR1_TUPLE=0
168 and all features using tuple will be disabled.
170 ### Multi-threaded Tests ###
172 Google Test is thread-safe where the pthread library is available.
177 If Google Test doesn't correctly detect whether pthread is available
180 -DGTEST_HAS_PTHREAD=1
184 -DGTEST_HAS_PTHREAD=0
186 When Google Test uses pthread, you may need to add flags to your
187 compiler and/or linker to select the pthread library, or you'll get
189 script, this is taken care of for you. If you use your own build
190 script, you'll need to read your compiler and linker's manual to
195 Google Test is compact, so most users can build and link it as a
196 static library for the simplicity. You can choose to use Google Test
201 -DGTEST_CREATE_SHARED_LIBRARY=1
204 a shared library instead - consult your linker's manual for how to do
209 -DGTEST_LINKED_AS_SHARED_LIBRARY=1
217 recommended to always add the above flags when using Google Test as a
218 shared library. Otherwise a future release of Google Test may break
219 your build script.
225 definitions. In case a Google Test macro clashes with another
226 library, you can force Google Test to rename its macro to avoid the
229 Specifically, if both Google Test and some other code define macro
232 -DGTEST_DONT_DEFINE_FOO=1
234 to the compiler flags to tell Google Test to change the macro's name
236 or `TEST`. For example, with `-DGTEST_DONT_DEFINE_TEST=1`, you'll
243 TEST(SomeTest, DoesThis) { ... }
245 in order to define a test.
247 ## Developing Google Test ##
249 This section discusses how to make your own changes to Google Test.
251 ### Testing Google Test Itself ### argument
253 To make sure your changes work as intended and don't break existing
254 functionality, you'll want to compile and run Google Test's own tests.
259 cmake -Dgtest_build_tests=ON ${GTEST_DIR}
261 Make sure you have Python installed, as some of Google Test's tests
267 cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR}
269 Next, you can build Google Test and all of its own tests. On \*nix,
272 make test
278 corresponding .pump files instead and run the pump.py Python script to