Changeset b4ce693


Ignore:
Timestamp:
Dec 21, 2016, 2:03:16 AM (8 years ago)
Author:
Eduard Müller <mueller.eduard@googlemail.com>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, sampler, yinfft+
Children:
4cbc6e9
Parents:
1f6a9f8
git-author:
Eduard Müller <mueller.eduard@googlemail.com> (12/21/16 00:16:23)
git-committer:
Eduard Müller <mueller.eduard@googlemail.com> (12/21/16 02:03:16)
Message:

added debug/release build type configuations
... release (default) enables optimizations (-O2 for GCC, /OX for msvc). debug symbols are enabled in both configurations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wscript

    r1f6a9f8 rb4ce693  
    4848
    4949def options(ctx):
     50    ctx.add_option('--build-type', action = 'store',
     51            default = "release",
     52            choices = ('debug', 'release'),
     53            dest = 'build_type',
     54            help = 'whether to compile with (--build_type=release) or without (--build_type=debug) '\
     55              ' compiler opimizations [default: release]')
    5056    add_option_enable_disable(ctx, 'fftw3f', default = False,
    5157            help_str = 'compile with fftw3f instead of ooura (recommended)',
     
    126132    ctx.env['DEST_OS'] = target_platform
    127133
     134    if ctx.options.build_type == "debug":
     135        ctx.define('DEBUG', 1)
     136    else:
     137        ctx.define('NDEBUG', 1)
     138   
    128139    if ctx.env.CC_NAME != 'msvc':
     140        # enable debug symbols and configure warnings
    129141        ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra']
    130     else:
    131         ctx.env.CFLAGS += ['/W4', '/MD']
    132         ctx.env.CFLAGS += ['/D_CRT_SECURE_NO_WARNINGS']
    133 
     142        if ctx.options.build_type == "release":
     143            # set optimization level
     144            ctx.env.CFLAGS += ['-O2']
     145    else:
     146        # enable debug symbols
     147        ctx.env.CFLAGS += ['/Z7', '/FS']
     148        ctx.env.LINKFLAGS += ['/DEBUG', '/INCREMENTAL:NO']
     149        # configure warnings
     150        ctx.env.CFLAGS += ['/W4', '/D_CRT_SECURE_NO_WARNINGS']
     151        # set optimization level and runtime libs
     152        if (ctx.options.build_type == "release"):
     153            ctx.env.CFLAGS += ['/Ox']
     154            ctx.env.CFLAGS += ['/MD']
     155        else:
     156            assert(ctx.options.build_type == "debug")
     157            ctx.env.CFLAGS += ['/MDd']
     158       
    134159    ctx.check_cc(lib='m', uselib_store='M', mandatory=False)
    135160
Note: See TracChangeset for help on using the changeset viewer.