Christopher Dunn | e0d7224 | 2007-06-14 17:58:59 +0000 | [diff] [blame] | 1 | Import( 'env' ) |
| 2 | import os.path |
| 3 | |
Baptiste Lepilleur | f66d370 | 2008-01-20 16:49:53 +0000 | [diff] [blame] | 4 | if 'doxygen' in env['TOOLS']: |
| 5 | doc_topdir = str(env['ROOTBUILD_DIR']) |
| 6 | html_dir = 'jsoncpp-api-doc' |
Christopher Dunn | e0d7224 | 2007-06-14 17:58:59 +0000 | [diff] [blame] | 7 | |
Baptiste Lepilleur | f66d370 | 2008-01-20 16:49:53 +0000 | [diff] [blame] | 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 |
Christopher Dunn | de10f45 | 2007-06-14 22:03:11 +0000 | [diff] [blame] | 14 | |
Baptiste Lepilleur | f66d370 | 2008-01-20 16:49:53 +0000 | [diff] [blame] | 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. |