
Import("env platform common_sources party_classes install_dir")

scened_sources = Split("""
	scen.actions.cpp
	scen.btnmg.cpp
	scen.core.cpp
	scen.fileio.cpp
	scen.graphics.cpp
	scen.keydlgs.cpp
	scen.locpicker.cpp
	scen.main.cpp
	scen.sdfpicker.cpp
	scen.townout.cpp
	scen.undo.cpp
	../view_dialogs.cpp
	../fileio/fileio_party.cpp
	../damage.cpp
	../deps/fmtlib/src/format.cc
	../deps/fmtlib/src/os.cc
""")

if str(platform) == "darwin":
	scened_sources.extend(Split("""
		scen.appleevents.mm
		scen.menus.mac.mm
	"""))
elif str(platform) == "win32":
	scened_sources.extend(Split("""
		scen.menus.win.cpp
	"""))
	scened_sources.extend(env.RES('#rsrc/menus/ScenEditor.rc'))

elif str(platform) == "posix":
	scened_sources.extend(Split("""
		scen.menus.linux.cpp
		scen.menu.cpp
	"""))

scened = env.Program("#build/bin/BoE Scenario Editor", scened_sources + common_sources + party_classes)
debug_symbols = None
if str(platform) == "win32" and 'msvc' in env["TOOLS"] and not env['release']:
	debug_symbols = scened[0].abspath.replace('.exe', '.pdb')

if str(platform) == "darwin":
	scened_info = {
		'nib': '#rsrc/menus/scenedit',
		'plist': '#pkg/mac/BoEScenEd-Info.plist',
		'creator': 'BlEd',
		'icons': 'boescenario BoEScenEd',
	}
else:
	scened_info = {}

env.Package(scened, install_dir, scened_info)
if debug_symbols is not None:
	env.Install(install_dir, debug_symbols)
