summaryrefslogtreecommitdiff
path: root/methods.py
diff options
context:
space:
mode:
authorNils ANDRÉ-CHANG <nils@nilsand.re>2019-09-12 21:28:49 +0100
committerNils ANDRÉ-CHANG <nils@nilsand.re>2019-09-26 20:36:12 +0100
commit0024dd7bb5a8a5194ed0283fc506edcd8b4a7737 (patch)
tree86316cccbf4fda58a275a7451e37fda83465bb20 /methods.py
parentcafb888361eba08297dd88b18dc71f4d418525c0 (diff)
parent24e1039eb6fe32115e8d1a62a84965e9be19a2ed (diff)
Merge branch 'master' into tab_key
Diffstat (limited to 'methods.py')
-rw-r--r--methods.py36
1 files changed, 27 insertions, 9 deletions
diff --git a/methods.py b/methods.py
index bb4adfb70b..86ab7cd9af 100644
--- a/methods.py
+++ b/methods.py
@@ -8,14 +8,28 @@ import subprocess
from compat import iteritems, isbasestring, decode_utf8
-def add_source_files(self, sources, filetype, lib_env=None, shared=False):
-
- if isbasestring(filetype):
- dir_path = self.Dir('.').abspath
- filetype = sorted(glob.glob(dir_path + "/" + filetype))
-
- for path in filetype:
- sources.append(self.Object(path))
+def add_source_files(self, sources, files, warn_duplicates=True):
+ # Convert string to list of absolute paths (including expanding wildcard)
+ if isbasestring(files):
+ # Keep SCons project-absolute path as they are (no wildcard support)
+ if files.startswith('#'):
+ if '*' in files:
+ print("ERROR: Wildcards can't be expanded in SCons project-absolute path: '{}'".format(files))
+ return
+ files = [files]
+ else:
+ dir_path = self.Dir('.').abspath
+ files = sorted(glob.glob(dir_path + "/" + files))
+
+ # Add each path as compiled Object following environment (self) configuration
+ for path in files:
+ obj = self.Object(path)
+ if obj in sources:
+ if warn_duplicates:
+ print("WARNING: Object \"{}\" already included in environment sources.".format(obj))
+ else:
+ continue
+ sources.append(obj)
def disable_warnings(self):
@@ -603,7 +617,11 @@ def detect_darwin_sdk_path(platform, env):
raise
def get_compiler_version(env):
- version = decode_utf8(subprocess.check_output([env['CXX'], '--version']).strip())
+ # Not using this method on clang because it returns 4.2.1 # https://reviews.llvm.org/D56803
+ if using_gcc(env):
+ version = decode_utf8(subprocess.check_output([env['CXX'], '-dumpversion']).strip())
+ else:
+ 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('.')