Skip to content

Commit 4cd8bae

Browse files
committed
- reorganized repository to match standard layout
1 parent d3a114c commit 4cd8bae

103 files changed

Lines changed: 7722 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Baptiste Lepilleur <blep@users.sourceforge.net>

README.txt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
* Introduction:
2+
3+
JSON (JavaScript Object Notation) is a lightweight data-interchange format.
4+
It can represent integer, real number, string, an ordered sequence of
5+
value, and a collection of name/value pairs.
6+
7+
JsonCpp is a simple API to manipulate JSON value, and handle serialization
8+
and unserialization to string.
9+
10+
It can also preserve existing comment in unserialization/serialization steps,
11+
making it a convenient format to store user input files.
12+
13+
Unserialization parsing is user friendly and provides precise error reports.
14+
15+
* Building/Testing:
16+
17+
JsonCpp uses Scons (http://www.scons.org) as a build system. Scons requires
18+
python to be installed (http://www.python.org).
19+
20+
You download scons-local distribution from the following url:
21+
http://sourceforge.net/project/showfiles.php?group_id=30337&package_id=67375
22+
23+
Unzip it in the directory where you found this README file. scons.py Should be
24+
at the same level as README.
25+
26+
python scons.py platform=PLTFRM [TARGET]
27+
where PLTFRM may be one of:
28+
suncc Sun C++ (Solaris)
29+
vacpp Visual Age C++ (AIX)
30+
mingw
31+
msvc6 Microsoft Visual Studio 6 service pack 5-6
32+
msvc70 Microsoft Visual Studio 2002
33+
msvc71 Microsoft Visual Studio 2003
34+
msvc80 Microsoft Visual Studio 2005
35+
linux-gcc Gnu C++ (linux, also reported to work for Mac OS X)
36+
37+
adding platform is fairly simple. You need to change the Sconstruct file
38+
to do so.
39+
40+
and TARGET may be:
41+
check: build library and run unit tests.
42+
doc: build documentation
43+
doc-dist: build documentation tarball
44+

SConstruct

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
import os
2+
import os.path
3+
import sys
4+
5+
JSONCPP_VERSION = '0.1'
6+
DIST_DIR = '#dist'
7+
8+
options = Options()
9+
options.Add( EnumOption('platform',
10+
'Platform (compiler/stl) used to build the project',
11+
'msvc71',
12+
allowed_values='suncc vacpp mingw msvc6 msvc7 msvc71 msvc80 linux-gcc'.split(),
13+
ignorecase=2) )
14+
15+
try:
16+
platform = ARGUMENTS['platform']
17+
except KeyError:
18+
print 'You must specify a "platform"'
19+
sys.exit(2)
20+
21+
print "Building using PLATFORM =", platform
22+
23+
rootbuild_dir = Dir('#buildscons')
24+
build_dir = os.path.join( '#buildscons', platform )
25+
bin_dir = os.path.join( '#bin', platform )
26+
lib_dir = os.path.join( '#libs', platform )
27+
sconsign_dir_path = Dir(build_dir).abspath
28+
sconsign_path = os.path.join( sconsign_dir_path, '.sconsign.dbm' )
29+
30+
# Ensure build directory exist (SConsignFile fail otherwise!)
31+
if not os.path.exists( sconsign_dir_path ):
32+
os.makedirs( sconsign_dir_path )
33+
34+
# Store all dependencies signature in a database
35+
SConsignFile( sconsign_path )
36+
37+
env = Environment( ENV = {'PATH' : os.environ['PATH']},
38+
toolpath = ['scons-tools'],
39+
tools=[] ) #, tools=['default'] )
40+
41+
if platform == 'suncc':
42+
env.Tool( 'sunc++' )
43+
env.Tool( 'sunlink' )
44+
env.Tool( 'sunar' )
45+
env.Append( LIBS = ['pthreads'] )
46+
elif platform == 'vacpp':
47+
env.Tool( 'default' )
48+
env.Tool( 'aixcc' )
49+
env['CXX'] = 'xlC_r' #scons does not pick-up the correct one !
50+
# using xlC_r ensure multi-threading is enabled:
51+
# http://publib.boulder.ibm.com/infocenter/pseries/index.jsp?topic=/com.ibm.vacpp7a.doc/compiler/ref/cuselect.htm
52+
env.Append( CCFLAGS = '-qrtti=all',
53+
LINKFLAGS='-bh:5' ) # -bh:5 remove duplicate symbol warning
54+
elif platform == 'msvc6':
55+
env['MSVS_VERSION']='6.0'
56+
for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
57+
env.Tool( tool )
58+
env['CXXFLAGS']='-GR -GX /nologo /MT'
59+
elif platform == 'msvc70':
60+
env['MSVS_VERSION']='7.0'
61+
for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
62+
env.Tool( tool )
63+
env['CXXFLAGS']='-GR -GX /nologo /MT'
64+
elif platform == 'msvc71':
65+
env['MSVS_VERSION']='7.1'
66+
for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
67+
env.Tool( tool )
68+
env['CXXFLAGS']='-GR -GX /nologo /MT'
69+
elif platform == 'msvc80':
70+
env['MSVS_VERSION']='8.0'
71+
for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
72+
env.Tool( tool )
73+
env['CXXFLAGS']='-GR -EHsc /nologo /MT'
74+
elif platform == 'mingw':
75+
env.Tool( 'mingw' )
76+
env.Append( CPPDEFINES=[ "WIN32", "NDEBUG", "_MT" ] )
77+
elif platform == 'linux-gcc':
78+
env.Tool( 'default' )
79+
env.Append( LIBS = ['pthread'] )
80+
else:
81+
print "UNSUPPORTED PLATFORM."
82+
env.Exit(1)
83+
84+
env.Tool('doxygen')
85+
env.Tool('substinfile')
86+
env.Tool('targz')
87+
env.Tool('srcdist')
88+
89+
env.Append( CPPPATH = ['#include'],
90+
LIBPATH = lib_dir )
91+
short_platform = platform
92+
if short_platform.startswith('msvc'):
93+
short_platform = short_platform[2:]
94+
env['LIB_PLATFORM'] = short_platform
95+
env['LIB_LINK_TYPE'] = 'lib' # static
96+
env['LIB_CRUNTIME'] = 'mt'
97+
env['LIB_NAME_SUFFIX'] = '${LIB_PLATFORM}_${LIB_LINK_TYPE}${LIB_CRUNTIME}' # must match autolink naming convention
98+
env['JSONCPP_VERSION'] = JSONCPP_VERSION
99+
env['BUILD_DIR'] = env.Dir(build_dir)
100+
env['ROOTBUILD_DIR'] = env.Dir(rootbuild_dir)
101+
env['DIST_DIR'] = DIST_DIR
102+
class SrcDistAdder:
103+
def __init__( self, env ):
104+
self.env = env
105+
def __call__( self, *args, **kw ):
106+
apply( self.env.SrcDist, (self.env['SRCDIST_TARGET'],) + args, kw )
107+
env['SRCDIST_ADD'] = SrcDistAdder( env )
108+
env['SRCDIST_TARGET'] = os.path.join( DIST_DIR, 'jsoncpp-src-%s.tar.gz' % env['JSONCPP_VERSION'] )
109+
env['SRCDIST_BUILDER'] = env.TarGz
110+
111+
env_testing = env.Copy( )
112+
env_testing.Append( LIBS = ['json_${LIB_NAME_SUFFIX}'] )
113+
114+
def buildJSONExample( env, target_sources, target_name ):
115+
env = env.Copy()
116+
env.Append( CPPPATH = ['#'] )
117+
exe = env.Program( target=target_name,
118+
source=target_sources )
119+
env['SRCDIST_ADD']( source=[target_sources] )
120+
global bin_dir
121+
return env.Install( bin_dir, exe )
122+
123+
def buildJSONTests( env, target_sources, target_name ):
124+
jsontests_node = buildJSONExample( env, target_sources, target_name )
125+
check_alias_target = env.Alias( 'check', jsontests_node, RunJSONTests( jsontests_node, jsontests_node ) )
126+
env.AlwaysBuild( check_alias_target )
127+
128+
def buildLibary( env, target_sources, target_name ):
129+
static_lib = env.StaticLibrary( target=target_name + '_${LIB_NAME_SUFFIX}',
130+
source=target_sources )
131+
global lib_dir
132+
env.Install( lib_dir, static_lib )
133+
env['SRCDIST_ADD']( source=[target_sources] )
134+
135+
Export( 'env env_testing buildJSONExample buildLibary buildJSONTests' )
136+
137+
def buildProjectInDirectory( target_directory ):
138+
global build_dir
139+
target_build_dir = os.path.join( build_dir, target_directory )
140+
target = os.path.join( target_directory, 'sconscript' )
141+
SConscript( target, build_dir=target_build_dir, duplicate=0 )
142+
env['SRCDIST_ADD']( source=[target] )
143+
144+
145+
def runJSONTests_action( target, source = None, env = None ):
146+
# Add test scripts to python path
147+
jsontest_path = Dir( '#test' ).abspath
148+
sys.path.insert( 0, jsontest_path )
149+
import runjsontests
150+
return runjsontests.runAllTests( os.path.abspath(source), jsontest_path )
151+
152+
def runJSONTests_string( target, source = None, env = None ):
153+
return 'RunJSONTests("%s")' % source
154+
155+
##def buildDoc( doxyfile_path ):
156+
## doc_cmd = env.Doxygen( doxyfile_path )
157+
158+
import SCons.Action
159+
ActionFactory = SCons.Action.ActionFactory
160+
RunJSONTests = ActionFactory(runJSONTests_action, runJSONTests_string )
161+
162+
env.Alias( 'check' )
163+
164+
srcdist_cmd = env['SRCDIST_ADD']( source = """
165+
AUTHORS README.txt SConstruct
166+
""".split() )
167+
env.Alias( 'src-dist', srcdist_cmd )
168+
169+
buildProjectInDirectory( 'src/jsontestrunner' )
170+
buildProjectInDirectory( 'src/lib_json' )
171+
buildProjectInDirectory( 'doc' )

0 commit comments

Comments
 (0)