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