|
|
|
@ -91,6 +91,13 @@ mono_buildtype_args = {'plain' : [], |
|
|
|
|
'debugoptimized': ['-debug', '-optimize+'], |
|
|
|
|
'release' : ['-optimize+']} |
|
|
|
|
|
|
|
|
|
gnu_winlibs = ['-lkernel32', '-luser32', '-lgdi32', '-lwinspool', '-lshell32', |
|
|
|
|
'-lole32', '-loleaut32', '-luuid', '-lcomdlg32', '-ladvapi32'] |
|
|
|
|
|
|
|
|
|
msvc_winlibs = ['kernel32.lib', 'user32.lib', 'gdi32.lib', |
|
|
|
|
'winspool.lib', 'shell32.lib', 'ole32.lib', 'oleaut32.lib', |
|
|
|
|
'uuid.lib', 'comdlg32.lib', 'advapi32.lib'] |
|
|
|
|
|
|
|
|
|
def build_unix_rpath_args(build_dir, rpath_paths, install_rpath): |
|
|
|
|
if len(rpath_paths) == 0 and len(install_rpath) == 0: |
|
|
|
|
return [] |
|
|
|
@ -118,8 +125,8 @@ class RunResult(): |
|
|
|
|
self.stdout = stdout |
|
|
|
|
self.stderr = stderr |
|
|
|
|
|
|
|
|
|
class CCompiler(): |
|
|
|
|
def __init__(self, exelist, version, is_cross, exe_wrapper=None): |
|
|
|
|
class Compiler(): |
|
|
|
|
def __init__(self, exelist, version): |
|
|
|
|
if type(exelist) == type(''): |
|
|
|
|
self.exelist = [exelist] |
|
|
|
|
elif type(exelist) == type([]): |
|
|
|
@ -127,6 +134,25 @@ class CCompiler(): |
|
|
|
|
else: |
|
|
|
|
raise TypeError('Unknown argument to CCompiler') |
|
|
|
|
self.version = version |
|
|
|
|
|
|
|
|
|
def get_always_args(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def get_linker_always_args(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def get_options(self): |
|
|
|
|
return {} # build afresh every time |
|
|
|
|
|
|
|
|
|
def get_option_compile_args(self, options): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def get_option_link_args(self, options): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
class CCompiler(Compiler): |
|
|
|
|
def __init__(self, exelist, version, is_cross, exe_wrapper=None): |
|
|
|
|
super().__init__(exelist, version) |
|
|
|
|
self.language = 'c' |
|
|
|
|
self.default_suffix = 'c' |
|
|
|
|
self.id = 'unknown' |
|
|
|
@ -142,9 +168,6 @@ class CCompiler(): |
|
|
|
|
def get_always_args(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def get_linker_always_args(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def get_warn_args(self, level): |
|
|
|
|
return self.warn_args[level] |
|
|
|
|
|
|
|
|
@ -539,29 +562,17 @@ class ObjCPPCompiler(CPPCompiler): |
|
|
|
|
if pe.returncode != 0: |
|
|
|
|
raise EnvironmentException('Executables created by ObjC++ compiler %s are not runnable.' % self.name_string()) |
|
|
|
|
|
|
|
|
|
class MonoCompiler(): |
|
|
|
|
class MonoCompiler(Compiler): |
|
|
|
|
def __init__(self, exelist, version): |
|
|
|
|
if type(exelist) == type(''): |
|
|
|
|
self.exelist = [exelist] |
|
|
|
|
elif type(exelist) == type([]): |
|
|
|
|
self.exelist = exelist |
|
|
|
|
else: |
|
|
|
|
raise TypeError('Unknown argument to Mono compiler') |
|
|
|
|
self.version = version |
|
|
|
|
super().__init__(exelist, version) |
|
|
|
|
self.language = 'cs' |
|
|
|
|
self.default_suffix = 'cs' |
|
|
|
|
self.id = 'mono' |
|
|
|
|
self.monorunner = 'mono' |
|
|
|
|
|
|
|
|
|
def get_always_args(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def get_output_args(self, fname): |
|
|
|
|
return ['-out:' + fname] |
|
|
|
|
|
|
|
|
|
def get_linker_always_args(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def get_link_args(self, fname): |
|
|
|
|
return ['-r:' + fname] |
|
|
|
|
|
|
|
|
@ -679,26 +690,14 @@ class MonoCompiler(): |
|
|
|
|
def get_buildtype_args(self, buildtype): |
|
|
|
|
return mono_buildtype_args[buildtype] |
|
|
|
|
|
|
|
|
|
class JavaCompiler(): |
|
|
|
|
class JavaCompiler(Compiler): |
|
|
|
|
def __init__(self, exelist, version): |
|
|
|
|
if type(exelist) == type(''): |
|
|
|
|
self.exelist = [exelist] |
|
|
|
|
elif type(exelist) == type([]): |
|
|
|
|
self.exelist = exelist |
|
|
|
|
else: |
|
|
|
|
raise TypeError('Unknown argument to JavaCompiler') |
|
|
|
|
self.version = version |
|
|
|
|
super().__init__(exelist, version) |
|
|
|
|
self.language = 'java' |
|
|
|
|
self.default_suffix = 'java' |
|
|
|
|
self.id = 'unknown' |
|
|
|
|
self.javarunner = 'java' |
|
|
|
|
|
|
|
|
|
def get_always_args(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def get_linker_always_args(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def get_soname_args(self, shlib_name, path, soversion): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@ -819,14 +818,9 @@ class JavaCompiler(): |
|
|
|
|
def has_function(self, funcname, prefix, env): |
|
|
|
|
raise EnvironmentException('Java does not support function checks.') |
|
|
|
|
|
|
|
|
|
class ValaCompiler(): |
|
|
|
|
class ValaCompiler(Compiler): |
|
|
|
|
def __init__(self, exelist, version): |
|
|
|
|
if isinstance(exelist, str): |
|
|
|
|
self.exelist = [exelist] |
|
|
|
|
elif type(exelist) == type([]): |
|
|
|
|
self.exelist = exelist |
|
|
|
|
else: |
|
|
|
|
raise TypeError('Unknown argument to Vala compiler') |
|
|
|
|
super().__init__(exelist, version) |
|
|
|
|
self.version = version |
|
|
|
|
self.id = 'unknown' |
|
|
|
|
self.language = 'vala' |
|
|
|
@ -863,15 +857,9 @@ class ValaCompiler(): |
|
|
|
|
suffix = filename.split('.')[-1] |
|
|
|
|
return suffix in ('vala', 'vapi') |
|
|
|
|
|
|
|
|
|
class RustCompiler(): |
|
|
|
|
class RustCompiler(Compiler): |
|
|
|
|
def __init__(self, exelist, version): |
|
|
|
|
if isinstance(exelist, str): |
|
|
|
|
self.exelist = [exelist] |
|
|
|
|
elif type(exelist) == type([]): |
|
|
|
|
self.exelist = exelist |
|
|
|
|
else: |
|
|
|
|
raise TypeError('Unknown argument to Rust compiler') |
|
|
|
|
self.version = version |
|
|
|
|
super().__init__(exelist, version) |
|
|
|
|
self.id = 'unknown' |
|
|
|
|
self.language = 'rust' |
|
|
|
|
|
|
|
|
@ -920,6 +908,7 @@ class VisualStudioCCompiler(CCompiler): |
|
|
|
|
vs2010_always_args = ['/nologo', '/showIncludes'] |
|
|
|
|
vs2013_always_args = ['/nologo', '/showIncludes', '/FS'] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, exelist, version, is_cross, exe_wrap): |
|
|
|
|
CCompiler.__init__(self, exelist, version, is_cross, exe_wrap) |
|
|
|
|
self.id = 'msvc' |
|
|
|
@ -1012,6 +1001,15 @@ class VisualStudioCCompiler(CCompiler): |
|
|
|
|
def thread_link_flags(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def get_options(self): |
|
|
|
|
return {'c_winlibs' : mesonlib.UserStringArrayOption('c_winlibs', |
|
|
|
|
'Windows libs to link against.', |
|
|
|
|
msvc_winlibs) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
def get_option_link_args(self, options): |
|
|
|
|
return options['c_winlibs'].value |
|
|
|
|
|
|
|
|
|
class VisualStudioCPPCompiler(VisualStudioCCompiler): |
|
|
|
|
def __init__(self, exelist, version, is_cross, exe_wrap): |
|
|
|
|
VisualStudioCCompiler.__init__(self, exelist, version, is_cross, exe_wrap) |
|
|
|
@ -1042,6 +1040,26 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler): |
|
|
|
|
if pe.returncode != 0: |
|
|
|
|
raise EnvironmentException('Executables created by C++ compiler %s are not runnable.' % self.name_string()) |
|
|
|
|
|
|
|
|
|
def get_options(self): |
|
|
|
|
return {'cpp_eh' : mesonlib.UserComboOption('cpp_eh', |
|
|
|
|
'C++ exception handling type.', |
|
|
|
|
['none', 'a', 's', 'sc'], |
|
|
|
|
'sc'), |
|
|
|
|
'cpp_winlibs' : mesonlib.UserStringArrayOption('cpp_winlibs', |
|
|
|
|
'Windows libs to link against.', |
|
|
|
|
msvc_winlibs) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
def get_option_compile_args(self, options): |
|
|
|
|
args = [] |
|
|
|
|
std = options['cpp_eh'] |
|
|
|
|
if std.value != 'none': |
|
|
|
|
args.append('/EH' + std.value) |
|
|
|
|
return args |
|
|
|
|
|
|
|
|
|
def get_option_link_args(self, options): |
|
|
|
|
return options['cpp_winlibs'].value |
|
|
|
|
|
|
|
|
|
GCC_STANDARD = 0 |
|
|
|
|
GCC_OSX = 1 |
|
|
|
|
GCC_MINGW = 2 |
|
|
|
@ -1059,6 +1077,7 @@ def get_gcc_soname_args(gcc_type, shlib_name, path, soversion): |
|
|
|
|
else: |
|
|
|
|
raise RuntimeError('Not implemented yet.') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GnuCCompiler(CCompiler): |
|
|
|
|
def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None): |
|
|
|
|
CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) |
|
|
|
@ -1094,6 +1113,29 @@ class GnuCCompiler(CCompiler): |
|
|
|
|
def can_compile(self, filename): |
|
|
|
|
return super().can_compile(filename) or filename.split('.')[-1].lower() == 's' # Gcc can do asm, too. |
|
|
|
|
|
|
|
|
|
def get_options(self): |
|
|
|
|
opts = {'c_std' : mesonlib.UserComboOption('c_std', 'C language standard to use', |
|
|
|
|
['none', 'c89', 'c99', 'c11', 'gnu89', 'gnu99', 'gnu11'], |
|
|
|
|
'c11')} |
|
|
|
|
if self.gcc_type == GCC_MINGW: |
|
|
|
|
opts.update({ |
|
|
|
|
'c_winlibs': mesonlib.UserStringArrayOption('c_winlibs', 'Standard Win libraries to link against', |
|
|
|
|
gnu_winlibs), |
|
|
|
|
}) |
|
|
|
|
return opts |
|
|
|
|
|
|
|
|
|
def get_option_compile_args(self, options): |
|
|
|
|
args = [] |
|
|
|
|
std = options['c_std'] |
|
|
|
|
if std.value != 'none': |
|
|
|
|
args.append('-std=' + std.value) |
|
|
|
|
return args |
|
|
|
|
|
|
|
|
|
def get_option_link_args(self, options): |
|
|
|
|
if self.gcc_type == GCC_MINGW: |
|
|
|
|
return options['c_winlibs'].value |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
class GnuObjCCompiler(ObjCCompiler): |
|
|
|
|
std_opt_args = ['-O2'] |
|
|
|
|
|
|
|
|
@ -1182,6 +1224,22 @@ class ClangCCompiler(CCompiler): |
|
|
|
|
# so it might change semantics at any time. |
|
|
|
|
return ['-include-pch', os.path.join (pch_dir, self.get_pch_name (header))] |
|
|
|
|
|
|
|
|
|
def get_options(self): |
|
|
|
|
return {'c_std' : mesonlib.UserComboOption('c_std', 'C language standard to use', |
|
|
|
|
['none', 'c89', 'c99', 'c11'], |
|
|
|
|
'c11')} |
|
|
|
|
|
|
|
|
|
def get_option_compile_args(self, options): |
|
|
|
|
args = [] |
|
|
|
|
std = options['c_std'] |
|
|
|
|
if std.value != 'none': |
|
|
|
|
args.append('-std=' + std.value) |
|
|
|
|
return args |
|
|
|
|
|
|
|
|
|
def get_option_link_args(self, options): |
|
|
|
|
if self.gcc_type == GCC_MINGW: |
|
|
|
|
return options['c_winlibs'].value |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
class GnuCPPCompiler(CPPCompiler): |
|
|
|
|
# may need to separate the latter to extra_debug_args or something |
|
|
|
@ -1210,6 +1268,29 @@ class GnuCPPCompiler(CPPCompiler): |
|
|
|
|
def get_soname_args(self, shlib_name, path, soversion): |
|
|
|
|
return get_gcc_soname_args(self.gcc_type, shlib_name, path, soversion) |
|
|
|
|
|
|
|
|
|
def get_options(self): |
|
|
|
|
opts = {'cpp_std' : mesonlib.UserComboOption('cpp_std', 'C language standard to use', |
|
|
|
|
['none', 'c++03', 'c++11', 'c++1y'], |
|
|
|
|
'c++11')} |
|
|
|
|
if self.gcc_type == GCC_MINGW: |
|
|
|
|
opts.update({ |
|
|
|
|
'cpp_winlibs': mesonlib.UserStringArrayOption('c_winlibs', 'Standard Win libraries to link against', |
|
|
|
|
gnu_winlibs), |
|
|
|
|
}) |
|
|
|
|
return opts |
|
|
|
|
|
|
|
|
|
def get_option_compile_args(self, options): |
|
|
|
|
args = [] |
|
|
|
|
std = options['cpp_std'] |
|
|
|
|
if std.value != 'none': |
|
|
|
|
args.append('-std=' + std.value) |
|
|
|
|
return args |
|
|
|
|
|
|
|
|
|
def get_option_link_args(self, options): |
|
|
|
|
if self.gcc_type == GCC_MINGW: |
|
|
|
|
return options['cpp_winlibs'].value |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
class ClangCPPCompiler(CPPCompiler): |
|
|
|
|
def __init__(self, exelist, version, is_cross, exe_wrapper=None): |
|
|
|
|
CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) |
|
|
|
@ -1233,11 +1314,24 @@ class ClangCPPCompiler(CPPCompiler): |
|
|
|
|
# so it might change semantics at any time. |
|
|
|
|
return ['-include-pch', os.path.join (pch_dir, self.get_pch_name (header))] |
|
|
|
|
|
|
|
|
|
class FortranCompiler(): |
|
|
|
|
def __init__(self, exelist, version,is_cross, exe_wrapper=None): |
|
|
|
|
super().__init__() |
|
|
|
|
self.exelist = exelist |
|
|
|
|
self.version = version |
|
|
|
|
def get_options(self): |
|
|
|
|
return {'cpp_std' : mesonlib.UserComboOption('cpp_std', 'C++ language standard to use', |
|
|
|
|
['none', 'c++03', 'c++11', 'c++1y'], |
|
|
|
|
'c++11')} |
|
|
|
|
|
|
|
|
|
def get_option_compile_args(self, options): |
|
|
|
|
args = [] |
|
|
|
|
std = options['cpp_std'] |
|
|
|
|
if std.value != 'none': |
|
|
|
|
args.append('-std=' + std.value) |
|
|
|
|
return args |
|
|
|
|
|
|
|
|
|
def get_option_link_args(self, options): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
class FortranCompiler(Compiler): |
|
|
|
|
def __init__(self, exelist, version, is_cross, exe_wrapper=None): |
|
|
|
|
super().__init__(exelist, version) |
|
|
|
|
self.is_cross = is_cross |
|
|
|
|
self.exe_wrapper = exe_wrapper |
|
|
|
|
self.language = 'fortran' |
|
|
|
@ -1293,12 +1387,6 @@ end program prog |
|
|
|
|
if pe.returncode != 0: |
|
|
|
|
raise EnvironmentException('Executables created by Fortran compiler %s are not runnable.' % self.name_string()) |
|
|
|
|
|
|
|
|
|
def get_always_args(self): |
|
|
|
|
return ['-pipe'] |
|
|
|
|
|
|
|
|
|
def get_linker_always_args(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def get_std_warn_args(self, level): |
|
|
|
|
return FortranCompiler.std_warn_args |
|
|
|
|
|
|
|
|
@ -1368,6 +1456,9 @@ class GnuFortranCompiler(FortranCompiler): |
|
|
|
|
self.gcc_type = gcc_type |
|
|
|
|
self.id = 'gcc' |
|
|
|
|
|
|
|
|
|
def get_always_args(self): |
|
|
|
|
return ['-pipe'] |
|
|
|
|
|
|
|
|
|
class G95FortranCompiler(FortranCompiler): |
|
|
|
|
def __init__(self, exelist, version, is_cross, exe_wrapper=None): |
|
|
|
|
super().__init__(exelist, version, is_cross, exe_wrapper=None) |
|
|
|
@ -1376,6 +1467,9 @@ class G95FortranCompiler(FortranCompiler): |
|
|
|
|
def get_module_outdir_args(self, path): |
|
|
|
|
return ['-fmod='+path] |
|
|
|
|
|
|
|
|
|
def get_always_args(self): |
|
|
|
|
return ['-pipe'] |
|
|
|
|
|
|
|
|
|
class SunFortranCompiler(FortranCompiler): |
|
|
|
|
def __init__(self, exelist, version, is_cross, exe_wrapper=None): |
|
|
|
|
super().__init__(exelist, version, is_cross, exe_wrapper=None) |
|
|
|
@ -1403,9 +1497,6 @@ class IntelFortranCompiler(FortranCompiler): |
|
|
|
|
def get_module_outdir_args(self, path): |
|
|
|
|
return ['-module', path] |
|
|
|
|
|
|
|
|
|
def get_always_args(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def can_compile(self, src): |
|
|
|
|
suffix = os.path.splitext(src)[1].lower() |
|
|
|
|
if suffix == '.f' or suffix == '.f90': |
|
|
|
@ -1425,9 +1516,6 @@ class PathScaleFortranCompiler(FortranCompiler): |
|
|
|
|
def get_module_outdir_args(self, path): |
|
|
|
|
return ['-module', path] |
|
|
|
|
|
|
|
|
|
def get_always_args(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def can_compile(self, src): |
|
|
|
|
suffix = os.path.splitext(src)[1].lower() |
|
|
|
|
if suffix == '.f' or suffix == '.f90' or suffix == '.f95': |
|
|
|
@ -1447,9 +1535,6 @@ class PGIFortranCompiler(FortranCompiler): |
|
|
|
|
def get_module_outdir_args(self, path): |
|
|
|
|
return ['-module', path] |
|
|
|
|
|
|
|
|
|
def get_always_args(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def can_compile(self, src): |
|
|
|
|
suffix = os.path.splitext(src)[1].lower() |
|
|
|
|
if suffix == '.f' or suffix == '.f90' or suffix == '.f95': |
|
|
|
@ -1470,9 +1555,6 @@ class Open64FortranCompiler(FortranCompiler): |
|
|
|
|
def get_module_outdir_args(self, path): |
|
|
|
|
return ['-module', path] |
|
|
|
|
|
|
|
|
|
def get_always_args(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def can_compile(self, src): |
|
|
|
|
suffix = os.path.splitext(src)[1].lower() |
|
|
|
|
if suffix == '.f' or suffix == '.f90' or suffix == '.f95': |
|
|
|
@ -1537,6 +1619,9 @@ class VisualStudioLinker(): |
|
|
|
|
def thread_link_flags(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def get_option_link_args(self, options): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
class ArLinker(): |
|
|
|
|
std_args = ['csr'] |
|
|
|
|
|
|
|
|
@ -1570,3 +1655,6 @@ class ArLinker(): |
|
|
|
|
|
|
|
|
|
def thread_link_flags(self): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def get_option_link_args(self, options): |
|
|
|
|
return [] |
|
|
|
|