aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.appveyor.yml23
-rw-r--r--README.md3
-rw-r--r--authors.txt1
-rw-r--r--mesonbuild/compilers.py68
-rw-r--r--mesonbuild/interpreter.py4
-rwxr-xr-xrun_tests.py4
-rw-r--r--test cases/common/86 same basename/meson.build6
-rw-r--r--test cases/common/86 same basename/sub/meson.build1
8 files changed, 85 insertions, 25 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
new file mode 100644
index 0000000..d5e0fbf
--- /dev/null
+++ b/.appveyor.yml
@@ -0,0 +1,23 @@
+version: 1.0.{build}
+
+os: Visual Studio 2015
+
+platform:
+ - x86
+
+branches:
+ only:
+ - master
+
+install:
+ - ps: (new-object net.webclient).DownloadFile('https://www.python.org/ftp/python/3.4.4/python-3.4.4.msi', 'python-3.4.4.msi')
+ - ps: msiexec /i python-3.4.4.msi /quiet /qn /norestart
+ - 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'
+
+build_script:
+ - cmd: echo No build step.
+
+test_script:
+ - cmd: PATH c:\python34;%PATH% && python3 run_tests.py --backend=ninja
diff --git a/README.md b/README.md
index 70f67a2..5e0eae7 100644
--- a/README.md
+++ b/README.md
@@ -6,8 +6,7 @@ build system.
####Build status
-<a href="https://travis-ci.org/mesonbuild/meson"><img
-src="https://travis-ci.org/mesonbuild/meson.svg?branch=master"></a>
+[![Build Status](https://travis-ci.org/mesonbuild/meson.svg?branch=master)](https://travis-ci.org/mesonbuild/meson) [![Build status](https://ci.appveyor.com/api/projects/status/l5c8v71ninew2i3p?svg=true)](https://ci.appveyor.com/project/jpakkane/meson)
####Dependencies
diff --git a/authors.txt b/authors.txt
index d628368..eadd2ff 100644
--- a/authors.txt
+++ b/authors.txt
@@ -34,3 +34,4 @@ Luke Adams
Rogiel Sulzbach
Tim-Philipp Müller
Emmanuele Bassi
+Martin Hostettler
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index eeb4185..4756013 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -296,6 +296,18 @@ class Compiler():
def has_argument(self, arg):
raise EnvironmentException('Language {} does not support has_arg.'.format(self.language))
+ def get_cross_extra_flags(self, environment, *, compile, link):
+ extra_flags = []
+ if self.is_cross:
+ if 'properties' in environment.cross_info.config:
+ lang_args_key = self.language + '_args'
+ if compile:
+ extra_flags += environment.cross_info.config['properties'].get(lang_args_key, [])
+ lang_link_args_key = self.language + '_link_args'
+ if link:
+ extra_flags += environment.cross_info.config['properties'].get(lang_link_args_key, [])
+ return extra_flags
+
class CCompiler(Compiler):
def __init__(self, exelist, version, is_cross, exe_wrapper=None):
super().__init__(exelist, version)
@@ -423,7 +435,7 @@ class CCompiler(Compiler):
def get_linker_search_args(self, dirname):
return ['-L'+dirname]
- def sanity_check_impl(self, work_dir, sname, code):
+ def sanity_check_impl(self, work_dir, environment, sname, code):
mlog.debug('Sanity testing ' + self.language + ' compiler:', ' '.join(self.exelist))
mlog.debug('Is cross compiler: %s.' % str(self.is_cross))
@@ -438,7 +450,10 @@ class CCompiler(Compiler):
# on OSX the compiler binary is the same but you need
# a ton of compiler flags to differentiate between
# arm and x86_64. So just compile.
+ extra_flags += self.get_cross_extra_flags(environment, compile=True, link=False)
extra_flags = self.get_compile_only_args()
+ else:
+ extra_flags += self.get_cross_extra_flags(environment, compile=True, link=True)
# Is a valid executable output for all toolchains and platforms
binname += '.exe'
# Write binary check source
@@ -474,9 +489,9 @@ class CCompiler(Compiler):
if pe.returncode != 0:
raise EnvironmentException('Executables created by {0} compiler {1} are not runnable.'.format(self.language, self.name_string()))
- def sanity_check(self, work_dir):
+ def sanity_check(self, work_dir, environment):
code = 'int main(int argc, char **argv) { int class=0; return class; }\n'
- return self.sanity_check_impl(work_dir, 'sanitycheckc.c', code)
+ return self.sanity_check_impl(work_dir, environment, 'sanitycheckc.c', code)
def has_header(self, hname, extra_args=[]):
templ = '''#include<%s>
@@ -839,9 +854,9 @@ class CPPCompiler(CCompiler):
return True
return False
- def sanity_check(self, work_dir):
+ def sanity_check(self, work_dir, environment):
code = 'class breakCCompiler;int main(int argc, char **argv) { return 0; }\n'
- return self.sanity_check_impl(work_dir, 'sanitycheckcpp.cc', code)
+ return self.sanity_check_impl(work_dir, environment, 'sanitycheckcpp.cc', code)
class ObjCCompiler(CCompiler):
def __init__(self, exelist, version, is_cross, exe_wrap):
@@ -855,16 +870,23 @@ class ObjCCompiler(CCompiler):
return True
return False
- def sanity_check(self, work_dir):
+ def sanity_check(self, work_dir, environment):
+ # TODO try to use sanity_check_impl instead of duplicated code
source_name = os.path.join(work_dir, 'sanitycheckobjc.m')
binary_name = os.path.join(work_dir, 'sanitycheckobjc')
+ extra_flags = self.get_cross_extra_flags(environment, compile=True, link=False)
+ if self.is_cross:
+ extra_flags = self.get_compile_only_args()
ofile = open(source_name, 'w')
ofile.write('#import<stdio.h>\nint main(int argc, char **argv) { return 0; }\n')
ofile.close()
- pc = subprocess.Popen(self.exelist + [source_name, '-o', binary_name])
+ pc = subprocess.Popen(self.exelist + extra_flags + [source_name, '-o', binary_name])
pc.wait()
if pc.returncode != 0:
raise EnvironmentException('ObjC compiler %s can not compile programs.' % self.name_string())
+ if self.is_cross:
+ # Can't check if the binaries run so we have to assume they do
+ return
pe = subprocess.Popen(binary_name)
pe.wait()
if pe.returncode != 0:
@@ -882,16 +904,23 @@ class ObjCPPCompiler(CPPCompiler):
return True
return False
- def sanity_check(self, work_dir):
+ def sanity_check(self, work_dir, environment):
+ # TODO try to use sanity_check_impl instead of duplicated code
source_name = os.path.join(work_dir, 'sanitycheckobjcpp.mm')
binary_name = os.path.join(work_dir, 'sanitycheckobjcpp')
+ extra_flags = self.get_cross_extra_flags(environment, compile=True, link=True)
+ if self.is_cross:
+ extra_flags = self.get_compile_only_args()
ofile = open(source_name, 'w')
ofile.write('#import<stdio.h>\nclass MyClass;int main(int argc, char **argv) { return 0; }\n')
ofile.close()
- pc = subprocess.Popen(self.exelist + [source_name, '-o', binary_name])
+ pc = subprocess.Popen(self.exelist + extra_flags + [source_name, '-o', binary_name])
pc.wait()
if pc.returncode != 0:
raise EnvironmentException('ObjC++ compiler %s can not compile programs.' % self.name_string())
+ if self.is_cross:
+ # Can't check if the binaries run so we have to assume they do
+ return
pe = subprocess.Popen(binary_name)
pe.wait()
if pe.returncode != 0:
@@ -980,7 +1009,7 @@ class MonoCompiler(Compiler):
def get_pch_name(self, header_name):
return ''
- def sanity_check(self, work_dir):
+ def sanity_check(self, work_dir, environment):
src = 'sanity.cs'
obj = 'sanity.exe'
source_name = os.path.join(work_dir, src)
@@ -1092,7 +1121,7 @@ class JavaCompiler(Compiler):
def get_buildtype_args(self, buildtype):
return java_buildtype_args[buildtype]
- def sanity_check(self, work_dir):
+ def sanity_check(self, work_dir, environment):
src = 'SanityCheck.java'
obj = 'SanityCheck'
source_name = os.path.join(work_dir, src)
@@ -1140,7 +1169,7 @@ class ValaCompiler(Compiler):
def get_language(self):
return self.language
- def sanity_check(self, work_dir):
+ def sanity_check(self, work_dir, environment):
src = 'valatest.vala'
source_name = os.path.join(work_dir, src)
ofile = open(source_name, 'w')
@@ -1148,7 +1177,8 @@ class ValaCompiler(Compiler):
}
''')
ofile.close()
- pc = subprocess.Popen(self.exelist + ['-C', '-c', src], cwd=work_dir)
+ extra_flags = self.get_cross_extra_flags(environment, compile=True, link=False)
+ pc = subprocess.Popen(self.exelist + extra_flags + ['-C', '-c', src], cwd=work_dir)
pc.wait()
if pc.returncode != 0:
raise EnvironmentException('Vala compiler %s can not compile programs.' % self.name_string())
@@ -1183,7 +1213,7 @@ class RustCompiler(Compiler):
def get_language(self):
return self.language
- def sanity_check(self, work_dir):
+ def sanity_check(self, work_dir, environment):
source_name = os.path.join(work_dir, 'sanity.rs')
output_name = os.path.join(work_dir, 'rusttest')
ofile = open(source_name, 'w')
@@ -1281,7 +1311,7 @@ class SwiftCompiler(Compiler):
def get_compile_only_args(self):
return ['-c']
- def sanity_check(self, work_dir):
+ def sanity_check(self, work_dir, environment):
src = 'swifttest.swift'
source_name = os.path.join(work_dir, src)
output_name = os.path.join(work_dir, 'swifttest')
@@ -1289,7 +1319,8 @@ class SwiftCompiler(Compiler):
ofile.write('''1 + 2
''')
ofile.close()
- pc = subprocess.Popen(self.exelist + ['-emit-executable', '-o', output_name, src], cwd=work_dir)
+ extra_flags = self.get_cross_extra_flags(environment, compile=True, link=True)
+ pc = subprocess.Popen(self.exelist + extra_flags + ['-emit-executable', '-o', output_name, src], cwd=work_dir)
pc.wait()
if pc.returncode != 0:
raise EnvironmentException('Swift compiler %s can not compile programs.' % self.name_string())
@@ -1825,7 +1856,7 @@ class FortranCompiler(Compiler):
def needs_static_linker(self):
return True
- def sanity_check(self, work_dir):
+ def sanity_check(self, work_dir, environment):
source_name = os.path.join(work_dir, 'sanitycheckf.f90')
binary_name = os.path.join(work_dir, 'sanitycheckf')
ofile = open(source_name, 'w')
@@ -1834,7 +1865,8 @@ class FortranCompiler(Compiler):
end program prog
''')
ofile.close()
- pc = subprocess.Popen(self.exelist + [source_name, '-o', binary_name])
+ extra_flags = self.get_cross_extra_flags(environment, compile=True, link=True)
+ pc = subprocess.Popen(self.exelist + extra_flags + [source_name, '-o', binary_name])
pc.wait()
if pc.returncode != 0:
raise EnvironmentException('Compiler %s can not compile programs.' % self.name_string())
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index e6b7406..53d7b10 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1557,10 +1557,10 @@ class Interpreter():
# cross_comp = self.environment.detect_fortran_compiler(True)
else:
raise InvalidCode('Tried to use unknown language "%s".' % lang)
- comp.sanity_check(self.environment.get_scratch_dir())
+ comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
self.coredata.compilers[lang] = comp
if cross_comp is not None:
- cross_comp.sanity_check(self.environment.get_scratch_dir())
+ cross_comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
self.coredata.cross_compilers[lang] = cross_comp
new_options = comp.get_options()
optprefix = lang + '_'
diff --git a/run_tests.py b/run_tests.py
index 1c6ae11..5fdfce9 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -406,7 +406,7 @@ def generate_prebuilt_object():
else:
raise RuntimeError("Could not find C compiler.")
cmd = [cmd, '-c', source, '-o', objectfile]
- subprocess.check_call(cmd)
+ subprocess.check_call(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
return objectfile
if __name__ == '__main__':
@@ -431,7 +431,7 @@ if __name__ == '__main__':
print('\nTotal passed tests:', passing_tests)
print('Total failed tests:', failing_tests)
print('Total skipped tests:', skipped_tests)
- if failing_tests > 0 and 'TRAVIS' in os.environ:
+ if failing_tests > 0 and ('TRAVIS' in os.environ or 'APPVEYOR' in os.environ):
# Cat because it can have stuff of unknown encodings mixed.
subprocess.call(['cat', 'meson-test-run.txt'])
sys.exit(failing_tests)
diff --git a/test cases/common/86 same basename/meson.build b/test cases/common/86 same basename/meson.build
index ba88dfd..e320f95 100644
--- a/test cases/common/86 same basename/meson.build
+++ b/test cases/common/86 same basename/meson.build
@@ -3,9 +3,13 @@ project('same basename', 'c')
# Use the same source file to check that each top level target
# has its own unique working directory. If they don't
# then the .o files will clobber each other.
-stlib = static_library('name', 'lib.c', c_args : '-DSTAT')
shlib = shared_library('name', 'lib.c', c_args : '-DSHAR')
+# On Windows a static lib is a foo.lib but a share library
+# is both a foo.dll and a foo.lib. Put static in subdir to avoid
+# name clashes.
+subdir('sub')
+
exe1 = executable('name', 'exe1.c', link_with : stlib)
exe2 = executable('name2', 'exe2.c', link_with : shlib)
diff --git a/test cases/common/86 same basename/sub/meson.build b/test cases/common/86 same basename/sub/meson.build
new file mode 100644
index 0000000..07250a5
--- /dev/null
+++ b/test cases/common/86 same basename/sub/meson.build
@@ -0,0 +1 @@
+stlib = static_library('name', '../lib.c', c_args : '-DSTAT')