Python distutils.msvccompiler.MSVCCompiler() Examples
The following are 3
code examples of distutils.msvccompiler.MSVCCompiler().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
distutils.msvccompiler
, or try the search function
.
Example #1
Source File: cuda_setup.py From implicit with MIT License | 6 votes |
def compile(self, sources, **kwargs): # Split CUDA C sources and others. cu_sources = [] other_sources = [] for source in sources: if os.path.splitext(source)[1] == '.cu': cu_sources.append(source) else: other_sources.append(source) # Compile source files other than CUDA C ones. other_objects = msvccompiler.MSVCCompiler.compile( self, other_sources, **kwargs) # Compile CUDA C sources. cu_objects = self._compile_cu(cu_sources, **kwargs) # Return compiled object filenames. return other_objects + cu_objects
Example #2
Source File: cupy_setup_build.py From cupy with MIT License | 6 votes |
def compile(self, sources, **kwargs): # Split CUDA C sources and others. cu_sources = [] other_sources = [] for source in sources: if os.path.splitext(source)[1] == '.cu': cu_sources.append(source) else: other_sources.append(source) # Compile source files other than CUDA C ones. other_objects = msvccompiler.MSVCCompiler.compile( self, other_sources, **kwargs) # Compile CUDA C sources. cu_objects = self._compile_cu(cu_sources, **kwargs) # Return compiled object filenames. return other_objects + cu_objects
Example #3
Source File: build_ext.py From ironpython3 with Apache License 2.0 | 4 votes |
def get_libraries(self, ext): """Return the list of libraries to link against when building a shared extension. On most platforms, this is just 'ext.libraries'; on Windows, we add the Python library (eg. python20.dll). """ # The python library is always needed on Windows. For MSVC, this # is redundant, since the library is mentioned in a pragma in # pyconfig.h that MSVC groks. The other Windows compilers all seem # to need it mentioned explicitly, though, so that's what we do. # Append '_d' to the python import library on debug builds. if sys.platform == "win32": from distutils.msvccompiler import MSVCCompiler if not isinstance(self.compiler, MSVCCompiler): template = "python%d%d" if self.debug: template = template + '_d' pythonlib = (template % (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) # don't extend ext.libraries, it may be shared with other # extensions, it is a reference to the original list return ext.libraries + [pythonlib] else: return ext.libraries elif sys.platform[:6] == "cygwin": template = "python%d.%d" pythonlib = (template % (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) # don't extend ext.libraries, it may be shared with other # extensions, it is a reference to the original list return ext.libraries + [pythonlib] elif sys.platform[:6] == "atheos": from distutils import sysconfig template = "python%d.%d" pythonlib = (template % (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) # Get SHLIBS from Makefile extra = [] for lib in sysconfig.get_config_var('SHLIBS').split(): if lib.startswith('-l'): extra.append(lib[2:]) else: extra.append(lib) # don't extend ext.libraries, it may be shared with other # extensions, it is a reference to the original list return ext.libraries + [pythonlib, "m"] + extra elif sys.platform == 'darwin': # Don't use the default code below return ext.libraries elif sys.platform[:3] == 'aix': # Don't use the default code below return ext.libraries else: from distutils import sysconfig if sysconfig.get_config_var('Py_ENABLE_SHARED'): pythonlib = 'python{}.{}{}'.format( sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff, sys.abiflags) return ext.libraries + [pythonlib] else: return ext.libraries