Source

nektoo / games-roguelike / dwarf-fortress / files / SConscript-gentoo

# -*- mode: python -*-
from sys import platform
import os
import SCons.Util

src_dll = ["basics.cpp","command_line.cpp","enabler.cpp","files.cpp",
           "find_files_posix.cpp","graphics.cpp","init.cpp","interface.cpp",
           "keybindings.cpp","music_and_sound_openal.cpp", "random.cpp",
           "textlines.cpp","glew.c","enabler_input.cpp","ViewBase.cpp",
           "KeybindingScreen.cpp", "win32_compat.cpp", "textures.cpp",
           "resize++.cpp", "renderer_offscreen.cpp",
           "ttf_manager.cpp"]

dll  = '#libs/libgraphics.so'

libgraphics = True
tetris = False

# Propagate PATH. We'll just take our chances with non-repeatable builds.
env = Environment(ENV = {'PATH' : os.environ['PATH']})

# Libraries and linking
env['LIBS']=["SDL_image","z","SDL_ttf","sndfile"]
#env['LINKFLAGS']=['-Wl,-rpath=\$$ORIGIN/libs']

# GLEW
# latest portage version is incompatible, lets stick to the bundled one
env.Append(CPPPATH = ['glext/'])
env["CCFLAGS"].append("-DGLEW_STATIC") # Should only be needed on windows, but can't hurt.

# Generic unix, including Linux
env.ParseConfig('pkg-config gtk+-2.0 --cflags --libs')
env.ParseConfig('pkg-config openal --cflags')
env.ParseConfig('pkg-config sndfile --cflags')
env.ParseConfig('pkg-config sdl --cflags --libs')
env.ParseConfig('pkg-config glu --cflags --libs')

# flags and compiler
env['CCFLAGS'].append("-Dunix")
env['CXXFLAGS'].append("-std=gnu++0x")
# this is gentoo, respect my flags
env['CC'] = os.environ['CC']
env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
env['CXX'] = os.environ['CXX']
env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])

# Finally, do the build
if libgraphics:
   env.SharedLibrary(dll, src_dll)

if tetris:
   env.Program("#tetris", src_dll + ["tetris.cpp"])