diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-11-09 15:00:46 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-09 15:00:46 -0500 |
commit | dc10945ad7cd210426091a9e7809c90a9ff0b175 (patch) | |
tree | ae9c7139555c1dda1a41946496ae13ab6303adba | |
parent | 5603f90287695fc6e092f2701ec222e4fddc3899 (diff) | |
parent | daa893e0119f972eae1b55db6e5f4a61799fdd93 (diff) | |
download | meson-dc10945ad7cd210426091a9e7809c90a9ff0b175.zip meson-dc10945ad7cd210426091a9e7809c90a9ff0b175.tar.gz meson-dc10945ad7cd210426091a9e7809c90a9ff0b175.tar.bz2 |
Merge pull request #995 from centricular/more-appveyor-builds
appveyor.yml: Test more than just MSVC2010 + Ninja on x86
-rw-r--r-- | .appveyor.yml | 43 | ||||
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 4 | ||||
-rw-r--r-- | mesonbuild/backend/vs2010backend.py | 160 | ||||
-rw-r--r-- | mesonbuild/compilers.py | 15 | ||||
-rwxr-xr-x | mesonbuild/scripts/regen_checker.py | 2 | ||||
-rwxr-xr-x | run_project_tests.py | 55 | ||||
-rwxr-xr-x | test cases/common/103 manygen/subdir/manygen.py | 3 | ||||
-rw-r--r-- | test cases/common/103 manygen/subdir/meson.build | 13 | ||||
-rw-r--r-- | test cases/common/113 generatorcustom/meson.build | 26 | ||||
-rw-r--r-- | test cases/common/51 pkgconfig-gen/meson.build | 2 | ||||
-rw-r--r-- | test cases/common/62 exe static shared/stat.c | 4 |
11 files changed, 228 insertions, 99 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index 38ebe56..adc13b8 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -2,23 +2,56 @@ version: 1.0.{build} os: Visual Studio 2015 +environment: + matrix: + - arch: x86 + compiler: msvc2010 + backend: ninja + + - arch: x86 + compiler: msvc2010 + backend: vs2010 + + - arch: x86 + compiler: msvc2015 + backend: ninja + + - arch: x86 + compiler: msvc2015 + backend: vs2015 + + - arch: x64 + compiler: msvc2015 + backend: ninja + + - arch: x64 + compiler: msvc2015 + backend: vs2015 + platform: - - x86 + - x64 branches: only: - master install: - - ps: (new-object net.webclient).DownloadFile('https://dl.dropboxusercontent.com/u/37517477/ninja.exe', 'c:\python34\ninja.exe') - - cmd: copy c:\python34\python.exe c:\python34\python3.exe - - '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86' + # Use the x86 python only when building for x86 for the cpython tests. + # For all other archs (including, say, arm), use the x64 python. + - ps: (new-object net.webclient).DownloadFile('https://dl.dropboxusercontent.com/u/37517477/ninja.exe', 'C:\projects\meson\ninja.exe') + - cmd: if %arch%==x86 (set MESON_PYTHON_PATH=C:\python34) else (set MESON_PYTHON_PATH=C:\python34-x64) + - cmd: echo Using Python at %MESON_PYTHON_PATH% + - cmd: copy %MESON_PYTHON_PATH%\python.exe %MESON_PYTHON_PATH%\python3.exe + - cmd: if %compiler%==msvc2010 ( call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" %arch% ) + - cmd: if %compiler%==msvc2015 ( call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %arch% ) build_script: - cmd: echo No build step. + - cmd: if %backend%==ninja ( ninja.exe --version ) else ( MSBuild /version & echo. ) test_script: - - cmd: PATH c:\python34;%PATH%; && python3 run_tests.py --backend=ninja + - cmd: echo Running tests for %arch% and %compiler% with the %backend% backend + - cmd: PATH=%cd%;%MESON_PYTHON_PATH%;%PATH%; && python3 run_tests.py --backend=%backend% on_finish: - appveyor PushArtifact meson-test-run.txt -DeploymentName "Text test logs" diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 63380bd..af96f3d 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1694,9 +1694,9 @@ rule FORTRAN_DEP_HACK if target.has_pch(): tfilename = self.get_target_filename_abs(target) - return compiler.get_compile_debugfile_args(tfilename) + return compiler.get_compile_debugfile_args(tfilename, pch=True) else: - return compiler.get_compile_debugfile_args(objfile) + return compiler.get_compile_debugfile_args(objfile, pch=False) def get_link_debugfile_args(self, linker, target, outname): return linker.get_link_debugfile_args(outname) diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index f1d949a..c66233e 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -284,20 +284,13 @@ class Vs2010Backend(backends.Backend): def generate_projects(self): projlist = [] - comp = None - for l, c in self.environment.coredata.compilers.items(): - if l == 'c' or l == 'cpp': - comp = c - break - if comp is None: - raise RuntimeError('C and C++ compilers missing.') for name, target in self.build.targets.items(): outdir = os.path.join(self.environment.get_build_dir(), self.get_target_dir(target)) fname = name + '.vcxproj' relname = os.path.join(target.subdir, fname) projfile = os.path.join(outdir, fname) uuid = self.environment.coredata.target_guids[name] - self.gen_vcxproj(target, projfile, uuid, comp) + self.gen_vcxproj(target, projfile, uuid) projlist.append((name, relname, uuid)) return projlist @@ -430,12 +423,26 @@ class Vs2010Backend(backends.Backend): pch_out = ET.SubElement(inc_cl, 'PrecompiledHeaderOutputFile') pch_out.text = '$(IntDir)$(TargetName)-%s.pch' % lang - def add_additional_options(self, source_file, parent_node, extra_args, has_additional_options_set): - if has_additional_options_set: + def add_additional_options(self, lang, parent_node, file_args): + if len(file_args[lang]) == 0: # We only need per file options if they were not set per project. return - lang = Vs2010Backend.lang_from_source_file(source_file) - ET.SubElement(parent_node, "AdditionalOptions").text = ' '.join(extra_args[lang]) + ' %(AdditionalOptions)' + args = file_args[lang] + ['%(AdditionalOptions)'] + ET.SubElement(parent_node, "AdditionalOptions").text = ' '.join(args) + + def add_preprocessor_defines(self, lang, parent_node, file_defines): + if len(file_defines[lang]) == 0: + # We only need per file options if they were not set per project. + return + defines = file_defines[lang] + ['%(PreprocessorDefinitions)'] + ET.SubElement(parent_node, "PreprocessorDefinitions").text = ';'.join(defines) + + def add_include_dirs(self, lang, parent_node, file_inc_dirs): + if len(file_inc_dirs[lang]) == 0: + # We only need per file options if they were not set per project. + return + dirs = file_inc_dirs[lang] + ['%(AdditionalIncludeDirectories)'] + ET.SubElement(parent_node, "AdditionalIncludeDirectories").text = ';'.join(dirs) @staticmethod def has_objects(objects, additional_objects, generated_objects): @@ -505,7 +512,19 @@ class Vs2010Backend(backends.Backend): other.append(arg) return (lpaths, libs, other) - def gen_vcxproj(self, target, ofname, guid, compiler): + def _get_cl_compiler(self, target): + for lang, c in target.compilers.items(): + if lang in ('c', 'cpp'): + return c + # No source files, only objects, but we still need a compiler, so + # return a found compiler + if len(target.objects) > 0: + for lang, c in self.environment.coredata.compilers.items(): + if lang in ('c', 'cpp'): + return c + raise MesonException('Could not find a C or C++ compiler. MSVC can only build C/C++ projects.') + + def gen_vcxproj(self, target, ofname, guid): mlog.debug('Generating vcxproj %s.' % target.name) entrypoint = 'WinMainCRTStartup' subsystem = 'Windows' @@ -532,6 +551,7 @@ class Vs2010Backend(backends.Backend): # Prefix to use to access the source tree's subdir from the vcxproj dir proj_to_src_dir = os.path.join(proj_to_src_root, target.subdir) (sources, headers, objects, languages) = self.split_sources(target.sources) + compiler = self._get_cl_compiler(target) buildtype_args = compiler.get_buildtype_args(self.buildtype) buildtype_link_args = compiler.get_buildtype_linker_args(self.buildtype) project_name = target.name @@ -643,83 +663,86 @@ class Vs2010Backend(backends.Backend): # Build information compiles = ET.SubElement(root, 'ItemDefinitionGroup') clconf = ET.SubElement(compiles, 'ClCompile') - inc_dirs = ['.', self.relpath(self.get_target_private_dir(target), self.get_target_dir(target)), - proj_to_src_dir] + generated_files_include_dirs - - extra_args = {'c': [], 'cpp': []} + # Arguments, include dirs, defines for all files in the current target + target_args = [] + target_defines = [] + target_inc_dirs = ['.', self.relpath(self.get_target_private_dir(target), + self.get_target_dir(target)), + proj_to_src_dir] + generated_files_include_dirs + # Arguments, include dirs, defines passed to individual files in + # a target; perhaps because the args are language-specific + file_args = dict((lang, []) for lang in target.compilers) + file_defines = dict((lang, []) for lang in target.compilers) + file_inc_dirs = dict((lang, []) for lang in target.compilers) for l, args in self.environment.coredata.external_args.items(): - if l in extra_args: - extra_args[l] += args + if l in file_args: + file_args[l] += args for l, args in self.build.global_args.items(): - if l in extra_args: - extra_args[l] += args + if l in file_args: + file_args[l] += args for l, args in target.extra_args.items(): - if l in extra_args: - extra_args[l] += compiler.unix_compile_flags_to_native(args) - # FIXME all the internal flags of VS (optimization etc) are represented - # by their own XML elements. In theory we should split all flags to those - # that have an XML element and those that don't and serialise them - # properly. This is a crapton of work for no real gain, so just dump them - # here. - general_args = compiler.get_option_compile_args(self.environment.coredata.compiler_options) + if l in file_args: + file_args[l] += compiler.unix_compile_flags_to_native(args) + for l, comp in target.compilers.items(): + if l in file_args: + file_args[l] += comp.get_option_compile_args(self.environment.coredata.compiler_options) for d in target.get_external_deps(): # Cflags required by external deps might have UNIX-specific flags, # so filter them out if needed d_compile_args = compiler.unix_compile_flags_to_native(d.get_compile_args()) for arg in d_compile_args: - if arg.startswith('-I') or arg.startswith('/I'): + if arg.startswith(('-D', '/D')): + define = arg[2:] + # De-dup + if define not in target_defines: + target_defines.append(define) + elif arg.startswith(('-I', '/I')): inc_dir = arg[2:] # De-dup - if inc_dir not in inc_dirs: - inc_dirs.append(inc_dir) + if inc_dir not in target_inc_dirs: + target_inc_dirs.append(inc_dir) else: - general_args.append(arg) + # De-dup + if arg not in target_args: + target_args.append(arg) - defines = [] # Split preprocessor defines and include directories out of the list of # all extra arguments. The rest go into %(AdditionalOptions). - for l, args in extra_args.items(): - extra_args[l] = [] + for l, args in file_args.items(): + file_args[l] = [] for arg in args: - if arg.startswith('-D') or arg.startswith('/D'): + if arg.startswith(('-D', '/D')): define = self.escape_preprocessor_define(arg[2:]) # De-dup - if define not in defines: - defines.append(define) - elif arg.startswith('-I') or arg.startswith('/I'): + if define not in file_defines[l]: + file_defines[l].append(define) + elif arg.startswith(('-I', '/I')): inc_dir = arg[2:] # De-dup - if inc_dir not in inc_dirs: - inc_dirs.append(inc_dir) + if inc_dir not in file_inc_dirs[l]: + file_inc_dirs[l].append(inc_dir) else: - extra_args[l].append(self.escape_additional_option(arg)) + file_args[l].append(self.escape_additional_option(arg)) languages += gen_langs - has_language_specific_args = any(l != extra_args['c'] for l in extra_args.values()) - additional_options_set = False - if not has_language_specific_args or len(languages) == 1: - if len(languages) == 0: - extra_args = [] - else: - extra_args = extra_args[languages[0]] - extra_args = general_args + extra_args - if len(extra_args) > 0: - extra_args.append('%(AdditionalOptions)') - ET.SubElement(clconf, "AdditionalOptions").text = ' '.join(extra_args) - additional_options_set = True + if len(target_args) > 0: + target_args.append('%(AdditionalOptions)') + ET.SubElement(clconf, "AdditionalOptions").text = ' '.join(target_args) + additional_options_set = True for d in target.include_dirs: for i in d.incdirs: curdir = os.path.join(d.curdir, i) - inc_dirs.append(self.relpath(curdir, target.subdir)) # build dir - inc_dirs.append(os.path.join(proj_to_src_root, curdir)) # src dir + target_inc_dirs.append(self.relpath(curdir, target.subdir)) # build dir + target_inc_dirs.append(os.path.join(proj_to_src_root, curdir)) # src dir for i in d.get_extra_build_dirs(): curdir = os.path.join(d.curdir, i) - inc_dirs.append(self.relpath(curdir, target.subdir)) # build dir + target_inc_dirs.append(self.relpath(curdir, target.subdir)) # build dir - inc_dirs.append('%(AdditionalIncludeDirectories)') - ET.SubElement(clconf, 'AdditionalIncludeDirectories').text = ';'.join(inc_dirs) - ET.SubElement(clconf, 'PreprocessorDefinitions').text = ';'.join(defines) + target_inc_dirs.append('%(AdditionalIncludeDirectories)') + ET.SubElement(clconf, 'AdditionalIncludeDirectories').text = ';'.join(target_inc_dirs) + target_defines.append('%(PreprocessorDefinitions)') + ET.SubElement(clconf, 'PreprocessorDefinitions').text = ';'.join(target_defines) rebuild = ET.SubElement(clconf, 'MinimalRebuild') rebuild.text = 'true' funclink = ET.SubElement(clconf, 'FunctionLevelLinking') @@ -834,19 +857,26 @@ class Vs2010Backend(backends.Backend): for s in sources: relpath = os.path.join(down, s.rel_to_builddir(self.build_to_src)) inc_cl = ET.SubElement(inc_src, 'CLCompile', Include=relpath) + lang = Vs2010Backend.lang_from_source_file(s) self.add_pch(inc_cl, proj_to_src_dir, pch_sources, s) - self.add_additional_options(s, inc_cl, extra_args, additional_options_set) + self.add_additional_options(lang, inc_cl, file_args) + self.add_preprocessor_defines(lang, inc_cl, file_defines) + self.add_include_dirs(lang, inc_cl, file_inc_dirs) basename = os.path.basename(s.fname) if basename in self.sources_conflicts[target.get_id()]: ET.SubElement(inc_cl, 'ObjectFileName').text = "$(IntDir)" + self.object_filename_from_source(target, s) for s in gen_src: inc_cl = ET.SubElement(inc_src, 'CLCompile', Include=s) + lang = Vs2010Backend.lang_from_source_file(s) self.add_pch(inc_cl, proj_to_src_dir, pch_sources, s) - self.add_additional_options(s, inc_cl, extra_args, additional_options_set) + self.add_additional_options(lang, inc_cl, file_args) + self.add_preprocessor_defines(lang, inc_cl, file_defines) + self.add_include_dirs(lang, inc_cl, file_inc_dirs) for lang in pch_sources: header, impl, suffix = pch_sources[lang] relpath = os.path.join(proj_to_src_dir, impl) inc_cl = ET.SubElement(inc_src, 'CLCompile', Include=relpath) + lang = Vs2010Backend.lang_from_source_file(s) pch = ET.SubElement(inc_cl, 'PrecompiledHeader') pch.text = 'Create' pch_out = ET.SubElement(inc_cl, 'PrecompiledHeaderOutputFile') @@ -855,7 +885,9 @@ class Vs2010Backend(backends.Backend): # MSBuild searches for the header relative from the implementation, so we have to use # just the file name instead of the relative path to the file. pch_file.text = os.path.split(header)[1] - self.add_additional_options(impl, inc_cl, extra_args, additional_options_set) + self.add_additional_options(lang, inc_cl, file_args) + self.add_preprocessor_defines(lang, inc_cl, file_defines) + self.add_include_dirs(lang, inc_cl, file_inc_dirs) if self.has_objects(objects, additional_objects, gen_objs): inc_objs = ET.SubElement(root, 'ItemGroup') diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 2feae88..bbe6a72 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -435,7 +435,7 @@ class Compiler(): # Some compilers (msvc) write debug info to a separate file. # These args specify where it should be written. - def get_compile_debugfile_args(self, rel_obj): + def get_compile_debugfile_args(self, rel_obj, **kwargs): return [] def get_link_debugfile_args(self, rel_obj): @@ -1883,10 +1883,19 @@ class VisualStudioCCompiler(CCompiler): raise MesonException('Compiling test app failed.') return not(warning_text in stde or warning_text in stdo) - def get_compile_debugfile_args(self, rel_obj): + def get_compile_debugfile_args(self, rel_obj, pch=False): pdbarr = rel_obj.split('.')[:-1] pdbarr += ['pdb'] - return ['/Fd' + '.'.join(pdbarr)] + args = ['/Fd' + '.'.join(pdbarr)] + # When generating a PDB file with PCH, all compile commands write + # to the same PDB file. Hence, we need to serialize the PDB + # writes using /FS since we do parallel builds. This slows down the + # build obviously, which is why we only do this when PCH is on. + # This was added in Visual Studio 2013 (MSVC 18.0). Before that it was + # always on: https://msdn.microsoft.com/en-us/library/dn502518.aspx + if pch and mesonlib.version_compare(self.version, '>=18.0'): + args = ['/FS'] + args + return args def get_link_debugfile_args(self, targetfile): pdbarr = targetfile.split('.')[:-1] diff --git a/mesonbuild/scripts/regen_checker.py b/mesonbuild/scripts/regen_checker.py index ddf4943..e8e1077 100755 --- a/mesonbuild/scripts/regen_checker.py +++ b/mesonbuild/scripts/regen_checker.py @@ -52,7 +52,7 @@ def run(args): regeninfo = pickle.load(f) with open(coredata, 'rb') as f: coredata = pickle.load(f) - mesonscript = coredata.meson_script_file + mesonscript = coredata.meson_script_launcher backend = coredata.get_builtin_option('backend') regen_timestamp = os.stat(dumpfile).st_mtime if need_regen(regeninfo, regen_timestamp): diff --git a/run_project_tests.py b/run_project_tests.py index b70fecc..15d656b 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -326,6 +326,28 @@ def have_d_compiler(): return True return False +def have_java(): + if shutil.which('javac') and shutil.which('java'): + return True + return False + +def using_backend(backends): + if isinstance(backends, str): + backends = (backends,) + for backend in backends: + if backend == 'ninja': + if not backend_flags: + return True + elif backend == 'xcode': + if backend_flags == '--backend=xcode': + return True + elif backend == 'vs': + if backend_flags.startswith('--backend=vs'): + return True + else: + raise AssertionError('Unknown backend type: ' + backend) + return False + def detect_tests_to_run(): all_tests = [] all_tests.append(('common', gather_tests('test cases/common'), False)) @@ -338,15 +360,15 @@ def detect_tests_to_run(): 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') and shutil.which('java') 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(('d', gather_tests('test cases/d'), False if have_d_compiler() 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)) - all_tests.append(('swift', gather_tests('test cases/swift'), False if shutil.which('swiftc') else True)) - all_tests.append(('python3', gather_tests('test cases/python3'), False if shutil.which('python3') else True)) + all_tests.append(('java', gather_tests('test cases/java'), False if using_backend('ninja') and not mesonlib.is_osx() and have_java() else True)) + all_tests.append(('C#', gather_tests('test cases/csharp'), False if using_backend('ninja') and shutil.which('mcs') else True)) + all_tests.append(('vala', gather_tests('test cases/vala'), False if using_backend('ninja') and shutil.which('valac') else True)) + all_tests.append(('rust', gather_tests('test cases/rust'), False if using_backend('ninja') and shutil.which('rustc') else True)) + all_tests.append(('d', gather_tests('test cases/d'), False if using_backend('ninja') and have_d_compiler() else True)) + all_tests.append(('objective c', gather_tests('test cases/objc'), False if using_backend(('ninja', 'xcode')) and not mesonlib.is_windows() else True)) + all_tests.append(('fortran', gather_tests('test cases/fortran'), False if using_backend('ninja') and shutil.which('gfortran') else True)) + all_tests.append(('swift', gather_tests('test cases/swift'), False if using_backend(('ninja', 'xcode')) and shutil.which('swiftc') else True)) + all_tests.append(('python3', gather_tests('test cases/python3'), False if using_backend('ninja') and shutil.which('python3') else True)) return all_tests def run_tests(extra_args): @@ -490,6 +512,21 @@ if __name__ == '__main__': options = parser.parse_args() setup_commands(options.backend) + # Appveyor sets the `platform` environment variable which completely messes + # up building with the vs2010 and vs2015 backends. + # + # Specifically, MSBuild reads the `platform` environment variable to set + # the configured value for the platform (Win32/x64/arm), which breaks x86 + # builds. + # + # Appveyor setting this also breaks our 'native build arch' detection for + # Windows in environment.py:detect_windows_arch() by overwriting the value + # of `platform` set by vcvarsall.bat. + # + # While building for x86, `platform` should be unset. + if 'APPVEYOR' in os.environ and os.environ['arch'] == 'x86': + os.environ.pop('platform') + script_dir = os.path.split(__file__)[0] if script_dir != '': os.chdir(script_dir) diff --git a/test cases/common/103 manygen/subdir/manygen.py b/test cases/common/103 manygen/subdir/manygen.py index 4fd2f25..8449dc3 100755 --- a/test cases/common/103 manygen/subdir/manygen.py +++ b/test cases/common/103 manygen/subdir/manygen.py @@ -9,6 +9,7 @@ import shutil, subprocess with open(sys.argv[1]) as f: funcname = f.readline().strip() outdir = sys.argv[2] +buildtype_args = sys.argv[3] if not os.path.isdir(outdir): print('Outdir does not exist.') @@ -67,7 +68,7 @@ with open(tmpc, 'w') as f: ''' % funcname) if is_vs: - subprocess.check_call([compiler, '/nologo', '/c', '/Fo' + outo, tmpc]) + subprocess.check_call([compiler, '/nologo', '/c', buildtype_args, '/Fo' + outo, tmpc]) else: subprocess.check_call([compiler, '-c', '-o', outo, tmpc]) diff --git a/test cases/common/103 manygen/subdir/meson.build b/test cases/common/103 manygen/subdir/meson.build index 5c5d763..3036899 100644 --- a/test cases/common/103 manygen/subdir/meson.build +++ b/test cases/common/103 manygen/subdir/meson.build @@ -1,6 +1,17 @@ gen = find_program('manygen.py') +buildtype = get_option('buildtype') +buildtype_args = '-Dfooxxx' # a useless compiler argument if meson.get_compiler('c').get_id() == 'msvc' + # We need our manually generated code to use the same CRT as the executable. + # Taken from compilers.py since build files do not have access to this. + if buildtype == 'debug' + buildtype_args = '/MDd' + elif buildtype == 'debugoptimized' + buildtype_args = '/MDd' + elif buildtype == 'release' + buildtype_args = '/MD' + endif outfiles = ['gen_func.lib', 'gen_func.c', 'gen_func.h', 'gen_func.o'] else outfiles = ['gen_func.a', 'gen_func.c', 'gen_func.h', 'gen_func.o'] @@ -9,5 +20,5 @@ endif generated = custom_target('manygen', output : outfiles, input : ['funcinfo.def'], - command : [gen, '@INPUT@', '@OUTDIR@'], + command : [gen, '@INPUT@', '@OUTDIR@', buildtype_args], ) diff --git a/test cases/common/113 generatorcustom/meson.build b/test cases/common/113 generatorcustom/meson.build index 1f4cc88..472d565 100644 --- a/test cases/common/113 generatorcustom/meson.build +++ b/test cases/common/113 generatorcustom/meson.build @@ -1,17 +1,21 @@ project('generatorcustom', 'c') -creator = find_program('gen.py') -catter = find_program('catter.py') +if meson.get_compiler('c').get_id() != 'msvc' + creator = find_program('gen.py') + catter = find_program('catter.py') -gen = generator(creator, - output: '@BASENAME@.h', - arguments : ['@INPUT@', '@OUTPUT@']) + gen = generator(creator, + output: '@BASENAME@.h', + arguments : ['@INPUT@', '@OUTPUT@']) -hs = gen.process('res1.txt', 'res2.txt') + hs = gen.process('res1.txt', 'res2.txt') -allinone = custom_target('alltogether', - input : hs, - output : 'alltogether.h', - command : [catter, '@INPUT@', '@OUTPUT@']) + allinone = custom_target('alltogether', + input : hs, + output : 'alltogether.h', + command : [catter, '@INPUT@', '@OUTPUT@']) -executable('proggie', 'main.c', allinone) + executable('proggie', 'main.c', allinone) +else + error('MESON_SKIP_TEST: Skipping test on VS backend; see: https://github.com/mesonbuild/meson/issues/1004') +endif diff --git a/test cases/common/51 pkgconfig-gen/meson.build b/test cases/common/51 pkgconfig-gen/meson.build index fa9439c..0933238 100644 --- a/test cases/common/51 pkgconfig-gen/meson.build +++ b/test cases/common/51 pkgconfig-gen/meson.build @@ -19,7 +19,7 @@ pkgg.generate( ) pkgconfig = find_program('pkg-config', required: false) -if pkgconfig.found() +if pkgconfig.found() and build_machine.system() != 'windows' test('pkgconfig-validation', pkgconfig, args: ['--validate', 'simple'], env: ['PKG_CONFIG_PATH=' + meson.current_build_dir() + '/meson-private' ], diff --git a/test cases/common/62 exe static shared/stat.c b/test cases/common/62 exe static shared/stat.c index 4eceb30..680ed92 100644 --- a/test cases/common/62 exe static shared/stat.c +++ b/test cases/common/62 exe static shared/stat.c @@ -1,5 +1,7 @@ +#include "subdir/exports.h" + int shlibfunc(); -int statlibfunc() { +int DLL_PUBLIC statlibfunc() { return shlibfunc(); } |