Extracted compiler definitions to their own file.

pull/34/head
Jussi Pakkanen 10 years ago
parent 3979e27a78
commit 08ef881c86
  1. 1481
      compilers.py
  2. 10
      dependencies.py
  3. 1507
      environment.py
  4. 4
      meson.py
  5. 43
      mesonlib.py
  6. 6
      ninjabackend.py
  7. 18
      run_tests.py

File diff suppressed because it is too large Load Diff

@ -25,7 +25,7 @@ import os, stat, glob, subprocess, shutil
from coredata import MesonException
import environment
import mlog
from environment import is_windows
import mesonlib
class DependencyException(MesonException):
def __init__(self, *args, **kwargs):
@ -148,10 +148,10 @@ class ExternalProgram():
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 environment.is_windows() and (suffix == 'exe' or suffix == 'com'\
if mesonlib.is_windows() and (suffix == 'exe' or suffix == 'com'\
or suffix == 'bat'):
self.fullpath = [trial]
elif not environment.is_windows() and os.access(trial, os.X_OK):
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
@ -160,7 +160,7 @@ class ExternalProgram():
first_line = open(trial).readline().strip()
if first_line.startswith('#!'):
commands = first_line[2:].split('#')[0].strip().split()
if environment.is_windows():
if mesonlib.is_windows():
commands[0] = commands[0].split('/')[-1] # Windows does not have /usr/bin.
self.fullpath = commands + [trial]
except Exception:
@ -665,7 +665,7 @@ class AppleFrameworks(Dependency):
return args
def found(self):
return environment.is_osx()
return mesonlib.is_osx()
def get_dep_identifier(name, kwargs):
elements = [name]

File diff suppressed because it is too large Load Diff

@ -17,7 +17,7 @@
from optparse import OptionParser
import sys, stat, traceback, pickle
import os.path
import environment, interpreter
import environment, interpreter, mesonlib
import build
import mlog, coredata
@ -35,7 +35,7 @@ backendlist = ['ninja', 'vs2010', 'xcode']
backend_help = 'backend to use, one of: %s' % ', '.join(backendlist)
backend_help += ' (default: %default)'
if environment.is_windows():
if mesonlib.is_windows():
def_prefix = 'c:/'
else:
def_prefix = '/usr/local'

@ -0,0 +1,43 @@
# Copyright 2012-2014 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""A library of random helper functionality."""
import platform, subprocess
def is_osx():
return platform.system().lower() == 'darwin'
def is_linux():
return platform.system().lower() == 'linux'
def is_windows():
return platform.system().lower() == 'windows'
def is_debianlike():
try:
open('/etc/debian_version', 'r')
return True
except FileNotFoundError:
return False
def exe_exists(arglist):
try:
p = subprocess.Popen(arglist, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.communicate()
if p.returncode == 0:
return True
except FileNotFoundError:
pass
return False

@ -13,7 +13,7 @@
# limitations under the License.
import backends
import environment
import environment, mesonlib
import build
import mlog
import dependencies
@ -22,7 +22,7 @@ from build import InvalidArguments
from coredata import MesonException
import os, sys, shutil, pickle, re
if environment.is_windows():
if mesonlib.is_windows():
quote_char = '"'
execute_wrapper = 'cmd /c'
else:
@ -870,7 +870,7 @@ class NinjaBackend(backends.Backend):
outfile.write('\n')
def generate_fortran_dep_hack(self, outfile):
if environment.is_windows():
if mesonlib.is_windows():
cmd = 'cmd /C ""'
else:
cmd = 'true'

@ -17,7 +17,7 @@
from glob import glob
import os, subprocess, shutil, sys, platform, signal
import environment
from environment import is_windows
import mesonlib
passing_tests = 0
failing_tests = 0
@ -47,7 +47,7 @@ if msbuild_exe is not None:
compile_commands = ['msbuild']
test_commands = ['msbuild', 'RUN_TESTS.vcxproj']
install_commands = []
elif environment.is_osx():
elif mesonlib.is_osx():
backend_flags = ['--backend=xcode']
compile_commands = ['xcodebuild']
test_commands = ['xcodebuild', '-target', 'RUN_TESTS']
@ -186,22 +186,22 @@ def run_tests():
commontests = gather_tests('test cases/common')
failtests = gather_tests('test cases/failing')
objtests = gather_tests('test cases/prebuilt object')
if environment.is_linux():
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 environment.is_osx():
if mesonlib.is_osx():
platformtests = gather_tests('test cases/osx')
elif environment.is_windows():
elif mesonlib.is_windows():
platformtests = gather_tests('test cases/windows')
else:
platformtests = gather_tests('test cases/linuxlike')
if not environment.is_osx() and not environment.is_windows():
if not mesonlib.is_osx() and not mesonlib.is_windows():
frameworktests = gather_tests('test cases/frameworks')
else:
frameworktests = []
if not environment.is_osx() and shutil.which('javac'):
if not mesonlib.is_osx() and shutil.which('javac'):
javatests = gather_tests('test cases/java')
else:
javatests = []
@ -217,7 +217,7 @@ def run_tests():
rusttests = gather_tests('test cases/rust')
else:
rusttests = []
if not environment.is_windows():
if not mesonlib.is_windows():
objctests = gather_tests('test cases/objc')
else:
objctests = []
@ -308,7 +308,7 @@ def generate_prebuilt_object():
objectfile = objectbase + 'obj'
cmd = ['cl', '/nologo', '/Fo'+objectfile, '/c', source]
else:
if is_windows():
if mesonlib.is_windows():
objectfile = objectbase + 'obj'
else:
objectfile = objectbase + 'o'

Loading…
Cancel
Save