# -*- mode: python -*-
# coding=utf-8

#*****************************************************************************
#                    The Dark Mod GPL Source Code
# 
# This file is part of the The Dark Mod Source Code, originally based 
# on the Doom 3 GPL Source Code as published in 2011.
# 
# The Dark Mod Source Code is free software: you can redistribute it 
# and/or modify it under the terms of the GNU General Public License as 
# published by the Free Software Foundation, either version 3 of the License, 
# or (at your option) any later version. For details, see LICENSE.TXT.
# 
# Project: The Dark Mod Updater (http://www.thedarkmod.com/)
# 
#*****************************************************************************

# The Dark Mod Updater build script
# Adapted from id's game sconscript
# Author: greebo

import sys, os, string
import scons_utils

Import( 'GLOBALS' )
Import( GLOBALS )

# Master list of source files to compile
tdm_update_list = scons_utils.BuildList('.', 'tdm_update.cpp ConsoleUpdater.cpp')

local_env = g_env.Clone()
local_env.Append(CPPFLAGS = [ '-Wno-unused', '-Wno-deprecated', '-Wno-non-virtual-dtor' ])

if g_os == 'Linux':
	# Linux
	path_template = '#/../ThirdParty/artefacts/{0}/lib/lnx%d_s_gcc5_rel_stdcpp/{1}' % (64 if TARGET_ARCH == 'x64' else 32)
	local_env.Append(LIBS = [
		File(path_template.format('libcurl', 'libcurl.a')),
		File(path_template.format('mbedtls', 'libmbedtls.a')),
		File(path_template.format('mbedtls', 'libmbedx509.a')),
		File(path_template.format('mbedtls', 'libmbedcrypto.a')),
		File(path_template.format('zlib', 'libminizip.a')),
		File(path_template.format('zlib', 'libz.a')),
		'stdc++fs',
	])

ret = local_env.Program(target = 'update', source = tdm_update_list + libtdm_update_list)
Return( 'ret' )

