mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-04-10 13:52:38 +02:00
More scons tool cleanups.
This commit is contained in:
parent
45d4593be8
commit
56654077b4
@ -1,42 +0,0 @@
|
|||||||
# MIT License
|
|
||||||
#
|
|
||||||
# Copyright The SCons Foundation
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
# a copy of this software and associated documentation files (the
|
|
||||||
# "Software"), to deal in the Software without restriction, including
|
|
||||||
# without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
# permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
# the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included
|
|
||||||
# in all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
||||||
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
||||||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
"""Dependency scanner for IDL (Interface Definition Language) files."""
|
|
||||||
|
|
||||||
from . import ClassicCPP
|
|
||||||
|
|
||||||
def IDLScan():
|
|
||||||
"""Return a prototype Scanner instance for scanning IDL source files"""
|
|
||||||
cs = ClassicCPP(
|
|
||||||
"IDLScan",
|
|
||||||
"$IDLSUFFIXES",
|
|
||||||
"CPPPATH",
|
|
||||||
r'^[ \t]*(?:#[ \t]*include|[ \t]*import)[ \t]+(<|")([^>"]+)(>|")',
|
|
||||||
)
|
|
||||||
return cs
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# tab-width:4
|
|
||||||
# indent-tabs-mode:nil
|
|
||||||
# End:
|
|
||||||
# vim: set expandtab tabstop=4 shiftwidth=4:
|
|
@ -1,216 +0,0 @@
|
|||||||
# MIT License
|
|
||||||
#
|
|
||||||
# Copyright The SCons Foundation
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
# a copy of this software and associated documentation files (the
|
|
||||||
# "Software"), to deal in the Software without restriction, including
|
|
||||||
# without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
# permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
# the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included
|
|
||||||
# in all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
||||||
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
||||||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
"""Dependency scanner for Python code.
|
|
||||||
|
|
||||||
One important note about the design is that this does not take any dependencies
|
|
||||||
upon packages or binaries in the Python installation unless they are listed in
|
|
||||||
PYTHONPATH. To do otherwise would have required code to determine where the
|
|
||||||
Python installation is, which is outside of the scope of a scanner like this.
|
|
||||||
If consumers want to pick up dependencies upon these packages, they must put
|
|
||||||
those directories in PYTHONPATH.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
import itertools
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
|
|
||||||
import SCons.Node.FS
|
|
||||||
import SCons.Util
|
|
||||||
from . import ScannerBase
|
|
||||||
|
|
||||||
# Capture python "from a import b" and "import a" statements.
|
|
||||||
from_cre = re.compile(r'^\s*from\s+([^\s]+)\s+import\s+(.*)', re.M)
|
|
||||||
import_cre = re.compile(r'^\s*import\s+([^\s]+)', re.M)
|
|
||||||
|
|
||||||
|
|
||||||
def path_function(env, dir=None, target=None, source=None, argument=None):
|
|
||||||
"""Retrieves a tuple with all search paths."""
|
|
||||||
paths = env['ENV'].get('PYTHONPATH', '').split(os.pathsep)
|
|
||||||
if source:
|
|
||||||
paths.append(source[0].dir.abspath)
|
|
||||||
return tuple(paths)
|
|
||||||
|
|
||||||
|
|
||||||
def find_include_names(node):
|
|
||||||
"""Scans the node for all imports.
|
|
||||||
|
|
||||||
Returns a list of tuples. Each tuple has two elements:
|
|
||||||
1. The main import (e.g. module, module.file, module.module2)
|
|
||||||
2. Additional optional imports that could be functions or files
|
|
||||||
in the case of a "from X import Y" statement. In the case of a
|
|
||||||
normal "import" statement, this is None.
|
|
||||||
"""
|
|
||||||
text = node.get_text_contents()
|
|
||||||
all_matches = []
|
|
||||||
matches = from_cre.findall(text)
|
|
||||||
if matches:
|
|
||||||
for match in matches:
|
|
||||||
imports = [i.strip() for i in match[1].split(',')]
|
|
||||||
|
|
||||||
# Add some custom logic to strip out "as" because the regex
|
|
||||||
# includes it.
|
|
||||||
last_import_split = imports[-1].split()
|
|
||||||
if len(last_import_split) > 1:
|
|
||||||
imports[-1] = last_import_split[0]
|
|
||||||
|
|
||||||
all_matches.append((match[0], imports))
|
|
||||||
|
|
||||||
matches = import_cre.findall(text)
|
|
||||||
if matches:
|
|
||||||
for match in matches:
|
|
||||||
all_matches.append((match, None))
|
|
||||||
|
|
||||||
return all_matches
|
|
||||||
|
|
||||||
|
|
||||||
def find_import(import_path, search_paths):
|
|
||||||
"""
|
|
||||||
Finds the specified import in the various search paths.
|
|
||||||
For an import of "p", it could either result in a file named p.py or
|
|
||||||
p/__init__.py. We can't do two consecutive searches for p then p.py
|
|
||||||
because the first search could return a result that is lower in the
|
|
||||||
search_paths precedence order. As a result, it is safest to iterate over
|
|
||||||
search_paths and check whether p or p.py exists in each path. This allows
|
|
||||||
us to cleanly respect the precedence order.
|
|
||||||
|
|
||||||
If the import is found, returns a tuple containing:
|
|
||||||
1. Discovered dependency node (e.g. p/__init__.py or p.py)
|
|
||||||
2. True if the import was a package, False if the import was a module.
|
|
||||||
3. The Dir node in search_paths that the import is relative to.
|
|
||||||
If the import is not found, returns a tuple containing (None, False, None).
|
|
||||||
Callers should check for failure by checking whether the first entry in the
|
|
||||||
tuple is not None.
|
|
||||||
"""
|
|
||||||
for search_path in search_paths:
|
|
||||||
paths = [search_path]
|
|
||||||
# Note: if the same import is present as a package and a module, Python
|
|
||||||
# prefers the package. As a result, we always look for x/__init__.py
|
|
||||||
# before looking for x.py.
|
|
||||||
node = SCons.Node.FS.find_file(import_path + '/__init__.py', paths)
|
|
||||||
if node:
|
|
||||||
return node, True, search_path
|
|
||||||
else:
|
|
||||||
node = SCons.Node.FS.find_file(import_path + '.py', paths)
|
|
||||||
if node:
|
|
||||||
return node, False, search_path
|
|
||||||
|
|
||||||
return None, False, None
|
|
||||||
|
|
||||||
|
|
||||||
def scan(node, env, path=()):
|
|
||||||
# cache the includes list in node so we only scan it once:
|
|
||||||
if node.includes is not None:
|
|
||||||
includes = node.includes
|
|
||||||
else:
|
|
||||||
includes = find_include_names(node)
|
|
||||||
# Intern the names of the include files. Saves some memory
|
|
||||||
# if the same header is included many times.
|
|
||||||
node.includes = list(map(SCons.Util.silent_intern, includes))
|
|
||||||
|
|
||||||
nodes = []
|
|
||||||
if callable(path):
|
|
||||||
path = path()
|
|
||||||
|
|
||||||
for module, imports in includes:
|
|
||||||
is_relative = module.startswith('.')
|
|
||||||
if is_relative:
|
|
||||||
# This is a relative include, so we must ignore PYTHONPATH.
|
|
||||||
module_lstripped = module.lstrip('.')
|
|
||||||
# One dot is current directory, two is parent, three is
|
|
||||||
# grandparent, etc.
|
|
||||||
num_parents = len(module) - len(module_lstripped) - 1
|
|
||||||
current_dir = node.get_dir()
|
|
||||||
for i in itertools.repeat(None, num_parents):
|
|
||||||
current_dir = current_dir.up()
|
|
||||||
|
|
||||||
search_paths = [current_dir]
|
|
||||||
search_string = module_lstripped
|
|
||||||
else:
|
|
||||||
search_paths = [env.Dir(p) for p in path]
|
|
||||||
search_string = module
|
|
||||||
|
|
||||||
# If there are no paths, there is no point in parsing includes for this
|
|
||||||
# iteration of the loop.
|
|
||||||
if not search_paths:
|
|
||||||
continue
|
|
||||||
|
|
||||||
module_components = [x for x in search_string.split('.') if x]
|
|
||||||
package_dir = None
|
|
||||||
hit_dir = None
|
|
||||||
if not module_components:
|
|
||||||
# This is just a "from . import x".
|
|
||||||
package_dir = search_paths[0]
|
|
||||||
else:
|
|
||||||
# Translate something like "import x.y" to a call to find_import
|
|
||||||
# with 'x/y' as the path. find_import will then determine whether
|
|
||||||
# we can find 'x/y/__init__.py' or 'x/y.py'.
|
|
||||||
import_node, is_dir, hit_dir = find_import(
|
|
||||||
'/'.join(module_components), search_paths)
|
|
||||||
if import_node:
|
|
||||||
nodes.append(import_node)
|
|
||||||
if is_dir:
|
|
||||||
package_dir = import_node.dir
|
|
||||||
|
|
||||||
# If the statement was something like "from x import y, z", whether we
|
|
||||||
# iterate over imports depends on whether x was a package or module.
|
|
||||||
# If it was a module, y and z are just functions so we don't need to
|
|
||||||
# search for them. If it was a package, y and z are either packages or
|
|
||||||
# modules and we do need to search for them.
|
|
||||||
if package_dir and imports:
|
|
||||||
for i in imports:
|
|
||||||
import_node, _, _ = find_import(i, [package_dir])
|
|
||||||
if import_node:
|
|
||||||
nodes.append(import_node)
|
|
||||||
|
|
||||||
# Take a dependency on all __init__.py files from all imported
|
|
||||||
# packages unless it's a relative import. If it's a relative
|
|
||||||
# import, we don't need to take the dependency because Python
|
|
||||||
# requires that all referenced packages have already been imported,
|
|
||||||
# which means that the dependency has already been established.
|
|
||||||
if hit_dir and not is_relative:
|
|
||||||
import_dirs = module_components
|
|
||||||
for i in range(len(import_dirs)):
|
|
||||||
init_path = '/'.join(import_dirs[:i+1] + ['__init__.py'])
|
|
||||||
init_node = SCons.Node.FS.find_file(init_path, [hit_dir])
|
|
||||||
if init_node and init_node not in nodes:
|
|
||||||
nodes.append(init_node)
|
|
||||||
|
|
||||||
return sorted(nodes)
|
|
||||||
|
|
||||||
|
|
||||||
PythonSuffixes = ['.py']
|
|
||||||
PythonScanner = ScannerBase(
|
|
||||||
scan,
|
|
||||||
name='PythonScanner',
|
|
||||||
skeys=PythonSuffixes,
|
|
||||||
path_function=path_function,
|
|
||||||
recursive=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# tab-width:4
|
|
||||||
# indent-tabs-mode:nil
|
|
||||||
# End:
|
|
||||||
# vim: set expandtab tabstop=4 shiftwidth=4:
|
|
@ -1,57 +0,0 @@
|
|||||||
# MIT License
|
|
||||||
#
|
|
||||||
# Copyright The SCons Foundation
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
# a copy of this software and associated documentation files (the
|
|
||||||
# "Software"), to deal in the Software without restriction, including
|
|
||||||
# without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
# permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
# the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included
|
|
||||||
# in all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
||||||
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
||||||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
"""Dependency scanner for RC (Interface Definition Language) files."""
|
|
||||||
|
|
||||||
|
|
||||||
import SCons.Node.FS
|
|
||||||
from . import ClassicCPP
|
|
||||||
|
|
||||||
|
|
||||||
def no_tlb(nodes):
|
|
||||||
"""Filter out .tlb files as they are binary and shouldn't be scanned."""
|
|
||||||
|
|
||||||
# print("Nodes:%s"%[str(n) for n in nodes])
|
|
||||||
return [n for n in nodes if str(n)[-4:] != '.tlb']
|
|
||||||
|
|
||||||
|
|
||||||
def RCScan():
|
|
||||||
"""Return a prototype Scanner instance for scanning RC source files"""
|
|
||||||
|
|
||||||
res_re = (
|
|
||||||
r'^(?:\s*#\s*(?:include)|'
|
|
||||||
r'.*?\s+(?:ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)'
|
|
||||||
r'\s*.*?)'
|
|
||||||
r'\s*(<|"| )([^>"\s]+)(?:[>"\s])*$'
|
|
||||||
)
|
|
||||||
resScanner = ClassicCPP(
|
|
||||||
"ResourceScanner", "$RCSUFFIXES", "CPPPATH", res_re, recursive=no_tlb
|
|
||||||
)
|
|
||||||
|
|
||||||
return resScanner
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# tab-width:4
|
|
||||||
# indent-tabs-mode:nil
|
|
||||||
# End:
|
|
||||||
# vim: set expandtab tabstop=4 shiftwidth=4:
|
|
@ -1,39 +0,0 @@
|
|||||||
# MIT License
|
|
||||||
#
|
|
||||||
# Copyright The SCons Foundation
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
# a copy of this software and associated documentation files (the
|
|
||||||
# "Software"), to deal in the Software without restriction, including
|
|
||||||
# without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
# permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
# the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included
|
|
||||||
# in all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
||||||
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
||||||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
"""Dependency scanner for SWIG code."""
|
|
||||||
|
|
||||||
from . import ClassicCPP
|
|
||||||
|
|
||||||
SWIGSuffixes = ['.i']
|
|
||||||
|
|
||||||
def SWIGScanner():
|
|
||||||
expr = r'^[ \t]*%[ \t]*(?:include|import|extern)[ \t]*(<|"?)([^>\s"]+)(?:>|"?)'
|
|
||||||
scanner = ClassicCPP("SWIGScanner", ".i", "SWIGPATH", expr)
|
|
||||||
return scanner
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# tab-width:4
|
|
||||||
# indent-tabs-mode:nil
|
|
||||||
# End:
|
|
||||||
# vim: set expandtab tabstop=4 shiftwidth=4:
|
|
@ -48,7 +48,6 @@ import SCons.Node.FS
|
|||||||
import SCons.Scanner
|
import SCons.Scanner
|
||||||
import SCons.Scanner.C
|
import SCons.Scanner.C
|
||||||
import SCons.Scanner.Prog
|
import SCons.Scanner.Prog
|
||||||
import SCons.Scanner.SWIG
|
|
||||||
from SCons.Tool.linkCommon import LibSymlinksActionFunction, LibSymlinksStrFun
|
from SCons.Tool.linkCommon import LibSymlinksActionFunction, LibSymlinksStrFun
|
||||||
|
|
||||||
DefaultToolpath = []
|
DefaultToolpath = []
|
||||||
@ -56,7 +55,6 @@ DefaultToolpath = []
|
|||||||
CScanner = SCons.Scanner.C.CScanner()
|
CScanner = SCons.Scanner.C.CScanner()
|
||||||
ProgramScanner = SCons.Scanner.Prog.ProgramScanner()
|
ProgramScanner = SCons.Scanner.Prog.ProgramScanner()
|
||||||
SourceFileScanner = SCons.Scanner.ScannerBase({}, name='SourceFileScanner')
|
SourceFileScanner = SCons.Scanner.ScannerBase({}, name='SourceFileScanner')
|
||||||
SWIGScanner = SCons.Scanner.SWIG.SWIGScanner()
|
|
||||||
|
|
||||||
CSuffixes = [".c", ".C", ".cxx", ".cpp", ".c++", ".cc",
|
CSuffixes = [".c", ".C", ".cxx", ".cpp", ".c++", ".cc",
|
||||||
".h", ".H", ".hxx", ".hpp", ".hh",
|
".h", ".H", ".hxx", ".hpp", ".hh",
|
||||||
@ -66,14 +64,9 @@ CSuffixes = [".c", ".C", ".cxx", ".cpp", ".c++", ".cc",
|
|||||||
|
|
||||||
IDLSuffixes = [".idl", ".IDL"]
|
IDLSuffixes = [".idl", ".IDL"]
|
||||||
|
|
||||||
SWIGSuffixes = ['.i']
|
|
||||||
|
|
||||||
for suffix in CSuffixes:
|
for suffix in CSuffixes:
|
||||||
SourceFileScanner.add_scanner(suffix, CScanner)
|
SourceFileScanner.add_scanner(suffix, CScanner)
|
||||||
|
|
||||||
for suffix in SWIGSuffixes:
|
|
||||||
SourceFileScanner.add_scanner(suffix, SWIGScanner)
|
|
||||||
|
|
||||||
# Tool aliases are needed for those tools whose module names also
|
# Tool aliases are needed for those tools whose module names also
|
||||||
# occur in the python standard library (This causes module shadowing and
|
# occur in the python standard library (This causes module shadowing and
|
||||||
# can break using python library functions under python3) or if the current tool/file names
|
# can break using python library functions under python3) or if the current tool/file names
|
||||||
@ -763,9 +756,6 @@ def tool_list(platform, env):
|
|||||||
assembler = FindTool(assemblers, env) or assemblers[0]
|
assembler = FindTool(assemblers, env) or assemblers[0]
|
||||||
ar = FindTool(ars, env) or ars[0]
|
ar = FindTool(ars, env) or ars[0]
|
||||||
|
|
||||||
d_compilers = ['dmd', 'ldc', 'gdc']
|
|
||||||
d_compiler = FindTool(d_compilers, env) or d_compilers[0]
|
|
||||||
|
|
||||||
other_tools = FindAllTools(other_plat_tools + [
|
other_tools = FindAllTools(other_plat_tools + [
|
||||||
# TODO: merge 'install' into 'filesystem' and
|
# TODO: merge 'install' into 'filesystem' and
|
||||||
# make 'filesystem' the default
|
# make 'filesystem' the default
|
||||||
@ -784,7 +774,6 @@ def tool_list(platform, env):
|
|||||||
cxx_compiler,
|
cxx_compiler,
|
||||||
assembler,
|
assembler,
|
||||||
ar,
|
ar,
|
||||||
d_compiler,
|
|
||||||
] + other_tools
|
] + other_tools
|
||||||
|
|
||||||
return [x for x in tools if x]
|
return [x for x in tools if x]
|
||||||
|
@ -1,168 +0,0 @@
|
|||||||
# MIT License
|
|
||||||
#
|
|
||||||
# Copyright The SCons Foundation
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
# a copy of this software and associated documentation files (the
|
|
||||||
# "Software"), to deal in the Software without restriction, including
|
|
||||||
# without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
# permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
# the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included
|
|
||||||
# in all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
||||||
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
||||||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
"""SCons.Tool.dmd
|
|
||||||
|
|
||||||
Tool-specific initialization for the Digital Mars D compiler.
|
|
||||||
(http://digitalmars.com/d)
|
|
||||||
|
|
||||||
Originally coded by Andy Friesen (andy@ikagames.com)
|
|
||||||
15 November 2003
|
|
||||||
|
|
||||||
Evolved by Russel Winder (russel@winder.org.uk)
|
|
||||||
2010-02-07 onwards
|
|
||||||
|
|
||||||
Compiler variables:
|
|
||||||
|
|
||||||
DC
|
|
||||||
The name of the D compiler to use.
|
|
||||||
Defaults to dmd or gdmd, whichever is found.
|
|
||||||
|
|
||||||
DPATH
|
|
||||||
List of paths to search for import modules.
|
|
||||||
|
|
||||||
DVERSIONS
|
|
||||||
List of version tags to enable when compiling.
|
|
||||||
|
|
||||||
DDEBUG
|
|
||||||
List of debug tags to enable when compiling.
|
|
||||||
|
|
||||||
Linker related variables:
|
|
||||||
|
|
||||||
LIBS
|
|
||||||
List of library files to link in.
|
|
||||||
|
|
||||||
DLINK
|
|
||||||
Name of the linker to use.
|
|
||||||
Defaults to dmd or gdmd, whichever is found.
|
|
||||||
|
|
||||||
DLINKFLAGS
|
|
||||||
List of linker flags.
|
|
||||||
|
|
||||||
Lib tool variables:
|
|
||||||
|
|
||||||
DLIB
|
|
||||||
Name of the lib tool to use. Defaults to lib.
|
|
||||||
|
|
||||||
DLIBFLAGS
|
|
||||||
List of flags to pass to the lib tool.
|
|
||||||
|
|
||||||
LIBS
|
|
||||||
Same as for the linker. (libraries to pull into the .lib)
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
import SCons.Action
|
|
||||||
import SCons.Builder
|
|
||||||
import SCons.Defaults
|
|
||||||
import SCons.Tool
|
|
||||||
|
|
||||||
import SCons.Tool.DCommon as DCommon
|
|
||||||
|
|
||||||
|
|
||||||
def generate(env):
|
|
||||||
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
|
|
||||||
|
|
||||||
static_obj.add_action('.d', SCons.Defaults.DAction)
|
|
||||||
shared_obj.add_action('.d', SCons.Defaults.ShDAction)
|
|
||||||
static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter)
|
|
||||||
shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter)
|
|
||||||
|
|
||||||
env['DC'] = env.Detect(['dmd', 'ldmd2', 'gdmd']) or 'dmd'
|
|
||||||
env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -of$TARGET $SOURCES'
|
|
||||||
env['_DINCFLAGS'] = '${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}'
|
|
||||||
env['_DVERFLAGS'] = '${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)}'
|
|
||||||
env['_DDEBUGFLAGS'] = '${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)}'
|
|
||||||
env['_DFLAGS'] = '${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)}'
|
|
||||||
|
|
||||||
env['SHDC'] = '$DC'
|
|
||||||
env['SHDCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -fPIC -of$TARGET $SOURCES'
|
|
||||||
|
|
||||||
env['DPATH'] = ['#/']
|
|
||||||
env['DFLAGS'] = []
|
|
||||||
env['DVERSIONS'] = []
|
|
||||||
env['DDEBUG'] = []
|
|
||||||
|
|
||||||
if env['DC']:
|
|
||||||
DCommon.addDPATHToEnv(env, env['DC'])
|
|
||||||
|
|
||||||
env['DINCPREFIX'] = '-I'
|
|
||||||
env['DINCSUFFIX'] = ''
|
|
||||||
env['DVERPREFIX'] = '-version='
|
|
||||||
env['DVERSUFFIX'] = ''
|
|
||||||
env['DDEBUGPREFIX'] = '-debug='
|
|
||||||
env['DDEBUGSUFFIX'] = ''
|
|
||||||
env['DFLAGPREFIX'] = '-'
|
|
||||||
env['DFLAGSUFFIX'] = ''
|
|
||||||
env['DFILESUFFIX'] = '.d'
|
|
||||||
|
|
||||||
env['DLINK'] = '$DC'
|
|
||||||
env['DLINKFLAGS'] = SCons.Util.CLVar('')
|
|
||||||
env['DLINKCOM'] = '$DLINK -of$TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS'
|
|
||||||
|
|
||||||
env['SHDLINK'] = '$DC'
|
|
||||||
env['SHDLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared -defaultlib=libphobos2.so')
|
|
||||||
env[
|
|
||||||
'SHDLINKCOM'] = '$DLINK -of$TARGET $SHDLINKFLAGS $__SHDLIBVERSIONFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS'
|
|
||||||
|
|
||||||
env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-L-l'
|
|
||||||
env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else ''
|
|
||||||
env['_DLIBFLAGS'] = '${_stripixes(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, LIBPREFIXES, LIBSUFFIXES, __env__)}'
|
|
||||||
|
|
||||||
env['DLIBDIRPREFIX'] = '-L-L'
|
|
||||||
env['DLIBDIRSUFFIX'] = ''
|
|
||||||
env['_DLIBDIRFLAGS'] = '${_concat(DLIBDIRPREFIX, LIBPATH, DLIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)}'
|
|
||||||
|
|
||||||
env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr'
|
|
||||||
env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {0}$TARGET $SOURCES $_DLIBFLAGS'.format(
|
|
||||||
'-c ' if env['PLATFORM'] == 'win32' else '')
|
|
||||||
|
|
||||||
# env['_DLIBFLAGS'] = '${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)}'
|
|
||||||
|
|
||||||
env['DLIBFLAGPREFIX'] = '-'
|
|
||||||
env['DLIBFLAGSUFFIX'] = ''
|
|
||||||
|
|
||||||
# __RPATH is set to $_RPATH in the platform specification if that
|
|
||||||
# platform supports it.
|
|
||||||
env['DRPATHPREFIX'] = '-L-rpath,' if env['PLATFORM'] == 'darwin' else '-L-rpath='
|
|
||||||
env['DRPATHSUFFIX'] = ''
|
|
||||||
env['_DRPATH'] = '${_concat(DRPATHPREFIX, RPATH, DRPATHSUFFIX, __env__)}'
|
|
||||||
|
|
||||||
# Support for versioned libraries
|
|
||||||
env['_SHDLIBVERSIONFLAGS'] = '$SHDLIBVERSIONFLAGS -L-soname=$_SHLIBSONAME'
|
|
||||||
|
|
||||||
env['BUILDERS']['ProgramAllAtOnce'] = SCons.Builder.Builder(
|
|
||||||
action='$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -of$TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS',
|
|
||||||
emitter=DCommon.allAtOnceEmitter,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def exists(env):
|
|
||||||
return env.Detect(['dmd', 'ldmd2', 'gdmd'])
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# tab-width:4
|
|
||||||
# indent-tabs-mode:nil
|
|
||||||
# End:
|
|
||||||
# vim: set expandtab tabstop=4 shiftwidth=4:
|
|
@ -1,134 +0,0 @@
|
|||||||
# MIT License
|
|
||||||
#
|
|
||||||
# Copyright The SCons Foundation
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
# a copy of this software and associated documentation files (the
|
|
||||||
# "Software"), to deal in the Software without restriction, including
|
|
||||||
# without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
# permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
# the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included
|
|
||||||
# in all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
||||||
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
||||||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
"""SCons.Tool.gdc
|
|
||||||
|
|
||||||
Tool-specific initialization for the GDC compiler.
|
|
||||||
(https://github.com/D-Programming-GDC/GDC)
|
|
||||||
|
|
||||||
Developed by Russel Winder (russel@winder.org.uk)
|
|
||||||
2012-05-09 onwards
|
|
||||||
|
|
||||||
Compiler variables:
|
|
||||||
DC - The name of the D compiler to use. Defaults to gdc.
|
|
||||||
DPATH - List of paths to search for import modules.
|
|
||||||
DVERSIONS - List of version tags to enable when compiling.
|
|
||||||
DDEBUG - List of debug tags to enable when compiling.
|
|
||||||
|
|
||||||
Linker related variables:
|
|
||||||
LIBS - List of library files to link in.
|
|
||||||
DLINK - Name of the linker to use. Defaults to gdc.
|
|
||||||
DLINKFLAGS - List of linker flags.
|
|
||||||
|
|
||||||
Lib tool variables:
|
|
||||||
DLIB - Name of the lib tool to use. Defaults to lib.
|
|
||||||
DLIBFLAGS - List of flags to pass to the lib tool.
|
|
||||||
LIBS - Same as for the linker. (libraries to pull into the .lib)
|
|
||||||
"""
|
|
||||||
|
|
||||||
import SCons.Action
|
|
||||||
import SCons.Defaults
|
|
||||||
import SCons.Tool
|
|
||||||
|
|
||||||
import SCons.Tool.DCommon as DCommon
|
|
||||||
import SCons.Tool.linkCommon
|
|
||||||
|
|
||||||
|
|
||||||
def generate(env):
|
|
||||||
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
|
|
||||||
|
|
||||||
static_obj.add_action('.d', SCons.Defaults.DAction)
|
|
||||||
shared_obj.add_action('.d', SCons.Defaults.ShDAction)
|
|
||||||
static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter)
|
|
||||||
shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter)
|
|
||||||
|
|
||||||
env['DC'] = env.Detect('gdc') or 'gdc'
|
|
||||||
env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -o $TARGET $SOURCES'
|
|
||||||
env['_DINCFLAGS'] = '${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}'
|
|
||||||
env['_DVERFLAGS'] = '${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)}'
|
|
||||||
env['_DDEBUGFLAGS'] = '${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)}'
|
|
||||||
env['_DFLAGS'] = '${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)}'
|
|
||||||
|
|
||||||
env['SHDC'] = '$DC'
|
|
||||||
env['SHDCOM'] = '$SHDC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -fPIC -c -o $TARGET $SOURCES'
|
|
||||||
|
|
||||||
env['DPATH'] = ['#/']
|
|
||||||
env['DFLAGS'] = []
|
|
||||||
env['DVERSIONS'] = []
|
|
||||||
env['DDEBUG'] = []
|
|
||||||
|
|
||||||
if env['DC']:
|
|
||||||
DCommon.addDPATHToEnv(env, env['DC'])
|
|
||||||
|
|
||||||
env['DINCPREFIX'] = '-I'
|
|
||||||
env['DINCSUFFIX'] = ''
|
|
||||||
env['DVERPREFIX'] = '-version='
|
|
||||||
env['DVERSUFFIX'] = ''
|
|
||||||
env['DDEBUGPREFIX'] = '-debug='
|
|
||||||
env['DDEBUGSUFFIX'] = ''
|
|
||||||
env['DFLAGPREFIX'] = '-'
|
|
||||||
env['DFLAGSUFFIX'] = ''
|
|
||||||
env['DFILESUFFIX'] = '.d'
|
|
||||||
|
|
||||||
env['DLINK'] = '$DC'
|
|
||||||
env['DLINKFLAGS'] = SCons.Util.CLVar('')
|
|
||||||
env['DLINKCOM'] = '$DLINK -o $TARGET $DLINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
|
|
||||||
|
|
||||||
env['SHDLINK'] = '$DC'
|
|
||||||
env['SHDLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared -shared-libphobos')
|
|
||||||
env['SHDLINKCOM'] = '$DLINK -o $TARGET $SHDLINKFLAGS $__SHDLIBVERSIONFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
|
|
||||||
|
|
||||||
env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr'
|
|
||||||
env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {0}$TARGET $SOURCES $_DLINKLIBFLAGS'.format('-c ' if env['PLATFORM'] == 'win32' else '')
|
|
||||||
|
|
||||||
env['_DLIBFLAGS'] = '${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)}'
|
|
||||||
|
|
||||||
env['DLIBFLAGPREFIX'] = '-'
|
|
||||||
env['DLIBFLAGSUFFIX'] = ''
|
|
||||||
env['DLINKFLAGPREFIX'] = '-'
|
|
||||||
env['DLINKFLAGSUFFIX'] = ''
|
|
||||||
|
|
||||||
# __RPATH is set to $_RPATH in the platform specification if that
|
|
||||||
# platform supports it.
|
|
||||||
env['RPATHPREFIX'] = '-Wl,-rpath='
|
|
||||||
env['RPATHSUFFIX'] = ''
|
|
||||||
env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}'
|
|
||||||
|
|
||||||
# Support for versioned libraries
|
|
||||||
env['_SHDLIBVERSIONFLAGS'] = '$SHDLIBVERSIONFLAGS -Wl,-soname=$_SHLIBSONAME'
|
|
||||||
|
|
||||||
env['BUILDERS']['ProgramAllAtOnce'] = SCons.Builder.Builder(
|
|
||||||
action='$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -o $TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS',
|
|
||||||
emitter=DCommon.allAtOnceEmitter,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def exists(env):
|
|
||||||
return env.Detect('gdc')
|
|
||||||
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# tab-width:4
|
|
||||||
# indent-tabs-mode:nil
|
|
||||||
# End:
|
|
||||||
# vim: set expandtab tabstop=4 shiftwidth=4:
|
|
@ -1,146 +0,0 @@
|
|||||||
# MIT License
|
|
||||||
#
|
|
||||||
# Copyright The SCons Foundation
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
# a copy of this software and associated documentation files (the
|
|
||||||
# "Software"), to deal in the Software without restriction, including
|
|
||||||
# without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
# permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
# the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included
|
|
||||||
# in all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
||||||
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
||||||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
|
|
||||||
"""SCons.Tool.ldc
|
|
||||||
|
|
||||||
Tool-specific initialization for the LDC compiler.
|
|
||||||
(https://github.com/ldc-developers/ldc)
|
|
||||||
|
|
||||||
Developed by Russel Winder (russel@winder.org.uk)
|
|
||||||
2012-05-09 onwards
|
|
||||||
|
|
||||||
Compiler variables:
|
|
||||||
DC - The name of the D compiler to use. Defaults to ldc2.
|
|
||||||
DPATH - List of paths to search for import modules.
|
|
||||||
DVERSIONS - List of version tags to enable when compiling.
|
|
||||||
DDEBUG - List of debug tags to enable when compiling.
|
|
||||||
|
|
||||||
Linker related variables:
|
|
||||||
LIBS - List of library files to link in.
|
|
||||||
DLINK - Name of the linker to use. Defaults to ldc2.
|
|
||||||
DLINKFLAGS - List of linker flags.
|
|
||||||
|
|
||||||
Lib tool variables:
|
|
||||||
DLIB - Name of the lib tool to use. Defaults to lib.
|
|
||||||
DLIBFLAGS - List of flags to pass to the lib tool.
|
|
||||||
LIBS - Same as for the linker. (libraries to pull into the .lib)
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import SCons.Action
|
|
||||||
import SCons.Builder
|
|
||||||
import SCons.Defaults
|
|
||||||
import SCons.Tool
|
|
||||||
|
|
||||||
import SCons.Tool.DCommon as DCommon
|
|
||||||
|
|
||||||
|
|
||||||
def generate(env):
|
|
||||||
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
|
|
||||||
|
|
||||||
static_obj.add_action('.d', SCons.Defaults.DAction)
|
|
||||||
shared_obj.add_action('.d', SCons.Defaults.ShDAction)
|
|
||||||
static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter)
|
|
||||||
shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter)
|
|
||||||
|
|
||||||
env['DC'] = env.Detect('ldc2') or 'ldc2'
|
|
||||||
env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -of=$TARGET $SOURCES'
|
|
||||||
env['_DINCFLAGS'] = '${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}'
|
|
||||||
env['_DVERFLAGS'] = '${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)}'
|
|
||||||
env['_DDEBUGFLAGS'] = '${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)}'
|
|
||||||
env['_DFLAGS'] = '${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)}'
|
|
||||||
|
|
||||||
env['SHDC'] = '$DC'
|
|
||||||
env['SHDCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -relocation-model=pic -of=$TARGET $SOURCES'
|
|
||||||
|
|
||||||
env['DPATH'] = ['#/']
|
|
||||||
env['DFLAGS'] = []
|
|
||||||
env['DVERSIONS'] = []
|
|
||||||
env['DDEBUG'] = []
|
|
||||||
|
|
||||||
if env['DC']:
|
|
||||||
DCommon.addDPATHToEnv(env, env['DC'])
|
|
||||||
|
|
||||||
env['DINCPREFIX'] = '-I='
|
|
||||||
env['DINCSUFFIX'] = ''
|
|
||||||
env['DVERPREFIX'] = '-version='
|
|
||||||
env['DVERSUFFIX'] = ''
|
|
||||||
env['DDEBUGPREFIX'] = '-debug='
|
|
||||||
env['DDEBUGSUFFIX'] = ''
|
|
||||||
env['DFLAGPREFIX'] = '-'
|
|
||||||
env['DFLAGSUFFIX'] = ''
|
|
||||||
env['DFILESUFFIX'] = '.d'
|
|
||||||
|
|
||||||
env['DLINK'] = '$DC'
|
|
||||||
env['DLINKFLAGS'] = SCons.Util.CLVar('')
|
|
||||||
env['DLINKCOM'] = '$DLINK -of=$TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS'
|
|
||||||
|
|
||||||
env['SHDLINK'] = '$DC'
|
|
||||||
env['SHDLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared -defaultlib=phobos2-ldc')
|
|
||||||
|
|
||||||
env['SHDLINKCOM'] = '$DLINK -of=$TARGET $SHDLINKFLAGS $__SHDLIBVERSIONFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS -L-ldruntime-ldc'
|
|
||||||
|
|
||||||
env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-L-l'
|
|
||||||
env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else ''
|
|
||||||
# env['_DLIBFLAGS'] = '${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)}'
|
|
||||||
env['_DLIBFLAGS'] = '${_stripixes(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, LIBPREFIXES, LIBSUFFIXES, __env__)}'
|
|
||||||
|
|
||||||
env['DLIBDIRPREFIX'] = '-L-L'
|
|
||||||
env['DLIBDIRSUFFIX'] = ''
|
|
||||||
env['_DLIBDIRFLAGS'] = '${_concat(DLIBDIRPREFIX, LIBPATH, DLIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)}'
|
|
||||||
|
|
||||||
env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr'
|
|
||||||
env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {0}$TARGET $SOURCES $_DLIBFLAGS'.format('-c ' if env['PLATFORM'] == 'win32' else '')
|
|
||||||
|
|
||||||
# env['_DLIBFLAGS'] = '${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)}'
|
|
||||||
|
|
||||||
env['DLIBFLAGPREFIX'] = '-'
|
|
||||||
env['DLIBFLAGSUFFIX'] = ''
|
|
||||||
|
|
||||||
# __RPATH is set to $_RPATH in the platform specification if that
|
|
||||||
# platform supports it.
|
|
||||||
env['DRPATHPREFIX'] = '-L-Wl,-rpath,' if env['PLATFORM'] == 'darwin' else '-L-rpath='
|
|
||||||
env['DRPATHSUFFIX'] = ''
|
|
||||||
env['_DRPATH'] = '${_concat(DRPATHPREFIX, RPATH, DRPATHSUFFIX, __env__)}'
|
|
||||||
|
|
||||||
# Support for versioned libraries
|
|
||||||
env['_SHDLIBVERSIONFLAGS'] = '$SHDLIBVERSIONFLAGS -L-soname=$_SHLIBSONAME'
|
|
||||||
|
|
||||||
|
|
||||||
env['BUILDERS']['ProgramAllAtOnce'] = SCons.Builder.Builder(
|
|
||||||
action='$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -of=$TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS',
|
|
||||||
emitter=DCommon.allAtOnceEmitter,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def exists(env):
|
|
||||||
return env.Detect('ldc2')
|
|
||||||
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# tab-width:4
|
|
||||||
# indent-tabs-mode:nil
|
|
||||||
# End:
|
|
||||||
# vim: set expandtab tabstop=4 shiftwidth=4:
|
|
Loading…
Reference in New Issue
Block a user