Example #1
0
def configure(ctx: ConfigurationContext):
    if not hasattr(ctx.options, 'check_c_compiler'):
        raise ConfigurationError(
            'Add configure(ctx): ctx.load(\'compiler_c\')')

    debug_flags = []
    release_flags = []

    if ctx.env.CC_NAME == 'msvc':
        debug_flags = ['/Zi', '/DDEBUG', '/D_DEBUG', '/MDd', '/Od', '/WX']
        release_flags = ['/O2', '/Oi', '/DNDEBUG', '/Gy']
    else:
        debug_flags = ['-ggdb']
        release_flags = ['-O3']

    original_env = ctx.env.derive()
    ctx.setenv('debug', env=ctx.env.derive())
    ctx.env.CFLAGS.extend(debug_flags)

    if ctx.env.CC_NAME == 'msvc':
        ctx.env.LINKFLAGS.append('/DEBUG')

    ctx.setenv('release', env=original_env)

    if '/Od' in ctx.env.CFLAGS:
        ctx.env.CFLAGS.remove('/Od')

    ctx.env.CFLAGS.extend(release_flags)
Example #2
0
    def execute(self):
        # Run configure
        ConfigurationContext.execute(self)

        # Ensure local vimrc and syntastic configuration files are generated
        # after the end of the configure step
        gen_local_vimrc(self)
        gen_syntastic(self)
Example #3
0
def _find_program(ctx, cmd, **kw):
    def noop(*args):
        pass

    if ctx is None or not isinstance(ctx, ConfigurationContext):
        ctx = ConfigurationContext()
        ctx.to_log = noop
        ctx.msg = noop
    return ctx.find_program(cmd, **kw)
Example #4
0
def prebuild(ctx):

	try:
		os.makedirs('build/waf')
	except OSError:
		pass
	ctx.logger = Logs.make_logger('build/waf/prebuild.log', 'prebuild')

	# Preconfiguration to decide target name
	out = 'build/waf/'
	preconfigureContext = PreconfigurationContext()
	preconfigureContext.out_dir = out
	preconfigureContext.options = ctx.options
	preconfigureContext.execute()

	# Real configuration
	out = 'build/waf/'+preconfigureContext.env.TARGETNAME
	configureContext = ConfigurationContext()
	configureContext.out_dir = out
	configureContext.init_dirs()
	configureContext.options = ctx.options
	configureContext.env = preconfigureContext.env
	configureContext.env.VARIANT = ctx.variant

	try:
		configureContext.execute()

	except Exception as e:
		ctx.start_msg("configuring toolchain ")
		ctx.end_msg("failed", color="RED")
		print e
		pass

	else:
		ctx.start_msg("configuring toolchain ")
		ctx.end_msg("ok", color="GREEN")

		# build
		buildContext = CustomBuildContext()
		buildContext.options = ctx.options
		buildContext.variant = ctx.variant
		buildContext.cmd = ctx.variant
		buildContext.execute()
Example #5
0
			def __init__(self, **kw):
				ConfigurationContext.__init__(self, **kw)
				self.setenv(x)
Example #6
0
 def __init__(self, **kw):
     ConfigurationContext.__init__(self, **kw)
     self.setenv(x)