Changes in sasmodels/kerneldll.py [9eb3632:739aad4] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kerneldll.py
r9eb3632 r739aad4 57 57 import numpy as np # type: ignore 58 58 59 try: 60 import tinycc 61 except ImportError: 62 tinycc = None 63 59 64 from . import generate 60 65 from .kernel import KernelModel, Kernel … … 70 75 pass 71 76 72 if os.name == 'nt': 73 ARCH = "" if sys.maxint > 2**32 else "x86" # maxint=2**31-1 on 32 bit 74 # Windows compiler; check if TinyCC is available 75 try: 76 import tinycc 77 except ImportError: 78 tinycc = None 79 # call vcvarsall.bat before compiling to set path, headers, libs, etc. 77 if "SAS_COMPILER" in os.environ: 78 compiler = os.environ["SAS_COMPILER"] 79 elif os.name == 'nt': 80 # If vcvarsall.bat has been called, then VCINSTALLDIR is in the environment 81 # and we can use the MSVC compiler. Otherwise, if tinycc is available 82 # the use it. Otherwise, hope that mingw is available. 80 83 if "VCINSTALLDIR" in os.environ: 81 # MSVC compiler is available, so use it. OpenMP requires a copy of 82 # vcomp90.dll on the path. One may be found here: 83 # C:/Windows/winsxs/x86_microsoft.vc90.openmp*/vcomp90.dll 84 # Copy this to the python directory and uncomment the OpenMP COMPILE 85 # TODO: remove intermediate OBJ file created in the directory 86 # TODO: maybe don't use randomized name for the c file 87 # TODO: maybe ask distutils to find MSVC 88 CC = "cl /nologo /Ox /MD /W3 /GS- /DNDEBUG".split() 89 if "SAS_OPENMP" in os.environ: 90 CC.append("/openmp") 91 LN = "/link /DLL /INCREMENTAL:NO /MANIFEST".split() 92 def compile_command(source, output): 93 return CC + ["/Tp%s"%source] + LN + ["/OUT:%s"%output] 84 compiler = "msvc" 94 85 elif tinycc: 95 # TinyCC compiler. 96 CC = [tinycc.TCC] + "-shared -rdynamic -Wall".split() 97 def compile_command(source, output): 98 return CC + [source, "-o", output] 86 compiler = "tinycc" 99 87 else: 100 # MinGW compiler. 101 CC = "gcc -shared -std=c99 -O2 -Wall".split() 102 if "SAS_OPENMP" in os.environ: 103 CC.append("-fopenmp") 104 def compile_command(source, output): 105 return CC + [source, "-o", output, "-lm"] 88 compiler = "mingw" 106 89 else: 107 ARCH = "" 90 compiler = "unix" 91 92 ARCH = "" if sys.maxint > 2**32 else "x86" # maxint=2**31-1 on 32 bit 93 if compiler == "unix": 108 94 # Generic unix compile 109 95 # On mac users will need the X code command line tools installed … … 112 98 # add openmp support if not running on a mac 113 99 if sys.platform != "darwin": 100 CC.append("-fopenmp") 101 def compile_command(source, output): 102 return CC + [source, "-o", output, "-lm"] 103 elif compiler == "msvc": 104 # Call vcvarsall.bat before compiling to set path, headers, libs, etc. 105 # MSVC compiler is available, so use it. OpenMP requires a copy of 106 # vcomp90.dll on the path. One may be found here: 107 # C:/Windows/winsxs/x86_microsoft.vc90.openmp*/vcomp90.dll 108 # Copy this to the python directory and uncomment the OpenMP COMPILE 109 # TODO: remove intermediate OBJ file created in the directory 110 # TODO: maybe don't use randomized name for the c file 111 # TODO: maybe ask distutils to find MSVC 112 CC = "cl /nologo /Ox /MD /W3 /GS- /DNDEBUG".split() 113 if "SAS_OPENMP" in os.environ: 114 CC.append("/openmp") 115 LN = "/link /DLL /INCREMENTAL:NO /MANIFEST".split() 116 def compile_command(source, output): 117 return CC + ["/Tp%s"%source] + LN + ["/OUT:%s"%output] 118 elif compiler == "tinycc": 119 # TinyCC compiler. 120 CC = [tinycc.TCC] + "-shared -rdynamic -Wall".split() 121 def compile_command(source, output): 122 return CC + [source, "-o", output] 123 elif compiler == "mingw": 124 # MinGW compiler. 125 CC = "gcc -shared -std=c99 -O2 -Wall".split() 126 if "SAS_OPENMP" in os.environ: 114 127 CC.append("-fopenmp") 115 128 def compile_command(source, output):
Note: See TracChangeset
for help on using the changeset viewer.