Skip to content

Commit

Permalink
- rewrote doxygen documentation generation integration with Scons (st…
Browse files Browse the repository at this point in the history
…ill 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.
  • Loading branch information
blep committed Jan 20, 2008
1 parent 4882d0a commit f66d370
Show file tree
Hide file tree
Showing 5 changed files with 211 additions and 212 deletions.
23 changes: 11 additions & 12 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ options.Add( EnumOption('platform',
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
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)
Expand Down Expand Up @@ -95,6 +95,7 @@ env.Tool('doxygen')
env.Tool('substinfile')
env.Tool('targz')
env.Tool('srcdist')
env.Tool('glob')

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

##def buildDoc( doxyfile_path ):
## doc_cmd = env.Doxygen( doxyfile_path )

import SCons.Action
ActionFactory = SCons.Action.ActionFactory
RunJSONTests = ActionFactory(runJSONTests_action, runJSONTests_string )
Expand All @@ -182,4 +180,5 @@ env.Alias( 'src-dist', srcdist_cmd )
buildProjectInDirectory( 'src/jsontestrunner' )
buildProjectInDirectory( 'src/lib_json' )
buildProjectInDirectory( 'doc' )
#print env.Dump()

2 changes: 2 additions & 0 deletions doc/roadmap.dox
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
- look into iconv, icu and windows API
\section ms_strict Adds a strict mode to reader/parser
Strict JSON support as specific in RFC 4627 (http://www.ietf.org/rfc/rfc4627.txt?number=4627).
- Enforce only object or array as root element
- Disable comment support
\section ms_separation Expose json reader/writer API that do not impose using Json::Value.
Some typical use-case involve an application specific structure to/from a JSON document.
- Performance oriented parser/writer:
Expand Down
76 changes: 55 additions & 21 deletions doc/sconscript
Original file line number Diff line number Diff line change
@@ -1,26 +1,60 @@
Import( 'env' )
import os.path

if 'doxygen' in env['TOOLS']:
doc_topdir = env['ROOTBUILD_DIR']
doxyfile = env.SubstInFile( '#doc/doxyfile', 'doxyfile.in',
SUBST_DICT = {
'%JSONCPP_VERSION%' : env['JSONCPP_VERSION'],
'%TOPDIR%' : env.Dir('#').abspath,
'%DOC_TOPDIR%' : str(doc_topdir) } )
doc_cmd = env.Doxygen( doxyfile )
alias_doc_cmd = env.Alias('doc', doc_cmd )
env.AlwaysBuild(alias_doc_cmd)
if 'doxygen' in env['TOOLS']:
doc_topdir = str(env['ROOTBUILD_DIR'])
html_dir = 'jsoncpp-api-doc'

for dir in doc_cmd:
env.Alias('doc', env.Install( '#' + dir.path, '#README.txt' ) )
filename = os.path.split(dir.path)[1]
targz_path = os.path.join( env['DIST_DIR'], '%s.tar.gz' % filename )
zip_doc_cmd = env.TarGz( targz_path, [env.Dir(dir)],
TARGZ_BASEDIR = doc_topdir )
env.Depends( zip_doc_cmd, alias_doc_cmd )
env.Alias( 'doc-dist', zip_doc_cmd )
doxygen_inputs = env.Glob( includes = '*.dox', dir = '#doc' ) \
+ env.Glob( includes = '*.h', dir = '#include/json/' ) \
+ env.Glob( includes = ('*.dox','*.h','*.inl','*.cpp'),
dir = '#src/lib_json' )
## for p in doxygen_inputs:
## print p.abspath

# When doxyfile gets updated, I get errors on the first pass.
# I have to run scons twice. Something is wrong with the dependencies
# here, but I avoid it by running "scons doc/doxyfile" first.
top_dir = env.Dir('#').abspath
include_top_dir = env.Dir('#include').abspath
env['DOXYFILE_DICT'] = { 'PROJECT_NAME': 'JsonCpp',
'PROJECT_NUMBER': env['JSONCPP_VERSION'],
'STRIP_FROM_PATH': top_dir,
'STRIP_FROM_INC_PATH': include_top_dir,
'HTML_OUTPUT': html_dir,
'HTML_HEADER': env.File('#doc/header.html').abspath,
'HTML_FOOTER': env.File('#doc/footer.html').abspath,
'INCLUDE_PATH': include_top_dir,
'PREDEFINED': 'JSONCPP_DOC_EXCLUDE_IMPLEMENTATION JSON_VALUE_USE_INTERNAL_MAP'
}
env['DOXYFILE_FILE'] = 'doxyfile.in'
doxfile_nodes = env.Doxyfile( os.path.join( doc_topdir, 'doxyfile' ), doxygen_inputs )
html_doc_path = os.path.join( doc_topdir, html_dir )
doc_nodes = env.Doxygen( source = doxfile_nodes,
target = os.path.join( html_doc_path, 'index.html' ) )
alias_doc_cmd = env.Alias('doc', doc_nodes )
env.Alias('doc', env.Install( html_doc_path, '#README.txt' ) )
targz_path = os.path.join( env['DIST_DIR'], '%s.tar.gz' % html_dir )
zip_doc_cmd = env.TarGz( targz_path, [env.Dir(html_doc_path)],
TARGZ_BASEDIR = env['ROOTBUILD_DIR'] )
env.Depends( zip_doc_cmd, alias_doc_cmd )
env.Alias( 'doc-dist', zip_doc_cmd )
##
## doxyfile = env.SubstInFile( '#doc/doxyfile', 'doxyfile.in',
## SUBST_DICT = {
## '%JSONCPP_VERSION%' : env['JSONCPP_VERSION'],
## '%TOPDIR%' : env.Dir('#').abspath,
## '%DOC_TOPDIR%' : str(doc_topdir) } )
## doc_cmd = env.Doxygen( doxyfile )
## alias_doc_cmd = env.Alias('doc', doc_cmd )
## env.AlwaysBuild(alias_doc_cmd)
##
## for dir in doc_cmd:
## env.Alias('doc', env.Install( '#' + dir.path, '#README.txt' ) )
## filename = os.path.split(dir.path)[1]
## targz_path = os.path.join( env['DIST_DIR'], '%s.tar.gz' % filename )
## zip_doc_cmd = env.TarGz( targz_path, [env.Dir(dir)],
## TARGZ_BASEDIR = doc_topdir )
## env.Depends( zip_doc_cmd, alias_doc_cmd )
## env.Alias( 'doc-dist', zip_doc_cmd )
##
## # When doxyfile gets updated, I get errors on the first pass.
## # I have to run scons twice. Something is wrong with the dependencies
## # here, but I avoid it by running "scons doc/doxyfile" first.
Loading

0 comments on commit f66d370

Please sign in to comment.