Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 1 | Building Python using Microsoft Visual C++ |
| 2 | ------------------------------------------ |
Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 3 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 4 | This directory is used to build CPython for Microsoft Windows NT version |
| 5 | 5.1 or higher (Windows XP, Windows Server 2003, or later) on 32 and 64 |
| 6 | bit platforms. Using this directory requires an installation of |
| 7 | Microsoft Visual C++ 2010 (MSVC 10.0) of any edition. The specific |
| 8 | requirements are as follows: |
Zachary Ware | 5f3e3c3 | 2014-03-19 14:46:25 -0500 | [diff] [blame] | 9 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 10 | Visual C++ 2010 Express Edition |
| 11 | Required for building 32-bit Debug and Release configuration builds. |
Zachary Ware | ef03565 | 2014-07-07 14:33:24 -0500 | [diff] [blame] | 12 | The Python build solution pcbuild.sln makes use of Solution Folders, |
| 13 | which this edition does not support. Any time pcbuild.sln is opened |
| 14 | or reloaded by Visual C++, a warning about Solution Folders will be |
| 15 | displayed which can be safely dismissed with no impact on your |
| 16 | ability to build Python. |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 17 | Visual Studio 2010 Professional Edition |
Zachary Ware | 5f3e3c3 | 2014-03-19 14:46:25 -0500 | [diff] [blame] | 18 | Required for building 64-bit Debug and Release configuration builds |
| 19 | Visual Studio 2010 Premium Edition |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 20 | Required for building Release configuration builds that make use of |
Zachary Ware | 5f3e3c3 | 2014-03-19 14:46:25 -0500 | [diff] [blame] | 21 | Profile Guided Optimization (PGO), on either platform. |
| 22 | |
Zachary Ware | 4856a6a | 2014-06-13 09:38:50 -0500 | [diff] [blame] | 23 | Installing Service Pack 1 for Visual Studio 2010 is highly recommended |
| 24 | to avoid LNK1123 errors. |
| 25 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 26 | All you need to do to build is open the solution "pcbuild.sln" in Visual |
| 27 | Studio, select the desired combination of configuration and platform, |
| 28 | then build with "Build Solution" or the F7 keyboard shortcut. You can |
| 29 | also build from the command line using the "build.bat" script in this |
| 30 | directory. The solution is configured to build the projects in the |
| 31 | correct order. |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 32 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 33 | The solution currently supports two platforms. The Win32 platform is |
| 34 | used to build standard x86-compatible 32-bit binaries, output into this |
| 35 | directory. The x64 platform is used for building 64-bit AMD64 (aka |
| 36 | x86_64 or EM64T) binaries, output into the amd64 sub-directory which |
| 37 | will be created if it doesn't already exist. The Itanium (IA-64) |
| 38 | platform is no longer supported. See the "Building for AMD64" section |
| 39 | below for more information about 64-bit builds. |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 40 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 41 | Four configuration options are supported by the solution: |
| 42 | Debug |
| 43 | Used to build Python with extra debugging capabilities, equivalent |
| 44 | to using ./configure --with-pydebug on UNIX. All binaries built |
| 45 | using this configuration have "_d" added to their name: |
| 46 | python34_d.dll, python_d.exe, parser_d.pyd, and so on. Both the |
| 47 | build and rt (run test) batch files in this directory accept a -d |
| 48 | option for debug builds. If you are building Python to help with |
| 49 | development of CPython, you will most likely use this configuration. |
| 50 | PGInstrument, PGUpdate |
| 51 | Used to build Python in Release configuration using PGO, which |
Zachary Ware | 2170b14 | 2014-07-07 14:31:34 -0500 | [diff] [blame] | 52 | requires Premium Edition of Visual Studio. See the "Profile |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 53 | Guided Optimization" section below for more information. Build |
| 54 | output from each of these configurations lands in its own |
| 55 | sub-directory of this directory. The official Python releases are |
| 56 | built using these configurations. |
| 57 | Release |
| 58 | Used to build Python as it is meant to be used in production |
| 59 | settings, though without PGO. |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 60 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 61 | |
Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 62 | Legacy support |
| 63 | -------------- |
| 64 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 65 | You can find build directories for older versions of Visual Studio and |
| 66 | Visual C++ in the PC directory. The legacy build directories are no |
| 67 | longer actively maintained and may not work out of the box. |
Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 68 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 69 | Currently, the only legacy build directory is PC\VS9.0, for Visual |
| 70 | Studio 2008 (9.0). |
Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 71 | |
| 72 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 73 | C Runtime |
Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 74 | --------- |
| 75 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 76 | Visual Studio 2010 uses version 10 of the C runtime (MSVCRT10). The |
| 77 | executables no longer use the "Side by Side" assemblies used in previous |
| 78 | versions of the compiler. This simplifies distribution of applications. |
Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 79 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 80 | The run time libraries are available under the VC/Redist folder of your |
| 81 | Visual Studio distribution. For more info, see the Readme in the |
| 82 | VC/Redist folder. |
Guido van Rossum | e79cf32 | 1998-07-07 22:35:03 +0000 | [diff] [blame] | 83 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 84 | |
| 85 | Sub-Projects |
| 86 | ------------ |
| 87 | |
| 88 | The CPython project is split up into several smaller sub-projects which |
| 89 | are managed by the pcbuild.sln solution file. Each sub-project is |
| 90 | represented by a .vcxproj and a .vcxproj.filters file starting with the |
| 91 | name of the sub-project. These sub-projects fall into a few general |
| 92 | categories: |
| 93 | |
| 94 | The following sub-projects represent the bare minimum required to build |
| 95 | a functioning CPython interpreter. If nothing else builds but these, |
| 96 | you'll have a very limited but usable python.exe: |
Tim Peters | 97c9640 | 2001-01-17 23:23:13 +0000 | [diff] [blame] | 97 | pythoncore |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 98 | .dll and .lib |
| 99 | python |
| 100 | .exe |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 101 | kill_python |
| 102 | kill_python.exe, a small program designed to kill any instances of |
| 103 | python(_d).exe that are running and live in the build output |
| 104 | directory; this is meant to avoid build issues due to locked files |
| 105 | make_buildinfo, make_versioninfo |
| 106 | helpers to provide necessary information to the build process |
| 107 | |
| 108 | These sub-projects provide extra executables that are useful for running |
| 109 | CPython in different ways: |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 110 | pythonw |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 111 | pythonw.exe, a variant of python.exe that doesn't open a Command |
| 112 | Prompt window |
| 113 | pylauncher |
| 114 | py.exe, the Python Launcher for Windows, see |
| 115 | http://docs.python.org/3/using/windows.html#launcher |
| 116 | pywlauncher |
| 117 | pyw.exe, a variant of py.exe that doesn't open a Command Prompt |
| 118 | window |
Zachary Ware | e0881f4 | 2013-11-05 21:55:46 -0600 | [diff] [blame] | 119 | _testembed |
| 120 | _testembed.exe, a small program that embeds Python for testing |
| 121 | purposes, used by test_capi.py |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 122 | |
| 123 | These are miscellaneous sub-projects that don't really fit the other |
| 124 | categories. By default, these projects do not build in Debug |
| 125 | configuration: |
| 126 | _freeze_importlib |
| 127 | _freeze_importlib.exe, used to regenerate Python\importlib.h after |
| 128 | changes have been made to Lib\importlib\_bootstrap.py |
| 129 | bdist_wininst |
| 130 | ..\Lib\distutils\command\wininst-10.0[-amd64].exe, the base |
| 131 | executable used by the distutils bdist_wininst command |
| 132 | python3dll |
| 133 | python3.dll, the PEP 384 Stable ABI dll |
| 134 | xxlimited |
| 135 | builds an example module that makes use of the PEP 384 Stable ABI, |
| 136 | see Modules\xxlimited.c |
| 137 | |
| 138 | The following sub-projects are for individual modules of the standard |
| 139 | library which are implemented in C; each one builds a DLL (renamed to |
| 140 | .pyd) of the same name as the project: |
| 141 | _ctypes |
| 142 | _ctypes_test |
| 143 | _decimal |
| 144 | _elementtree |
| 145 | _hashlib |
| 146 | _msi |
| 147 | _multiprocessing |
| 148 | _overlapped |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 149 | _socket |
Tim Peters | d66595f | 2001-02-04 03:09:53 +0000 | [diff] [blame] | 150 | _testcapi |
Stefan Krah | 9a2d99e | 2012-02-25 12:24:21 +0100 | [diff] [blame] | 151 | _testbuffer |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 152 | _testimportmultiple |
Tim Peters | b012a15 | 2002-02-13 23:56:46 +0000 | [diff] [blame] | 153 | pyexpat |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 154 | select |
Tim Peters | 19f52c2 | 2001-01-24 10:07:22 +0000 | [diff] [blame] | 155 | unicodedata |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 156 | winsound |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 157 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 158 | The following Python-controlled sub-projects wrap external projects. |
| 159 | Note that these external libraries are not necessary for a working |
| 160 | interpreter, but they do implement several major features. See the |
| 161 | "Getting External Sources" section below for additional information |
| 162 | about getting the source for building these libraries. The sub-projects |
| 163 | are: |
Antoine Pitrou | 37dc5f8 | 2011-04-03 17:05:46 +0200 | [diff] [blame] | 164 | _bz2 |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 165 | Python wrapper for version 1.0.6 of the libbzip2 compression library |
| 166 | Homepage: |
Antoine Pitrou | 37dc5f8 | 2011-04-03 17:05:46 +0200 | [diff] [blame] | 167 | http://www.bzip.org/ |
Nadeem Vawda | 3ff069e | 2011-11-30 00:25:06 +0200 | [diff] [blame] | 168 | _lzma |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 169 | Python wrapper for the liblzma compression library, using pre-built |
Martin v. Löwis | baacf4d | 2013-11-22 19:13:51 +0100 | [diff] [blame] | 170 | binaries of XZ Utils version 5.0.5 |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 171 | Homepage: |
| 172 | http://tukaani.org/xz/ |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 173 | _ssl |
Zachary Ware | 7d55da4 | 2014-06-06 01:23:53 -0500 | [diff] [blame] | 174 | Python wrapper for version 1.0.1h of the OpenSSL secure sockets |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 175 | library, which is built by ssl.vcxproj |
| 176 | Homepage: |
| 177 | http://www.openssl.org/ |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 178 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 179 | Building OpenSSL requires nasm.exe (the Netwide Assembler), version |
| 180 | 2.10 or newer from |
| 181 | http://www.nasm.us/ |
| 182 | to be somewhere on your PATH. More recent versions of OpenSSL may |
| 183 | need a later version of NASM. If OpenSSL's self tests don't pass, |
| 184 | you should first try to update NASM and do a full rebuild of |
| 185 | OpenSSL. |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 186 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 187 | If you like to use the official sources instead of the files from |
| 188 | python.org's subversion repository, Perl is required to build the |
| 189 | necessary makefiles and assembly files. ActivePerl is available |
| 190 | from |
Hirokazu Yamamoto | 7c3d709 | 2010-10-28 17:57:25 +0000 | [diff] [blame] | 191 | http://www.activestate.com/activeperl/ |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 192 | The svn.python.org version contains pre-built makefiles and assembly |
| 193 | files. |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 194 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 195 | The build process makes sure that no patented algorithms are |
| 196 | included. For now RC5, MDC2 and IDEA are excluded from the build. |
| 197 | You may have to manually remove $(OBJ_D)\i_*.obj from ms\nt.mak if |
| 198 | using official sources; the svn.python.org-hosted version is already |
| 199 | fixed. |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 200 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 201 | The ssl.vcxproj sub-project simply invokes PCbuild/build_ssl.py, |
| 202 | which locates and builds OpenSSL. |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 203 | |
| 204 | build_ssl.py attempts to catch the most common errors (such as not |
| 205 | being able to find OpenSSL sources, or not being able to find a Perl |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 206 | that works with OpenSSL) and give a reasonable error message. If |
| 207 | you have a problem that doesn't seem to be handled correctly (e.g., |
| 208 | you know you have ActivePerl but we can't find it), please take a |
| 209 | peek at build_ssl.py and suggest patches. Note that build_ssl.py |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 210 | should be able to be run directly from the command-line. |
| 211 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 212 | The ssl sub-project does not have the ability to clean the OpenSSL |
| 213 | build; if you need to rebuild, you'll have to clean it by hand. |
| 214 | _sqlite3 |
Martin v. Löwis | a663069 | 2014-03-02 19:42:50 +0100 | [diff] [blame] | 215 | Wraps SQLite 3.8.3.1, which is itself built by sqlite3.vcxproj |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 216 | Homepage: |
| 217 | http://www.sqlite.org/ |
| 218 | _tkinter |
Martin v. Löwis | 8d0d369 | 2013-11-23 23:05:27 +0100 | [diff] [blame] | 219 | Wraps version 8.6.1 of the Tk windowing system. |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 220 | Homepage: |
| 221 | http://www.tcl.tk/ |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 222 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 223 | Unlike the other external libraries listed above, Tk must be built |
| 224 | separately before the _tkinter module can be built. This means that |
| 225 | a pre-built Tcl/Tk installation is expected in ..\..\tcltk (tcltk64 |
| 226 | for 64-bit) relative to this directory. See "Getting External |
| 227 | Sources" below for the easiest method to ensure Tcl/Tk is built. |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 228 | |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 229 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 230 | Getting External Sources |
| 231 | ------------------------ |
| 232 | |
| 233 | The last category of sub-projects listed above wrap external projects |
| 234 | Python doesn't control, and as such a little more work is required in |
| 235 | order to download the relevant source files for each project before they |
| 236 | can be built. The buildbots must ensure that all libraries are present |
| 237 | before building, so the easiest approach is to run either external.bat |
| 238 | or external-amd64.bat (depending on platform) in the ..\Tools\buildbot |
| 239 | directory from ..\, i.e.: |
| 240 | |
| 241 | C:\python\cpython\PCbuild>cd .. |
| 242 | C:\python\cpython>Tools\buildbot\external.bat |
| 243 | |
| 244 | This extracts all the external sub-projects from |
| 245 | http://svn.python.org/projects/external |
| 246 | via Subversion (so you'll need an svn.exe on your PATH) and places them |
| 247 | in ..\.. (relative to this directory). |
| 248 | |
| 249 | It is also possible to download sources from each project's homepage, |
| 250 | though you may have to change the names of some folders in order to make |
Martin v. Löwis | baacf4d | 2013-11-22 19:13:51 +0100 | [diff] [blame] | 251 | things work. For instance, if you were to download a version 5.0.7 of |
| 252 | XZ Utils, you would need to extract the archive into ..\..\xz-5.0.5 |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 253 | anyway, since that is where the solution is set to look for xz. The |
| 254 | same is true for all other external projects. |
| 255 | |
| 256 | The external(-amd64).bat scripts will also build a debug build of |
| 257 | Tcl/Tk, but there aren't any equivalent batch files for building release |
| 258 | versions of Tcl/Tk currently available. If you need to build a release |
| 259 | version of Tcl/Tk, just take a look at the relevant external(-amd64).bat |
| 260 | file and find the two nmake lines, then call each one without the |
| 261 | 'DEBUG=1' parameter, i.e.: |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 262 | |
| 263 | The external-amd64.bat file contains this for tcl: |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 264 | nmake -f makefile.vc DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean all install |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 265 | |
| 266 | So for a release build, you'd call it as: |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 267 | nmake -f makefile.vc MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean all install |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 268 | |
Martin v. Löwis | 8d0d369 | 2013-11-23 23:05:27 +0100 | [diff] [blame] | 269 | Note that the above command is called from within ..\..\tcl-8.6.1.0\win |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 270 | (relative to this directory); don't forget to build Tk as well as Tcl! |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 271 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 272 | This will be cleaned up in the future; http://bugs.python.org/issue15968 |
| 273 | tracks adding a new tcltk.vcxproj file that will build Tcl/Tk and Tix |
| 274 | the same way the other external projects listed above are built. |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 275 | |
Martin v. Löwis | 13e50fe | 2004-07-20 14:37:48 +0000 | [diff] [blame] | 276 | |
Martin v. Löwis | 856bf9a | 2006-02-14 20:42:55 +0000 | [diff] [blame] | 277 | Building for AMD64 |
| 278 | ------------------ |
| 279 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 280 | The build process for AMD64 / x64 is very similar to standard builds, |
| 281 | you just have to set x64 as platform. In addition, the HOST_PYTHON |
| 282 | environment variable must point to a Python interpreter (at least 2.4), |
| 283 | to support cross-compilation from Win32. Note that Visual Studio |
Zachary Ware | e08f376 | 2014-03-28 23:31:04 -0500 | [diff] [blame] | 284 | requires Professional Edition or better in order to build 64-bit |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 285 | binaries. |
Martin v. Löwis | 856bf9a | 2006-02-14 20:42:55 +0000 | [diff] [blame] | 286 | |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 287 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 288 | Profile Guided Optimization |
| 289 | --------------------------- |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 290 | |
Christian Heimes | 25bb783 | 2008-01-11 16:17:00 +0000 | [diff] [blame] | 291 | The solution has two configurations for PGO. The PGInstrument |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 292 | configuration must be built first. The PGInstrument binaries are linked |
| 293 | against a profiling library and contain extra debug information. The |
| 294 | PGUpdate configuration takes the profiling data and generates optimized |
| 295 | binaries. |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 296 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 297 | The build_pgo.bat script automates the creation of optimized binaries. |
| 298 | It creates the PGI files, runs the unit test suite or PyBench with the |
| 299 | PGI python, and finally creates the optimized files. |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 300 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 301 | See |
| 302 | http://msdn.microsoft.com/en-us/library/e7k32f4k(VS.100).aspx |
| 303 | for more on this topic. |
| 304 | |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 305 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 306 | Static library |
| 307 | -------------- |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 308 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 309 | The solution has no configuration for static libraries. However it is |
| 310 | easy to build a static library instead of a DLL. You simply have to set |
| 311 | the "Configuration Type" to "Static Library (.lib)" and alter the |
| 312 | preprocessor macro "Py_ENABLE_SHARED" to "Py_NO_ENABLE_SHARED". You may |
| 313 | also have to change the "Runtime Library" from "Multi-threaded DLL |
| 314 | (/MD)" to "Multi-threaded (/MT)". |
| 315 | |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 316 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 317 | Visual Studio properties |
| 318 | ------------------------ |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 319 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 320 | The PCbuild solution makes heavy use of Visual Studio property files |
| 321 | (*.props). The properties can be viewed and altered in the Property |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 322 | Manager (View -> Other Windows -> Property Manager). |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 323 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 324 | The property files used are (+-- = "also imports"): |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 325 | * debug (debug macro: _DEBUG) |
| 326 | * pginstrument (PGO) |
| 327 | * pgupdate (PGO) |
| 328 | +-- pginstrument |
| 329 | * pyd (python extension, release build) |
| 330 | +-- release |
| 331 | +-- pyproject |
| 332 | * pyd_d (python extension, debug build) |
| 333 | +-- debug |
| 334 | +-- pyproject |
| 335 | * pyproject (base settings for all projects, user macros like PyDllName) |
| 336 | * release (release macro: NDEBUG) |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 337 | * sqlite3 (used only by sqlite3.vcxproj) |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 338 | * x64 (AMD64 / x64 platform specific settings) |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 339 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 340 | The pyproject property file defines _WIN32 and x64 defines _WIN64 and |
| 341 | _M_X64 although the macros are set by the compiler, too. The GUI doesn't |
| 342 | always know about the macros and confuse the user with false |
| 343 | information. |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 344 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 345 | |
| 346 | Your Own Extension DLLs |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 347 | ----------------------- |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 348 | |
Tim Golden | 7d05236 | 2013-10-25 08:58:16 +0100 | [diff] [blame] | 349 | If you want to create your own extension module DLL (.pyd), there's an |
| 350 | example with easy-to-follow instructions in ..\PC\example\; read the |
| 351 | file readme.txt there first. |