Changeset 13f00a0 in sasview for sansmodels


Ignore:
Timestamp:
Dec 9, 2011 4:27:02 PM (13 years ago)
Author:
Mathieu Doucet <doucetm@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
2cef9d3
Parents:
849fa92
Message:

Re #7 fix sansmodels setup.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/setup.py

    rb57e704 r13f00a0  
    1111# Then build and install the modules 
    1212from distutils.core import Extension, setup 
    13 #from setuptools import setup#, find_packages 
     13from distutils.command.build_ext import build_ext 
     14 
     15# Options to enable OpenMP 
     16copt =  {'msvc': ['/openmp'], 
     17         'mingw32' : ['-fopenmp'], 
     18         'unix' : ['-fopenmp']} 
     19lopt =  {'msvc': ['/MANIFEST'], 
     20         'mingw32' : ['-fopenmp'], 
     21         'unix' : ['-lgomp']} 
     22 
     23class build_ext_subclass( build_ext ): 
     24    def build_extensions(self): 
     25        # Get 64-bitness 
     26        is_64bits = sys.maxsize > 2**32 
     27         
     28        c = self.compiler.compiler_type 
     29        print "Compiling with %s (64bit=%s)" % (c, str(is_64bits)) 
     30         
     31        if not (sys.platform=='darwin' and not is_64bits): 
     32            if copt.has_key(c): 
     33               for e in self.extensions: 
     34                   e.extra_compile_args = copt[ c ] 
     35            if lopt.has_key(c): 
     36                for e in self.extensions: 
     37                    e.extra_link_args = lopt[ c ] 
     38                     
     39        build_ext.build_extensions(self) 
    1440 
    1541# Build the module name 
     
    7096    smearer_sources.append(os.path.join(igordir, "winFuncs.c")) 
    7197 
    72 # Enable OpenMP 
    73 extra_compile_args = [] 
    74 extra_link_args = [] 
    75 if sys.platform=='linux2' or (sys.platform=='darwin' and platform.architecture()[0]=='64bit'): 
    76     extra_compile_args = ['-fopenmp'] 
    77     extra_link_args = ['-lgomp'] 
    78 elif sys.platform=='win32': 
    79     extra_compile_args = ['/openmp']     
    80     extra_link_args = ['/MANIFEST'] 
    81  
    8298dist = setup( 
    8399    name="sansmodels", 
     
    103119                              sources=model_sources,                  
    104120                              include_dirs=[igordir, srcdir, c_model_dir, numpy_incl_path],    
    105                               extra_compile_args=extra_compile_args, 
    106                               extra_link_args=extra_link_args 
    107121                              ), 
    108122     
     
    110124        Extension("sans.models.sans_extension.smearer", 
    111125                   sources = smearer_sources, 
    112                    include_dirs=[igordir, smear_dir, numpy_incl_path]), 
     126                   include_dirs=[igordir, smear_dir, numpy_incl_path], 
     127                   ), 
     128                    
    113129        Extension("sans.models.sans_extension.smearer2d_helper", 
    114130                  sources = [os.path.join(smear_dir,  
     
    116132                             os.path.join(smear_dir, "smearer2d_helper.cpp"),], 
    117133                  include_dirs=[smear_dir,numpy_incl_path], 
    118                   extra_compile_args=extra_compile_args, 
    119                   extra_link_args=extra_link_args 
    120         ) 
    121         ] 
     134                  ) 
     135        ], 
     136    cmdclass = {'build_ext': build_ext_subclass } 
    122137    ) 
    123138         
Note: See TracChangeset for help on using the changeset viewer.