Skip to content

Commit f66d370

Browse files
committed
- rewrote doxygen documentation generation integration with Scons (still need some clean-up): list of sources is explicitly passed to a doxyfile builder which is used as input of a doxygen builder. Hence, the doxyfile depends on all the sources.
- documentation is now correctly generated once when source are changed on the first scons run.
1 parent 4882d0a commit f66d370

5 files changed

Lines changed: 211 additions & 212 deletions

File tree

SConstruct

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ options.Add( EnumOption('platform',
1515
try:
1616
platform = ARGUMENTS['platform']
1717
if platform == 'linux-gcc':
18-
CXX = 'g++' # not quite right, but env is not yet available.
19-
import commands
20-
version = commands.getoutput('%s -dumpversion' %CXX)
21-
platform = 'linux-gcc-%s' %version
22-
print "Using platform '%s'" %platform
23-
LD_LIBRARY_PATH = os.environ.get('LD_LIBRARY_PATH', '')
24-
LD_LIBRARY_PATH = "%s:libs/%s" %(LD_LIBRARY_PATH, platform)
25-
os.environ['LD_LIBRARY_PATH'] = LD_LIBRARY_PATH
26-
print "LD_LIBRARY_PATH =", LD_LIBRARY_PATH
18+
CXX = 'g++' # not quite right, but env is not yet available.
19+
import commands
20+
version = commands.getoutput('%s -dumpversion' %CXX)
21+
platform = 'linux-gcc-%s' %version
22+
print "Using platform '%s'" %platform
23+
LD_LIBRARY_PATH = os.environ.get('LD_LIBRARY_PATH', '')
24+
LD_LIBRARY_PATH = "%s:libs/%s" %(LD_LIBRARY_PATH, platform)
25+
os.environ['LD_LIBRARY_PATH'] = LD_LIBRARY_PATH
26+
print "LD_LIBRARY_PATH =", LD_LIBRARY_PATH
2727
except KeyError:
2828
print 'You must specify a "platform"'
2929
sys.exit(2)
@@ -95,6 +95,7 @@ env.Tool('doxygen')
9595
env.Tool('substinfile')
9696
env.Tool('targz')
9797
env.Tool('srcdist')
98+
env.Tool('glob')
9899

99100
env.Append( CPPPATH = ['#include'],
100101
LIBPATH = lib_dir )
@@ -165,9 +166,6 @@ def runJSONTests_action( target, source = None, env = None ):
165166
def runJSONTests_string( target, source = None, env = None ):
166167
return 'RunJSONTests("%s")' % source
167168

168-
##def buildDoc( doxyfile_path ):
169-
## doc_cmd = env.Doxygen( doxyfile_path )
170-
171169
import SCons.Action
172170
ActionFactory = SCons.Action.ActionFactory
173171
RunJSONTests = ActionFactory(runJSONTests_action, runJSONTests_string )
@@ -182,4 +180,5 @@ env.Alias( 'src-dist', srcdist_cmd )
182180
buildProjectInDirectory( 'src/jsontestrunner' )
183181
buildProjectInDirectory( 'src/lib_json' )
184182
buildProjectInDirectory( 'doc' )
183+
#print env.Dump()
185184

doc/roadmap.dox

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
- look into iconv, icu and windows API
2222
\section ms_strict Adds a strict mode to reader/parser
2323
Strict JSON support as specific in RFC 4627 (http://www.ietf.org/rfc/rfc4627.txt?number=4627).
24+
- Enforce only object or array as root element
25+
- Disable comment support
2426
\section ms_separation Expose json reader/writer API that do not impose using Json::Value.
2527
Some typical use-case involve an application specific structure to/from a JSON document.
2628
- Performance oriented parser/writer:

doc/sconscript

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,60 @@
11
Import( 'env' )
22
import os.path
33

4-
if 'doxygen' in env['TOOLS']:
5-
doc_topdir = env['ROOTBUILD_DIR']
6-
doxyfile = env.SubstInFile( '#doc/doxyfile', 'doxyfile.in',
7-
SUBST_DICT = {
8-
'%JSONCPP_VERSION%' : env['JSONCPP_VERSION'],
9-
'%TOPDIR%' : env.Dir('#').abspath,
10-
'%DOC_TOPDIR%' : str(doc_topdir) } )
11-
doc_cmd = env.Doxygen( doxyfile )
12-
alias_doc_cmd = env.Alias('doc', doc_cmd )
13-
env.AlwaysBuild(alias_doc_cmd)
4+
if 'doxygen' in env['TOOLS']:
5+
doc_topdir = str(env['ROOTBUILD_DIR'])
6+
html_dir = 'jsoncpp-api-doc'
147

15-
for dir in doc_cmd:
16-
env.Alias('doc', env.Install( '#' + dir.path, '#README.txt' ) )
17-
filename = os.path.split(dir.path)[1]
18-
targz_path = os.path.join( env['DIST_DIR'], '%s.tar.gz' % filename )
19-
zip_doc_cmd = env.TarGz( targz_path, [env.Dir(dir)],
20-
TARGZ_BASEDIR = doc_topdir )
21-
env.Depends( zip_doc_cmd, alias_doc_cmd )
22-
env.Alias( 'doc-dist', zip_doc_cmd )
8+
doxygen_inputs = env.Glob( includes = '*.dox', dir = '#doc' ) \
9+
+ env.Glob( includes = '*.h', dir = '#include/json/' ) \
10+
+ env.Glob( includes = ('*.dox','*.h','*.inl','*.cpp'),
11+
dir = '#src/lib_json' )
12+
## for p in doxygen_inputs:
13+
## print p.abspath
2314

24-
# When doxyfile gets updated, I get errors on the first pass.
25-
# I have to run scons twice. Something is wrong with the dependencies
26-
# here, but I avoid it by running "scons doc/doxyfile" first.
15+
top_dir = env.Dir('#').abspath
16+
include_top_dir = env.Dir('#include').abspath
17+
env['DOXYFILE_DICT'] = { 'PROJECT_NAME': 'JsonCpp',
18+
'PROJECT_NUMBER': env['JSONCPP_VERSION'],
19+
'STRIP_FROM_PATH': top_dir,
20+
'STRIP_FROM_INC_PATH': include_top_dir,
21+
'HTML_OUTPUT': html_dir,
22+
'HTML_HEADER': env.File('#doc/header.html').abspath,
23+
'HTML_FOOTER': env.File('#doc/footer.html').abspath,
24+
'INCLUDE_PATH': include_top_dir,
25+
'PREDEFINED': 'JSONCPP_DOC_EXCLUDE_IMPLEMENTATION JSON_VALUE_USE_INTERNAL_MAP'
26+
}
27+
env['DOXYFILE_FILE'] = 'doxyfile.in'
28+
doxfile_nodes = env.Doxyfile( os.path.join( doc_topdir, 'doxyfile' ), doxygen_inputs )
29+
html_doc_path = os.path.join( doc_topdir, html_dir )
30+
doc_nodes = env.Doxygen( source = doxfile_nodes,
31+
target = os.path.join( html_doc_path, 'index.html' ) )
32+
alias_doc_cmd = env.Alias('doc', doc_nodes )
33+
env.Alias('doc', env.Install( html_doc_path, '#README.txt' ) )
34+
targz_path = os.path.join( env['DIST_DIR'], '%s.tar.gz' % html_dir )
35+
zip_doc_cmd = env.TarGz( targz_path, [env.Dir(html_doc_path)],
36+
TARGZ_BASEDIR = env['ROOTBUILD_DIR'] )
37+
env.Depends( zip_doc_cmd, alias_doc_cmd )
38+
env.Alias( 'doc-dist', zip_doc_cmd )
39+
##
40+
## doxyfile = env.SubstInFile( '#doc/doxyfile', 'doxyfile.in',
41+
## SUBST_DICT = {
42+
## '%JSONCPP_VERSION%' : env['JSONCPP_VERSION'],
43+
## '%TOPDIR%' : env.Dir('#').abspath,
44+
## '%DOC_TOPDIR%' : str(doc_topdir) } )
45+
## doc_cmd = env.Doxygen( doxyfile )
46+
## alias_doc_cmd = env.Alias('doc', doc_cmd )
47+
## env.AlwaysBuild(alias_doc_cmd)
48+
##
49+
## for dir in doc_cmd:
50+
## env.Alias('doc', env.Install( '#' + dir.path, '#README.txt' ) )
51+
## filename = os.path.split(dir.path)[1]
52+
## targz_path = os.path.join( env['DIST_DIR'], '%s.tar.gz' % filename )
53+
## zip_doc_cmd = env.TarGz( targz_path, [env.Dir(dir)],
54+
## TARGZ_BASEDIR = doc_topdir )
55+
## env.Depends( zip_doc_cmd, alias_doc_cmd )
56+
## env.Alias( 'doc-dist', zip_doc_cmd )
57+
##
58+
## # When doxyfile gets updated, I get errors on the first pass.
59+
## # I have to run scons twice. Something is wrong with the dependencies
60+
## # here, but I avoid it by running "scons doc/doxyfile" first.

0 commit comments

Comments
 (0)