3
# Dennis Schridde, 2006 (devurandom)
7
# the following two variables are used by the target "waf dist"
11
# these variables are mandatory ('/' are converted automatically)
15
# make sure waf has the version we want
17
Utils.waf_version(mini="1.0", maxi="9.9.9")
20
# For DEFAULT_DATADIR and debug variant
25
#add option for additional/external includes and library dirs for MinGW on Windows
26
opt.tool_options('compiler_cc')
27
opt.add_option('--debug',
30
help='Build debug variant [Default: False]',
35
# Check for C-Compiler, the Lexer/Parser tools and get the checks module for checkEndian
36
conf.check_tool('compiler_cc batched_cc flex bison checks')
38
# Big or little endian?
41
# Check for all required libs
42
if not conf.check_pkg2('sdl', '1.2', 0):
43
if not conf.check_cfg2('sdl', 0):
44
conf.check_header('SDL/SDL.h')
45
conf.check_library('SDL')
46
conf.check_library('SDLmain')
48
if not conf.check_pkg2('openal', '0', 0):
49
conf.check_header2('AL/al.h')
50
conf.check_library2('openal')
52
if not conf.check_pkg2('libpng', '1.2', 0, 'PNG'):
53
conf.check_header2('png.h')
54
conf.check_library2('png')
56
if not conf.check_pkg2('ogg', '1.0', 0):
57
conf.check_header2('ogg/ogg.h')
58
conf.check_library2('ogg')
60
if not conf.check_pkg2('vorbisfile', '1.0', 0):
61
conf.check_header2('vorbis/vorbisfile.h')
62
conf.check_library2('vorbisfile')
64
conf.check_header2('SDL/SDL_net.h')
65
conf.check_library2('SDL_net')
67
conf.check_header2('GL/gl.h')
68
conf.check_library2('GL')
70
conf.check_header2('GL/glu.h')
71
conf.check_library2('GLU')
73
conf.check_header2('physfs.h')
74
conf.check_library2('physfs')
77
conf.add_define('VERSION', VERSION)
78
conf.add_define('DEFAULT_DATADIR', Params.g_options.prefix + 'warzone2100')
79
conf.add_define('YY_STATIC', 1)
80
conf.add_define('LOCALEDIR', '')
81
conf.add_define('PACKAGE', 'warzone2100')
82
conf.env['CCFLAGS'] += ['-pipe', '-combine']
84
# Split off debug variant before adding variant specific defines
85
conf.set_env_name('debug', conf.env.deepcopy())
87
# Configure non debug variant
88
conf.env['CCFLAGS'] += ['-DNDEBUG', '-g', '-O2']
89
conf.add_define('NDEBUG', 1)
90
conf.write_config_header()
92
# Configure debug variant
94
conf.env.set_variant('debug')
95
conf.env['CCFLAGS'] += ['-DDEBUG', '-g', '-O0', '-Wall', '-Wextra']
96
conf.add_define('DEBUG', 1)
97
conf.write_config_header()
101
obj = bld.create_obj('cc', 'program')
102
obj.find_sources_in_dirs('lib/framework lib/gamelib lib/netplay lib/ivis_common lib/ivis_opengl lib/script lib/sequence lib/sound lib/widget src')
103
obj.uselib='PNG OGG VORBISFILE GLU GL OPENAL PHYSFS SDL_NET SDL SDLMAIN'
104
obj.includes='lib/framework lib/gamelib lib/script src'
105
obj.defines='HAVE_CONFIG_H'
106
obj.target='warzone2100'
108
# Use debug environment when --enable-debug is given
109
if Params.g_options.debug:
110
obj.env = bld.env_of_name('debug')