Permalink
Browse files

Just testing svn commit.

git-svn-id: svn://svn.code.sf.net/p/jsoncpp/code@147 1f120ed1-78a5-a849-adca-83f0a9e25bb6
  • Loading branch information...
1 parent e4d5d86 commit 3320755286b6290b6a1e33ffa1c609442c823c79 christopherdunn committed Mar 23, 2010
Showing with 14,547 additions and 0 deletions.
  1. +1 −0 branches/jsoncpp/cdunn-146/AUTHORS
  2. +1 −0 branches/jsoncpp/cdunn-146/LICENSE
  3. +21 −0 branches/jsoncpp/cdunn-146/NEWS.txt
  4. +122 −0 branches/jsoncpp/cdunn-146/README.txt
  5. +248 −0 branches/jsoncpp/cdunn-146/SConstruct
  6. +1 −0 branches/jsoncpp/cdunn-146/devtools/__init__.py
  7. +201 −0 branches/jsoncpp/cdunn-146/devtools/antglob.py
  8. +63 −0 branches/jsoncpp/cdunn-146/devtools/fixeol.py
  9. +53 −0 branches/jsoncpp/cdunn-146/devtools/tarball.py
  10. +1,534 −0 branches/jsoncpp/cdunn-146/doc/doxyfile.in
  11. +23 −0 branches/jsoncpp/cdunn-146/doc/footer.html
  12. +24 −0 branches/jsoncpp/cdunn-146/doc/header.html
  13. +123 −0 branches/jsoncpp/cdunn-146/doc/jsoncpp.dox
  14. +1 −0 branches/jsoncpp/cdunn-146/doc/readme.txt
  15. +32 −0 branches/jsoncpp/cdunn-146/doc/roadmap.dox
  16. +168 −0 branches/jsoncpp/cdunn-146/doxybuild.py
  17. +19 −0 branches/jsoncpp/cdunn-146/include/json/autolink.h
  18. +43 −0 branches/jsoncpp/cdunn-146/include/json/config.h
  19. +42 −0 branches/jsoncpp/cdunn-146/include/json/features.h
  20. +38 −0 branches/jsoncpp/cdunn-146/include/json/forwards.h
  21. +10 −0 branches/jsoncpp/cdunn-146/include/json/json.h
  22. +196 −0 branches/jsoncpp/cdunn-146/include/json/reader.h
  23. +1,050 −0 branches/jsoncpp/cdunn-146/include/json/value.h
  24. +174 −0 branches/jsoncpp/cdunn-146/include/json/writer.h
  25. +46 −0 branches/jsoncpp/cdunn-146/makefiles/vs71/jsoncpp.sln
  26. +119 −0 branches/jsoncpp/cdunn-146/makefiles/vs71/jsontest.vcproj
  27. +214 −0 branches/jsoncpp/cdunn-146/makefiles/vs71/lib_json.vcproj
  28. +130 −0 branches/jsoncpp/cdunn-146/makefiles/vs71/test_lib_json.vcproj
  29. +371 −0 branches/jsoncpp/cdunn-146/makerelease.py
  30. +53 −0 branches/jsoncpp/cdunn-146/scons-tools/globtool.py
  31. +179 −0 branches/jsoncpp/cdunn-146/scons-tools/srcdist.py
  32. +79 −0 branches/jsoncpp/cdunn-146/scons-tools/substinfile.py
  33. +82 −0 branches/jsoncpp/cdunn-146/scons-tools/targz.py
  34. +233 −0 branches/jsoncpp/cdunn-146/src/jsontestrunner/main.cpp
  35. +9 −0 branches/jsoncpp/cdunn-146/src/jsontestrunner/sconscript
  36. +125 −0 branches/jsoncpp/cdunn-146/src/lib_json/json_batchallocator.h
  37. +448 −0 branches/jsoncpp/cdunn-146/src/lib_json/json_internalarray.inl
  38. +607 −0 branches/jsoncpp/cdunn-146/src/lib_json/json_internalmap.inl
  39. +850 −0 branches/jsoncpp/cdunn-146/src/lib_json/json_reader.cpp
  40. +78 −0 branches/jsoncpp/cdunn-146/src/lib_json/json_tool.h
  41. +1,666 −0 branches/jsoncpp/cdunn-146/src/lib_json/json_value.cpp
  42. +292 −0 branches/jsoncpp/cdunn-146/src/lib_json/json_valueiterator.inl
  43. +814 −0 branches/jsoncpp/cdunn-146/src/lib_json/json_writer.cpp
  44. +8 −0 branches/jsoncpp/cdunn-146/src/lib_json/sconscript
  45. +603 −0 branches/jsoncpp/cdunn-146/src/test_lib_json/jsontest.cpp
  46. +254 −0 branches/jsoncpp/cdunn-146/src/test_lib_json/jsontest.h
  47. +244 −0 branches/jsoncpp/cdunn-146/src/test_lib_json/main.cpp
  48. +10 −0 branches/jsoncpp/cdunn-146/src/test_lib_json/sconscript
  49. +10 −0 branches/jsoncpp/cdunn-146/test/cleantests.py
  50. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_array_01.expected
  51. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_array_01.json
  52. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_array_02.expected
  53. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_array_02.json
  54. +6 −0 branches/jsoncpp/cdunn-146/test/data/test_array_03.expected
  55. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_array_03.json
  56. +5 −0 branches/jsoncpp/cdunn-146/test/data/test_array_04.expected
  57. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_array_04.json
  58. +100 −0 branches/jsoncpp/cdunn-146/test/data/test_array_05.expected
  59. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_array_05.json
  60. +5 −0 branches/jsoncpp/cdunn-146/test/data/test_array_06.expected
  61. +4 −0 branches/jsoncpp/cdunn-146/test/data/test_array_06.json
  62. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_01.expected
  63. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_01.json
  64. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_02.expected
  65. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_02.json
  66. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_03.expected
  67. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_03.json
  68. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_04.expected
  69. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_04.json
  70. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_05.expected
  71. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_05.json
  72. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_06.expected
  73. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_06.json
  74. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_07.expected
  75. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_07.json
  76. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_08.expected
  77. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_08.json
  78. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_09.expected
  79. +4 −0 branches/jsoncpp/cdunn-146/test/data/test_basic_09.json
  80. +8 −0 branches/jsoncpp/cdunn-146/test/data/test_comment_01.expected
  81. +8 −0 branches/jsoncpp/cdunn-146/test/data/test_comment_01.json
  82. +20 −0 branches/jsoncpp/cdunn-146/test/data/test_complex_01.expected
  83. +17 −0 branches/jsoncpp/cdunn-146/test/data/test_complex_01.json
  84. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_integer_01.expected
  85. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_integer_01.json
  86. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_integer_02.expected
  87. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_integer_02.json
  88. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_integer_03.expected
  89. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_integer_03.json
  90. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_integer_04.expected
  91. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_integer_04.json
  92. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_integer_05.expected
  93. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_integer_05.json
  94. +2,122 −0 branches/jsoncpp/cdunn-146/test/data/test_large_01.expected
  95. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_large_01.json
  96. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_object_01.expected
  97. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_object_01.json
  98. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_object_02.expected
  99. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_object_02.json
  100. +4 −0 branches/jsoncpp/cdunn-146/test/data/test_object_03.expected
  101. +5 −0 branches/jsoncpp/cdunn-146/test/data/test_object_03.json
  102. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_object_04.expected
  103. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_object_04.json
  104. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_preserve_comment_01.expected
  105. +14 −0 branches/jsoncpp/cdunn-146/test/data/test_preserve_comment_01.json
  106. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_real_01.expected
  107. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_real_01.json
  108. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_real_02.expected
  109. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_real_02.json
  110. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_real_03.expected
  111. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_real_03.json
  112. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_real_04.expected
  113. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_real_04.json
  114. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_real_05.expected
  115. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_real_05.json
  116. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_real_06.expected
  117. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_real_06.json
  118. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_real_07.expected
  119. +3 −0 branches/jsoncpp/cdunn-146/test/data/test_real_07.json
  120. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_string_01.expected
  121. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_string_01.json
  122. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_string_02.expected
  123. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_string_02.json
  124. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_string_unicode_01.expected
  125. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_string_unicode_01.json
  126. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_string_unicode_02.expected
  127. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_string_unicode_02.json
  128. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_string_unicode_03.expected
  129. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_string_unicode_03.json
  130. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_string_unicode_04.expected
  131. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_string_unicode_04.json
  132. +2 −0 branches/jsoncpp/cdunn-146/test/data/test_string_unicode_05.expected
  133. +1 −0 branches/jsoncpp/cdunn-146/test/data/test_string_unicode_05.json
  134. +11 −0 branches/jsoncpp/cdunn-146/test/generate_expected.py
  135. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail1.json
  136. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail10.json
  137. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail11.json
  138. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail12.json
  139. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail13.json
  140. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail14.json
  141. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail15.json
  142. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail16.json
  143. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail17.json
  144. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail18.json
  145. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail19.json
  146. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail2.json
  147. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail20.json
  148. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail21.json
  149. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail22.json
  150. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail23.json
  151. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail24.json
  152. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail25.json
  153. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail26.json
  154. +2 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail27.json
  155. +2 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail28.json
  156. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail29.json
  157. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail3.json
  158. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail30.json
  159. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail31.json
  160. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail32.json
  161. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail33.json
  162. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail4.json
  163. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail5.json
  164. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail6.json
  165. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail7.json
  166. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail8.json
  167. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/fail9.json
  168. +58 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/pass1.json
  169. +1 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/pass2.json
  170. +6 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/pass3.json
  171. +3 −0 branches/jsoncpp/cdunn-146/test/jsonchecker/readme.txt
  172. +64 −0 branches/jsoncpp/cdunn-146/test/pyjsontestrunner.py
  173. +134 −0 branches/jsoncpp/cdunn-146/test/runjsontests.py
  174. +73 −0 branches/jsoncpp/cdunn-146/test/rununittests.py
  175. +1 −0 branches/jsoncpp/cdunn-146/version
@@ -0,0 +1 @@
+Baptiste Lepilleur <blep@users.sourceforge.net>
@@ -0,0 +1 @@
+The json-cpp library and this documentation are in Public Domain.
@@ -0,0 +1,21 @@
+ New in JsonCpp 0.6.0:
+ ---------------------
+
+* Compilation
+
+ - LD_LIBRARY_PATH and LIBRARY_PATH environment variables are now propagated to the build
+ environment as this is required for some compiler installation.
+
+ - Added support for Microsoft Visual Studio 2008 (bug #2930462):
+ The platform "msvc90" has been added.
+
+ Notes: you need to setup the environment by running vcvars32.bat
+ (e.g. MSVC 2008 command prompt in start menu) before running scons.
+
+* Value
+
+ - Removed experimental ValueAllocator, it caused static
+ initialization/destruction order issues (bug #2934500).
+ The DefaultValueAllocator has been inlined in code.
+
+
@@ -0,0 +1,122 @@
+* Introduction:
+ =============
+
+JSON (JavaScript Object Notation) is a lightweight data-interchange format.
+It can represent integer, real number, string, an ordered sequence of
+value, and a collection of name/value pairs.
+
+JsonCpp is a simple API to manipulate JSON value, handle serialization
+and unserialization to string.
+
+It can also preserve existing comment in unserialization/serialization steps,
+making it a convenient format to store user input files.
+
+Unserialization parsing is user friendly and provides precise error reports.
+
+
+* Building/Testing:
+ =================
+
+JsonCpp uses Scons (http://www.scons.org) as a build system. Scons requires
+python to be installed (http://www.python.org).
+
+You download scons-local distribution from the following url:
+http://sourceforge.net/project/showfiles.php?group_id=30337&package_id=67375
+
+Unzip it in the directory where you found this README file. scons.py Should be
+at the same level as README.
+
+python scons.py platform=PLTFRM [TARGET]
+where PLTFRM may be one of:
+ suncc Sun C++ (Solaris)
+ vacpp Visual Age C++ (AIX)
+ mingw
+ msvc6 Microsoft Visual Studio 6 service pack 5-6
+ msvc70 Microsoft Visual Studio 2002
+ msvc71 Microsoft Visual Studio 2003
+ msvc80 Microsoft Visual Studio 2005
+ msvc90 Microsoft Visual Studio 2008
+ linux-gcc Gnu C++ (linux, also reported to work for Mac OS X)
+
+Notes: if you are building with Microsoft Visual Studio 2008, you need to
+setup the environment by running vcvars32.bat (e.g. MSVC 2008 command prompt)
+before running scons.
+
+Adding platform is fairly simple. You need to change the Sconstruct file
+to do so.
+
+and TARGET may be:
+ check: build library and run unit tests.
+
+
+* Running the test manually:
+ ==========================
+
+cd test
+# This will run the Reader/Writer tests
+python runjsontests.py "path to jsontest.exe"
+
+# This will run the Reader/Writer tests, using JSONChecker test suite
+# (http://www.json.org/JSON_checker/).
+# Notes: not all tests pass: JsonCpp is too lenient (for example,
+# it allows an integer to start with '0'). The goal is to improve
+# strict mode parsing to get all tests to pass.
+python runjsontests.py --with-json-checker "path to jsontest.exe"
+
+# This will run the unit tests (mostly Value)
+python rununittests.py "path to test_lib_json.exe"
+
+You can run the tests using valgrind:
+python rununittests.py --valgrind "path to test_lib_json.exe"
+
+
+* Building the documentation:
+ ===========================
+
+Run the python script doxybuild.py from the top directory:
+
+python doxybuild.py --open --with-dot
+
+See doxybuild.py --help for options.
+
+
+* Adding a reader/writer test:
+ ============================
+
+To add a test, you need to create two files in test/data:
+- a TESTNAME.json file, that contains the input document in JSON format.
+- a TESTNAME.expected file, that contains a flatened representation of
+ the input document.
+
+TESTNAME.expected file format:
+- each line represents a JSON element of the element tree represented
+ by the input document.
+- each line has two parts: the path to access the element separated from
+ the element value by '='. Array and object values are always empty
+ (e.g. represented by either [] or {}).
+- element path: '.' represented the root element, and is used to separate
+ object members. [N] is used to specify the value of an array element
+ at index N.
+See test_complex_01.json and test_complex_01.expected to better understand
+element path.
+
+
+* Understanding reader/writer test output:
+ ========================================
+
+When a test is run, output files are generated aside the input test files.
+Below is a short description of the content of each file:
+
+- test_complex_01.json: input JSON document
+- test_complex_01.expected: flattened JSON element tree used to check if
+ parsing was corrected.
+
+- test_complex_01.actual: flattened JSON element tree produced by
+ jsontest.exe from reading test_complex_01.json
+- test_complex_01.rewrite: JSON document written by jsontest.exe using the
+ Json::Value parsed from test_complex_01.json and serialized using
+ Json::StyledWritter.
+- test_complex_01.actual-rewrite: flattened JSON element tree produced by
+ jsontest.exe from reading test_complex_01.rewrite.
+test_complex_01.process-output: jsontest.exe output, typically useful to
+ understand parsing error.
@@ -0,0 +1,248 @@
+"""
+Notes:
+- shared library support is buggy: it assumes that a static and dynamic library can be build from the same object files. This is not true on many platforms. For this reason it is only enabled on linux-gcc at the current time.
+
+To add a platform:
+- add its name in options allowed_values below
+- add tool initialization for this platform. Search for "if platform == 'suncc'" as an example.
+"""
+
+import os
+import os.path
+import sys
+
+JSONCPP_VERSION = open(File('#version').abspath,'rt').read().strip()
+DIST_DIR = '#dist'
+
+options = Variables()
+options.Add( EnumVariable('platform',
+ 'Platform (compiler/stl) used to build the project',
+ 'msvc71',
+ allowed_values='suncc vacpp mingw msvc6 msvc7 msvc71 msvc80 msvc90 linux-gcc'.split(),
+ ignorecase=2) )
+
+try:
+ platform = ARGUMENTS['platform']
+ if platform == 'linux-gcc':
+ CXX = 'g++' # not quite right, but env is not yet available.
+ import commands
+ version = commands.getoutput('%s -dumpversion' %CXX)
+ platform = 'linux-gcc-%s' %version
+ print "Using platform '%s'" %platform
+ LD_LIBRARY_PATH = os.environ.get('LD_LIBRARY_PATH', '')
+ LD_LIBRARY_PATH = "%s:libs/%s" %(LD_LIBRARY_PATH, platform)
+ os.environ['LD_LIBRARY_PATH'] = LD_LIBRARY_PATH
+ print "LD_LIBRARY_PATH =", LD_LIBRARY_PATH
+except KeyError:
+ print 'You must specify a "platform"'
+ sys.exit(2)
+
+print "Building using PLATFORM =", platform
+
+rootbuild_dir = Dir('#buildscons')
+build_dir = os.path.join( '#buildscons', platform )
+bin_dir = os.path.join( '#bin', platform )
+lib_dir = os.path.join( '#libs', platform )
+sconsign_dir_path = Dir(build_dir).abspath
+sconsign_path = os.path.join( sconsign_dir_path, '.sconsign.dbm' )
+
+# Ensure build directory exist (SConsignFile fail otherwise!)
+if not os.path.exists( sconsign_dir_path ):
+ os.makedirs( sconsign_dir_path )
+
+# Store all dependencies signature in a database
+SConsignFile( sconsign_path )
+
+def make_environ_vars():
+ """Returns a dictionnary with environment variable to use when compiling."""
+ # PATH is required to find the compiler
+ # TEMP is required for at least mingw
+ # LD_LIBRARY_PATH & co is required on some system for the compiler
+ vars = {}
+ for name in ('PATH', 'TEMP', 'TMP', 'LD_LIBRARY_PATH', 'LIBRARY_PATH'):
+ if name in os.environ:
+ vars[name] = os.environ[name]
+ return vars
+
+
+env = Environment( ENV = make_environ_vars(),
+ toolpath = ['scons-tools'],
+ tools=[] ) #, tools=['default'] )
+
+if platform == 'suncc':
+ env.Tool( 'sunc++' )
+ env.Tool( 'sunlink' )
+ env.Tool( 'sunar' )
+ env.Append( CCFLAGS = ['-mt'] )
+elif platform == 'vacpp':
+ env.Tool( 'default' )
+ env.Tool( 'aixcc' )
+ env['CXX'] = 'xlC_r' #scons does not pick-up the correct one !
+ # using xlC_r ensure multi-threading is enabled:
+ # http://publib.boulder.ibm.com/infocenter/pseries/index.jsp?topic=/com.ibm.vacpp7a.doc/compiler/ref/cuselect.htm
+ env.Append( CCFLAGS = '-qrtti=all',
+ LINKFLAGS='-bh:5' ) # -bh:5 remove duplicate symbol warning
+elif platform == 'msvc6':
+ env['MSVS_VERSION']='6.0'
+ for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
+ env.Tool( tool )
+ env['CXXFLAGS']='-GR -GX /nologo /MT'
+elif platform == 'msvc70':
+ env['MSVS_VERSION']='7.0'
+ for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
+ env.Tool( tool )
+ env['CXXFLAGS']='-GR -GX /nologo /MT'
+elif platform == 'msvc71':
+ env['MSVS_VERSION']='7.1'
+ for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
+ env.Tool( tool )
+ env['CXXFLAGS']='-GR -GX /nologo /MT'
+elif platform == 'msvc80':
+ env['MSVS_VERSION']='8.0'
+ for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
+ env.Tool( tool )
+ env['CXXFLAGS']='-GR -EHsc /nologo /MT'
+elif platform == 'msvc90':
+ env['MSVS_VERSION']='9.0'
+ # Scons 1.2 fails to detect the correct location of the platform SDK.
+ # So we propagate those from the environment. This requires that the
+ # user run vcvars32.bat before compiling.
+ if 'INCLUDE' in os.environ:
+ env['ENV']['INCLUDE'] = os.environ['INCLUDE']
+ if 'LIB' in os.environ:
+ env['ENV']['LIB'] = os.environ['LIB']
+ for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
+ env.Tool( tool )
+ env['CXXFLAGS']='-GR -EHsc /nologo /MT'
+elif platform == 'mingw':
+ env.Tool( 'mingw' )
+ env.Append( CPPDEFINES=[ "WIN32", "NDEBUG", "_MT" ] )
+elif platform.startswith('linux-gcc'):
+ env.Tool( 'default' )
+ env.Append( LIBS = ['pthread'], CCFLAGS = "-Wall" )
+ env['SHARED_LIB_ENABLED'] = True
+else:
+ print "UNSUPPORTED PLATFORM."
+ env.Exit(1)
+
+env.Tool('targz')
+env.Tool('srcdist')
+env.Tool('globtool')
+
+env.Append( CPPPATH = ['#include'],
+ LIBPATH = lib_dir )
+short_platform = platform
+if short_platform.startswith('msvc'):
+ short_platform = short_platform[2:]
+# Notes: on Windows you need to rebuild the source for each variant
+# Build script does not support that yet so we only build static libraries.
+# This also fails on AIX because both dynamic and static library ends with
+# extension .a.
+env['SHARED_LIB_ENABLED'] = env.get('SHARED_LIB_ENABLED', False)
+env['LIB_PLATFORM'] = short_platform
+env['LIB_LINK_TYPE'] = 'lib' # static
+env['LIB_CRUNTIME'] = 'mt'
+env['LIB_NAME_SUFFIX'] = '${LIB_PLATFORM}_${LIB_LINK_TYPE}${LIB_CRUNTIME}' # must match autolink naming convention
+env['JSONCPP_VERSION'] = JSONCPP_VERSION
+env['BUILD_DIR'] = env.Dir(build_dir)
+env['ROOTBUILD_DIR'] = env.Dir(rootbuild_dir)
+env['DIST_DIR'] = DIST_DIR
+if 'TarGz' in env['BUILDERS']:
+ class SrcDistAdder:
+ def __init__( self, env ):
+ self.env = env
+ def __call__( self, *args, **kw ):
+ apply( self.env.SrcDist, (self.env['SRCDIST_TARGET'],) + args, kw )
+ env['SRCDIST_BUILDER'] = env.TarGz
+else: # If tarfile module is missing
+ class SrcDistAdder:
+ def __init__( self, env ):
+ pass
+ def __call__( self, *args, **kw ):
+ pass
+env['SRCDIST_ADD'] = SrcDistAdder( env )
+env['SRCDIST_TARGET'] = os.path.join( DIST_DIR, 'jsoncpp-src-%s.tar.gz' % env['JSONCPP_VERSION'] )
+
+env_testing = env.Clone( )
+env_testing.Append( LIBS = ['json_${LIB_NAME_SUFFIX}'] )
+
+def buildJSONExample( env, target_sources, target_name ):
+ env = env.Clone()
+ env.Append( CPPPATH = ['#'] )
+ exe = env.Program( target=target_name,
+ source=target_sources )
+ env['SRCDIST_ADD']( source=[target_sources] )
+ global bin_dir
+ return env.Install( bin_dir, exe )
+
+def buildJSONTests( env, target_sources, target_name ):
+ jsontests_node = buildJSONExample( env, target_sources, target_name )
+ check_alias_target = env.Alias( 'check', jsontests_node, RunJSONTests( jsontests_node, jsontests_node ) )
+ env.AlwaysBuild( check_alias_target )
+
+def buildUnitTests( env, target_sources, target_name ):
+ jsontests_node = buildJSONExample( env, target_sources, target_name )
+ check_alias_target = env.Alias( 'check', jsontests_node,
+ RunUnitTests( jsontests_node, jsontests_node ) )
+ env.AlwaysBuild( check_alias_target )
+
+def buildLibrary( env, target_sources, target_name ):
+ static_lib = env.StaticLibrary( target=target_name + '_${LIB_NAME_SUFFIX}',
+ source=target_sources )
+ global lib_dir
+ env.Install( lib_dir, static_lib )
+ if env['SHARED_LIB_ENABLED']:
+ shared_lib = env.SharedLibrary( target=target_name + '_${LIB_NAME_SUFFIX}',
+ source=target_sources )
+ env.Install( lib_dir, shared_lib )
+ env['SRCDIST_ADD']( source=[target_sources] )
+
+Export( 'env env_testing buildJSONExample buildLibrary buildJSONTests buildUnitTests' )
+
+def buildProjectInDirectory( target_directory ):
+ global build_dir
+ target_build_dir = os.path.join( build_dir, target_directory )
+ target = os.path.join( target_directory, 'sconscript' )
+ SConscript( target, build_dir=target_build_dir, duplicate=0 )
+ env['SRCDIST_ADD']( source=[target] )
+
+
+def runJSONTests_action( target, source = None, env = None ):
+ # Add test scripts to python path
+ jsontest_path = Dir( '#test' ).abspath
+ sys.path.insert( 0, jsontest_path )
+ data_path = os.path.join( jsontest_path, 'data' )
+ import runjsontests
+ return runjsontests.runAllTests( os.path.abspath(source[0].path), data_path )
+
+def runJSONTests_string( target, source = None, env = None ):
+ return 'RunJSONTests("%s")' % source[0]
+
+import SCons.Action
+ActionFactory = SCons.Action.ActionFactory
+RunJSONTests = ActionFactory(runJSONTests_action, runJSONTests_string )
+
+def runUnitTests_action( target, source = None, env = None ):
+ # Add test scripts to python path
+ jsontest_path = Dir( '#test' ).abspath
+ sys.path.insert( 0, jsontest_path )
+ import rununittests
+ return rununittests.runAllTests( os.path.abspath(source[0].path) )
+
+def runUnitTests_string( target, source = None, env = None ):
+ return 'RunUnitTests("%s")' % source[0]
+
+RunUnitTests = ActionFactory(runUnitTests_action, runUnitTests_string )
+
+env.Alias( 'check' )
+
+srcdist_cmd = env['SRCDIST_ADD']( source = """
+ AUTHORS README.txt SConstruct
+ """.split() )
+env.Alias( 'src-dist', srcdist_cmd )
+
+buildProjectInDirectory( 'src/jsontestrunner' )
+buildProjectInDirectory( 'src/lib_json' )
+buildProjectInDirectory( 'src/test_lib_json' )
+#print env.Dump()
+
Oops, something went wrong.

0 comments on commit 3320755

Please sign in to comment.