Exemple #1
0
 def __init__(self, name, fullpath=None, silent=False, search_dir=None):
     self.name = name
     if fullpath is not None:
         if not isinstance(fullpath, list):
             self.fullpath = [fullpath]
         else:
             self.fullpath = fullpath
     else:
         self.fullpath = [shutil.which(name)]
         if self.fullpath[0] is None and search_dir is not None:
             trial = os.path.join(search_dir, name)
             suffix = os.path.splitext(trial)[-1].lower()[1:]
             if mesonlib.is_windows() and (suffix == 'exe' or suffix == 'com'\
                                       or suffix == 'bat'):
                 self.fullpath = [trial]
             elif not mesonlib.is_windows() and os.access(trial, os.X_OK):
                 self.fullpath = [trial]
             else:
                 # Now getting desperate. Maybe it is a script file that is a) not chmodded
                 # executable or b) we are on windows so they can't be directly executed.
                 try:
                     first_line = open(trial).readline().strip()
                     if first_line.startswith('#!'):
                         commands = first_line[2:].split('#')[0].strip().split()
                         if mesonlib.is_windows():
                             commands[0] = commands[0].split('/')[-1] # Windows does not have /usr/bin.
                         self.fullpath = commands + [trial]
                 except Exception:
                     pass
     if not silent:
         if self.found():
             mlog.log('Program', mlog.bold(name), 'found:', mlog.green('YES'), '(%s)' % ' '.join(self.fullpath))
         else:
             mlog.log('Program', mlog.bold(name), 'found:', mlog.red('NO'))
Exemple #2
0
def detect_tests_to_run():
    all_tests = []
    all_tests.append(('common', gather_tests('test cases/common'), False))
    all_tests.append(('failing', gather_tests('test cases/failing'), False))
    all_tests.append(
        ('prebuilt object', gather_tests('test cases/prebuilt object'), False))

    all_tests.append(('platform-osx', gather_tests('test cases/osx'),
                      False if mesonlib.is_osx() else True))
    all_tests.append(('platform-windows', gather_tests('test cases/windows'),
                      False if mesonlib.is_windows() else True))
    all_tests.append(
        ('platform-linux', gather_tests('test cases/linuxlike'),
         False if not (mesonlib.is_osx() or mesonlib.is_windows()) else True))
    all_tests.append(
        ('framework', gather_tests('test cases/frameworks'), False
         if not mesonlib.is_osx() and not mesonlib.is_windows() else True))
    all_tests.append(
        ('java', gather_tests('test cases/java'),
         False if not mesonlib.is_osx() and shutil.which('javac') else True))
    all_tests.append(('C#', gather_tests('test cases/csharp'),
                      False if shutil.which('mcs') else True))
    all_tests.append(('vala', gather_tests('test cases/vala'),
                      False if shutil.which('valac') else True))
    all_tests.append(('rust', gather_tests('test cases/rust'),
                      False if shutil.which('rustc') else True))
    all_tests.append(('objective c', gather_tests('test cases/objc'),
                      False if not mesonlib.is_windows() else True))
    all_tests.append(('fortran', gather_tests('test cases/fortran'),
                      False if shutil.which('gfortran') else True))
    return all_tests
Exemple #3
0
    def __init__(self, source_dir, build_dir, main_script_file, options):
        assert(os.path.isabs(main_script_file))
        assert(not os.path.islink(main_script_file))
        self.source_dir = source_dir
        self.build_dir = build_dir
        self.meson_script_file = main_script_file
        self.scratch_dir = os.path.join(build_dir, Environment.private_dir)
        self.log_dir = os.path.join(build_dir, Environment.log_dir)
        os.makedirs(self.scratch_dir, exist_ok=True)
        os.makedirs(self.log_dir, exist_ok=True)
        try:
            cdf = os.path.join(self.get_build_dir(), Environment.coredata_file)
            self.coredata = coredata.load(cdf)
            self.first_invocation = False
        except FileNotFoundError:
            self.coredata = coredata.CoreData(options)
            self.first_invocation = True
        if self.coredata.cross_file:
            self.cross_info = CrossBuildInfo(self.coredata.cross_file)
        else:
            self.cross_info = None
        self.cmd_line_options = options

        # List of potential compilers.
        if mesonlib.is_windows():
            self.default_c = ['cl', 'cc', 'gcc']
            self.default_cpp = ['cl', 'c++', 'g++']
        else:
            self.default_c = ['cc']
            self.default_cpp = ['c++']
        self.default_objc = ['cc']
        self.default_objcpp = ['c++']
        self.default_fortran = ['gfortran', 'g95', 'f95', 'f90', 'f77']
        self.default_static_linker = 'ar'
        self.vs_static_linker = 'lib'

        cross = self.is_cross_build()
        if (not cross and mesonlib.is_windows()) \
        or (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['system'] == 'windows'):
            self.exe_suffix = 'exe'
            self.import_lib_suffix = 'lib'
            self.shared_lib_suffix = 'dll'
            self.shared_lib_prefix = ''
            self.static_lib_suffix = 'lib'
            self.static_lib_prefix = ''
            self.object_suffix = 'obj'
        else:
            self.exe_suffix = ''
            if (not cross and mesonlib.is_osx()) or \
            (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['system'] == 'darwin'):
                self.shared_lib_suffix = 'dylib'
            else:
                self.shared_lib_suffix = 'so'
            self.shared_lib_prefix = 'lib'
            self.static_lib_suffix = 'a'
            self.static_lib_prefix = 'lib'
            self.object_suffix = 'o'
            self.import_lib_suffix = self.shared_lib_suffix
Exemple #4
0
    def __init__(self, source_dir, build_dir, main_script_file, options):
        assert (os.path.isabs(main_script_file))
        assert (not os.path.islink(main_script_file))
        self.source_dir = source_dir
        self.build_dir = build_dir
        self.meson_script_file = main_script_file
        self.scratch_dir = os.path.join(build_dir, Environment.private_dir)
        self.log_dir = os.path.join(build_dir, Environment.log_dir)
        os.makedirs(self.scratch_dir, exist_ok=True)
        os.makedirs(self.log_dir, exist_ok=True)
        try:
            cdf = os.path.join(self.get_build_dir(), Environment.coredata_file)
            self.coredata = coredata.load(cdf)
            self.first_invocation = False
        except FileNotFoundError:
            self.coredata = coredata.CoreData(options)
            self.first_invocation = True
        if self.coredata.cross_file:
            self.cross_info = CrossBuildInfo(self.coredata.cross_file)
        else:
            self.cross_info = None
        self.cmd_line_options = options

        # List of potential compilers.
        if mesonlib.is_windows():
            self.default_c = ['cl', 'cc', 'gcc', 'clang']
            self.default_cpp = ['cl', 'c++', 'g++', 'clang++']
        else:
            self.default_c = ['cc']
            self.default_cpp = ['c++']
        self.default_objc = ['cc']
        self.default_objcpp = ['c++']
        self.default_fortran = ['gfortran', 'g95', 'f95', 'f90', 'f77']
        self.default_static_linker = 'ar'
        self.vs_static_linker = 'lib'

        cross = self.is_cross_build()
        if (not cross and mesonlib.is_windows()) \
        or (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['system'] == 'windows'):
            self.exe_suffix = 'exe'
            self.import_lib_suffix = 'lib'
            self.shared_lib_suffix = 'dll'
            self.shared_lib_prefix = ''
            self.static_lib_suffix = 'lib'
            self.static_lib_prefix = ''
            self.object_suffix = 'obj'
        else:
            self.exe_suffix = ''
            if (not cross and mesonlib.is_osx()) or \
            (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['system'] == 'darwin'):
                self.shared_lib_suffix = 'dylib'
            else:
                self.shared_lib_suffix = 'so'
            self.shared_lib_prefix = 'lib'
            self.static_lib_suffix = 'a'
            self.static_lib_prefix = 'lib'
            self.object_suffix = 'o'
            self.import_lib_suffix = self.shared_lib_suffix
Exemple #5
0
 def write_test_serialisation(self, tests, datafile):
     arr = []
     for t in tests:
         exe = t.get_exe()
         if isinstance(exe, dependencies.ExternalProgram):
             fname = exe.fullpath
         else:
             fname = [
                 os.path.join(self.environment.get_build_dir(),
                              self.get_target_filename(t.get_exe()))
             ]
         is_cross = self.environment.is_cross_build(
         ) and self.environment.cross_info.need_cross_compiler()
         if is_cross:
             exe_wrapper = self.environment.cross_info.config[
                 'binaries'].get('exe_wrapper', None)
         else:
             exe_wrapper = None
         if mesonlib.is_windows():
             extra_paths = self.determine_windows_extra_paths(exe)
         else:
             extra_paths = []
         cmd_args = []
         for a in t.cmd_args:
             if isinstance(a, mesonlib.File):
                 a = os.path.join(self.environment.get_build_dir(),
                                  a.rel_to_builddir(self.build_to_src))
             cmd_args.append(a)
         ts = TestSerialisation(t.get_name(), t.suite, fname, is_cross,
                                exe_wrapper, t.is_parallel, cmd_args, t.env,
                                t.should_fail, t.valgrind_args, t.timeout,
                                t.workdir, extra_paths)
         arr.append(ts)
     pickle.dump(arr, datafile)
Exemple #6
0
 def write_test_file(self, datafile):
     arr = []
     for t in self.build.get_tests():
         exe = t.get_exe()
         if isinstance(exe, dependencies.ExternalProgram):
             fname = exe.fullpath
         else:
             fname = [os.path.join(self.environment.get_build_dir(), self.get_target_filename(t.get_exe()))]
         is_cross = self.environment.is_cross_build() and self.environment.cross_info.need_cross_compiler()
         if is_cross:
             exe_wrapper = self.environment.cross_info.config['binaries'].get('exe_wrapper', None)
         else:
             exe_wrapper = None
         if mesonlib.is_windows():
             extra_paths = self.determine_windows_extra_paths(exe)
         else:
             extra_paths = []
         cmd_args = []
         for a in t.cmd_args:
             if isinstance(a, mesonlib.File):
                 a = os.path.join(self.environment.get_build_dir(), a.rel_to_builddir(self.build_to_src))
             cmd_args.append(a)
         ts = TestSerialisation(t.get_name(), fname, is_cross, exe_wrapper,
                                t.is_parallel, cmd_args, t.env, t.should_fail, t.valgrind_args,
                                t.timeout, extra_paths)
         arr.append(ts)
     pickle.dump(arr, datafile)
Exemple #7
0
 def get_compile_args(self):
     args = []
     if self.boost_root is not None:
         if mesonlib.is_windows():
             args.append('-I' + self.boost_root)
         else:
             args.append('-I' + os.path.join(self.boost_root, 'include'))
     return args
Exemple #8
0
 def get_compile_args(self):
     args = []
     if self.boost_root is not None:
         if mesonlib.is_windows():
             args.append('-I' + self.boost_root)
         else:
             args.append('-I' + os.path.join(self.boost_root, 'include'))
     else:
         args.append('-I' + self.incdir)
     return args
Exemple #9
0
 def __init__(self, name, fullpath=None, silent=False, search_dir=None):
     self.name = name
     self.fullpath = None
     if fullpath is not None:
         if not isinstance(fullpath, list):
             self.fullpath = [fullpath]
         else:
             self.fullpath = fullpath
     else:
         self.fullpath = [shutil.which(name)]
         if self.fullpath[0] is None and search_dir is not None:
             trial = os.path.join(search_dir, name)
             suffix = os.path.splitext(trial)[-1].lower()[1:]
             if mesonlib.is_windows() and (suffix == 'exe' or suffix == 'com'\
                                       or suffix == 'bat'):
                 self.fullpath = [trial]
             elif not mesonlib.is_windows() and os.access(trial, os.X_OK):
                 self.fullpath = [trial]
             else:
                 # Now getting desperate. Maybe it is a script file that is a) not chmodded
                 # executable or b) we are on windows so they can't be directly executed.
                 try:
                     first_line = open(trial).readline().strip()
                     if first_line.startswith('#!'):
                         commands = first_line[2:].split(
                             '#')[0].strip().split()
                         if mesonlib.is_windows():
                             # Windows does not have /usr/bin.
                             commands[0] = commands[0].split('/')[-1]
                             if commands[0] == 'env':
                                 commands = commands[1:]
                         self.fullpath = commands + [trial]
                 except Exception:
                     pass
     if not silent:
         if self.found():
             mlog.log('Program', mlog.bold(name), 'found:',
                      mlog.green('YES'), '(%s)' % ' '.join(self.fullpath))
         else:
             mlog.log('Program', mlog.bold(name), 'found:', mlog.red('NO'))
Exemple #10
0
def platform_fix_filename(fname):
    if mesonlib.is_osx():
        if fname.endswith('.so'):
            return fname[:-2] + 'dylib'
        return fname.replace('.so.', '.dylib.')
    elif mesonlib.is_windows():
        if fname.endswith('.so'):
            (p, f) = os.path.split(fname)
            f = f[3:-2] + 'dll'
            return os.path.join(p, f)
        if fname.endswith('.a'):
            return fname[:-1] + 'lib'
    return fname
Exemple #11
0
def platform_fix_filename(fname):
    if mesonlib.is_osx():
        if fname.endswith('.so'):
            return fname[:-2] + 'dylib'
        return fname.replace('.so.', '.dylib.')
    elif mesonlib.is_windows():
        if fname.endswith('.so'):
            (p, f) = os.path.split(fname)
            f = f[3:-2] + 'dll'
            return os.path.join(p, f)
        if fname.endswith('.a'):
            return fname[:-1] + 'lib'
    return fname
Exemple #12
0
def generate_prebuilt_object():
    source = 'test cases/prebuilt object/1 basic/source.c'
    objectbase = 'test cases/prebuilt object/1 basic/prebuilt.'
    if shutil.which('cl'):
        objectfile = objectbase + 'obj'
        cmd = ['cl', '/nologo', '/Fo'+objectfile, '/c', source]
    else:
        if mesonlib.is_windows():
            objectfile = objectbase + 'obj'
        else:
            objectfile = objectbase + 'o'
        cmd = ['cc', '-c', source, '-o', objectfile]
    subprocess.check_call(cmd)
    return objectfile
Exemple #13
0
def generate_prebuilt_object():
    source = 'test cases/prebuilt object/1 basic/source.c'
    objectbase = 'test cases/prebuilt object/1 basic/prebuilt.'
    if shutil.which('cl'):
        objectfile = objectbase + 'obj'
        cmd = ['cl', '/nologo', '/Fo' + objectfile, '/c', source]
    else:
        if mesonlib.is_windows():
            objectfile = objectbase + 'obj'
        else:
            objectfile = objectbase + 'o'
        cmd = ['cc', '-c', source, '-o', objectfile]
    subprocess.check_call(cmd)
    return objectfile
Exemple #14
0
 def __init__(self, name, fullpath=None, silent=False, search_dir=None):
     self.name = name
     self.fullpath = None
     if fullpath is not None:
         if not isinstance(fullpath, list):
             self.fullpath = [fullpath]
         else:
             self.fullpath = fullpath
     else:
         self.fullpath = [shutil.which(name)]
         if self.fullpath[0] is None and search_dir is not None:
             trial = os.path.join(search_dir, name)
             suffix = os.path.splitext(trial)[-1].lower()[1:]
             if mesonlib.is_windows() and (suffix == "exe" or suffix == "com" or suffix == "bat"):
                 self.fullpath = [trial]
             elif not mesonlib.is_windows() and os.access(trial, os.X_OK):
                 self.fullpath = [trial]
             else:
                 # Now getting desperate. Maybe it is a script file that is a) not chmodded
                 # executable or b) we are on windows so they can't be directly executed.
                 try:
                     first_line = open(trial).readline().strip()
                     if first_line.startswith("#!"):
                         commands = first_line[2:].split("#")[0].strip().split()
                         if mesonlib.is_windows():
                             # Windows does not have /usr/bin.
                             commands[0] = commands[0].split("/")[-1]
                             if commands[0] == "env":
                                 commands = commands[1:]
                         self.fullpath = commands + [trial]
                 except Exception:
                     pass
     if not silent:
         if self.found():
             mlog.log("Program", mlog.bold(name), "found:", mlog.green("YES"), "(%s)" % " ".join(self.fullpath))
         else:
             mlog.log("Program", mlog.bold(name), "found:", mlog.red("NO"))
Exemple #15
0
def detect_tests_to_run():
    all_tests = []
    all_tests.append(('common', gather_tests('test cases/common'), False))
    all_tests.append(('failing', gather_tests('test cases/failing'), False))
    all_tests.append(('prebuilt object', gather_tests('test cases/prebuilt object'), False))

    all_tests.append(('platform-osx', gather_tests('test cases/osx'), False if mesonlib.is_osx() else True))
    all_tests.append(('platform-windows', gather_tests('test cases/windows'), False if mesonlib.is_windows() else True))
    all_tests.append(('platform-linux', gather_tests('test cases/linuxlike'), False if not (mesonlib.is_osx() or mesonlib.is_windows()) else True))
    all_tests.append(('framework', gather_tests('test cases/frameworks'), False if not mesonlib.is_osx() and not mesonlib.is_windows() else True))
    all_tests.append(('java', gather_tests('test cases/java'), False if not mesonlib.is_osx() and shutil.which('javac') else True))
    all_tests.append(('C#', gather_tests('test cases/csharp'), False if shutil.which('mcs') else True))
    all_tests.append(('vala', gather_tests('test cases/vala'), False if shutil.which('valac') else True))
    all_tests.append(('rust', gather_tests('test cases/rust'), False if shutil.which('rustc') else True))
    all_tests.append(('objective c', gather_tests('test cases/objc'), False if not mesonlib.is_windows() else True))
    all_tests.append(('fortran', gather_tests('test cases/fortran'), False if shutil.which('gfortran') else True))
    return all_tests
Exemple #16
0
def generate_prebuilt_object():
    source = 'test cases/prebuilt object/1 basic/source.c'
    objectbase = 'test cases/prebuilt object/1 basic/prebuilt.'
    if shutil.which('cl'):
        objectfile = objectbase + 'obj'
        cmd = ['cl', '/nologo', '/Fo'+objectfile, '/c', source]
    else:
        if mesonlib.is_windows():
            objectfile = objectbase + 'obj'
        else:
            objectfile = objectbase + 'o'
        if shutil.which('cc'):
            cmd = 'cc'
        elif shutil.which('gcc'):
            cmd = 'gcc'
        else:
            raise RuntimeError("Could not find C compiler.")
        cmd = [cmd, '-c', source, '-o', objectfile]
    subprocess.check_call(cmd)
    return objectfile
Exemple #17
0
 def __init__(self, environment, kwargs):
     Dependency.__init__(self)
     self.is_found = False
     self.cargs = []
     self.linkargs = []
     try:
         pcdep = PkgConfigDependency("gl", kwargs)
         if pcdep.found():
             self.is_found = True
             self.cargs = pcdep.get_compile_args()
             self.linkargs = pcdep.get_link_args()
     except Exception:
         pass
     if mesonlib.is_osx():
         self.is_found = True
         self.linkargs = ["-framework", "OpenGL"]
         return
     if mesonlib.is_windows():
         self.is_found = True
         return
Exemple #18
0
def generate_prebuilt_object():
    source = 'test cases/prebuilt object/1 basic/source.c'
    objectbase = 'test cases/prebuilt object/1 basic/prebuilt.'
    if shutil.which('cl'):
        objectfile = objectbase + 'obj'
        cmd = ['cl', '/nologo', '/Fo'+objectfile, '/c', source]
    else:
        if mesonlib.is_windows():
            objectfile = objectbase + 'obj'
        else:
            objectfile = objectbase + 'o'
        if shutil.which('cc'):
            cmd = 'cc'
        elif shutil.which('gcc'):
            cmd = 'gcc'
        else:
            raise RuntimeError("Could not find C compiler.")
        cmd = [cmd, '-c', source, '-o', objectfile]
    subprocess.check_call(cmd)
    return objectfile
Exemple #19
0
 def __init__(self, environment, kwargs):
     Dependency.__init__(self)
     self.is_found = False
     self.cargs = []
     self.linkargs = []
     try:
         pcdep = PkgConfigDependency('gl', environment, kwargs)
         if pcdep.found():
             self.is_found = True
             self.cargs = pcdep.get_compile_args()
             self.linkargs = pcdep.get_link_args()
             return
     except Exception:
         pass
     if mesonlib.is_osx():
         self.is_found = True
         self.linkargs = ['-framework', 'OpenGL']
         return
     if mesonlib.is_windows():
         self.is_found = True
         return
Exemple #20
0
 def __init__(self, environment, kwargs):
     Dependency.__init__(self)
     self.name = 'boost'
     self.libdir = ''
     try:
         self.boost_root = os.environ['BOOST_ROOT']
         if not os.path.isabs(self.boost_root):
             raise DependencyException(
                 'BOOST_ROOT must be an absolute path.')
     except KeyError:
         self.boost_root = None
     if self.boost_root is None:
         if mesonlib.is_windows():
             self.boost_root = self.detect_win_root()
             self.incdir = self.boost_root
         else:
             self.incdir = '/usr/include'
     else:
         self.incdir = os.path.join(self.boost_root, 'include')
     self.boost_inc_subdir = os.path.join(self.incdir, 'boost')
     mlog.debug('Boost library root dir is', self.boost_root)
     self.src_modules = {}
     self.lib_modules = {}
     self.lib_modules_mt = {}
     self.detect_version()
     self.requested_modules = self.get_requested(kwargs)
     module_str = ', '.join(self.requested_modules)
     if self.version is not None:
         self.detect_src_modules()
         self.detect_lib_modules()
         self.validate_requested()
         if self.boost_root is not None:
             info = self.version + ', ' + self.boost_root
         else:
             info = self.version
         mlog.log('Dependency Boost (%s) found:' % module_str,
                  mlog.green('YES'), '(' + info + ')')
     else:
         mlog.log("Dependency Boost (%s) found:" % module_str,
                  mlog.red('NO'))
Exemple #21
0
 def __init__(self, environment, kwargs):
     Dependency.__init__(self)
     self.is_found = False
     self.cargs = []
     self.linkargs = []
     try:
         pcdep = PkgConfigDependency('gl', environment, kwargs)
         if pcdep.found():
             self.is_found = True
             self.cargs = pcdep.get_compile_args()
             self.linkargs = pcdep.get_link_args()
             return
     except Exception:
         pass
     if mesonlib.is_osx():
         self.is_found = True
         self.linkargs = ['-framework', 'OpenGL']
         return
     if mesonlib.is_windows():
         self.is_found = True
         self.linkargs = ['-lopengl32']
         return
Exemple #22
0
 def __init__(self, environment, kwargs):
     Dependency.__init__(self)
     self.name = 'boost'
     self.libdir = ''
     try:
         self.boost_root = os.environ['BOOST_ROOT']
         if not os.path.isabs(self.boost_root):
             raise DependencyException('BOOST_ROOT must be an absolute path.')
     except KeyError:
         self.boost_root = None
     if self.boost_root is None:
         if mesonlib.is_windows():
             self.boost_root = self.detect_win_root()
             self.incdir = self.boost_root
         else:
             self.incdir = '/usr/include'
     else:
         self.incdir = os.path.join(self.boost_root, 'include')
     self.boost_inc_subdir = os.path.join(self.incdir, 'boost')
     mlog.debug('Boost library root dir is', self.boost_root)
     self.src_modules = {}
     self.lib_modules = {}
     self.lib_modules_mt = {}
     self.detect_version()
     self.requested_modules = self.get_requested(kwargs)
     module_str = ', '.join(self.requested_modules)
     if self.version is not None:
         self.detect_src_modules()
         self.detect_lib_modules()
         self.validate_requested()
         if self.boost_root is not None:
             info = self.version + ', ' + self.boost_root
         else:
             info = self.version
         mlog.log('Dependency Boost (%s) found:' % module_str, mlog.green('YES'),
                  '(' + info + ')')
     else:
         mlog.log("Dependency Boost (%s) found:" % module_str, mlog.red('NO'))
Exemple #23
0
 def get_link_args(self):
     if mesonlib.is_windows():
         return self.get_win_link_args()
     args = []
     if self.boost_root:
         args.append('-L' + os.path.join(self.boost_root, 'lib'))
     for module in self.requested_modules:
         module = BoostDependency.name2lib.get(module, module)
         if module in self.lib_modules or module in self.lib_modules_mt:
             linkcmd = '-lboost_' + module
             args.append(linkcmd)
             # FIXME a hack, but Boost's testing framework has a lot of
             # different options and it's hard to determine what to do
             # without feedback from actual users. Update this
             # as we get more bug reports.
             if module == 'unit_testing_framework':
                 args.append('-lboost_test_exec_monitor')
         elif module + '-mt' in self.lib_modules_mt:
             linkcmd = '-lboost_' + module + '-mt'
             args.append(linkcmd)
             if module == 'unit_testing_framework':
                 args.append('-lboost_test_exec_monitor-mt')
     return args
Exemple #24
0
 def get_link_args(self):
     if mesonlib.is_windows():
         return self.get_win_link_args()
     args = []
     if self.boost_root:
         args.append('-L' + os.path.join(self.boost_root, 'lib'))
     for module in self.requested_modules:
         module = BoostDependency.name2lib.get(module, module)
         if module in self.lib_modules or module in self.lib_modules_mt:
             linkcmd = '-lboost_' + module
             args.append(linkcmd)
             # FIXME a hack, but Boost's testing framework has a lot of
             # different options and it's hard to determine what to do
             # without feedback from actual users. Update this
             # as we get more bug reports.
             if module == 'unit_testing_framework':
                 args.append('-lboost_test_exec_monitor')
         elif module + '-mt' in self.lib_modules_mt:
             linkcmd = '-lboost_' + module + '-mt'
             args.append(linkcmd)
             if module == 'unit_testing_framework':
                 args.append('-lboost_test_exec_monitor-mt')
     return args
Exemple #25
0
def validate_install(srcdir, installdir):
    if mesonlib.is_windows():
        # Don't really know how Windows installs should work
        # so skip.
        return ''
    info_file = os.path.join(srcdir, 'installed_files.txt')
    expected = {}
    found = {}
    if os.path.exists(info_file):
        for line in open(info_file):
            expected[platform_fix_filename(line.strip())] = True
    for root, _, files in os.walk(installdir):
        for fname in files:
            found_name = os.path.join(root, fname)[len(installdir)+1:]
            found[found_name] = True
    expected = set(expected)
    found = set(found)
    missing = expected - found
    for fname in missing:
        return 'Expected file %s missing.' % fname
    extra = found - expected
    for fname in extra:
        return 'Found extra file %s.' % fname
    return ''
Exemple #26
0
def validate_install(srcdir, installdir):
    if mesonlib.is_windows():
        # Don't really know how Windows installs should work
        # so skip.
        return ''
    info_file = os.path.join(srcdir, 'installed_files.txt')
    expected = {}
    found = {}
    if os.path.exists(info_file):
        for line in open(info_file):
            expected[platform_fix_filename(line.strip())] = True
    for root, _, files in os.walk(installdir):
        for fname in files:
            found_name = os.path.join(root, fname)[len(installdir)+1:]
            found[found_name] = True
    expected = set(expected)
    found = set(found)
    missing = expected - found
    for fname in missing:
        return 'Expected file %s missing.' % fname
    extra = found - expected
    for fname in extra:
        return 'Found extra file %s.' % fname
    return ''
Exemple #27
0
def run_with_mono(fname):
    if fname.endswith('.exe') and not mesonlib.is_windows():
        return True
    return False
Exemple #28
0
def run_tests():
    logfile = open('meson-test-run.txt', 'w')
    commontests = gather_tests('test cases/common')
    failtests = gather_tests('test cases/failing')
    objtests = gather_tests('test cases/prebuilt object')
    if mesonlib.is_linux():
        cpuid = platform.machine()
        if cpuid != 'x86_64' and cpuid != 'i386' and cpuid != 'i686':
            # Don't have a prebuilt object file for those so skip.
            objtests = []
    if mesonlib.is_osx():
        platformtests = gather_tests('test cases/osx')
    elif mesonlib.is_windows():
        platformtests = gather_tests('test cases/windows')
    else:
        platformtests = gather_tests('test cases/linuxlike')
    if not mesonlib.is_osx() and not mesonlib.is_windows():
        frameworktests = gather_tests('test cases/frameworks')
    else:
        frameworktests = []
    if not mesonlib.is_osx() and shutil.which('javac'):
        javatests = gather_tests('test cases/java')
    else:
        javatests = []
    if shutil.which('mcs'):
        cstests = gather_tests('test cases/csharp')
    else:
        cstests = []
    if shutil.which('valac'):
        valatests = gather_tests('test cases/vala')
    else:
        valatests = []
    if shutil.which('rustc'):
        rusttests = gather_tests('test cases/rust')
    else:
        rusttests = []
    if not mesonlib.is_windows():
        objctests = gather_tests('test cases/objc')
    else:
        objctests = []
    if shutil.which('gfortran'):
        fortrantests = gather_tests('test cases/fortran')
    else:
        fortrantests = []
    try:
        os.mkdir(test_build_dir)
    except OSError:
        pass
    try:
        os.mkdir(install_dir)
    except OSError:
        pass
    print('\nRunning common tests.\n')
    [run_and_log(logfile, t) for t in commontests]
    print('\nRunning failing tests.\n')
    [run_and_log(logfile, t, False) for t in failtests]
    if len(objtests) > 0:
        print('\nRunning object inclusion tests.\n')
        [run_and_log(logfile, t) for t in objtests]
    else:
        print('\nNo object inclusion tests.\n')
    if len(platformtests) > 0:
        print('\nRunning platform dependent tests.\n')
        [run_and_log(logfile, t) for t in platformtests]
    else:
        print('\nNo platform specific tests.\n')
    if len(frameworktests) > 0:
        print('\nRunning framework tests.\n')
        [run_and_log(logfile, t) for t in frameworktests]
    else:
        print('\nNo framework tests on this platform.\n')
    if len(javatests) > 0:
        print('\nRunning java tests.\n')
        [run_and_log(logfile, t) for t in javatests]
    else:
        print('\nNot running Java tests.\n')
    if len(cstests) > 0:
        print('\nRunning C# tests.\n')
        [run_and_log(logfile, t) for t in cstests]
    else:
        print('\nNot running C# tests.\n')
    if len(valatests) > 0:
        print('\nRunning Vala tests.\n')
        [run_and_log(logfile, t) for t in valatests]
    else:
        print('\nNot running Vala tests.\n')
    if len(rusttests) > 0:
        print('\nRunning Rust tests.\n')
        [run_and_log(logfile, t) for t in rusttests]
    else:
        print('\nNot running Rust tests.\n')
    if len(objctests) > 0:
        print('\nRunning Objective C tests.\n')
        [run_and_log(logfile, t) for t in objctests]
    else:
        print('\nNo Objective C tests on this platform.\n')
    if len(fortrantests) > 0:
        print('\nRunning Fortran tests.\n')
        [run_and_log(logfile, t) for t in fortrantests]
    else:
        print('\nNo Fortran tests on this platform.\n')
Exemple #29
0
 def detect_lib_modules(self):
     if mesonlib.is_windows():
         return self.detect_lib_modules_win()
     return self.detect_lib_modules_nix()
Exemple #30
0
def run_with_mono(fname):
    if fname.endswith('.exe') and not mesonlib.is_windows():
        return True
    return False
Exemple #31
0
def run_tests():
    logfile = open('meson-test-run.txt', 'w')
    commontests = gather_tests('test cases/common')
    failtests = gather_tests('test cases/failing')
    objtests = gather_tests('test cases/prebuilt object')
    if mesonlib.is_linux():
        cpuid = platform.machine()
        if cpuid != 'x86_64' and cpuid != 'i386' and cpuid != 'i686':
            # Don't have a prebuilt object file for those so skip.
            objtests = []
    if mesonlib.is_osx():
        platformtests = gather_tests('test cases/osx')
    elif mesonlib.is_windows():
        platformtests = gather_tests('test cases/windows')
    else:
        platformtests = gather_tests('test cases/linuxlike')
    if not mesonlib.is_osx() and not mesonlib.is_windows():
        frameworktests = gather_tests('test cases/frameworks')
    else:
        frameworktests = []
    if not mesonlib.is_osx() and shutil.which('javac'):
        javatests = gather_tests('test cases/java')
    else:
        javatests = []
    if shutil.which('mcs'):
        cstests = gather_tests('test cases/csharp')
    else:
        cstests = []
    if shutil.which('valac'):
        valatests = gather_tests('test cases/vala')
    else:
        valatests = []
    if shutil.which('rustc'):
        rusttests = gather_tests('test cases/rust')
    else:
        rusttests = []
    if not mesonlib.is_windows():
        objctests = gather_tests('test cases/objc')
    else:
        objctests = []
    if shutil.which('gfortran'):
        fortrantests = gather_tests('test cases/fortran')
    else:
        fortrantests = []
    try:
        os.mkdir(test_build_dir)
    except OSError:
        pass
    try:
        os.mkdir(install_dir)
    except OSError:
        pass
    print('\nRunning common tests.\n')
    [run_and_log(logfile, t) for t in commontests]
    print('\nRunning failing tests.\n')
    [run_and_log(logfile, t, False) for t in failtests]
    if len(objtests) > 0:
        print('\nRunning object inclusion tests.\n')
        [run_and_log(logfile, t) for t in objtests]
    else:
        print('\nNo object inclusion tests.\n')
    if len(platformtests) > 0:
        print('\nRunning platform dependent tests.\n')
        [run_and_log(logfile, t) for t in platformtests]
    else:
        print('\nNo platform specific tests.\n')
    if len(frameworktests) > 0:
        print('\nRunning framework tests.\n')
        [run_and_log(logfile, t) for t in frameworktests]
    else:
        print('\nNo framework tests on this platform.\n')
    if len(javatests) > 0:
        print('\nRunning java tests.\n')
        [run_and_log(logfile, t) for t in javatests]
    else:
        print('\nNot running Java tests.\n')
    if len(cstests) > 0:
        print('\nRunning C# tests.\n')
        [run_and_log(logfile, t) for t in cstests]
    else:
        print('\nNot running C# tests.\n')
    if len(valatests) > 0:
        print('\nRunning Vala tests.\n')
        [run_and_log(logfile, t) for t in valatests]
    else:
        print('\nNot running Vala tests.\n')
    if len(rusttests) > 0:
        print('\nRunning Rust tests.\n')
        [run_and_log(logfile, t) for t in rusttests]
    else:
        print('\nNot running Rust tests.\n')
    if len(objctests) > 0:
        print('\nRunning Objective C tests.\n')
        [run_and_log(logfile, t) for t in objctests]
    else:
        print('\nNo Objective C tests on this platform.\n')
    if len(fortrantests) > 0:
        print('\nRunning Fortran tests.\n')
        [run_and_log(logfile, t) for t in fortrantests]
    else:
        print('\nNo Fortran tests on this platform.\n')
Exemple #32
0
# limitations under the License.

import sys, stat, traceback, pickle, argparse
import os.path
import environment, interpreter, mesonlib
import build
import mlog, coredata

from coredata import MesonException

parser = argparse.ArgumentParser()

backendlist = ['ninja', 'vs2010', 'xcode']
build_types = ['plain', 'debug', 'debugoptimized', 'release']

if mesonlib.is_windows():
    def_prefix = 'c:/'
else:
    def_prefix = '/usr/local'

parser.add_argument('--prefix',
                    default=def_prefix,
                    dest='prefix',
                    help='the installation prefix (default: %(default)s)')
parser.add_argument(
    '--libdir',
    default=mesonlib.default_libdir(),
    dest='libdir',
    help='the installation subdir of libraries (default: %(default)s)')
parser.add_argument(
    '--bindir',
Exemple #33
0
 def detect_lib_modules(self):
     if mesonlib.is_windows():
         return self.detect_lib_modules_win()
     return self.detect_lib_modules_nix()
Exemple #34
0
parser = argparse.ArgumentParser()

backendlist = ['ninja', 'vs2010', 'xcode']
build_types = ['plain', 'debug', 'debugoptimized', 'release']
layouts = ['mirror', 'flat']
warning_levels = ['1', '2', '3']

default_warning = '1'
try:
    warn_candidate = os.environ['MESON_WARN_LEVEL']
    if warn_candidate in warning_levels:
        default_warning = warn_candidate
except KeyError:
    pass

if mesonlib.is_windows():
    def_prefix = 'c:/'
else:
    def_prefix = '/usr/local'

parser.add_argument('--prefix', default=def_prefix, dest='prefix',
                    help='the installation prefix (default: %(default)s)')
parser.add_argument('--libdir', default=mesonlib.default_libdir(), dest='libdir',
                    help='the installation subdir of libraries (default: %(default)s)')
parser.add_argument('--bindir', default='bin', dest='bindir',
                    help='the installation subdir of executables (default: %(default)s)')
parser.add_argument('--includedir', default='include', dest='includedir',
                    help='relative path of installed headers (default: %(default)s)')
parser.add_argument('--datadir', default='share', dest='datadir',
                    help='relative path to the top of data file subdirectory (default: %(default)s)')
parser.add_argument('--mandir', default='share/man', dest='mandir',