Changeset 95d7c4f in sasview for setup.py


Ignore:
Timestamp:
Nov 13, 2017 3:33:43 PM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
a1daf86
Parents:
7e82256
Message:

allow compile with tinycc (note: does yet run correctly)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • setup.py

    r0957bb3a r95d7c4f  
    1717import numpy as np 
    1818from setuptools import Extension, setup 
     19 
     20if os.name == 'nt': 
     21    try: 
     22        import tinycc 
     23    except ImportError: 
     24        os.path.insert(os.path.insert(0, '..', 'tinycc')) 
     25        import tinycc 
     26    use_tinycc = True 
     27    sys.argv.append('--compiler=mingw32') 
     28    print(tinycc.TCC) 
     29else: 
     30    use_tinycc = False 
    1931 
    2032# Manage version number ###################################### 
     
    133145 
    134146 
     147_ = """ 
     148C:\Users\pkienzle\AppData\Local\Continuum\Anaconda2\lib\site-packages\tinycc\tcc.exe -DMS_WIN64 -shared -s build\temp.win-amd64-2.7\Release\src\sas\sascalc\calculator\c_extensions\sld2i_module.o build\temp.win-amd64-2.7\Release\src\sas\sascalc\calculator\c_extensions\sld2i.o build\temp.win-amd64-2.7\Release\src\sas\sascalc\calculator\c_extensions\libfunc.o build\temp.win-amd64-2.7\Release\src\sas\sascalc\calculator\c_extensions\librefl.o build\temp.win-amd64-2.7\Release\src\sas\sascalc\calculator\c_extensions\sld2i.def -LC:\Users\pkienzle\AppData\Local\Continuum\Anaconda2\libs -LC:\Users\pkienzle\AppData\Local\Continuum\Anaconda2\PCbuild\amd64 -LC:\Users\pkienzle\AppData\Local\Continuum\Anaconda2\PC\VS9.0\amd64 -lpython27 -lmsvcr90 -o build\lib.win-amd64-2.7\sas\sascalc\calculator\core\sld2i.pyd 
     149""" 
     150 
    135151class build_ext_subclass(build_ext): 
    136152    def build_extensions(self): 
     153        if use_tinycc: 
     154            # Note: no -O option because not an optimizer 
     155            self.compiler.set_executables( 
     156                #archiver = ['ar', '-cr'], 
     157                compiler=[tinycc.TCC, '-DMS_WIN64', '-D__TINYCC__', '-Wall'], 
     158                #compiler_cxx=['g__', '-DMS_WIN64', '-Wall'],  # tinycc is not a C++ compiler 
     159                compiler_so=[tinycc.TCC, '-DMS_WIN64', '-D__TINYCC__', '-Wall'],  # and '-c'?? 
     160                #dll_libraries=['msvcr90'], 
     161                linker_exe=[tinycc.TCC, '-DMS_WIN64'], 
     162                linker_so=[tinycc.TCC, '-DMS_WIN64', '-shared'], 
     163                #linker_dll=tinycc.TCC, 
     164            ) 
     165            sysroot = os.path.dirname(os.path.realpath(sys.executable)) 
     166            self.compiler.include_dirs = [os.path.join(sysroot, 'include')] 
     167            self.compiler.library_dirs = [sysroot] 
    137168        # Get 64-bitness 
    138169        c = self.compiler.compiler_type 
    139170        print("Compiling with %s (64bit=%s)" % (c, str(is_64bits))) 
     171        #print("=== compiler attributes ===") 
     172        #print("\n".join("%s: %s"%(k, v) for k, v in sorted(self.compiler.__dict__.items()))) 
     173        #print("=== build_ext attributes ===") 
     174        #print("\n".join("%s: %s"%(k, v) for k, v in self.__dict__.items())) 
     175        #sys.exit(1) 
    140176 
    141177        # OpenMP build options 
Note: See TracChangeset for help on using the changeset viewer.