diff options
Diffstat (limited to 'methods.py')
| -rw-r--r-- | methods.py | 88 | 
1 files changed, 21 insertions, 67 deletions
diff --git a/methods.py b/methods.py index 42eac7ca75..11efd68ce4 100644 --- a/methods.py +++ b/methods.py @@ -4,7 +4,6 @@ import sys  import re  import glob  import string -import datetime  import subprocess  from compat import iteritems, isbasestring, decode_utf8 @@ -25,10 +24,16 @@ def disable_warnings(self):          # We have to remove existing warning level defines before appending /w,          # otherwise we get: "warning D9025 : overriding '/W3' with '/w'"          warn_flags = ['/Wall', '/W4', '/W3', '/W2', '/W1', '/WX'] -        self['CCFLAGS'] = [x for x in self['CCFLAGS'] if not x in warn_flags]          self.Append(CCFLAGS=['/w']) +        self.Append(CFLAGS=['/w']) +        self.Append(CPPFLAGS=['/w']) +        self['CCFLAGS'] = [x for x in self['CCFLAGS'] if not x in warn_flags] +        self['CFLAGS'] = [x for x in self['CFLAGS'] if not x in warn_flags] +        self['CXXFLAGS'] = [x for x in self['CXXFLAGS'] if not x in warn_flags]      else:          self.Append(CCFLAGS=['-w']) +        self.Append(CFLAGS=['-w']) +        self.Append(CXXFLAGS=['-w'])  def add_module_version_string(self,s): @@ -55,7 +60,7 @@ def update_version(module_version_string=""):      f.write("#define VERSION_STATUS \"" + str(version.status) + "\"\n")      f.write("#define VERSION_BUILD \"" + str(build_name) + "\"\n")      f.write("#define VERSION_MODULE_CONFIG \"" + str(version.module_config) + module_version_string + "\"\n") -    f.write("#define VERSION_YEAR " + str(2018) + "\n") +    f.write("#define VERSION_YEAR " + str(version.year) + "\n")      f.close()      # NOTE: It is safe to generate this file here, since this is still executed serially @@ -212,70 +217,6 @@ def win32_spawn(sh, escape, cmd, args, spawnenv):  	return exit_code  """ -def android_add_flat_dir(self, dir): -    if (dir not in self.android_flat_dirs): -        self.android_flat_dirs.append(dir) - -def android_add_maven_repository(self, url): -    if (url not in self.android_maven_repos): -        self.android_maven_repos.append(url) - -def android_add_dependency(self, depline): -    if (depline not in self.android_dependencies): -        self.android_dependencies.append(depline) - -def android_add_java_dir(self, subpath): -    base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath -    if (base_path not in self.android_java_dirs): -        self.android_java_dirs.append(base_path) - -def android_add_res_dir(self, subpath): -    base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath -    if (base_path not in self.android_res_dirs): -        self.android_res_dirs.append(base_path) - -def android_add_asset_dir(self, subpath): -    base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath -    if (base_path not in self.android_asset_dirs): -        self.android_asset_dirs.append(base_path) - -def android_add_aidl_dir(self, subpath): -    base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath -    if (base_path not in self.android_aidl_dirs): -        self.android_aidl_dirs.append(base_path) - -def android_add_jni_dir(self, subpath): -    base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath -    if (base_path not in self.android_jni_dirs): -        self.android_jni_dirs.append(base_path) - -def android_add_gradle_plugin(self, plugin): -    if (plugin not in self.android_gradle_plugins): -        self.android_gradle_plugins.append(plugin) - -def android_add_gradle_classpath(self, classpath): -    if (classpath not in self.android_gradle_classpath): -        self.android_gradle_classpath.append(classpath) - -def android_add_default_config(self, config): -    if (config not in self.android_default_config): -        self.android_default_config.append(config) - -def android_add_to_manifest(self, file): -    base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + file -    with open(base_path, "r") as f: -        self.android_manifest_chunk += f.read() - -def android_add_to_permissions(self, file): -    base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + file -    with open(base_path, "r") as f: -        self.android_permission_chunk += f.read() - -def android_add_to_attributes(self, file): -    base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + file -    with open(base_path, "r") as f: -        self.android_appattributes_chunk += f.read() -  def disable_module(self):      self.disabled_modules.append(self.current_module) @@ -660,3 +601,16 @@ def detect_darwin_sdk_path(platform, env):              print("Failed to find SDK path while running xcrun --sdk {} --show-sdk-path.".format(sdk_name))              raise +def get_compiler_version(env): +    version = decode_utf8(subprocess.check_output([env['CXX'], '--version']).strip()) +    match = re.search('[0-9][0-9.]*', version) +    if match is not None: +        return match.group().split('.') +    else: +        return None + +def using_gcc(env): +    return 'gcc' in os.path.basename(env["CC"]) + +def using_clang(env): +    return 'clang' in os.path.basename(env["CC"])  |