Changeset 41b985f for wscript


Ignore:
Timestamp:
Mar 12, 2017, 11:26:24 AM (7 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
sampler
Children:
bde49c4a
Parents:
71f2e5f (diff), 67b6618 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge 'origin/master' into sampler

Conflicts:

.travis.yml
Makefile
examples/aubionotes.c
examples/parse_args.h
python/demos/demo_timestretch_online.py
python/lib/moresetuptools.py
python/tests/test_source.py
setup.py
src/io/source.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wscript

    r71f2e5f r41b985f  
    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)',
     
    8793            help_str = 'use CoreFoundation (darwin only) (auto)',
    8894            help_disable_str = 'do not use CoreFoundation framework')
    89     add_option_enable_disable(ctx, 'atlas', default = None,
    90             help_str = 'use Atlas library (auto)',
     95    add_option_enable_disable(ctx, 'atlas', default = False,
     96            help_str = 'use Atlas library (no)',
    9197            help_disable_str = 'do not use Atlas library')
    9298    add_option_enable_disable(ctx, 'wavread', default = True,
     
    134140    ctx.env['DEST_OS'] = target_platform
    135141
     142    if ctx.options.build_type == "debug":
     143        ctx.define('DEBUG', 1)
     144    else:
     145        ctx.define('NDEBUG', 1)
     146
    136147    if ctx.env.CC_NAME != 'msvc':
    137         ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra']
     148        if ctx.options.build_type == "debug":
     149            # no optimization in debug mode
     150            ctx.env.prepend_value('CFLAGS', ['-O0'])
     151        else:
     152            # default to -O2 in release mode
     153            ctx.env.prepend_value('CFLAGS', ['-O2'])
     154        # enable debug symbols and configure warnings
     155        ctx.env.prepend_value('CFLAGS', ['-g', '-Wall', '-Wextra'])
    138156    else:
    139         ctx.env.CFLAGS += ['/W4', '/MD']
    140         ctx.env.CFLAGS += ['/D_CRT_SECURE_NO_WARNINGS']
     157        # enable debug symbols
     158        ctx.env.CFLAGS += ['/Z7', '/FS']
     159        ctx.env.LINKFLAGS += ['/DEBUG', '/INCREMENTAL:NO']
     160        # configure warnings
     161        ctx.env.CFLAGS += ['/W4', '/D_CRT_SECURE_NO_WARNINGS']
     162        # set optimization level and runtime libs
     163        if (ctx.options.build_type == "release"):
     164            ctx.env.CFLAGS += ['/Ox']
     165            ctx.env.CFLAGS += ['/MD']
     166        else:
     167            assert(ctx.options.build_type == "debug")
     168            ctx.env.CFLAGS += ['/MDd']
    141169
    142170    ctx.check_cc(lib='m', uselib_store='M', mandatory=False)
     
    160188            ctx.define('HAVE_SOURCE_APPLE_AUDIO', 1)
    161189            ctx.define('HAVE_SINK_APPLE_AUDIO', 1)
     190            ctx.msg('Checking for AudioToolbox.framework', 'yes')
     191        else:
     192            ctx.msg('Checking for AudioToolbox.framework', 'no (disabled)', color = 'YELLOW')
    162193        if (ctx.options.enable_accelerate != False):
    163194            ctx.define('HAVE_ACCELERATE', 1)
    164195            ctx.env.FRAMEWORK += ['Accelerate']
     196            ctx.msg('Checking for Accelerate framework', 'yes')
     197        else:
     198            ctx.msg('Checking for Accelerate framework', 'no (disabled)', color = 'YELLOW')
    165199
    166200    if target_platform in [ 'ios', 'iosimulator' ]:
     
    270304
    271305    # check for libsamplerate
     306    if (ctx.options.enable_double):
     307        if (ctx.options.enable_samplerate):
     308            ctx.fatal("Could not compile aubio in double precision mode with libsamplerate")
     309        else:
     310            ctx.options.enable_samplerate = False
     311            ctx.msg('Checking if using samplerate', 'no (disabled in double precision mode)',
     312                    color = 'YELLOW')
    272313    if (ctx.options.enable_samplerate != False):
    273314        ctx.check_cfg(package = 'samplerate', atleast_version = '0.0.15',
     
    330371    # the following defines will be passed as arguments to the compiler
    331372    # instead of being written to src/config.h
     373    ctx.define('HAVE_CONFIG_H', 1)
    332374
    333375    # add some defines used in examples
     
    362404    bld.env['LIB_VERSION'] = LIB_VERSION
    363405
     406    # main source
     407    bld.recurse('src')
     408
    364409    # add sub directories
    365     bld.recurse('src')
    366410    if bld.env['DEST_OS'] not in ['ios', 'iosimulator', 'android']:
    367411        bld.recurse('examples')
    368412        bld.recurse('tests')
    369413
     414    # pkg-config template
    370415    bld( source = 'aubio.pc.in' )
    371416
     417    # documentation
     418    txt2man(bld)
     419    doxygen(bld)
     420    sphinx(bld)
     421
     422def txt2man(bld):
    372423    # build manpages from txt files using txt2man
    373424    if bld.env['TXT2MAN']:
    374425        from waflib import TaskGen
    375426        if 'MANDIR' not in bld.env:
    376             bld.env['MANDIR'] = bld.env['PREFIX'] + '/share/man'
     427            bld.env['MANDIR'] = bld.env['DATAROOTDIR'] + '/man'
     428        bld.env.VERSION = VERSION
    377429        rule_str = '${TXT2MAN} -t `basename ${TGT} | cut -f 1 -d . | tr a-z A-Z`'
    378430        rule_str += ' -r ${PACKAGE}\\ ${VERSION} -P ${PACKAGE}'
     
    389441        bld( source = bld.path.ant_glob('doc/*.txt') )
    390442
     443def doxygen(bld):
    391444    # build documentation from source files using doxygen
    392445    if bld.env['DOXYGEN']:
    393446        bld( name = 'doxygen', rule = 'doxygen ${SRC} > /dev/null',
    394447                source = 'doc/web.cfg',
     448                target = '../doc/web/html/index.html',
    395449                cwd = 'doc')
    396         bld.install_files( '${PREFIX}' + '/share/doc/libaubio-doc',
     450        bld.install_files( '${DATAROOTDIR}' + '/doc/libaubio-doc',
    397451                bld.path.ant_glob('doc/web/html/**'),
    398452                cwd = bld.path.find_dir ('doc/web'),
    399453                relative_trick = True)
    400454
     455def sphinx(bld):
    401456    # build documentation from source files using sphinx-build
     457    # note: build in ../doc/_build/html, otherwise waf wont install unsigned files
    402458    if bld.env['SPHINX']:
    403         bld( name = 'sphinx', rule = 'make html',
    404                 source = ['doc/conf.py'] + bld.path.ant_glob('doc/**.rst'),
    405                 cwd = 'doc')
    406         bld.install_files( '${PREFIX}' + '/share/doc/libaubio-doc/sphinx',
     459        bld.env.VERSION = VERSION
     460        bld( name = 'sphinx',
     461                rule = '${SPHINX} -b html -D release=${VERSION} -D version=${VERSION} -a -q `dirname ${SRC}` `dirname ${TGT}`',
     462                source = 'doc/conf.py',
     463                target = '../doc/_build/html/index.html')
     464        bld.install_files( '${DATAROOTDIR}' + '/doc/libaubio-doc/sphinx',
    407465                bld.path.ant_glob('doc/_build/html/**'),
    408                 cwd = bld.path.find_dir ('doc/_build/html'),
     466                cwd = bld.path.find_dir('doc/_build/html'),
    409467                relative_trick = True)
     468
     469# register the previous rules as build rules
     470from waflib.Build import BuildContext
     471
     472class build_txt2man(BuildContext):
     473    cmd = 'txt2man'
     474    fun = 'txt2man'
     475
     476class build_manpages(BuildContext):
     477    cmd = 'manpages'
     478    fun = 'txt2man'
     479
     480class build_sphinx(BuildContext):
     481    cmd = 'sphinx'
     482    fun = 'sphinx'
     483
     484class build_doxygen(BuildContext):
     485    cmd = 'doxygen'
     486    fun = 'doxygen'
    410487
    411488def shutdown(bld):
     
    418495
    419496def dist(ctx):
    420     ctx.excl  = ' **/.waf-1* **/*~ **/*.pyc **/*.swp **/*.swo **/*.swn **/.lock-w* **/.git*'
     497    ctx.excl  = ' **/.waf* **/*~ **/*.pyc **/*.swp **/*.swo **/*.swn **/.lock-w* **/.git*'
    421498    ctx.excl += ' **/build/*'
    422499    ctx.excl += ' doc/_build'
     
    427504    ctx.excl += ' **.egg-info'
    428505    ctx.excl += ' **/**.zip **/**.tar.bz2'
     506    ctx.excl += ' **.tar.bz2'
    429507    ctx.excl += ' **/doc/full/* **/doc/web/*'
     508    ctx.excl += ' **/doc/full.cfg'
    430509    ctx.excl += ' **/python/*.db'
    431510    ctx.excl += ' **/python.old/*'
Note: See TracChangeset for help on using the changeset viewer.