import os

version = File('#VERSION').get_contents().strip()

js_cflags = '/nologo /Zi /Ogsb1 /Gs /GF /GL /MT'
# There is a problem with libjs: it doesn't like the ICF linker option.
# We could just use /OPT:NOICF, but that would add about 100KB to the
# executable.  The alternative is to disable the /Gy compiler option for
# libjs sources. /Gy is implicitly enabled by /O1 and /O2.  We could use
# /O1 /Gy-, but only VS2005 understands that.  Instead, we replace /O1 with
# a more or less equivalent set of options, excluding /Gy.

env = Environment(
	platform = 'win32',
	tools = ['msvc','mslink','mslib'],
	ENV = os.environ,
	CPPDEFINES = [
		'WIN32', '_X86_', 'NDEBUG', 'NOMINMAX',
		('_SECURE_SCL', '0'), ('_HAS_ITERATOR_DEBUGGING', '0'),
		'BOOST_REGEX_NO_LIB', 'BOOST_REGEX_NON_RECURSIVE',
		'BOOST_MULTI_INDEX_DISABLE_SERIALIZATION',
		'ENABLE_PCH', ('BFILTER_VERSION', '\\"'+version+'\\"')
	],
	CCFLAGS = js_cflags, # only libjs contains C code, the rest is C++
	CXXFLAGS = '/nologo /O1 /Zi /EHsc /GR /GF /GL /MT /Zc:forScope /wd4258 /wd4355',
	CPPPATH = ['#'],
	ARFLAGS = '/NOLOGO /LTCG',
	LINKFLAGS = '/NOLOGO /OPT:REF /OPT:ICF /LTCG /DEBUG'
)

Export('env')

SConscript([
'mkskel/SConscript',
'foundation/SConscript',
'boost/SConscript',
'reactor/SConscript',
'lexgen/SConscript',
'libjs/SConscript',
'main/SConscript'
])
