2012-07-22 12:51:05 -05:00
import os , sys , subprocess , time
2012-07-07 13:08:05 -05:00
2012-10-18 18:41:55 -05:00
2012-07-07 13:08:05 -05:00
##Fix for long command line - http://scons.org/wiki/LongCmdLinesOnWin32
class ourSpawn :
2012-08-12 12:52:22 -05:00
def ourspawn ( self , sh , escape , cmd , args , env ) :
newargs = ' ' . join ( args [ 1 : ] )
cmdline = cmd + " " + newargs
startupinfo = subprocess . STARTUPINFO ( )
startupinfo . dwFlags | = subprocess . STARTF_USESHOWWINDOW
proc = subprocess . Popen ( cmdline , stdin = subprocess . PIPE , stdout = subprocess . PIPE ,
stderr = subprocess . PIPE , startupinfo = startupinfo , shell = False , env = env )
data , err = proc . communicate ( )
rv = proc . wait ( )
if rv :
print " ===== "
print err
print " ===== "
return rv
2012-07-07 13:08:05 -05:00
def SetupSpawn ( env ) :
2012-08-12 12:52:22 -05:00
if sys . platform == ' win32 ' :
buf = ourSpawn ( )
buf . ourenv = env
env [ ' SPAWN ' ] = buf . ourspawn
2012-07-07 13:08:05 -05:00
AddOption ( ' --opengl ' , dest = " opengl " , action = ' store_true ' , default = False , help = " Build with OpenGL interface support. " )
2012-08-06 01:30:25 -05:00
AddOption ( ' --opengl-renderer ' , dest = " opengl-renderer " , action = ' store_true ' , default = False , help = " Build with OpenGL renderer support. (requires --opengl) " )
2012-10-29 04:50:05 -05:00
AddOption ( ' --renderer ' , dest = " renderer " , action = ' store_true ' , default = False , help = " Save renderer " )
2012-07-29 11:14:14 -05:00
AddOption ( ' --win ' , dest = " win " , action = ' store_true ' , default = False , help = " Windows platform target. " )
2012-07-29 10:55:26 -05:00
AddOption ( ' --lin ' , dest = " lin " , action = ' store_true ' , default = False , help = " Linux platform target " )
2012-07-20 15:19:37 -05:00
AddOption ( ' --macosx ' , dest = " macosx " , action = ' store_true ' , default = False , help = " Mac OS X platform target " )
2012-12-31 13:18:56 -06:00
AddOption ( ' --rpi ' , dest = " rpi " , action = ' store_true ' , default = False , help = " Raspbain platform target " )
2012-08-01 14:36:56 -05:00
AddOption ( ' --64bit ' , dest = " _64bit " , action = ' store_true ' , default = False , help = " 64-bit platform target " )
2012-07-11 15:11:13 -05:00
AddOption ( ' --static ' , dest = " static " , action = " store_true " , default = False , help = " Static linking, reduces external library dependancies but increased file size " )
AddOption ( ' --pthreadw32-static ' , dest = " ptw32-static " , action = " store_true " , default = False , help = " Use PTW32_STATIC_LIB for pthreadw32 headers " )
2013-01-12 18:56:11 -06:00
AddOption ( ' --python-ver ' , dest = " pythonver " , default = False , help = " Python version to use for generator.py " )
2012-07-07 13:08:05 -05:00
AddOption ( ' --release ' , dest = " release " , action = ' store_true ' , default = False , help = " Enable optimisations (Will slow down compiling) " )
2012-07-08 08:03:51 -05:00
AddOption ( ' --lua-dir ' , dest = " lua-dir " , default = False , help = " Directory for lua includes " )
AddOption ( ' --sdl-dir ' , dest = " sdl-dir " , default = False , help = " Directory for SDL includes " )
2012-07-11 15:11:13 -05:00
AddOption ( ' --tool ' , dest = " toolprefix " , default = False , help = " Prefix " )
2012-07-20 15:19:37 -05:00
AddOption ( ' --sse ' , dest = " sse " , action = ' store_true ' , default = False , help = " Enable SSE optimisations " )
AddOption ( ' --sse2 ' , dest = " sse2 " , action = ' store_true ' , default = False , help = " Enable SSE2 optimisations " )
AddOption ( ' --sse3 ' , dest = " sse3 " , action = ' store_true ' , default = False , help = " Enable SSE3 optimisations " )
AddOption ( ' --x86 ' , dest = " x86 " , action = ' store_true ' , default = True , help = " Target Intel x86 platform " )
2013-04-04 09:04:29 -05:00
AddOption ( ' --nofft ' , dest = " nofft " , action = ' store_true ' , default = False , help = " Do not use fftw3f for gravity. " )
2013-05-11 05:52:35 -05:00
AddOption ( ' --nolua ' , dest = " nolua " , action = ' store_true ' , default = False , help = " Disable all lua scripting features. " )
2012-07-20 15:19:37 -05:00
2012-07-28 12:37:49 -05:00
AddOption ( ' --debugging ' , dest = " debug " , action = " store_true " , default = False , help = " Enable debug options " )
2012-07-22 13:33:56 -05:00
AddOption ( ' --beta ' , dest = " beta " , action = ' store_true ' , default = False , help = " Beta build. " )
AddOption ( ' --save-version ' , dest = " save-version " , default = False , help = " Save version. " )
AddOption ( ' --minor-version ' , dest = " minor-version " , default = False , help = " Minor version. " )
AddOption ( ' --build-number ' , dest = " build-number " , default = False , help = " Build number. " )
2012-08-13 09:43:57 -05:00
AddOption ( ' --snapshot ' , dest = " snapshot " , action = ' store_true ' , default = False , help = " Snapshot build. " )
2012-08-13 15:32:08 -05:00
AddOption ( ' --snapshot-id ' , dest = " snapshot-id " , default = False , help = " Snapshot build ID. " )
2013-01-12 18:56:11 -06:00
AddOption ( ' --stable ' , dest = " stable " , default = True , help = " Non snapshot build " )
2012-08-13 12:07:27 -05:00
AddOption ( ' --aao ' , dest = " everythingAtOnce " , action = ' store_true ' , default = False , help = " Compile the whole game without generating intermediate objects (very slow), enable this when using compilers like clang or mscc that don ' t support -fkeep-inline-functions " )
2012-12-31 13:18:56 -06:00
if ( ( not GetOption ( ' lin ' ) ) and ( not GetOption ( ' win ' ) ) and ( not GetOption ( ' rpi ' ) ) and ( not GetOption ( ' macosx ' ) ) ) :
2012-08-12 12:52:22 -05:00
print " You must specify a platform to target "
raise SystemExit ( 1 )
2012-07-07 13:08:05 -05:00
2012-07-29 11:14:14 -05:00
if ( GetOption ( ' win ' ) ) :
2012-09-02 09:08:03 -05:00
env = Environment ( tools = [ ' mingw ' ] , ENV = os . environ )
2012-07-07 13:08:05 -05:00
else :
2012-09-02 09:08:03 -05:00
env = Environment ( tools = [ ' default ' ] , ENV = os . environ )
2012-07-07 13:08:05 -05:00
2012-07-11 15:11:13 -05:00
if GetOption ( " toolprefix " ) :
2012-08-12 12:52:22 -05:00
env [ ' CC ' ] = GetOption ( " toolprefix " ) + env [ ' CC ' ]
env [ ' CXX ' ] = GetOption ( " toolprefix " ) + env [ ' CXX ' ]
2012-09-25 12:19:54 -05:00
if GetOption ( ' win ' ) :
env [ ' RC ' ] = GetOption ( " toolprefix " ) + env [ ' RC ' ]
2012-07-11 15:11:13 -05:00
2012-07-07 13:08:05 -05:00
#Check for headers and libraries
2012-09-25 11:52:43 -05:00
if not GetOption ( " macosx " ) :
2012-09-25 12:03:58 -05:00
conf = Configure ( env )
2012-09-25 11:52:43 -05:00
try :
env . ParseConfig ( ' sdl-config --cflags ' )
env . ParseConfig ( ' sdl-config --libs ' )
except :
2013-01-22 14:08:36 -06:00
if not conf . CheckLib ( " SDL " ) :
print " libSDL not found or not installed "
raise SystemExit ( 1 )
2012-09-25 11:52:43 -05:00
if ( GetOption ( " sdl-dir " ) ) :
if not conf . CheckCHeader ( GetOption ( " sdl-dir " ) + ' /SDL.h ' ) :
print " sdl headers not found or not installed "
raise SystemExit ( 1 )
else :
2013-01-22 14:08:36 -06:00
env . Append ( CPPPATH = [ GetOption ( " sdl-dir " ) ] )
2012-07-07 13:08:05 -05:00
2012-09-25 12:03:58 -05:00
#Find correct lua include dir
2013-05-11 05:52:35 -05:00
if not GetOption ( " nolua " ) :
try :
env . ParseConfig ( ' pkg-config --cflags lua5.1 ' )
except :
if ( GetOption ( " lua-dir " ) ) :
if not conf . CheckCHeader ( GetOption ( " lua-dir " ) + ' /lua.h ' ) :
print " lua5.1 headers not found or not installed "
raise SystemExit ( 1 )
else :
env . Append ( CPPPATH = [ GetOption ( " lua-dir " ) ] )
2012-07-07 13:08:05 -05:00
2013-04-09 18:36:42 -05:00
if not GetOption ( ' nofft ' ) :
#Check for FFT lib
if not conf . CheckLib ( ' fftw3f ' ) and not conf . CheckLib ( ' fftw3f-3 ' ) :
print " libfftw3f not found or not installed "
raise SystemExit ( 1 )
2012-07-07 13:08:05 -05:00
2012-09-25 12:03:58 -05:00
#Check for Bzip lib
if not conf . CheckLib ( ' bz2 ' ) :
print " libbz2 not found or not installed "
raise SystemExit ( 1 )
2012-08-11 14:24:48 -05:00
2012-09-25 12:03:58 -05:00
#Check for zlib
if not conf . CheckLib ( ' z ' ) :
print " libz not found or not installed "
raise SystemExit ( 1 )
2012-08-09 15:32:04 -05:00
2012-09-25 12:03:58 -05:00
if not conf . CheckCHeader ( " bzlib.h " ) :
print " bzip2 headers not found "
2012-09-25 11:53:48 -05:00
raise SystemExit ( 1 )
2012-07-07 13:08:05 -05:00
2012-09-25 12:03:58 -05:00
#Check for Lua lib
2013-05-11 05:52:35 -05:00
if not GetOption ( " macosx " ) and not GetOption ( " nolua " ) :
2013-01-03 09:14:24 -06:00
if not conf . CheckLib ( ' lua5.1 ' ) and not conf . CheckLib ( ' lua-5.1 ' ) and not conf . CheckLib ( ' lua51 ' ) and not conf . CheckLib ( ' lua ' ) :
2012-09-25 12:03:58 -05:00
print " liblua not found or not installed "
raise SystemExit ( 1 )
env = conf . Finish ( ) ;
else :
2013-04-04 09:04:29 -05:00
env . Append ( LIBS = [ ' z ' , ' bz2 ' ] )
if not GetOption ( ' nofft ' ) :
env . Append ( LIBS = [ ' fftw3f ' ] )
2012-07-07 13:08:05 -05:00
2012-07-08 08:03:51 -05:00
env . Append ( CPPPATH = [ ' src/ ' , ' data/ ' , ' generated/ ' ] )
2012-10-20 12:06:53 -05:00
env . Append ( CCFLAGS = [ ' -w ' , ' -std=c++98 ' , ' -fkeep-inline-functions ' ] )
2012-08-09 15:32:04 -05:00
env . Append ( LIBS = [ ' pthread ' , ' m ' ] )
2013-05-11 05:52:35 -05:00
env . Append ( CPPDEFINES = [ " _GNU_SOURCE " , " USE_STDINT " , " _POSIX_C_SOURCE=200112L " ] )
2013-04-04 09:04:29 -05:00
if not GetOption ( ' nofft ' ) :
env . Append ( CPPDEFINES = [ " GRAVFFT " ] )
2013-05-11 05:52:35 -05:00
if not GetOption ( ' nolua ' ) :
2013-05-13 13:26:20 -05:00
env . Append ( CPPDEFINES = [ " LUACONSOLE " ] )
2012-07-11 15:11:13 -05:00
if GetOption ( " ptw32-static " ) :
2012-08-12 12:52:22 -05:00
env . Append ( CPPDEFINES = [ ' PTW32_STATIC_LIB ' ] ) ;
2012-07-11 15:11:13 -05:00
if ( GetOption ( ' static ' ) ) :
2012-08-12 12:52:22 -05:00
env . Append ( LINKFLAGS = [ ' -static-libgcc ' ] )
2012-07-07 13:08:05 -05:00
2012-10-29 04:50:05 -05:00
if ( GetOption ( ' renderer ' ) ) :
env . Append ( CPPDEFINES = [ ' RENDERER ' ] )
2012-10-29 04:59:07 -05:00
else :
env . Append ( CPPDEFINES = [ " USE_SDL " ] )
2012-10-29 04:50:05 -05:00
2012-12-31 13:18:56 -06:00
if ( GetOption ( ' rpi ' ) ) :
if ( GetOption ( ' opengl ' ) ) :
env . ParseConfig ( ' pkg-config --libs glew gl glu ' )
openGLLibs = [ ' GL ' ]
env . Append ( LIBS = [ ' X11 ' , ' rt ' ] )
env . Append ( CPPDEFINES = [ " LIN " ] )
2012-07-29 11:14:14 -05:00
if ( GetOption ( ' win ' ) ) :
2012-08-12 12:52:22 -05:00
openGLLibs = [ ' opengl32 ' , ' glew32 ' ]
env . Prepend ( LIBS = [ ' mingw32 ' , ' ws2_32 ' , ' SDLmain ' , ' regex ' ] )
2012-10-20 12:12:54 -05:00
env . Append ( CCFLAGS = [ ' -std=gnu++98 ' ] )
2012-08-12 12:52:22 -05:00
env . Append ( LIBS = [ ' winmm ' , ' gdi32 ' ] )
env . Append ( CPPDEFINES = [ " WIN " ] )
env . Append ( LINKFLAGS = [ ' -mwindows ' ] )
if ( GetOption ( ' _64bit ' ) ) :
env . Append ( CPPDEFINES = [ ' __CRT__NO_INLINE ' ] )
env . Append ( LINKFLAGS = [ ' -Wl,--stack=16777216 ' ] )
2012-08-01 14:28:43 -05:00
if ( GetOption ( ' lin ' ) ) :
2012-08-12 12:52:22 -05:00
if ( GetOption ( ' opengl ' ) ) :
env . ParseConfig ( ' pkg-config --libs glew gl glu ' )
openGLLibs = [ ' GL ' ]
env . Append ( LIBS = [ ' X11 ' , ' rt ' ] )
2013-01-18 13:37:24 -06:00
env . Append ( CPPDEFINES = [ " LIN " ] )
2012-08-12 12:52:22 -05:00
if GetOption ( ' _64bit ' ) :
2012-12-25 14:42:29 -06:00
env . Append ( LINKFLAGS = [ ' -m64 ' ] )
2012-08-12 12:52:22 -05:00
env . Append ( CCFLAGS = [ ' -m64 ' ] )
else :
env . Append ( LINKFLAGS = [ ' -m32 ' ] )
env . Append ( CCFLAGS = [ ' -m32 ' ] )
2012-09-25 07:44:24 -05:00
if ( GetOption ( ' macosx ' ) ) :
env . Append ( CPPDEFINES = [ " MACOSX " ] )
2012-09-25 11:53:48 -05:00
env . Append ( CCFLAGS = [ ' -I/Library/Frameworks/SDL.framework/Headers ' ] )
env . Append ( CCFLAGS = [ ' -I/Library/Frameworks/Lua.framework/Headers ' ] )
2013-04-04 09:04:29 -05:00
if not GetOption ( ' nofft ' ) :
env . Append ( LINKFLAGS = [ ' -lfftw3f ' ] )
2012-09-25 11:53:48 -05:00
env . Append ( LINKFLAGS = [ ' -framework ' ] )
env . Append ( LINKFLAGS = [ ' SDL ' ] )
env . Append ( LINKFLAGS = [ ' -framework ' ] )
env . Append ( LINKFLAGS = [ ' Lua ' ] )
env . Append ( LINKFLAGS = [ ' -framework ' ] ) ;
env . Append ( LINKFLAGS = [ ' Cocoa ' ] )
#env.Append(LINKFLAGS=['-framework SDL'])
#env.Append(LINKFLAGS=['-framework Lua'])
#env.Append(LINKFLAGS=['-framework Cocoa'])
if GetOption ( ' _64bit ' ) :
2012-12-25 14:42:29 -06:00
env . Append ( LINKFLAGS = [ ' -m64 ' ] )
2012-09-25 11:53:48 -05:00
env . Append ( CCFLAGS = [ ' -m64 ' ] )
else :
env . Append ( LINKFLAGS = [ ' -m32 ' ] )
env . Append ( CCFLAGS = [ ' -m32 ' ] )
2012-07-07 13:08:05 -05:00
2012-07-29 12:33:01 -05:00
if GetOption ( ' _64bit ' ) :
2012-08-12 12:52:22 -05:00
env . Append ( CPPDEFINES = [ " _64BIT " ] )
2012-07-29 12:33:01 -05:00
2012-07-22 13:33:56 -05:00
if ( GetOption ( ' beta ' ) ) :
2012-08-12 12:52:22 -05:00
env . Append ( CPPDEFINES = ' BETA ' )
2012-07-22 13:33:56 -05:00
2012-08-13 09:43:57 -05:00
2013-01-12 18:56:11 -06:00
if ( not GetOption ( ' snapshot ' ) and not GetOption ( ' beta ' ) and not GetOption ( ' release ' ) and not GetOption ( ' stable ' ) ) :
2012-08-13 09:43:57 -05:00
env . Append ( CPPDEFINES = ' SNAPSHOT_ID=0 ' )
env . Append ( CPPDEFINES = ' SNAPSHOT ' )
2012-08-13 15:32:08 -05:00
elif ( GetOption ( ' snapshot ' ) or GetOption ( ' snapshot-id ' ) ) :
if ( GetOption ( ' snapshot-id ' ) ) :
env . Append ( CPPDEFINES = [ ' SNAPSHOT_ID= ' + GetOption ( ' snapshot-id ' ) ] )
else :
env . Append ( CPPDEFINES = [ ' SNAPSHOT_ID= ' + str ( int ( time . time ( ) ) ) ] )
2012-08-12 12:52:22 -05:00
env . Append ( CPPDEFINES = ' SNAPSHOT ' )
2013-01-12 18:56:11 -06:00
elif ( GetOption ( ' stable ' ) ) :
env . Append ( CPPDEFINES = ' STABLE ' )
2012-07-22 13:33:56 -05:00
if ( GetOption ( ' save-version ' ) ) :
2012-09-02 09:08:03 -05:00
env . Append ( CPPDEFINES = [ ' SAVE_VERSION= ' + GetOption ( ' save-version ' ) ] )
2012-07-22 13:33:56 -05:00
if ( GetOption ( ' minor-version ' ) ) :
2012-08-12 12:52:22 -05:00
env . Append ( CPPDEFINES = [ ' MINOR_VERSION= ' + GetOption ( ' minor-version ' ) ] )
2012-07-07 13:08:05 -05:00
2012-09-02 09:08:03 -05:00
if ( GetOption ( ' build-number ' ) ) :
env . Append ( CPPDEFINES = [ ' BUILD_NUM= ' + GetOption ( ' build-number ' ) ] )
2012-07-20 15:19:37 -05:00
if ( GetOption ( ' x86 ' ) ) :
2012-08-12 12:52:22 -05:00
env . Append ( CPPDEFINES = ' X86 ' )
2012-07-20 15:19:37 -05:00
2012-07-28 12:37:49 -05:00
if ( GetOption ( ' debug ' ) ) :
2012-08-12 12:52:22 -05:00
env . Append ( CPPDEFINES = ' DEBUG ' )
env . Append ( CCFLAGS = ' -g ' )
2012-07-28 12:37:49 -05:00
2012-07-20 15:19:37 -05:00
if ( GetOption ( ' sse ' ) ) :
2012-08-12 12:52:22 -05:00
env . Append ( CCFLAGS = ' -msse ' )
env . Append ( CPPDEFINES = ' X86_SSE ' )
2012-07-20 15:19:37 -05:00
if ( GetOption ( ' sse2 ' ) ) :
2012-08-12 12:52:22 -05:00
env . Append ( CCFLAGS = ' -msse2 ' )
env . Append ( CPPDEFINES = ' X86_SSE2 ' )
2012-07-20 15:19:37 -05:00
if ( GetOption ( ' sse3 ' ) ) :
2012-08-12 12:52:22 -05:00
env . Append ( CCFLAGS = ' -msse3 ' )
env . Append ( CPPDEFINES = ' X86_SSE3 ' )
2012-07-07 13:08:05 -05:00
if ( GetOption ( ' opengl ' ) ) :
2012-08-12 12:52:22 -05:00
env . Append ( CPPDEFINES = [ " OGLI " , " PIX32OGL " ] )
env . Append ( LIBS = openGLLibs )
2012-07-07 13:08:05 -05:00
2012-08-02 09:31:40 -05:00
if ( GetOption ( ' opengl ' ) and GetOption ( ' opengl-renderer ' ) ) :
2012-08-12 12:52:22 -05:00
env . Append ( CPPDEFINES = [ " OGLR " ] )
2012-07-07 13:08:05 -05:00
elif ( GetOption ( ' opengl-renderer ' ) ) :
2012-08-12 12:52:22 -05:00
print " opengl-renderer requires opengl "
raise SystemExit ( 1 )
2012-07-07 13:08:05 -05:00
sources = Glob ( " src/*.cpp " )
2012-09-25 11:53:48 -05:00
if ( GetOption ( ' macosx ' ) ) :
sources + = [ " SDLMain.m " ]
2012-07-29 11:14:14 -05:00
if ( GetOption ( ' win ' ) ) :
2012-08-12 12:52:22 -05:00
sources + = env . RES ( ' resources/powder-res.rc ' )
2012-07-07 13:08:05 -05:00
sources + = Glob ( " src/*/*.cpp " )
2013-03-22 09:26:24 -05:00
sources + = Glob ( " src/gui/*/*.cpp " )
2012-07-07 13:08:05 -05:00
sources + = Glob ( " src/simulation/elements/*.cpp " )
sources + = Glob ( " src/simulation/tools/*.cpp " )
2013-03-14 06:30:24 -05:00
sources + = Glob ( " src/client/requestbroker/*.cpp " )
2013-05-11 05:52:35 -05:00
if not GetOption ( ' nolua ' ) :
sources + = Glob ( " src/socket/*.c " )
2012-07-23 14:58:38 -05:00
2013-01-22 14:08:36 -06:00
#for source in sources:
# print str(source)
2012-09-02 09:08:03 -05:00
if ( GetOption ( ' win ' ) ) :
2013-01-22 14:08:36 -06:00
sources = filter ( lambda source : not ' src \\ simulation \\ Gravity.cpp ' in str ( source ) , sources )
sources = filter ( lambda source : not ' src/simulation/Gravity.cpp ' in str ( source ) , sources )
2012-07-07 13:08:05 -05:00
SetupSpawn ( env )
2012-07-23 05:49:58 -05:00
programName = " powder "
2012-10-29 05:13:15 -05:00
if ( GetOption ( ' renderer ' ) ) :
2012-10-29 05:10:43 -05:00
programName = " render "
2012-07-29 11:14:14 -05:00
if ( GetOption ( ' win ' ) ) :
2012-10-29 05:13:15 -05:00
if ( GetOption ( ' renderer ' ) ) :
2012-10-29 05:10:43 -05:00
programName = " Render "
2012-10-29 05:14:51 -05:00
else :
2012-10-29 05:10:43 -05:00
programName = " Powder "
2012-07-23 05:49:58 -05:00
2012-07-29 10:55:26 -05:00
if ( GetOption ( ' _64bit ' ) ) :
2012-08-12 12:52:22 -05:00
programName + = " 64 "
2012-07-23 05:49:58 -05:00
if ( not ( GetOption ( ' sse2 ' ) or GetOption ( ' sse3 ' ) ) ) :
2012-08-12 12:52:22 -05:00
programName + = " -legacy "
2012-07-23 05:49:58 -05:00
if ( GetOption ( ' macosx ' ) ) :
2012-08-12 12:52:22 -05:00
programName + = " -x "
2012-07-23 05:49:58 -05:00
2012-07-29 11:14:14 -05:00
if ( GetOption ( ' win ' ) ) :
2012-08-12 12:52:22 -05:00
programName + = " .exe "
2012-07-23 05:49:58 -05:00
2012-08-13 11:29:58 -05:00
if ( GetOption ( ' release ' ) ) :
2012-09-25 12:14:39 -05:00
if GetOption ( ' macosx ' ) :
env . Append ( CCFLAGS = [ ' -O3 ' , ' -ftree-vectorize ' , ' -funsafe-math-optimizations ' , ' -ffast-math ' , ' -fomit-frame-pointer ' ] )
else :
env . Append ( CCFLAGS = [ ' -O3 ' , ' -ftree-vectorize ' , ' -funsafe-math-optimizations ' , ' -ffast-math ' , ' -fomit-frame-pointer ' , ' -funsafe-loop-optimizations ' , ' -Wunsafe-loop-optimizations ' ] )
2012-08-13 12:07:27 -05:00
2013-01-12 18:56:11 -06:00
if ( GetOption ( ' pythonver ' ) ) :
pythonVer = GetOption ( ' pythonver ' )
elif ( GetOption ( ' lin ' ) ) :
2012-12-31 13:23:22 -06:00
pythonVer = " python2 "
else :
pythonVer = " python "
2012-09-02 09:08:03 -05:00
if ( GetOption ( ' win ' ) ) :
envCopy = env . Clone ( )
envCopy . Append ( CCFLAGS = [ ' -mincoming-stack-boundary=2 ' ] )
sources + = envCopy . Object ( ' src/simulation/Gravity.cpp ' )
2012-12-31 13:23:22 -06:00
env . Command ( [ ' generated/ElementClasses.cpp ' , ' generated/ElementClasses.h ' ] , Glob ( ' src/simulation/elements/*.cpp ' ) , pythonVer + " generator.py elements $TARGETS $SOURCES " )
2012-10-06 13:38:50 -05:00
sources + = Glob ( " generated/ElementClasses.cpp " )
2012-12-31 13:23:22 -06:00
env . Command ( [ ' generated/ToolClasses.cpp ' , ' generated/ToolClasses.h ' ] , Glob ( ' src/simulation/tools/*.cpp ' ) , pythonVer + " generator.py tools $TARGETS $SOURCES " )
2012-10-06 13:38:50 -05:00
sources + = Glob ( " generated/ToolClasses.cpp " )
2012-09-02 09:08:03 -05:00
env . Decider ( ' MD5 ' )
2012-10-20 11:57:06 -05:00
t = env . Program ( target = programName , source = sources )
2012-10-02 15:43:58 -05:00
Default ( t )