2 from sys import platform
5 src_dll = ["basics.cpp","command_line.cpp","enabler.cpp","files.cpp",
6 "find_files_posix.cpp","graphics.cpp","init.cpp","interface.cpp",
7 "keybindings.cpp","music_and_sound_openal.cpp", "random.cpp",
8 "textlines.cpp","glew.c","enabler_input.cpp","ViewBase.cpp",
9 "KeybindingScreen.cpp", "win32_compat.cpp", "textures.cpp",
10 "resize++.cpp", "renderer_offscreen.cpp",
13 dll = '#libs/libgraphics.so'
24 M64 = False if libgraphics else True
26 # Propagate PATH. We'll just take our chances with non-repeatable builds.
27 env = Environment(ENV = {'PATH' : os.environ['PATH']})
30 env["STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME"]=True
33 env['CXXCOM']="$CXX -o $TARGET -emit-llvm -pipe -c $CXXFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"
34 env['CCCOM']="$CC -o $TARGET -emit-llvm -pipe -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"
35 env['SHCCCOM']=env['CCCOM']
36 env['SHCXXCOM']=env['CXXCOM']
37 env["OBJSUFFIX"]=".bc"
38 env["SHOBJSUFFIX"]=".so.bc"
39 env["ARCOM"]="llvm-link $SOURCES -o $TARGET"
40 env["RANLIBCOM"]="true"
42 env["SHLINKCOM"]="llvm-link $SOURCES | opt -disable-internalize -std-link-opts | llc -O3 | g++ -shared -xassembler - -o $TARGET $SHLINKFLAGS $_LIBDIRFLAGS $_LIBFLAGS"
43 env["LINKCOM"]="llvm-link $SOURCES | opt -disable-internalize -std-link-opts | llc -O3 | g++ -xassembler -o $TARGET - $LINKFLAGS $_LIBDIRFLAGS $_LIBFLAGS"
45 env["SHLINKCOM"]="llvm-link $SOURCES | llc | g++ -shared -xassembler -fPIC -o $TARGET - $SHLINKFLAGS $_LIBDIRFLAGS $_LIBFLAGS"
46 env["LINKCOM"]="llvm-link $SOURCES | llc | g++ -xassembler -o $TARGET - $LINKFLAGS $_LIBDIRFLAGS $_LIBFLAGS"
49 # Init variables, and make sure they're around for appending to
50 # These variables are the ones used by the actual compilation. We construct
51 # them from ccflags/libs in varying ways depending on which compiler is used,
53 env['CPPPATH']=["#g_src/fmodexinclude"]
54 env['CCFLAGS']=["-Dunix"]
55 env['CXXFLAGS'].append("-std=gnu++0x")
56 env['LIBS']=["SDL_image","z","SDL_ttf"]
57 # If there's a library in the libs folder it will get linked over a system one.
58 env['LIBPATH']=["#libs"]
60 env['LIBPATH'].append("/usr/lib32")
61 env['LINKFLAGS']=["-Wl,--as-needed"]
62 #env['LINKFLAGS'].append('-Wl,-rpath=\$$ORIGIN/libs')
65 env["CPPPATH"].append('#g_src/glext')
66 env["CCFLAGS"].append('-DGLEW_STATIC') # Should only be needed on windows, but can't hurt.
68 # Generic unix, including Linux
69 if not clang and not M64:
71 env['LINKFLAGS'].append("-m32")
72 env["CCFLAGS"].append("-m32")
74 env.ParseConfig('pkg-config gtk+-2.0 --cflags --libs')
75 env.Append(CPPFLAGS = '-DHAVE_GTK2')
77 print 'gtk+-2.0 not found!'
79 env.ParseConfig('pkg-config openal --cflags')
80 env.ParseConfig('pkg-config sndfile --cflags')
81 env.ParseConfig('pkg-config sdl --cflags --libs')
83 env.ParseConfig('pkg-config glu --cflags --libs')
84 env.Append(CPPFLAGS = '-DWANT_GL')
86 print 'glu not found, disabling GL'
90 env["CCFLAGS"].append("-pg")
91 env['LINKFLAGS'].append("-pg")
96 env["CCFLAGS"]+=["-fomit-frame-pointer"]
98 env["CCFLAGS"]+=["-O3","-march=pentium3","-mfpmath=sse"]
100 env["CCFLAGS"]+=["-O3"]
102 env["CCFLAGS"].append("-O2") # Only to reduce WPO time
105 env["CCFLAGS"].append("-ggdb")
106 env["CCFLAGS"].append("-DDEBUG")
108 # Finally, do the build
110 env.SharedLibrary(dll, src_dll)
113 env.Program("#tetris", src_dll + ["tetris.cpp"])