Source

pyGAP / game / wscript

#!/usr/bin/env python
# encoding: utf-8

from waflib import Options, Utils
from tools import config

top = '.'
SVG = False

def options(opt):
    opt.load('compiler_cxx')
    config.options(opt)
    opt.add_option('-d', '--debug', action='store_true', default=False,
                   dest='debug', help='Debug mode.')


def configure(conf):
    conf.load('compiler_cxx')
    config.configure(conf)

    if conf.options.zip == 'zlib':
        conf.env.STLIB_ZIP = 'z'
        conf.env.INCLUDES_ZIP = '../../libs/zlib'
        conf.env.STLIBPATH_ZIP = '../../../libs/zlib'
    elif conf.options.zip == 'lzma':
        conf.env.STLIB_ZIP = 'lzma'
        conf.env.INCLUDES_ZIP = '../../libs/xz/src/liblzma/api'
        conf.env.STLIBPATH_ZIP = '../../../libs/xz/src/liblzma/.libs'
        #conf.env.INCLUDES_ZIP = '../../libs/xz/include'
        #conf.env.STLIBPATH_ZIP = '../../../libs/xz/bin_x86-64'
    else:
        conf.fatal('compression unsupported')
    conf.define('COMPRESSION_%s' % conf.options.zip.upper(), 1)
    conf.define('COMPRESSION_LIB', conf.options.zip)

    conf.env.STLIB_LIBCONFIG = 'config++'
    conf.env.INCLUDES_LIBCONFIG = '../../libs/libconfig/lib'
    conf.env.STLIBPATH_LIBCONFIG = '../../../libs/libconfig/lib/.libs'

    if conf.env.COMPILER_CXX == 'msvc':
        conf.define('MSVC', 1)
        conf.env.cxxflags = ['/EHsc']
        conf.env.linkflags = []
        if conf.options.debug:
            conf.env.cxxflags.extend(('/Z7', '/O2'))
            conf.env.linkflags.append('/Debug')
    else:
        conf.env.cxxflags = ['-m64' if conf.env.m64 else '-m32']
        conf.env.linkflags = conf.env.cxxflags
        if conf.options.debug:
            conf.env.cxxflags.extend(('-g', '-DDEBUG'))

    if conf.options.debug:
        conf.env.cxxflags.append('-DDEBUG')

    if Utils.unversioned_sys_platform() == 'win32':
        conf.env.cxxflags.extend(('-mwindows',
                                  '-DWINVER=0x0601',
                                  '-D_WIN32_WINNT=0x0601'))

    if conf.options.warning:
        #conf.env.cxxflags.append('-Wdouble-promotion')
        conf.env.cxxflags.extend(('-Wall', '-Wextra', '-Weffc++', '-pedantic'))

    conf.env.linkflags.extend('-l%s' % lib for lib in conf.env['libs'])


def build(bld):
    Options.lockfile = '.lock-waf%s' % bld.env.target
    if config.PEP8:
        bld(source=bld.path.ant_glob('tools/**/*.py **/wscript'))

    bld.recurse('res')
    #bld.program(source=bld.path.ant_glob('''src/**/*.cpp'''),
    bld.program(source=bld.path.ant_glob('''
                                         src/io/**/*.cpp
                                         src/clock/**/*.cpp
                                         src/codec/**/*.cpp
                                         src/common/**/*.cpp
                                         src/game/state/*.cpp
                                         src/game/input/*.cpp
                                         src/game/game_loop_sample.cpp
                                         src/game/game_%(platform)s.cpp
                                         src/input/*.cpp
                                         src/input/%(platform)s/**/*.cpp
                                         src/main/main_%(platform)s.cpp
                                         src/platform/*.cpp
                                         src/platform/%(platform)s/**/*.cpp
                                         src/renderer/**/*.cpp
                                         src/state/**/*.cpp
                                         src/text/**/*.cpp
                                         ''' % \
                                         {'platform': bld.env.platform}),
                includes=['inc', '%s/res/inc' % bld.env.target],
                cxxflags=bld.env.cxxflags,
                linkflags=bld.env.linkflags,
                target='game', use='ZIP LIBCONFIG')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.