diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2015-12-28 23:27:25 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2015-12-28 23:27:25 +0200 |
commit | ec0a73b1e21881a395a92a9d0a9676e1783fb651 (patch) | |
tree | 761e37173ba72da242d5c5555cb8e0e2b893dcdd | |
parent | df37c79dc9212d32453c115be09d1b85f1fde4ae (diff) | |
download | meson-ec0a73b1e21881a395a92a9d0a9676e1783fb651.zip meson-ec0a73b1e21881a395a92a9d0a9676e1783fb651.tar.gz meson-ec0a73b1e21881a395a92a9d0a9676e1783fb651.tar.bz2 |
Fix manygen to work with msvc.
-rwxr-xr-x | test cases/common/103 manygen/subdir/manygen.py | 43 | ||||
-rw-r--r-- | test cases/common/103 manygen/subdir/meson.build | 8 |
2 files changed, 34 insertions, 17 deletions
diff --git a/test cases/common/103 manygen/subdir/manygen.py b/test cases/common/103 manygen/subdir/manygen.py index fbf2eae..3c692ee 100755 --- a/test cases/common/103 manygen/subdir/manygen.py +++ b/test cases/common/103 manygen/subdir/manygen.py @@ -14,27 +14,30 @@ if not os.path.isdir(outdir): sys.exit(1) if shutil.which('cl'): - print('VS support not yet added.') - sys.exit(1) + libsuffix = '.lib' + is_vs = True + compiler = 'cl' + linker = 'lib' +else: + libsuffix = '.a' + is_vs = False + linker = 'ar' + compiler = shutil.which('gcc') + if compiler is None: + compiler = shutil.which('clang') + if compiler is None: + compiler = shutil.which('cc') + if compiler is None: + print('No known compilers found.') + sys.exit(1) objsuffix = '.o' -libsuffix = '.a' outo = os.path.join(outdir, funcname + objsuffix) outa = os.path.join(outdir, funcname + libsuffix) outh = os.path.join(outdir, funcname + '.h') outc = os.path.join(outdir, funcname + '.c') -compiler = shutil.which('gcc') -if compiler is None: - compiler = shutil.which('clang') -if compiler is None: - compiler = shutil.which('cc') -if compiler is None: - print('No known compilers found.') - sys.exit(1) -linker = 'ar' - tmpc = 'diibadaaba.c' tmpo = 'diibadaaba' + objsuffix @@ -55,15 +58,23 @@ open(tmpc, 'w').write('''int %s_in_obj() { } ''' % funcname) -subprocess.check_call([compiler, '-c', '-o', outo, tmpc]) +if is_vs: + subprocess.check_call([compiler, '/nologo', '/c', '/Fo' + outo, tmpc]) +else: + subprocess.check_call([compiler, '-c', '-o', outo, tmpc]) open(tmpc, 'w').write('''int %s_in_lib() { return 0; } ''' % funcname) -subprocess.check_call([compiler, '-c', '-o', tmpo, tmpc]) -subprocess.check_call([linker, 'csr', outa, tmpo]) +if is_vs: + subprocess.check_call([compiler, '/nologo', '/c', '/Fo' + tmpo, tmpc]) + subprocess.check_call([linker, '/NOLOGO', '/OUT:' + outa, tmpo]) +else: + subprocess.check_call([compiler, '-c', '-o', tmpo, tmpc]) + subprocess.check_call([linker, 'csr', outa, tmpo]) + os.unlink(tmpo) os.unlink(tmpc) diff --git a/test cases/common/103 manygen/subdir/meson.build b/test cases/common/103 manygen/subdir/meson.build index 4470d1a..5c5d763 100644 --- a/test cases/common/103 manygen/subdir/meson.build +++ b/test cases/common/103 manygen/subdir/meson.build @@ -1,7 +1,13 @@ gen = find_program('manygen.py') +if meson.get_compiler('c').get_id() == 'msvc' + 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'] +endif + generated = custom_target('manygen', - output : ['gen_func.a', 'gen_func.c', 'gen_func.h', 'gen_func.o'], + output : outfiles, input : ['funcinfo.def'], command : [gen, '@INPUT@', '@OUTDIR@'], ) |