Kaydet (Commit) a2cc2695 authored tarafından Martin v. Löwis's avatar Martin v. Löwis

Update example to VC 7.1. Will backport to 2.4.

üst e1a0391b
# Microsoft Developer Studio Project File - Name="example" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=example - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "example.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "example.mak" CFG="example - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "example - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "example - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "example - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib python24.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\PCbuild" /export:initexample
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "example - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib python24_d.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:".\Debug/example_d.dll" /libpath:"..\PCbuild" /export:initexample
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "example - Win32 Release"
# Name "example - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\example.c
# End Source File
# Begin Source File
SOURCE=.\example.def
# End Source File
# Begin Source File
SOURCE=.\readme.txt
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "example"=.\example.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example.vcproj", "{A0608D6F-84ED-44AE-A2A6-A3CC7F4A4030}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{A0608D6F-84ED-44AE-A2A6-A3CC7F4A4030}.Debug.ActiveCfg = Debug|Win32
{A0608D6F-84ED-44AE-A2A6-A3CC7F4A4030}.Debug.Build.0 = Debug|Win32
{A0608D6F-84ED-44AE-A2A6-A3CC7F4A4030}.Release.ActiveCfg = Release|Win32
{A0608D6F-84ED-44AE-A2A6-A3CC7F4A4030}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="example"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\Include,..\PC"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/example.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/export:initexample"
AdditionalDependencies="odbc32.lib odbccp32.lib python24.lib"
OutputFile=".\Release/example.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\PCbuild"
ModuleDefinitionFile=".\example.def"
ProgramDatabaseFile=".\Release/example.pdb"
SubSystem="2"
ImportLibrary=".\Release/example.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Release/example.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\Include,..\PC"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/example.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/export:initexample"
AdditionalDependencies="odbc32.lib odbccp32.lib python24_d.lib"
OutputFile=".\Debug/example_d.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\PCbuild"
ModuleDefinitionFile=".\example.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/example_d.pdb"
SubSystem="2"
ImportLibrary=".\Debug/example_d.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Debug/example.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90">
<File
RelativePath="example.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;$(NoInherit)"/>
</FileConfiguration>
</File>
<File
RelativePath="example.def">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;fi;fd">
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe">
</Filter>
<File
RelativePath="readme.txt">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
......@@ -3,10 +3,11 @@ Example Python extension for Windows NT
This directory contains everything needed (except for the Python
distribution!) to build a Python extension module using Microsoft VC++
("Developer Studio") version 6. It has been tested with VC++ 6.0 on Python
2.2c1. You can also use earlier versions of VC to build Python extensions,
but the sample VC project file (example.dsw in this directory) is in VC 6
format.
("Developer Studio") version 7.1. It has been tested with VC++ 7.1 on
Python 2.4. You can also use earlier versions of VC to build Python
extensions, but the sample VC project file (example.dsw in this directory)
is in VC 7.1 format. Notice that you need to use the same compiler version
that was used to build Python itself.
COPY THIS DIRECTORY!
--------------------
......@@ -19,10 +20,10 @@ this new location -- sorry, but you'll be sorry if you don't.
OPEN THE PROJECT
----------------
From VC 6.x, use the
File -> Open Workspace...
From VC 7.1, use the
File -> Open Solution...
dialog (*not* the "File -> Open..." dialog!). Navigate to and select the
file "example.dsw", in the *copy* of the example_nt directory you made
file "example.sln", in the *copy* of the example_nt directory you made
above.
Click Open.
......@@ -31,15 +32,12 @@ BUILD THE EXAMPLE DLL
In order to check that everything is set up right, try building:
1. Select a configuration. This step is optional. Do
Build -> Select Active Configuration...
and select either "example - Win32 Release" or "example - Win32 Debug".
Build -> Configuration Manager... -> Active Solution Configuration
and select either "Release" or "Debug".
If you skip this step, you'll use the Debug configuration by default.
2. Build the DLL. Do
Build -> Build example_d.dll
in Debug mode, or
Build -> Build example.dll
in Release mode.
Build -> Build Solution
This creates all intermediate and result files in a subdirectory which
is called either Debug or Release, depending on which configuration you
picked in the preceding step.
......@@ -96,7 +94,7 @@ in Release mode, or spam_d.dll or spam_d.pyd in Debug mode.
Now your options are:
1) Copy example.dsw and example.dsp, rename them to spam.*, and edit them
1) Copy example.sln and example.vcproj, rename them to spam.*, and edit them
by hand.
or
......@@ -109,7 +107,8 @@ created a new project yourself, add the file spam.def to the project now.
(This is an annoying little file with only two lines. An alternative
approach is to forget about the .def file, and add the option
"/export:initspam" somewhere to the Link settings, by manually editing the
"Project Options" box).
"Project -> Properties -> Linker -> Command Line -> Additional Options"
box).
You are now all set to build your extension, unless it requires other
external libraries, include files, etc. See Python's Extending and
......@@ -119,47 +118,44 @@ Embedding manual for instructions on how to write an extension.
CREATING A BRAND NEW PROJECT
----------------------------
Use the
File -> New... -> Projects
dialog to create a new Project Workspace. Select "Win32 Dynamic-Link
Library", enter the name ("spam"), and make sure the "Location" is set to
the spam directory you have created (which should be a direct subdirectory
of the Python build tree, a sibling of Include and PC). Select Win32 as the
platform (in my version, this is the only choice). Make sure the "Create
new workspace" radio button is selected. Click OK.
File -> New -> Project...
dialog to create a new Project Workspace. Select "Visual C++ Projects/Win32/
Win32 Project", enter the name ("spam"), and make sure the "Location" is
set to parent of the spam directory you have created (which should be a direct
subdirectory of the Python build tree, a sibling of Include and PC).
In "Application Settings", select "DLL", and "Empty Project". Click OK.
You should now create the file spam.def as instructed in the previous
section. Add the source files (including the .def file) to the project,
using "Project", "Add Existing Item".
Now open the
Project -> Settings...
Project -> spam properties...
dialog. (Impressive, isn't it? :-) You only need to change a few
settings. Make sure "All Configurations" is selected from the "Settings
for:" dropdown list. Select the "C/C++" tab. Choose the "Preprocessor"
for:" dropdown list. Select the "C/C++" tab. Choose the "General"
category in the popup menu at the top. Type the following text in the
entry box labeled "Addditional include directories:"
entry box labeled "Addditional Include Directories:"
..\Include,..\PC
Then, choose the "Input" category in the Link tab, and enter
Then, choose the "General" category in the "Linker" tab, and enter
..\PCbuild
in the "Additional library path:" box.
in the "Additional library Directories" box.
Now you need to add some mode-specific settings:
Now you need to add some mode-specific settings (select "Accept"
when asked to confirm your changes):
Select "Win32 Release" in the "Settings for:" dropdown list. Click the
"Link" tab, choose the "Input" Category, and append "python22.lib" to the
list in the "Object/library modules:" box.
Select "Release" in the "Configuration" dropdown list. Click the
"Link" tab, choose the "Input" Category, and append "python24.lib" to the
list in the "Additional Dependencies" box.
Select "Win32 Debug" in the "Settings for:" dropdown list, and append
"python22_d.lib" to the list in the "Object/library modules:" box. Then
click on the C/C++ tab, select "Code Generation" from the "Category:"
dropdown list, and select "Debug Multithreaded DLL" from the "Use run-time
library:" dropdown list.
Select "Debug" in the "Settings for:" dropdown list, and append
"python24_d.lib" to the list in the Additional Dependencies" box. Then
click on the C/C++ tab, select "Code Generation", and select
"Multi-threaded Debug DLL" from the "Runtime library" dropdown list.
Select "Win32 Release" again from the "Settings for:" dropdown list.
Select "Multithreaded DLL" from the "Use run-time library:" dropdown list.
Select "Release" again from the "Settings for:" dropdown list.
Select "Multi-threaded DLL" from the "Use run-time library:" dropdown list.
That's all <wink>.
You should now create the file spam.def as instructed in the previous
section. Then chose the
Insert -> Files into Project...
dialog. Set the pattern to *.* and select both spam.c and spam.def and
click OK. (Inserting them one by one is fine too.)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment