Changeset 8159:e71c993ca5bc in orange


Ignore:
Timestamp:
08/09/11 13:02:25 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
466078b360fa508741ad6387f22511df0582aa8c
Message:

Made setup.py compile with MSVSC compiler.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/setup.py

    r8089 r8159  
    22from distutils.command.build_ext import build_ext 
    33from distutils.command.install_lib import install_lib 
     4from distutils.msvccompiler import MSVCCompiler 
     5from distutils.unixccompiler import UnixCCompiler 
    46 
    57import os, sys, re 
     
    2527    extra_link_args = "-headerpad_max_install_names -undefined dynamic_lookup -lstdc++ -lorange_include".split() 
    2628elif sys.platform == "win32": 
    27     extra_compile_args = [] 
     29    extra_compile_args = ["/EHsc"] 
    2830    extra_link_args = [] 
    2931elif sys.platform == "linux2": 
     
    9092             
    9193        if isinstance(ext, PyXtractSharedExtension): 
    92             # Make lib{name}.so link to {name}.so 
    93             ext_path = self.get_ext_fullpath(ext.name) 
    94             ext_path, ext_filename = os.path.split(ext_path) 
    95             realpath = os.path.realpath(os.curdir) 
    96             try: 
    97                 os.chdir(ext_path) 
    98                 # Get the shared library name 
    99                 lib_filename = self.compiler.library_filename(ext.name, lib_type="shared") 
    100                 # Create the link 
    101                 copy_file(ext_filename, lib_filename, link="sym") 
    102             except OSError, ex: 
    103                 log.info("failed to create shared library for %s: %s" % (ext.name, str(ex))) 
    104             finally: 
    105                 os.chdir(realpath) 
     94            if isinstance(self.compiler, MSVCCompiler): 
     95                # Copy ${TEMP}/orange/orange.lib to ${BUILD}/orange.lib 
     96                ext_fullpath = self.get_ext_fullpath(ext.name) 
     97                lib = glob.glob(os.path.join(self.build_temp, "*", "*", ext.name + ".lib"))[0] 
     98                copy_file(lib, os.path.splitext(ext_fullpath)[0] + ".lib") 
     99                           
     100                #self.get 
     101            else: 
     102                # Make lib{name}.so link to {name}.so 
     103                ext_path = self.get_ext_fullpath(ext.name) 
     104                ext_path, ext_filename = os.path.split(ext_path) 
     105                realpath = os.path.realpath(os.curdir) 
     106                try: 
     107                    os.chdir(ext_path) 
     108                    # Get the shared library name 
     109                    lib_filename = self.compiler.library_filename(ext.name, lib_type="shared") 
     110                    # Create the link 
     111                    copy_file(ext_filename, lib_filename, link="sym") 
     112                except OSError, ex: 
     113                    log.info("failed to create shared library for %s: %s" % (ext.name, str(ex))) 
     114                finally: 
     115                    os.chdir(realpath) 
    106116             
    107117    def build_pyxtract(self, ext): 
     
    208218        ext_path = self.get_ext_fullpath(ext.name) 
    209219        output_dir, _ = os.path.split(ext_path) 
     220        if not os.path.exists(output_dir): #VSC fails if the dir does not exist 
     221            os.makedirs(output_dir) 
    210222        lib_filename = self.compiler.library_filename(ext.name, lib_type='static', output_dir=output_dir) 
    211223         
     
    346358include_ext = LibStatic("orange_include", get_source_files("source/include/"), include_dirs=include_dirs) 
    347359 
    348 libraries = ["stdc++", "orange_include"] 
     360if sys.platform == "win32": 
     361    libraries = ["orange_include"] 
     362else: 
     363    libraries = ["stdc++", "orange_include"] 
    349364 
    350365orange_ext = PyXtractSharedExtension("orange", get_source_files("source/orange/") + \ 
     
    401416  for filename in fnmatch.filter(filenames, '__init__.py'): 
    402417      matches.append(os.path.join(root, filename)) 
    403 packages = [pkg.rpartition('/__init__.py')[0].replace('/','.') for pkg in matches] 
     418packages = [os.path.dirname(pkg).replace(os.path.sep, '.') for pkg in matches] 
    404419 
    405420setup(cmdclass={"build_ext": pyxtract_build_ext, "install_lib": my_install_lib}, 
Note: See TracChangeset for help on using the changeset viewer.