コード例 #1
0
ファイル: common.py プロジェクト: s1wmcewan/scons
def testForTool(tool):

    test = TestSCons.TestSCons()

    if not isExecutableOfToolAvailable(test, tool):
        test.skip_test(
            "Required executable for tool '{0}' not found, skipping test.\n".
            format(tool))

    if tool == 'gdc':
        result = check_output(('gdc', '--version'))
        version = result.decode().splitlines()[0].split()[3]
        major, minor, debug = [int(x) for x in version.split('.')]
        if (major < 6) or (major == 6 and minor < 3):
            test.skip_test(
                'gdc prior to version 6.0.0 does not support shared libraries.\n'
            )

    if tool == 'dmd' and Base()['DC'] == 'gdmd':
        test.skip_test(
            'gdmd does not recognize the -shared option so cannot support linking of shared objects.\n'
        )

    code_root = 'code'
    library_root = 'answer'

    platform = Base()['PLATFORM']
    if platform == 'posix':
        code_name = code_root + '.o'
        library_name = 'lib' + library_root + '.so'
    elif platform == 'darwin':
        code_name = code_root + '.o'
        library_name = 'lib' + library_root + '.dylib'
        # As at 2017-08-22, DMD 2.075.1, LDC 1.2.0 (D 2.072.2), and GDC 7.2.0 (D 2.068.2)
        # it is not clear if shared libraries are supported on macOS.
        # test.skip_test('Dynamic libraries not yet supported on macOS.\n')
    elif platform == 'win32':
        code_name = code_root + '.obj'
        library_name = library_root + '.dll'
    else:
        test.fail_test()

    test.dir_fixture('Image')
    with open('SConstruct_template', 'r') as f:
        config = f.read().format(tool)
    test.write('SConstruct', config)

    if Base()['DC'] == 'gdmd':
        # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr
        # that cause inappropriate failure of the tests, so simply ignore them.
        test.run(stderr=None)
    else:
        test.run()

    test.must_exist(test.workpath(code_name))
    test.must_exist(test.workpath(library_name))

    test.pass_test()
コード例 #2
0
def testForTool(tool):

    test = TestSCons.TestSCons()

    if not isExecutableOfToolAvailable(test, tool):
        test.skip_test(
            "Required executable for tool '{0}' not found, skipping test.\n".
            format(tool))

    if tool == 'gdc':
        result = check_output(('gdc', '--version'))
        version = result.decode().splitlines()[0].split()[3]
        major, minor, debug = [int(x) for x in version.split('.')]
        if (major < 6) or (major == 6 and minor < 3):
            test.skip_test(
                'gdc prior to version 6.0.0 does not support shared libraries.\n'
            )

    if tool == 'dmd' and Base()['DC'] == 'gdmd':
        test.skip_test(
            'gdmd does not recognize the -shared option so cannot support linking of shared objects.\n'
        )

    platform = Base()['PLATFORM']
    if platform == 'posix':
        filename = 'code.o'
        libraryname = 'libanswer.so'
    elif platform == 'darwin':
        filename = 'code.o'
        libraryname = 'libanswer.dylib'
    elif platform == 'win32':
        filename = 'code.obj'
        libraryname = 'answer.dll'
    else:
        test.fail_test()

    test.dir_fixture('Image')
    test.write('SConstruct',
               open('SConstruct_template', 'r').read().format(tool))

    if Base()['DC'] == 'gdmd':
        # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr
        # that cause inappropriate failure of the tests, so simply ignore them.
        test.run(stderr=None)
    else:
        test.run()

    test.must_exist(test.workpath(filename))
    test.must_exist(test.workpath(libraryname))

    test.pass_test()
コード例 #3
0
ファイル: kenv.py プロジェクト: fdgonthier/kas
    def __init__(self,
		 **keyw):

	# Start with no listener
	listeners = keyw.get('LISTENERS', None)
	keyw['LISTENERS'] = {}

	# Set default values.
	keyw.setdefault('CCFLAGS', ['-W', '-Wall', '$CONF_DEBUG_CCFLAGS', '$CONF_MUDFLAP_CCFLAGS'])
	keyw.setdefault('LDFLAGS', ['-rdynamic', '$CONF_DEBUG_LDFLAGS', '$CONF_MUDFLAP_LDFLAGS', '$CONF_MPATROL_LDFLAGS'])
	keyw.setdefault('LIBS', [])
	keyw.setdefault('CPPPATH', [])
	keyw.setdefault('LIBPATH', [])
	keyw.setdefault('PLATFORM', get_platform())
	keyw.setdefault('ARCH', get_arch())
	keyw.setdefault('ENDIAN', get_endianness())
	keyw.setdefault('DEBUG_CCFLAGS', ['-g', '-O0'])
	keyw.setdefault('DEBUG_LDFLAGS', ['-g'])
	keyw.setdefault('NDEBUG_CCFLAGS', ['-O2', '-fno-strict-aliasing', '-DNDEBUG'])
	keyw.setdefault('MUDFLAP_CCFLAGS', ['-fmudflap'])
	keyw.setdefault('MUDFLAP_LDFLAGS', ['-lmudflap'])
	keyw.setdefault('MAPTROL_LDFLAGS', ['-lmpatrol', '-lbfd'])
	keyw.setdefault('VERSION', '0.0')
        
        tools = None
        if get_platform() == 'windows': tools = ["mingw"]
        keyw['tools'] = tools

	# Initialize the Environment with those values.
	Base.__init__(self, **keyw)

	self.Append(BUILDERS = {'Link' : Builder(action = Link),
			        'ExtractSerializable' : Builder(action = extract_serializable, suffix = '.c', src_suffix = '.c'),
			        'ExtractTests' : Builder(action = extract_tests, suffix = '.c', src_suffix = '.c'),
                                'Textfile': _text_builder,
                                'Substfile': _subst_builder})

	# Set the listener and tell them the value has changed.
	if listeners:
	    self['LISTENERS'] = listeners
	else:
	    self['LISTENERS'] = {'debug' : debug_listener,
				 'PLATFORM' : platform_listener,
				 'mudflap' : mudflap_listener,
				 'mpatrol' : mpatrol_listener,
				 'VERSION' : version_listener }

	for key in self['LISTENERS'].keys():
	    self.dict_change(key)
コード例 #4
0
def testForTool(tool):

    test = TestSCons.TestSCons()

    if not isExecutableOfToolAvailable(test, tool):
        test.skip_test(
            "Required executable for tool '{0}' not found, skipping test.\n".
            format(tool))

    test.dir_fixture('Project')
    with open('SConstruct_template', 'r') as f:
        config = f.read().format('tools=["{0}", "link"]'.format(tool))
    test.write('SConstruct', config)

    test.run()

    platform = Base()['PLATFORM']

    if platform == 'posix':
        libraryname = 'libstuff.so'
        filename = 'stuff.os'
    elif platform == 'darwin':
        libraryname = 'libstuff.dylib'
        filename = 'stuff.os'
    elif platform == 'win32':
        libraryname = 'stuff.dll'
        filename = 'stuff.obj'
    else:
        test.fail_test('No information about platform: ' + platform)

    for f in (libraryname, filename, 'test1', 'test1.o', 'test2', 'test2.o'):
        test.must_exist(test.workpath(join('test', 'test1', f)))

    test.pass_test()
コード例 #5
0
def testForTool(tool):

    test = TestSCons.TestSCons()

    if not isExecutableOfToolAvailable(test, tool) :
        test.skip_test("Required executable for tool '{0}' not found, skipping test.\n".format(tool))

    test.dir_fixture('SingleStringCannotBeMultipleOptions')
    test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool))

    test.run(status=2, stdout=None, stderr=None)

    result = {
        'dmd': ".*unrecognized switch '-m64 -O'.*",
        'gdc': ".*unrecognized command line option.*",
        'ldc': ".*Unknown command line argument '-m64 -O'.*",
        }[tool]

    from SCons.Environment import Base
    if tool == 'dmd' and Base()['DC'] == 'gdmd':
        result = ".*unrecognized command line option '-m64 -O'.*"

    test.fail_test(not test.match_re_dotall(test.stderr(), result))

    test.pass_test()
コード例 #6
0
def testForTool(tool):

    test = TestSCons.TestSCons()

    if not isExecutableOfToolAvailable(test, tool) :
        test.skip_test("Required executable for tool '{0}' not found, skipping test.\n".format(tool))

    if tool == 'gdc':
        test.skip_test('gdc does not, as at version 4.9.1, support shared libraries.\n')

    if tool == 'dmd' and Base()['DC'] == 'gdmd':
        test.skip_test('gdmd does not recognize the -shared option so cannot support linking of shared objects.\n')

    platform = Base()['PLATFORM']
    if platform == 'posix':
        filename = 'code.o'
        libraryname = 'libanswer.so'
    elif platform == 'darwin':
        filename = 'code.o'
        libraryname = 'libanswer.dylib'
        # As at 2014-09-14, DMD 2.066, LDC master head, and GDC 4.9.1 do not support
        # shared libraries on OSX.
        test.skip_test('Dynamic libraries not yet supported on OSX.\n')
    elif platform == 'win32':
        filename = 'code.obj'
        libraryname = 'answer.dll'
    else:
        test.fail_test()

    test.dir_fixture('Image')
    test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool))

    if tool == 'dmd':
        # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr
        # that cause inappropriate failure of the tests, so simply ignore them.
        test.run(stderr=None)
    else:
        test.run()

    test.must_exist(test.workpath(filename))
    test.must_exist(test.workpath(libraryname))

    test.pass_test()
コード例 #7
0
ファイル: freetype.py プロジェクト: BackupTheBerlios/sfox-svn
def generate(env):
    """ Detect the freetype library """

    from SCons.Options import Options
    cachefile = env['CACHEDIR'] + '/freetype.cache.py'
    opts = Options(cachefile)
    opts.AddOptions(('FREETYPE_CPPPATH', 'flags for the SDL_LIBRARY'),
                    ('FREETYPE_LIBPATH', 'flags for the SDL_LIBRARY'),
                    ('FREETYPE_FLAGS', 'flags for the SDL_LIBRARY'),
                    ('FREETYPE_LIBS', 'flags for the SDL_LIBRARY'))
    opts.Update(env)

    if 'configure' in env['TARGS'] or not env.has_key('FREETYPE_FLAGS'):
        from SCons.Environment import Base
        freetype_env = Base()
        freetype_env.ParseConfig(
            'pkg-config --cflags --libs freetype2 || freetype-config --cflags --libs'
        )
        freetype_cflags = freetype_env.Dictionary()['CCFLAGS']
        freetype_include = freetype_env.Dictionary()['CPPPATH']
        freetype_libpath = freetype_env.Dictionary()['LIBPATH']
        freetype_lib = freetype_env.Dictionary()['LIBS']

        env['FREETYPE_FLAGS'] = freetype_cflags
        env['FREETYPE_LIBS'] = freetype_lib
        env['FREETYPE_LIBPATH'] = freetype_libpath
        env['FREETYPE_CPPPATH'] = freetype_include
        opts.Save(cachefile, env)
    env.AppendUnique(LIBS=env['FREETYPE_LIBS'],
                     CXXFLAGS=env['FREETYPE_FLAGS'],
                     CCFLAGS=env['FREETYPE_FLAGS'],
                     LIBPATH=env['FREETYPE_LIBPATH'],
                     CPPPATH=env['FREETYPE_CPPPATH'])
コード例 #8
0
def testForTool(tool):

    test = TestSCons.TestSCons()

    if not isExecutableOfToolAvailable(test, tool) :
        test.skip_test("Required executable for tool '{0}' not found, skipping test.\n".format(tool))

    test.dir_fixture('ArLibIssue')
    test.write('SConstruct', open('SConstruct_template', 'r').read().format('tools=["{0}", "ar"]'.format(tool)))

    test.run()

    test.must_exist(test.workpath('a.o'))
    test.must_exist(test.workpath('b.o'))
    test.must_exist(test.workpath('mylib.a' if Base()['PLATFORM'] == 'win32' else 'libmylib.a'))

    test.pass_test()
コード例 #9
0
ファイル: libCompileOptions.py プロジェクト: zhengft/scons
def testForTool(tool):

    test = TestSCons.TestSCons()

    if not isExecutableOfToolAvailable(test, tool):
        test.skip_test(
            "Required executable for tool '{0}' not found, skipping test.\n".
            format(tool))

    test.dir_fixture('LibCompileOptions')
    with open('SConstruct_template', 'r') as f:
        config = f.read().format('tools=["{0}", "link", "ar"]'.format(tool))
    test.write('SConstruct', config)

    test.run()

    test.must_exist(test.workpath('mylib.o'))
    test.must_exist(
        test.workpath('mylib.a' if Base()['PLATFORM'] ==
                      'win32' else 'libmylib.a'))
    test.must_exist(test.workpath('prog'))

    test.pass_test()
コード例 #10
0
def testForTool(tool):

    test = TestSCons.TestSCons()

    if not isExecutableOfToolAvailable(test, tool):
        test.skip_test(
            "Required executable for tool '{0}' not found, skipping test.\n".
            format(tool))

    platform = Base()['PLATFORM']
    if platform == 'posix':
        libraryname = 'libstuff.so'
        filename = 'stuff.os'
    elif platform == 'darwin':
        libraryname = 'libstuff.dylib'
        filename = 'stuff.os'
        # As at 2014-09-14, DMD 2.066, LDC master head, and GDC 4.9.1 do not support
        # shared libraries on OSX.
        test.skip_test('Dynamic libraries not yet supported on OSX.\n')
    elif platform == 'win32':
        libraryname = 'stuff.dll'
        filename = 'stuff.obj'
    else:
        test.fail_test('No information about platform: ' + platform)

    test.dir_fixture('Project')
    test.write(
        'SConstruct',
        open('SConstruct_template',
             'r').read().format('tools=["{0}", "link"]'.format(tool)))

    test.run()

    for f in (libraryname, filename, 'test1', 'test1.o', 'test2', 'test2.o'):
        test.must_exist(test.workpath(join('test', 'test1', f)))

    test.pass_test()
コード例 #11
0
def generate(env):
	""" Detect the SDL library """

        from SCons.Options import Options
	cachefile = env['CACHEDIR']+'/sdl.cache.py'
        opts = Options(cachefile)
        opts.AddOptions(
                ( 'SDL_CPPPATH', 'flags for the SDL_LIBRARY' ),
                ( 'SDL_LIBPATH', 'flags for the SDL_LIBRARY' ),
                ( 'SDL_FLAGS', 'flags for the SDL_LIBRARY' ),
                ( 'SDL_LIBS', 'flags for the SDL_LIBRARY' )
        )
        opts.Update(env)

	if 'configure' in env['TARGS'] or not env.has_key('SDL_FLAGS'):
		from SCons.Environment import Base
		sdl_env = Base()
		sdl_env.ParseConfig('sdl-config --cflags --libs')
	        sdl_cflags = sdl_env.Dictionary()['CCFLAGS']
        	sdl_include = sdl_env.Dictionary()['CPPPATH']
	        sdl_libpath = sdl_env.Dictionary()['LIBPATH']
        	sdl_lib = sdl_env.Dictionary()['LIBS']

#		conf = SCons.SConf.SConf( env )
#		if not conf.CheckCHeader('Cg/cg.h'):
#			print 'We really need the cg library !'
#			print 'Get ftp://download.nvidia.com/developer/cg/Cg_1.3/Linux/Cg-1.3.0501-0700.i386.tar.gz and unpack it in your root directory'
#			import sys
#			sys.exit(1)
		env['SDL_FLAGS']=sdl_cflags
		env['SDL_LIBS']=sdl_lib
		env['SDL_LIBPATH']=sdl_libpath
		env['SDL_CPPPATH']=sdl_include
		opts.Save(cachefile, env)
	env.AppendUnique(LIBS=env['SDL_LIBS'],
			 CXXFLAGS=env['SDL_FLAGS'],
			 CCFLAGS=env['SDL_FLAGS'],
			 LIBPATH=env['SDL_LIBPATH'],
			 CPPPATH=env['SDL_CPPPATH']
			)
コード例 #12
0
# 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.
#

__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"

if __name__ == '__main__':
    import sys
    import os.path
    sys.path.append(os.path.abspath('../../../src/engine'))

from SCons.Environment import Base

path = Base()['ENV']['PATH']


def isExecutableOfToolAvailable(test, tool):
    for executable in {
            'dmd': ['dmd', 'gdmd'],
            'gdc': ['gdc'],
            'ldc': ['ldc2', 'ldc'],
    }[tool]:
        if test.where_is(executable, path):
            return True
    return False


if __name__ == '__main__':
    import unittest
コード例 #13
0
ファイル: kenv.py プロジェクト: fdgonthier/kas
    def __setitem__(self, key, value):
	Base.__setitem__(self, key, value)
	self.dict_change(key)
コード例 #14
0
ファイル: kenv.py プロジェクト: fdgonthier/kas
    def __delitem__(self, key):
	Base.__delitem__(self, key)
	self.dict_change(key)
コード例 #15
0
ファイル: kenv.py プロジェクト: fdgonthier/kas
 def __delitem__(self, key):
     Base.__delitem__(self, key)
     self.dict_change(key)
コード例 #16
0
from eiffel_loop.eiffel import project

from eiffel_loop.eiffel.ecf import EIFFEL_CONFIG_FILE
from eiffel_loop.eiffel.ecf import FREEZE_BUILD

from SCons.Environment import Base
from SCons.Variables import Variables
from glob import glob

var = Variables()
var.Add('cpu', '', 'x64')
var.Add('project', '', glob('*.ecf')[0])

os.environ['ISE_LIBRARY'] = os.environ['ISE_EIFFEL']

env = Base()

var.Update(env)

env.Append(ENV=os.environ)
env.Append(ISE_PLATFORM=os.environ['ISE_PLATFORM'])

project_py = project.read_project_py()
project_py.update_os_environ(env.get('cpu') == 'x86')

ecf_path = env.get('project')
config = EIFFEL_CONFIG_FILE(ecf_path, True)

build = FREEZE_BUILD(config, project_py)
build.install_resources(build.resources_destination())
コード例 #17
0
ファイル: kenv.py プロジェクト: fdgonthier/kas
    def __init__(self, **keyw):

        # Start with no listener
        listeners = keyw.get('LISTENERS', None)
        keyw['LISTENERS'] = {}

        # Set default values.
        keyw.setdefault(
            'CCFLAGS',
            ['-W', '-Wall', '$CONF_DEBUG_CCFLAGS', '$CONF_MUDFLAP_CCFLAGS'])
        keyw.setdefault('LDFLAGS', [
            '-rdynamic', '$CONF_DEBUG_LDFLAGS', '$CONF_MUDFLAP_LDFLAGS',
            '$CONF_MPATROL_LDFLAGS'
        ])
        keyw.setdefault('LIBS', [])
        keyw.setdefault('CPPPATH', [])
        keyw.setdefault('LIBPATH', [])
        keyw.setdefault('PLATFORM', get_platform())
        keyw.setdefault('ARCH', get_arch())
        keyw.setdefault('ENDIAN', get_endianness())
        keyw.setdefault('DEBUG_CCFLAGS', ['-g', '-O0'])
        keyw.setdefault('DEBUG_LDFLAGS', ['-g'])
        keyw.setdefault('NDEBUG_CCFLAGS',
                        ['-O2', '-fno-strict-aliasing', '-DNDEBUG'])
        keyw.setdefault('MUDFLAP_CCFLAGS', ['-fmudflap'])
        keyw.setdefault('MUDFLAP_LDFLAGS', ['-lmudflap'])
        keyw.setdefault('MAPTROL_LDFLAGS', ['-lmpatrol', '-lbfd'])
        keyw.setdefault('VERSION', '0.0')

        tools = None
        if get_platform() == 'windows': tools = ["mingw"]
        keyw['tools'] = tools

        # Initialize the Environment with those values.
        Base.__init__(self, **keyw)

        self.Append(
            BUILDERS={
                'Link':
                Builder(action=Link),
                'ExtractSerializable':
                Builder(
                    action=extract_serializable, suffix='.c', src_suffix='.c'),
                'ExtractTests':
                Builder(action=extract_tests, suffix='.c', src_suffix='.c'),
                'Textfile':
                _text_builder,
                'Substfile':
                _subst_builder
            })

        # Set the listener and tell them the value has changed.
        if listeners:
            self['LISTENERS'] = listeners
        else:
            self['LISTENERS'] = {
                'debug': debug_listener,
                'PLATFORM': platform_listener,
                'mudflap': mudflap_listener,
                'mpatrol': mpatrol_listener,
                'VERSION': version_listener
            }

        for key in self['LISTENERS'].keys():
            self.dict_change(key)
コード例 #18
0
ファイル: kenv.py プロジェクト: fdgonthier/kas
 def __setitem__(self, key, value):
     Base.__setitem__(self, key, value)
     self.dict_change(key)
コード例 #19
0
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"

import TestSCons
from SCons.Environment import Base

_exe = TestSCons._exe
test = TestSCons.TestSCons()

if not test.where_is('clang'):
    test.skip_test("Could not find 'clang', skipping test.\n")

base = Base()
platform = base['PLATFORM']
if platform == 'posix':
    filename_options = ['foo.os']
    libraryname = 'libfoo.so'
elif platform == 'darwin':
    filename_options = ['foo.os']
    libraryname = 'libfoo.dylib'
elif platform == 'win32':
    filename_options = ['foo.obj', 'foo.os']
    libraryname = 'foo.dll'
else:
    test.fail_test()

test.write(
    'SConstruct', """\
コード例 #20
0
from eiffel_loop.eiffel import project

from eiffel_loop.eiffel.ecf import EIFFEL_CONFIG_FILE
from eiffel_loop.eiffel.ecf import FREEZE_BUILD

from SCons.Environment import Base
from SCons.Variables import Variables
from glob import glob

var = Variables()
var.Add('cpu', '', 'x64')
var.Add('project', '', glob('*.ecf')[0])

os.environ['ISE_LIBRARY'] = os.environ['ISE_EIFFEL']

env = Base()

var.Update(env)

env.Append(ENV=os.environ)
env.Append(ISE_PLATFORM=os.environ['ISE_PLATFORM'])

project_py = project.read_project_py()
project_py.set_build_environment(env.get('cpu'))

ecf_path = env.get('project')
config = EIFFEL_CONFIG_FILE(ecf_path)

build = FREEZE_BUILD(config, project_py)
build.install_resources(build.resources_destination())
コード例 #21
0
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"

import TestSCons

from SCons.Environment import Base

_exe = TestSCons._exe
test = TestSCons.TestSCons()

if not test.where_is('clang'):
    test.skip_test("Could not find 'clang++', skipping test.\n")

platform = Base()['PLATFORM']
if platform == 'posix':
    filename_options = ['foo.os']
    libraryname = 'libfoo.so'
elif platform == 'darwin':
    filename_options = ['foo.os']
    libraryname = 'libfoo.dylib'
elif platform == 'win32':
    filename_options = ['foo.obj', 'foo.os']
    libraryname = 'foo.dll'
else:
    test.fail_test()

test.write(
    'SConstruct', """\
DefaultEnvironment(tools=[])
コード例 #22
0
from eiffel_loop.eiffel import project

from eiffel_loop.eiffel.ecf import EIFFEL_CONFIG_FILE
from eiffel_loop.eiffel.ecf import FREEZE_BUILD

from SCons.Environment import Base
from SCons.Variables import Variables
from glob import glob

var = Variables ()
var.Add ('cpu', '', 'x64')
var.Add ('project', '', glob ('*.ecf')[0])

os.environ ['ISE_LIBRARY'] = os.environ ['ISE_EIFFEL']

env = Base ()

var.Update (env)

env.Append (ENV = os.environ)
env.Append (ISE_PLATFORM = os.environ ['ISE_PLATFORM'])

project_py = project.read_project_py ()
project_py.set_build_environment (env.get ('cpu'))

ecf_path = env.get ('project')
config = EIFFEL_CONFIG_FILE (ecf_path)

build = FREEZE_BUILD (config, project_py)
build.install_resources (build.resources_destination ())
コード例 #23
0
ファイル: common.py プロジェクト: mwichmann/scons
def testForTool(tool):

    test = TestSCons.TestSCons()

    if not isExecutableOfToolAvailable(test, tool):
        test.skip_test(
            "Required executable for tool '{0}' not found, skipping test.\n".
            format(tool))

    if tool == 'gdc':
        cp = subprocess.run(('gdc', '--version'), stdout=subprocess.PIPE)
        # different version strings possible, i.e.:
        # gdc (GCC) 11.1.1 20210531 (Red Hat 11.1.1-3)\nCopyright (C)...
        # gdc (Ubuntu 10.2.0-5ubuntu1~20.04) 10.20.0\nCopyright (C)...
        vstr = cp.stdout.decode().splitlines()[0]
        match = re.search(r'[0-9]+(\.[0-9]+)+', vstr)
        if match:
            version = match.group(0)
            major, minor, debug = [int(x) for x in version.split('.')]
        else:
            major = 0
        if (major < 6) or (major == 6 and minor < 3):
            test.skip_test(
                'gdc prior to version 6.0.0 does not support shared libraries.\n'
            )

    if tool == 'dmd' and Base()['DC'] == 'gdmd':
        test.skip_test(
            'gdmd does not recognize the -shared option so cannot support linking of shared objects.\n'
        )

    code_root = 'code'
    library_root = 'answer'

    platform = Base()['PLATFORM']
    if platform == 'posix':
        code_name = code_root + '.o'
        library_name = 'lib' + library_root + '.so'
    elif platform == 'darwin':
        code_name = code_root + '.o'
        library_name = 'lib' + library_root + '.dylib'
        # As at 2017-08-22, DMD 2.075.1, LDC 1.2.0 (D 2.072.2), and GDC 7.2.0 (D 2.068.2)
        # it is not clear if shared libraries are supported on macOS.
        # test.skip_test('Dynamic libraries not yet supported on macOS.\n')
    elif platform == 'win32':
        code_name = code_root + '.obj'
        library_name = library_root + '.dll'
    else:
        test.fail_test()

    test.dir_fixture('Image')
    with open('SConstruct_template', 'r') as f:
        config = f.read().format(tool)
    test.write('SConstruct', config)

    if Base()['DC'] == 'gdmd':
        # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr
        # that cause inappropriate failure of the tests, so simply ignore them.
        test.run(stderr=None)
    else:
        test.run()

    test.must_exist(test.workpath(code_name))
    test.must_exist(test.workpath(library_name))

    test.pass_test()