6 HAVE_GIT
=os
.system("git rev-parse --git-dir >/dev/null 2>/dev/null") == 0
8 TAG
=os
.popen('git describe --tag --candidates=0 2>/dev/null').readline().strip('\n')
12 INGAMEVER
='git-'+os
.popen('git-rev-parse --default HEAD').readline().strip('\n')
13 BRANCH
=os
.popen("git branch | grep -e '^\*' | sed 's/^\* //'").readline().strip('\n')
19 # the following two variables are used by the target "waf dist"
20 VERSION
=str(INGAMEVER
)
21 APPNAME
='dirtyblobwars'
23 # these variables are mandatory ('/' are converted automatically)
28 Params
.g_autoconfig
= 1
34 # options provided in a script in a subdirectory named "src"
35 opt
.sub_options('src')
37 # options provided by the modules
38 opt
.tool_options('g++')
39 opt
.tool_options('boost')
42 opt
.add_option('--with-mapeditor', action
='store_true', help='Build a simple map editor', dest
='mapedit')
43 opt
.add_option('--bindir', type='string', default
='games/bin/', help='Put binaries into this dir (relative to prefix)', dest
='bindir')
44 opt
.add_option('--docsdir', type='string', default
='share/doc/dirtystudios/blobwars/', help='Put docs into this dir (relative to prefix)', dest
='docsdir')
45 opt
.add_option('--datadir', type='string', default
='share/games/dirtystudios/blobwars/', help='Put data files into this dir (relative to prefix)', dest
='datadir')
54 ICONV_CONST char* in_orig = "boo";
60 iconv(cd, &in_orig, &in_len, &out, &out_len);
67 def check_iconv(conf
):
68 conf
.check_header2('iconv.h')
69 conf
.check_library2('iconv', mandatory
=0)
71 test
= conf
.create_test_configurator()
72 test
.code
= "#define ICONV_CONST const\n" + iconv_test
77 conf
.check_message('we can compile iconv program', '', 1, 'with const')
78 conf
.env
['defines']['ICONV_CONST'] = 'const'
80 test
.code
= "#define ICONV_CONST \n" + iconv_test
83 conf
.check_message('we can compile iconv program', '', 1, 'without const')
84 conf
.env
['defines']['ICONV_CONST'] = ' '
86 conf
.check_message('we can compile iconv program', '', 0)
87 raise "Compilation failed"
92 from Params
import fatal
94 if not conf
.check_library2('jpeg.dll', uselib
='JPEG', mandatory
= 0):
95 conf
.check_library2('jpeg', uselib
='JPEG')
96 # whaa! Why there aren't any people who can program? Making a header without including required headers?!?!
97 # Looks, not only Parallel Realities can't code..
98 test
= conf
.create_header_configurator()
99 test
.name
= 'jpeglib.h'
100 test
.header_code
= "#include <cstdio>\n"
106 def boost_header(conf
, name
):
107 test
= conf
.create_header_configurator()
110 test
.uselib
= "BOOST"
117 from Params
import fatal
118 pre
= conf
.env
['PREFIX']
119 conf
.env
['BINDIR'] = pre
+ Params
.g_options
.bindir
120 conf
.env
['DOCSDIR'] = pre
+ Params
.g_options
.docsdir
121 conf
.env
['DATADIR'] = pre
+ Params
.g_options
.datadir
122 conf
.env
['MAPEDIT'] = Params
.g_options
.mapedit
124 conf
.check_tool('g++')
126 #conf.sub_config('src')
128 #conf.env['CXXFLAGS']='-g -Wall -O0' # -I/home/dirty_ice/crossdev/winroot/include'
129 #conf.env['CCFLAGS']='-g -Wall -O0'
130 #conf.env['LINKFLAGS']='-L/home/dirty_ice/crossdev/winroot/lib'
131 if (Params
.g_options
.debug_level
== "ultradebug"):
132 conf
.env
['CXXFLAGS'] += ["-Wabi", "-Wctor-dtor-privacy", "-Wnon-virtual-dtor", "-Wreorder", "-Weffc++", "-Wstrict-null-sentinel", "-Wold-style-cast", "-Woverloaded-virtual", "-Wsign-promo", "-Wformat=2", "-Winit-self", "-Wswitch-default", "-Wswitch-enum", "-Wunused", "-Wextra", "-Wfloat-equal", "-Wundef", "-Wpointer-arith", "-Wcast-qual", "-Wcast-align", "-Wwrite-strings", "-Wconversion", "-Waddress", "-Wmissing-field-initializers", "-Wmissing-noreturn", "-Wmissing-format-attribute", "-Wpacked", "-Wno-invalid-offsetof", "-Wvolatile-register-var", "-Wcomment", "-Wtrigraphs", "-Wimport"]
136 conf
.check_pkg2('sdl', '1.2')
137 conf
.check_tool('checks')
138 conf
.check_header2('SDL/SDL_image.h')
139 conf
.check_library2('SDL_image')
140 conf
.check_header2('SDL/SDL_mixer.h')
141 conf
.check_library2('SDL_mixer')
142 conf
.check_header2('SDL/SDL_ttf.h')
143 conf
.check_library2('SDL_ttf')
144 conf
.check_header2('physfs.h')
147 conf
.check_library2('physfs')
148 conf
.check_header2('physfs.h')
154 conf
.check_pkg2('libpng12', '1.2', uselib
='PNG')
160 #conf.env["WANT_BOOST"] = ""
161 conf
.check_tool('boost')
162 boost_header(conf
, 'boost/format.hpp')
163 boost_header(conf
, 'boost/scoped_ptr.hpp')
164 boost_header(conf
, 'boost/shared_ptr.hpp')
165 boost_header(conf
, 'boost/tokenizer.hpp')
167 platform
=conf
.detect_platform()
168 conf
.check_message_custom("platform", '', platform
)
169 if (platform
!= 'cygwin'):
170 conf
.define('UNIX', 1)
172 conf
.define('WIN32', 1)
174 conf
.env
['VERSION'] = INGAMEVER
175 conf
.env
['BRANCH'] = BRANCH
176 conf
.define('VERSION', INGAMEVER
)
177 conf
.define('BRANCH', BRANCH
)
178 conf
.define('DATADIR', conf
.env
['DATADIR'])
180 conf
.write_config_header('config.h')
184 preproc
.strict_quotes
= 1
190 if not Params
.g_commands
['build']: return
191 os
.popen('ln -f -s build/default/dirtyblobwars ../dirtyblobwars')
192 os
.popen('ln -f -s build/default/dirtyblobwars-mapeditor ../mapedit')