blob: 62b481e31441b9d868b46cc2c4531669c6d3ce4e [file] [log] [blame]
Christopher Dunne0d72242007-06-14 17:58:59 +00001Import( 'env' )
2import os.path
3
Baptiste Lepilleurf66d3702008-01-20 16:49:53 +00004if 'doxygen' in env['TOOLS']:
5 doc_topdir = str(env['ROOTBUILD_DIR'])
6 html_dir = 'jsoncpp-api-doc'
Christopher Dunne0d72242007-06-14 17:58:59 +00007
Baptiste Lepilleurf66d3702008-01-20 16:49:53 +00008 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
Christopher Dunnde10f452007-06-14 22:03:11 +000014
Baptiste Lepilleurf66d3702008-01-20 16:49:53 +000015 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.