Kristján Valur Jónsson | c45ea9e | 2012-05-19 21:10:14 +0000 | [diff] [blame] | 1 | Building Python using VC++ 10.0 |
Christian Heimes | 9c99cc0 | 2013-09-29 19:02:35 +0200 | [diff] [blame] | 2 | ------------------------------- |
Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 3 | |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 4 | This directory is used to build Python for Win32 and x64 platforms, e.g. |
| 5 | Windows XP, Vista and Windows Server 2008. In order to build 32-bit |
Christian Heimes | 9c99cc0 | 2013-09-29 19:02:35 +0200 | [diff] [blame] | 6 | debug and release executables, Microsoft Visual C++ 2010 Express Edition is |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 7 | required at the very least. In order to build 64-bit debug and release |
Christian Heimes | 9c99cc0 | 2013-09-29 19:02:35 +0200 | [diff] [blame] | 8 | executables, Visual Studio 2010 Standard Edition is required at the very |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 9 | least. In order to build all of the above, as well as generate release builds |
Christian Heimes | 9c99cc0 | 2013-09-29 19:02:35 +0200 | [diff] [blame] | 10 | that make use of Profile Guided Optimisation (PG0), Visual Studio 2010 |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 11 | Professional Edition is required at the very least. The official Python |
| 12 | releases are built with this version of Visual Studio. |
| 13 | |
| 14 | For other Windows platforms and compilers, see ../PC/readme.txt. |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 15 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 16 | All you need to do is open the workspace "pcbuild.sln" in Visual Studio, |
| 17 | select the desired combination of configuration and platform and eventually |
| 18 | build the solution. Unless you are going to debug a problem in the core or |
| 19 | you are going to create an optimized build you want to select "Release" as |
| 20 | configuration. |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 21 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 22 | The PCbuild directory is compatible with all versions of Visual Studio from |
| 23 | VS C++ Express Edition over the standard edition up to the professional |
Benjamin Peterson | 9bc9351 | 2008-09-22 22:10:59 +0000 | [diff] [blame] | 24 | edition. However the express edition does not support features like solution |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 25 | folders or profile guided optimization (PGO). The missing bits and pieces |
| 26 | won't stop you from building Python. |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 27 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 28 | The solution is configured to build the projects in the correct order. "Build |
Christian Heimes | a822314 | 2008-02-09 20:58:00 +0000 | [diff] [blame] | 29 | Solution" or F7 takes care of dependencies except for x64 builds. To make |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 30 | cross compiling x64 builds on a 32bit OS possible the x64 builds require a |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 31 | 32bit version of Python. |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 32 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 33 | NOTE: |
| 34 | You probably don't want to build most of the other subprojects, unless |
| 35 | you're building an entire Python distribution from scratch, or |
| 36 | specifically making changes to the subsystems they implement, or are |
| 37 | running a Python core buildbot test slave; see SUBPROJECTS below) |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 38 | |
| 39 | When using the Debug setting, the output files have a _d added to |
Georg Brandl | fa2c61a | 2011-02-20 10:41:31 +0000 | [diff] [blame] | 40 | their name: python33_d.dll, python_d.exe, parser_d.pyd, and so on. Both |
Christian Heimes | a822314 | 2008-02-09 20:58:00 +0000 | [diff] [blame] | 41 | the build and rt batch files accept a -d option for debug builds. |
Guido van Rossum | e79cf32 | 1998-07-07 22:35:03 +0000 | [diff] [blame] | 42 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 43 | The 32bit builds end up in the solution folder PCbuild while the x64 builds |
| 44 | land in the amd64 subfolder. The PGI and PGO builds for profile guided |
| 45 | optimization end up in their own folders, too. |
| 46 | |
Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 47 | Legacy support |
| 48 | -------------- |
| 49 | |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 50 | You can find build directories for older versions of Visual Studio and |
Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 51 | Visual C++ in the PC directory. The legacy build directories are no longer |
| 52 | actively maintained and may not work out of the box. |
| 53 | |
| 54 | PC/VC6/ |
| 55 | Visual C++ 6.0 |
| 56 | PC/VS7.1/ |
| 57 | Visual Studio 2003 (7.1) |
Hirokazu Yamamoto | 0b0ebb4 | 2010-10-01 10:40:49 +0000 | [diff] [blame] | 58 | PC/VS8.0/ |
Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 59 | Visual Studio 2005 (8.0) |
Christian Heimes | 5176337 | 2013-09-29 19:10:07 +0200 | [diff] [blame] | 60 | PC/VS9.0/ |
| 61 | Visual Studio 2008 (9.0) |
Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 62 | |
| 63 | |
| 64 | C RUNTIME |
| 65 | --------- |
| 66 | |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 67 | Visual Studio 2010 uses version 10 of the C runtime (MSVCRT10). The executables |
Kristján Valur Jónsson | c45ea9e | 2012-05-19 21:10:14 +0000 | [diff] [blame] | 68 | no longer use the "Side by Side" assemblies used in previous versions of the |
| 69 | compiler. This simplifies distribution of applications. |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 70 | The run time libraries are available under the VC/Redist folder of your visual studio |
Kristján Valur Jónsson | c45ea9e | 2012-05-19 21:10:14 +0000 | [diff] [blame] | 71 | distribution. For more info, see the Readme in the VC/Redist folder. |
Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 72 | |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 73 | SUBPROJECTS |
| 74 | ----------- |
Tim Peters | 610a827 | 2000-07-01 02:51:23 +0000 | [diff] [blame] | 75 | These subprojects should build out of the box. Subprojects other than the |
Tim Peters | befc97c | 2001-01-18 19:01:39 +0000 | [diff] [blame] | 76 | main ones (pythoncore, python, pythonw) generally build a DLL (renamed to |
Tim Peters | 610a827 | 2000-07-01 02:51:23 +0000 | [diff] [blame] | 77 | .pyd) from a specific module so that users don't have to load the code |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 78 | supporting that module unless they import the module. |
Guido van Rossum | e79cf32 | 1998-07-07 22:35:03 +0000 | [diff] [blame] | 79 | |
Tim Peters | 97c9640 | 2001-01-17 23:23:13 +0000 | [diff] [blame] | 80 | pythoncore |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 81 | .dll and .lib |
| 82 | python |
| 83 | .exe |
| 84 | pythonw |
| 85 | pythonw.exe, a variant of python.exe that doesn't pop up a DOS box |
| 86 | _socket |
| 87 | socketmodule.c |
Tim Peters | d66595f | 2001-02-04 03:09:53 +0000 | [diff] [blame] | 88 | _testcapi |
Tim Peters | b16c56f | 2001-02-02 21:24:51 +0000 | [diff] [blame] | 89 | tests of the Python C API, run via Lib/test/test_capi.py, and |
Tim Peters | d66595f | 2001-02-04 03:09:53 +0000 | [diff] [blame] | 90 | implemented by module Modules/_testcapimodule.c |
Stefan Krah | 9a2d99e | 2012-02-25 12:24:21 +0100 | [diff] [blame] | 91 | _testbuffer |
| 92 | buffer protocol tests, run via Lib/test/test_buffer.py, and |
| 93 | implemented by module Modules/_testbuffer.c |
Tim Peters | b012a15 | 2002-02-13 23:56:46 +0000 | [diff] [blame] | 94 | pyexpat |
| 95 | Python wrapper for accelerated XML parsing, which incorporates stable |
| 96 | code from the Expat project: http://sourceforge.net/projects/expat/ |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 97 | select |
| 98 | selectmodule.c |
Tim Peters | 19f52c2 | 2001-01-24 10:07:22 +0000 | [diff] [blame] | 99 | unicodedata |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 100 | large tables of Unicode data |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 101 | winsound |
| 102 | play sounds (typically .wav files) under Windows |
| 103 | |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 104 | Python-controlled subprojects that wrap external projects: |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 105 | _sqlite3 |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 106 | Wraps SQLite 3.7.12, which is currently built by sqlite3.vcxproj. |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 107 | _tkinter |
Georg Brandl | 1158a33 | 2009-06-04 09:30:30 +0000 | [diff] [blame] | 108 | Wraps the Tk windowing system. Unlike _sqlite3, there's no |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 109 | corresponding tcltk.vcxproj-type project that builds Tcl/Tk from vcxproj's |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 110 | within our pcbuild.sln, which means this module expects to find a |
| 111 | pre-built Tcl/Tk in either ..\..\tcltk for 32-bit or ..\..\tcltk64 for |
| 112 | 64-bit (relative to this directory). See below for instructions to build |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 113 | Tcl/Tk. |
Antoine Pitrou | 37dc5f8 | 2011-04-03 17:05:46 +0200 | [diff] [blame] | 114 | _bz2 |
| 115 | Python wrapper for the libbzip2 compression library. Homepage |
| 116 | http://www.bzip.org/ |
Martin v. Löwis | f6f7925 | 2006-03-13 13:48:05 +0000 | [diff] [blame] | 117 | Download the source from the python.org copy into the dist |
| 118 | directory: |
| 119 | |
Martin v. Löwis | ecc5877 | 2012-05-14 13:52:03 +0200 | [diff] [blame] | 120 | svn export http://svn.python.org/projects/external/bzip2-1.0.6 |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 121 | |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 122 | ** NOTE: if you use the Tools\buildbot\external(-amd64).bat approach for |
| 123 | obtaining external sources then you don't need to manually get the source |
| 124 | above via subversion. ** |
Nadeem Vawda | 3ff069e | 2011-11-30 00:25:06 +0200 | [diff] [blame] | 125 | _lzma |
| 126 | Python wrapper for the liblzma compression library. |
| 127 | |
| 128 | Download the pre-built Windows binaries from http://tukaani.org/xz/, and |
| 129 | extract to ..\xz-5.0.3. If you are using a more recent version of liblzma, |
| 130 | it will be necessary to rename the directory from xz-<VERSION> to xz-5.0.3. |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 131 | |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 132 | _ssl |
Tim Peters | e8bcb25 | 2002-12-04 02:39:52 +0000 | [diff] [blame] | 133 | Python wrapper for the secure sockets library. |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 134 | |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 135 | Get the source code through |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 136 | |
Georg Brandl | 84fc4ba | 2013-05-12 19:50:34 +0200 | [diff] [blame] | 137 | svn export http://svn.python.org/projects/external/openssl-1.0.1e |
Tim Peters | e8bcb25 | 2002-12-04 02:39:52 +0000 | [diff] [blame] | 138 | |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 139 | ** NOTE: if you use the Tools\buildbot\external(-amd64).bat approach for |
| 140 | obtaining external sources then you don't need to manually get the source |
| 141 | above via subversion. ** |
| 142 | |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 143 | Alternatively, get the latest version from http://www.openssl.org. |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 144 | You can (theoretically) use any version of OpenSSL you like - the |
| 145 | build process will automatically select the latest version. |
| 146 | |
Christian Heimes | c81549f | 2013-06-14 15:40:28 +0200 | [diff] [blame] | 147 | You must install the NASM assembler 2.10 or newer from |
Benjamin Peterson | e5384b0 | 2008-10-04 22:00:42 +0000 | [diff] [blame] | 148 | http://nasm.sf.net |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 149 | for x86 builds. Put nasm.exe anywhere in your PATH. More recent |
Christian Heimes | c81549f | 2013-06-14 15:40:28 +0200 | [diff] [blame] | 150 | versions of OpenSSL may need a later version of NASM. If OpenSSL's self |
| 151 | tests don't pass, you should first try to update NASM and do a full |
| 152 | rebuild of OpenSSL. |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 153 | |
| 154 | You can also install ActivePerl from |
Hirokazu Yamamoto | 7c3d709 | 2010-10-28 17:57:25 +0000 | [diff] [blame] | 155 | http://www.activestate.com/activeperl/ |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 156 | if you like to use the official sources instead of the files from |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 157 | python's subversion repository. The svn version contains pre-build |
| 158 | makefiles and assembly files. |
| 159 | |
| 160 | The build process makes sure that no patented algorithms are included. |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 161 | For now RC5, MDC2 and IDEA are excluded from the build. You may have |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 162 | to manually remove $(OBJ_D)\i_*.obj from ms\nt.mak if the build process |
| 163 | complains about missing files or forbidden IDEA. Again the files provided |
| 164 | in the subversion repository are already fixed. |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 165 | |
| 166 | The MSVC project simply invokes PCBuild/build_ssl.py to perform |
Tim Peters | e8bcb25 | 2002-12-04 02:39:52 +0000 | [diff] [blame] | 167 | the build. This Python script locates and builds your OpenSSL |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 168 | installation, then invokes a simple makefile to build the final .pyd. |
| 169 | |
| 170 | build_ssl.py attempts to catch the most common errors (such as not |
| 171 | being able to find OpenSSL sources, or not being able to find a Perl |
| 172 | that works with OpenSSL) and give a reasonable error message. |
| 173 | If you have a problem that doesn't seem to be handled correctly |
| 174 | (eg, you know you have ActivePerl but we can't find it), please take |
| 175 | a peek at build_ssl.py and suggest patches. Note that build_ssl.py |
| 176 | should be able to be run directly from the command-line. |
| 177 | |
Tim Peters | e8bcb25 | 2002-12-04 02:39:52 +0000 | [diff] [blame] | 178 | build_ssl.py/MSVC isn't clever enough to clean OpenSSL - you must do |
| 179 | this by hand. |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 180 | |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 181 | The subprojects above wrap external projects Python doesn't control, and as |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 182 | such, a little more work is required in order to download the relevant source |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 183 | files for each project before they can be built. The buildbots do this each |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 184 | time they're built, so the easiest approach is to run either external.bat or |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 185 | external-amd64.bat in the ..\Tools\buildbot directory from ..\, i.e.: |
| 186 | |
| 187 | C:\..\svn.python.org\projects\python\trunk\PCbuild>cd .. |
| 188 | C:\..\svn.python.org\projects\python\trunk>Tools\buildbot\external.bat |
| 189 | |
| 190 | This extracts all the external subprojects from http://svn.python.org/external |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 191 | via Subversion (so you'll need an svn.exe on your PATH) and places them in |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 192 | ..\.. (relative to this directory). The external(-amd64).bat scripts will |
| 193 | also build a debug build of Tcl/Tk; there aren't any equivalent batch files |
| 194 | for building release versions of Tcl/Tk lying around in the Tools\buildbot |
| 195 | directory. If you need to build a release version of Tcl/Tk it isn't hard |
| 196 | though, take a look at the relevant external(-amd64).bat file and find the |
| 197 | two nmake lines, then call each one without the 'DEBUG=1' parameter, i.e.: |
| 198 | |
| 199 | The external-amd64.bat file contains this for tcl: |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 200 | 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] | 201 | |
| 202 | So for a release build, you'd call it as: |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 203 | nmake -f makefile.vc MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean all install |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 204 | |
| 205 | XXX Should we compile with OPTS=threads? |
| 206 | XXX Our installer copies a lot of stuff out of the Tcl/Tk install |
| 207 | XXX directory. Is all of that really needed for Python use of Tcl/Tk? |
| 208 | |
| 209 | This will be cleaned up in the future; ideally Tcl/Tk will be brought into our |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 210 | pcbuild.sln as custom .vcxproj files, just as we've recently done with the |
| 211 | sqlite3.vcxproj file, which will remove the need for Tcl/Tk to be built |
Georg Brandl | 1158a33 | 2009-06-04 09:30:30 +0000 | [diff] [blame] | 212 | separately via a batch file. |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 213 | |
| 214 | XXX trent.nelson 02-Apr-08: |
| 215 | Having the external subprojects in ..\.. relative to this directory is a |
| 216 | bit of a nuisance when you're working on py3k and trunk in parallel and |
| 217 | your directory layout mimics that of Python's subversion layout, e.g.: |
| 218 | |
| 219 | C:\..\svn.python.org\projects\python\trunk |
| 220 | C:\..\svn.python.org\projects\python\branches\py3k |
| 221 | C:\..\svn.python.org\projects\python\branches\release25-maint |
| 222 | |
| 223 | I'd like to change things so that external subprojects are fetched from |
| 224 | ..\external instead of ..\.., then provide some helper scripts or batch |
| 225 | files that would set up a new ..\external directory with svn checkouts of |
| 226 | the relevant branches in http://svn.python.org/projects/external/, or |
| 227 | alternatively, use junctions to link ..\external with a pre-existing |
| 228 | externals directory being used by another branch. i.e. if I'm usually |
| 229 | working on trunk (and have previously created trunk\external via the |
| 230 | provided batch file), and want to do some work on py3k, I'd set up a |
| 231 | junction as follows (using the directory structure above as an example): |
| 232 | |
| 233 | C:\..\python\trunk\external <- already exists and has built versions |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 234 | of the external subprojects |
Trent Nelson | 5203727 | 2008-04-02 15:06:49 +0000 | [diff] [blame] | 235 | |
| 236 | C:\..\python\branches\py3k>linkd.exe external ..\..\trunk\external |
| 237 | Link created at: external |
| 238 | |
| 239 | Only a slight tweak would be needed to the buildbots such that bots |
| 240 | building trunk and py3k could make use of the same facility. (2.5.x |
| 241 | builds need to be kept separate as they're using Visual Studio 7.1.) |
| 242 | /XXX trent.nelson 02-Apr-08 |
| 243 | |
Martin v. Löwis | 13e50fe | 2004-07-20 14:37:48 +0000 | [diff] [blame] | 244 | Building for Itanium |
| 245 | -------------------- |
| 246 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 247 | Official support for Itanium builds have been dropped from the build. Please |
Christian Heimes | a822314 | 2008-02-09 20:58:00 +0000 | [diff] [blame] | 248 | contact us and provide patches if you are interested in Itanium builds. |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 249 | |
Martin v. Löwis | 856bf9a | 2006-02-14 20:42:55 +0000 | [diff] [blame] | 250 | Building for AMD64 |
| 251 | ------------------ |
| 252 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 253 | The build process for AMD64 / x64 is very similar to standard builds. You just |
Martin v. Löwis | 1561bab | 2008-02-29 19:39:25 +0000 | [diff] [blame] | 254 | have to set x64 as platform. In addition, the HOST_PYTHON environment variable |
| 255 | must point to a Python interpreter (at least 2.4), to support cross-compilation. |
Martin v. Löwis | 856bf9a | 2006-02-14 20:42:55 +0000 | [diff] [blame] | 256 | |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 257 | Building Python Using the free MS Toolkit Compiler |
| 258 | -------------------------------------------------- |
| 259 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 260 | Microsoft has withdrawn the free MS Toolkit Compiler, so this can no longer |
| 261 | be considered a supported option. Instead you can use the free VS C++ Express |
| 262 | Edition. |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 263 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 264 | Profile Guided Optimization |
| 265 | --------------------------- |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 266 | |
Christian Heimes | 25bb783 | 2008-01-11 16:17:00 +0000 | [diff] [blame] | 267 | The solution has two configurations for PGO. The PGInstrument |
| 268 | configuration must be build first. The PGInstrument binaries are |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 269 | linked against a profiling library and contain extra debug |
Christian Heimes | 25bb783 | 2008-01-11 16:17:00 +0000 | [diff] [blame] | 270 | information. The PGUpdate configuration takes the profiling data and |
| 271 | generates optimized binaries. |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 272 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 273 | The build_pgo.bat script automates the creation of optimized binaries. It |
| 274 | creates the PGI files, runs the unit test suite or PyBench with the PGI |
| 275 | python and finally creates the optimized files. |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 276 | |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 277 | http://msdn.microsoft.com/en-us/library/e7k32f4k(VS.100).aspx |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 278 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 279 | Static library |
| 280 | -------------- |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 281 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 282 | The solution has no configuration for static libraries. However it is easy |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 283 | it build a static library instead of a DLL. You simply have to set the |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 284 | "Configuration Type" to "Static Library (.lib)" and alter the preprocessor |
| 285 | macro "Py_ENABLE_SHARED" to "Py_NO_ENABLE_SHARED". You may also have to |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 286 | change the "Runtime Library" from "Multi-threaded DLL (/MD)" to |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 287 | "Multi-threaded (/MT)". |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 288 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 289 | Visual Studio properties |
| 290 | ------------------------ |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 291 | |
Zachary Ware | 200bcbc | 2013-11-03 21:48:54 -0600 | [diff] [blame] | 292 | The PCbuild solution makes heavy use of Visual Studio property files |
| 293 | (*.props). The properties can be viewed and altered in the Property |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 294 | Manager (View -> Other Windows -> Property Manager). |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 295 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 296 | * debug (debug macro: _DEBUG) |
| 297 | * pginstrument (PGO) |
| 298 | * pgupdate (PGO) |
| 299 | +-- pginstrument |
| 300 | * pyd (python extension, release build) |
| 301 | +-- release |
| 302 | +-- pyproject |
| 303 | * pyd_d (python extension, debug build) |
| 304 | +-- debug |
| 305 | +-- pyproject |
| 306 | * pyproject (base settings for all projects, user macros like PyDllName) |
| 307 | * release (release macro: NDEBUG) |
| 308 | * x64 (AMD64 / x64 platform specific settings) |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 309 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 310 | The pyproject propertyfile defines _WIN32 and x64 defines _WIN64 and _M_X64 |
| 311 | although the macros are set by the compiler, too. The GUI doesn't always know |
| 312 | about the macros and confuse the user with false information. |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 313 | |
Tim Peters | f9a4a6e | 2000-07-01 20:38:27 +0000 | [diff] [blame] | 314 | YOUR OWN EXTENSION DLLs |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 315 | ----------------------- |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 316 | |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 317 | If you want to create your own extension module DLL, there's an example |
| 318 | with easy-to-follow instructions in ../PC/example/; read the file |
| 319 | readme.txt there first. |