
Import("env platform common_sources party_classes install_dir")

game_sources = Split("""
	boe.actions.cpp
	boe.combat.cpp
	boe.dlgutil.cpp
	boe.fileio.cpp
	boe.graphics.cpp
	boe.graphutil.cpp
	boe.infodlg.cpp
	boe.items.cpp
	boe.locutils.cpp
	boe.main.cpp
	boe.monster.cpp
	boe.newgraph.cpp
	boe.party.cpp
	boe.specials.cpp
	boe.startup.cpp
	boe.text.cpp
	boe.town.cpp
	boe.townspec.cpp
	boe.ui.cpp
	../pcedit/pc.editors.cpp
	../fileio/fileio_party.cpp
	../view_dialogs.cpp
	../deps/fmtlib/src/format.cc
	../deps/fmtlib/src/os.cc
""")

if str(platform) == "darwin":
	game_sources.extend(Split("""
		boe.appleevents.mm
		boe.menus.mac.mm
	"""))
elif str(platform) == "win32":
	game_sources.extend(Split("""
		boe.menus.win.cpp
	"""))
	game_sources.append(env.RES('#rsrc/menus/BladesOfExile.rc'))
elif str(platform) == "posix":
	game_sources.extend(Split("""
		boe.menus.linux.cpp
		boe.menu.cpp
	"""))

boe = env.Program("#build/bin/Blades of Exile", game_sources + party_classes + common_sources)
debug_symbols = None
if str(platform) == "win32" and 'msvc' in env["TOOLS"] and not env['release']:
	debug_symbols = boe[0].abspath.replace('.exe', '.pdb')

if str(platform) == "darwin":
	boe_info = {
		'nib': '#rsrc/menus/game',
		'plist': '#pkg/mac/BoE-Info.plist',
		'creator': 'blx!',
		'icons': 'BoE boegraphics boeresources boesave boesounds',
	}
else:
	boe_info = {}

env.Package(boe, install_dir, boe_info)
if debug_symbols is not None:
	env.Install(install_dir, debug_symbols)
