(cfile, outputfilename, include_dirs=[], libraries=[],
library_dirs=[])
| 179 | |
| 180 | |
| 181 | def _c_compile(cfile, outputfilename, include_dirs=[], libraries=[], |
| 182 | library_dirs=[]): |
| 183 | if sys.platform == 'win32': |
| 184 | compile_extra = ["/we4013"] |
| 185 | link_extra = ["/LIBPATH:" + os.path.join(sys.base_prefix, 'libs')] |
| 186 | elif sys.platform.startswith('linux'): |
| 187 | compile_extra = [ |
| 188 | "-O0", "-g", "-Werror=implicit-function-declaration", "-fPIC"] |
| 189 | link_extra = [] |
| 190 | else: |
| 191 | compile_extra = link_extra = [] |
| 192 | pass |
| 193 | if sys.platform == 'win32': |
| 194 | link_extra = link_extra + ['/DEBUG'] # generate .pdb file |
| 195 | if sys.platform == 'darwin': |
| 196 | # support Fink & Darwinports |
| 197 | for s in ('/sw/', '/opt/local/'): |
| 198 | if (s + 'include' not in include_dirs |
| 199 | and os.path.exists(s + 'include')): |
| 200 | include_dirs.append(s + 'include') |
| 201 | if s + 'lib' not in library_dirs and os.path.exists(s + 'lib'): |
| 202 | library_dirs.append(s + 'lib') |
| 203 | |
| 204 | outputfilename = outputfilename.with_suffix(get_so_suffix()) |
| 205 | build( |
| 206 | cfile, outputfilename, |
| 207 | compile_extra, link_extra, |
| 208 | include_dirs, libraries, library_dirs) |
| 209 | return outputfilename |
| 210 | |
| 211 | |
| 212 | def build(cfile, outputfilename, compile_extra, link_extra, |
no test coverage detected