Permalink
Browse files

Improve SConstruct file.

Thanks to Elan Ruusamäe and Milan Bouchet-Valat.

The current version doesn't allow to switch configurations yet.

BUG=42
  • Loading branch information...
floitsch committed Dec 23, 2013
1 parent 3c10962 commit 3833c5ca25dcf026b46e29df8c18efa97ed39a3e
Showing with 44 additions and 8 deletions.
  1. +1 −0 AUTHORS
  2. +3 −0 Changelog
  3. +40 −8 SConstruct
View
@@ -11,3 +11,4 @@ Jeff Muizelaar <jmuizelaar@mozilla.com>
Mike Hommey <mhommey@mozilla.com>
Martin Olsson <mnemo@minimum.se>
Kent Williams <chaircrusher@gmail.com>
Elan Ruusamäe <glen@delfi.ee>
View
@@ -1,3 +1,6 @@
2013-12-23:
Improved SConstruct file. Thanks to Milan Bouchet-Valat and Elan Ruusamäe.
2013-11-09:
Tagged v2.0.0.
String-to-Double|Float: ALLOW_LEADING_SPACES and similar flags now include
View
@@ -1,14 +1,46 @@
# vim:ft=python
import os
double_conversion_sources = ['src/' + x for x in SConscript('src/SConscript')]
double_conversion_test_sources = ['test/cctest/' + x for x in SConscript('test/cctest/SConscript')]
test = double_conversion_sources + double_conversion_test_sources
print(test)
env = Environment(CPPPATH='#/src', LIBS=['m', 'stdc++'])
DESTDIR = ARGUMENTS.get('DESTDIR', '')
prefix = ARGUMENTS.get('prefix', '/usr/local')
lib = ARGUMENTS.get('libsuffix', 'lib')
libdir = os.path.join(DESTDIR + prefix, lib)
env = Environment(CPPPATH='#/src', LIBS=['m', 'stdc++'],
CXXFLAGS=ARGUMENTS.get('CXXFLAGS', ''))
debug = ARGUMENTS.get('debug', 0)
optimize = ARGUMENTS.get('optimize', 0)
env.Replace(CXX = ARGUMENTS.get('CXX', 'g++'))
# for shared lib, requires scons 2.3.0
env['SHLIBVERSION'] = '0.0.0'
CCFLAGS = []
if int(debug):
env.Append(CCFLAGS = '-g -Wall -Werror')
CCFLAGS.append(ARGUMENTS.get('CXXFLAGS', '-g -Wall -Werror'))
if int(optimize):
env.Append(CCFLAGS = '-O3')
print double_conversion_sources
print double_conversion_test_sources
env.Program('run_tests', double_conversion_sources + double_conversion_test_sources)
CCFLAGS.append(ARGUMENTS.get('CXXFLAGS', '-O3'))
env.Append(CCFLAGS = " ".join(CCFLAGS))
double_conversion_shared_objects = [
env.SharedObject(src) for src in double_conversion_sources]
double_conversion_static_objects = [
env.StaticObject(src) for src in double_conversion_sources]
library_name = 'double-conversion'
static_lib = env.StaticLibrary(library_name, double_conversion_static_objects)
static_lib_pic = env.StaticLibrary(library_name + '_pic', double_conversion_shared_objects)
shared_lib = env.SharedLibrary(library_name, double_conversion_shared_objects)
env.Program('run_tests', double_conversion_test_sources, LIBS=[static_lib])
env.InstallVersionedLib(libdir, shared_lib)
env.Install(libdir, static_lib)
env.Install(libdir, static_lib_pic)
env.Alias('install', libdir)

0 comments on commit 3833c5c

Please sign in to comment.