Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
de2cde61
Commit
de2cde61
authored
Feb 20, 2006
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detect Win64 builds.
parent
71322121
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
10 deletions
+39
-10
Lib/distutils/msvccompiler.py
Lib/distutils/msvccompiler.py
+39
-10
No files found.
Lib/distutils/msvccompiler.py
View file @
de2cde61
...
...
@@ -172,6 +172,20 @@ def get_build_version():
# else we don't know what version of the compiler this is
return None
def get_build_architecture():
"""Return the processor architecture.
Possible results are "
Intel
", "
Itanium
", or "
AMD64
".
"""
prefix = "
bit
(
"
i = string.find(sys.version, prefix)
if i == -1:
return "
Intel
"
j = string.find(sys.version, "
)
", i)
return sys.version[i+len(prefix):j]
class MSVCCompiler (CCompiler) :
"""Concrete class that implements an interface to Microsoft Visual C++,
...
...
@@ -206,11 +220,19 @@ class MSVCCompiler (CCompiler) :
def __init__ (self, verbose=0, dry_run=0, force=0):
CCompiler.__init__ (self, verbose, dry_run, force)
self.__version = get_build_version()
self.__arch = get_build_architecture()
if self.__arch == "
Intel
":
# x86
if self.__version >= 7:
self.__root = r"
Software
\
Microsoft
\
VisualStudio
"
self.__macros = MacroExpander(self.__version)
else:
self.__root = r"
Software
\
Microsoft
\
Devstudio
"
self.__product = "
Visual
Studio
version
%
s
" % self.__version
else:
# Win64. Assume this was built with the platform SDK
self.__product = "
Microsoft
SDK
compiler
%
s
" % (self.__version + 6)
self.initialized = False
def initialize(self):
...
...
@@ -228,9 +250,9 @@ class MSVCCompiler (CCompiler) :
if len (self.__paths) == 0:
raise DistutilsPlatformError,
\
("
Python
was
built
with
version
%
s
of
Visual
Studio
,
"
("
Python
was
built
with
%
s
,
"
"
and
extensions
need
to
be
built
with
the
same
"
"
version
of
the
compiler
,
but
it
isn
't installed." % self.__
version
)
"
version
of
the
compiler
,
but
it
isn
't installed." % self.__
product
)
self.cc = self.find_exe("cl.exe")
self.linker = self.find_exe("link.exe")
...
...
@@ -249,10 +271,17 @@ class MSVCCompiler (CCompiler) :
os.environ['
path
'] = string.join(self.__paths, '
;
')
self.preprocess_options = None
if self.__arch == "Intel":
self.compile_options = [ '
/
nologo
', '
/
Ox
', '
/
MD
', '
/
W3
', '
/
GX
' ,
'
/
DNDEBUG
']
self.compile_options_debug = ['
/
nologo
', '
/
Od
', '
/
MDd
', '
/
W3
', '
/
GX
',
'
/
Z7
', '
/
D_DEBUG
']
else:
# Win64
self.compile_options = [ '
/
nologo
', '
/
Ox
', '
/
MD
', '
/
W3
', '
/
GS
-
' ,
'
/
DNDEBUG
']
self.compile_options_debug = ['
/
nologo
', '
/
Od
', '
/
MDd
', '
/
W3
', '
/
GS
-
',
'
/
Z7
', '
/
D_DEBUG
']
self.ldflags_shared = ['
/
DLL
', '
/
nologo
', '
/
INCREMENTAL
:
NO
']
if self.__version >= 7:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment