Changeset 13f00a0 in sasview


Ignore:
Timestamp:
Dec 9, 2011 4:27:02 PM (12 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

Files:
2 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         
  • setup.py

    r01de557 r13f00a0  
    2424ext_modules = [] 
    2525 
    26 # TODO check for sans/__init__.py 
    27  
    28 # Enable OpenMP 
    29 extra_compile_args = [] 
    30 extra_link_args = [] 
    31 if sys.platform=='linux2' or (sys.platform=='darwin' and platform.architecture()[0]=='64bit'): 
    32     extra_compile_args = ['-fopenmp'] 
    33     extra_link_args = ['-lgomp'] 
    34 elif os.name=='nt': 
    35     extra_compile_args = ['/openmp'] 
     26# Options to enable OpenMP 
     27copt =  {'msvc': ['/openmp'], 
     28         'mingw32' : ['-fopenmp'], 
     29         'unix' : ['-fopenmp']} 
     30lopt =  {'msvc': ['/MANIFEST'], 
     31         'mingw32' : ['-fopenmp'], 
     32         'unix' : ['-lgomp']} 
     33 
     34class build_ext_subclass( build_ext ): 
     35    def build_extensions(self): 
     36        # Get 64-bitness 
     37        is_64bits = sys.maxsize > 2**32 
     38         
     39        c = self.compiler.compiler_type 
     40        print "Compiling with %s (64bit=%s)" % (c, str(is_64bits)) 
     41         
     42        if not (sys.platform=='darwin' and not is_64bits): 
     43            if copt.has_key(c): 
     44               for e in self.extensions: 
     45                   e.extra_compile_args = copt[ c ] 
     46            if lopt.has_key(c): 
     47                for e in self.extensions: 
     48                    e.extra_link_args = lopt[ c ] 
     49                     
     50        build_ext.build_extensions(self) 
     51 
    3652 
    3753# sans.invariant 
     
    7591                                         ], 
    7692                              include_dirs=[numpy_incl_path], 
    77                               extra_compile_args=extra_compile_args, 
    78                               extra_link_args=extra_link_args                               
    7993                              ) ) 
    8094         
     
    126140                                         os.path.join("park-1.2.1", "park", "lib", "resolution.c"), 
    127141                                         ], 
    128                               extra_compile_args=extra_compile_args, 
    129                               extra_link_args=extra_link_args 
    130142                              ) ) 
    131143 
     
    198210                                sources=model_sources,                  
    199211                                include_dirs=[igordir, srcdir, c_model_dir, numpy_incl_path], 
    200                                 extra_compile_args=extra_compile_args, 
    201                                 extra_link_args=extra_link_args 
    202212                                ),        
    203213                    # Smearer extension 
     
    205215                              sources = smearer_sources, 
    206216                              include_dirs=[igordir, smear_dir, numpy_incl_path], 
    207                               extra_compile_args=extra_compile_args, 
    208                               extra_link_args=extra_link_args 
    209217                              ), 
    210218                     
     
    214222                                         os.path.join(smear_dir, "smearer2d_helper.cpp"),], 
    215223                              include_dirs=[smear_dir,numpy_incl_path], 
    216                               extra_compile_args=extra_compile_args, 
    217                               extra_link_args=extra_link_args 
    218224                              ) 
    219225                    ] ) 
     
    255261                                       "sansview = sans.sansview.sansview:run", 
    256262                                       ] 
    257                     } 
     263                    }, 
     264    cmdclass = {'build_ext': build_ext_subclass } 
    258265    )    
Note: See TracChangeset for help on using the changeset viewer.