# -*- mode: python -*-
# DOOM build script
# TTimo <ttimo@idsoftware.com>
# http://scons.sourceforge.net

import scons_utils

Import( 'GLOBALS' )
Import( GLOBALS )
Import( 'g_env_game' )

idlib_string = ' \
	bv/Bounds.cpp \
	bv/Frustum.cpp \
	bv/Sphere.cpp \
	bv/Box.cpp \
	containers/HashIndex.cpp \
	containers/LinkList.cpp \
	geometry/DrawVert.cpp \
	geometry/Winding2D.cpp \
	geometry/RenderMatrix.cpp \
	geometry/Surface_SweptSpline.cpp \
	geometry/Winding.cpp \
	geometry/Surface.cpp \
	geometry/Surface_Patch.cpp \
	geometry/TraceModel.cpp \
	geometry/JointTransform.cpp \
	hashing/MD4.cpp \
	hashing/MD5.cpp \
	math/Angles.cpp \
	math/Lcp.cpp \
	math/Math.cpp \
	math/Matrix.cpp \
	math/Ode.cpp \
	math/Plane.cpp \
	math/Pluecker.cpp \
	math/Polynomial.cpp \
	math/Quat.cpp \
	math/Rotation.cpp \
	math/Simd.cpp \
	math/Simd_Generic.cpp \
	math/Simd_MMX.cpp \
	math/Simd_SSE.cpp \
	math/Simd_SSE2.cpp \
	math/Simd_SSE3.cpp \
	math/Simd_AVX.cpp \
	math/Simd_AVX2.cpp \
	math/Vector.cpp \
	math/Line.cpp \
	sys/posix/posix_thread.cpp \
	sys/sys_assert.cpp \
	BitMsg.cpp \
	CmdArgs.cpp \
	Debug.cpp \
	Dict.cpp \
	Heap.cpp \
	Heap_Embedded.cpp \
	Image.cpp \
	LangDict.cpp \
	Lexer.cpp \
	Lib.cpp \
	MapFile.cpp \
	ParallelJobList.cpp \
	Parser.cpp \
	RevisionTracker.cpp \
	Str.cpp \
	StdString.cpp \
	StdFilesystem.cpp \
	Thread.cpp \
	Timer.cpp'

# greebo: Compile the token source with less aggressive optimisation, to resolve issue #3184
suppress_optimization_string = ' \
	bv/Frustum_gcc.cpp \
	Token.cpp'

idlib_list = scons_utils.BuildList( '../../idlib', idlib_string)
suppress_optimization_list = scons_utils.BuildList( '../../idlib', suppress_optimization_string )

local_env = g_env_game.Clone()
# max allowed -O1
local_env_noopt = scons_utils.CloneWithoutOptimization(local_env, '-O1')

ret_list = []
for f in idlib_list:
	ret_list += local_env.StaticObject( source = f )
for f in suppress_optimization_list:
	ret_list += local_env_noopt.StaticObject( source = f )
Return( 'ret_list' )
