allow source files in arbitrary subdirectories under src/*; allow C source files in addition to C++
This commit is contained in:
parent
f06dbf7bac
commit
9b993f2028
21
SConstruct
21
SConstruct
@ -9,6 +9,16 @@ server_name = client_name + '-server'
|
|||||||
|
|
||||||
CCFS_ROOT = 'assets/fs'
|
CCFS_ROOT = 'assets/fs'
|
||||||
|
|
||||||
|
def find_sources_under(path):
|
||||||
|
sources = []
|
||||||
|
for ent in os.listdir(path):
|
||||||
|
ent_path = '%s/%s' % (path, ent)
|
||||||
|
if re.search('\.cc?$', ent):
|
||||||
|
sources.append(ent_path)
|
||||||
|
elif os.path.isdir(ent_path):
|
||||||
|
sources += find_sources_under(ent_path)
|
||||||
|
return sources
|
||||||
|
|
||||||
# determine our build platform
|
# determine our build platform
|
||||||
platform = 'windows' if os.path.exists('/bin/cygwin1.dll') else 'unix'
|
platform = 'windows' if os.path.exists('/bin/cygwin1.dll') else 'unix'
|
||||||
|
|
||||||
@ -16,6 +26,7 @@ platform = 'windows' if os.path.exists('/bin/cygwin1.dll') else 'unix'
|
|||||||
SFML_VERSION = '2.0-rc'
|
SFML_VERSION = '2.0-rc'
|
||||||
BIN_DIR = 'bin'
|
BIN_DIR = 'bin'
|
||||||
CXX = 'g++'
|
CXX = 'g++'
|
||||||
|
CC = 'gcc'
|
||||||
CXXFLAGS = ['-Wall', '-O2']
|
CXXFLAGS = ['-Wall', '-O2']
|
||||||
LINKFLAGS = []
|
LINKFLAGS = []
|
||||||
LIBS_client = []
|
LIBS_client = []
|
||||||
@ -33,6 +44,7 @@ for dirent in os.listdir('src'):
|
|||||||
if platform == 'windows':
|
if platform == 'windows':
|
||||||
# Windows-specific environment settings
|
# Windows-specific environment settings
|
||||||
CXX = 'i686-pc-mingw32-g++'
|
CXX = 'i686-pc-mingw32-g++'
|
||||||
|
CC = 'i686-pc-mingw32-gcc'
|
||||||
MINGW_DIR = '/usr/i686-pc-mingw32/sys-root/mingw/bin'
|
MINGW_DIR = '/usr/i686-pc-mingw32/sys-root/mingw/bin'
|
||||||
LIBS_client += ['sfml-graphics-s', 'sfml-window-s', 'sfml-system-s',
|
LIBS_client += ['sfml-graphics-s', 'sfml-window-s', 'sfml-system-s',
|
||||||
'sfml-network-s', 'opengl32', 'glu32', 'mingw32']
|
'sfml-network-s', 'opengl32', 'glu32', 'mingw32']
|
||||||
@ -47,11 +59,15 @@ else:
|
|||||||
LINKFLAGS.append('-Wl,-R%s/lib' % SFML_PATH)
|
LINKFLAGS.append('-Wl,-R%s/lib' % SFML_PATH)
|
||||||
|
|
||||||
# our sources
|
# our sources
|
||||||
sources_client = [Glob('src/common/*.cc'), Glob('src/client/*.cc')]
|
sources_client = (find_sources_under('src/common') +
|
||||||
sources_server = [Glob('src/common/*.cc'), Glob('src/server/*.cc'), 'src/client/ccfs.cc']
|
find_sources_under('src/client'))
|
||||||
|
sources_server = (find_sources_under('src/common') +
|
||||||
|
find_sources_under('src/server') +
|
||||||
|
['src/client/ccfs.cc'])
|
||||||
|
|
||||||
# create the scons environments
|
# create the scons environments
|
||||||
env_client = Environment(
|
env_client = Environment(
|
||||||
|
CC = CC,
|
||||||
CXX = CXX,
|
CXX = CXX,
|
||||||
CPPFLAGS = CPPFLAGS,
|
CPPFLAGS = CPPFLAGS,
|
||||||
CXXFLAGS = CXXFLAGS,
|
CXXFLAGS = CXXFLAGS,
|
||||||
@ -60,6 +76,7 @@ env_client = Environment(
|
|||||||
LIBS = LIBS_client)
|
LIBS = LIBS_client)
|
||||||
env_server = Environment(
|
env_server = Environment(
|
||||||
OBJSUFFIX = '-server.o',
|
OBJSUFFIX = '-server.o',
|
||||||
|
CC = CC,
|
||||||
CXX = CXX,
|
CXX = CXX,
|
||||||
CPPFLAGS = CPPFLAGS,
|
CPPFLAGS = CPPFLAGS,
|
||||||
CXXFLAGS = CXXFLAGS,
|
CXXFLAGS = CXXFLAGS,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user