cmake: Add a Doxygen target to the binary distribution (fixes issue #3386)

This change also writes a docs/index.html file to provide an easier entry point
for loading the documentation from the docs/html directory.
This commit is contained in:
Marshall Greenblatt 2022-09-02 13:10:58 -04:00
parent 51699e671a
commit fa2464e843
3 changed files with 38 additions and 1 deletions

View File

@ -234,3 +234,22 @@ endif()
# Display configuration settings.
PRINT_CEF_CONFIG()
#
# Define the API documentation target.
#
find_package(Doxygen)
if(DOXYGEN_FOUND)
add_custom_target(apidocs ALL
# Generate documentation in the docs/html directory.
COMMAND "${DOXYGEN_EXECUTABLE}" Doxyfile
# Write a docs/index.html file.
COMMAND ${CMAKE_COMMAND} -E echo "<html><head><meta http-equiv=\"refresh\" content=\"0;URL='html/index.html'\"/></head></html>" > docs/index.html
WORKING_DIRECTORY "${CEF_ROOT}"
COMMENT "Generating API documentation with Doxygen..."
VERBATIM )
else()
message(WARNING "Doxygen must be installed to generate API documentation.")
endif()

View File

@ -25,8 +25,12 @@ for /F %%i in ('python.bat %~dp0\cef_version.py current') do set PROJECT_NUMBER=
set CURRENT_PATH="%CD%"
cd "%~dp0\.."
:: Generate documentation in the docs/html directory.
%DOXYGEN_EXE% Doxyfile
:: Write a docs/index.html file.
echo|set /p="<html><head><meta http-equiv="refresh" content="0;URL='html/index.html'"/></head></html>" > docs/index.html
cd "%CURRENT_PATH%"
:end

View File

@ -211,6 +211,17 @@ def copy_gtest(tests_dir):
os.path.join(target_gtest_dir, 'teamcity'), options.quiet)
def transfer_doxyfile(dst_dir, quiet):
""" Transfer and post-process the Doxyfile. """
src_file = os.path.join(cef_dir, 'Doxyfile')
if os.path.isfile(src_file):
data = read_file(src_file)
data = data.replace("$(PROJECT_NUMBER)", cef_ver)
write_file(os.path.join(dst_dir, 'Doxyfile'), data)
if not quiet:
sys.stdout.write('Creating Doxyfile file.\n')
def transfer_gypi_files(src_dir, gypi_paths, gypi_path_prefix, dst_dir, quiet):
""" Transfer files from one location to another. """
for path in gypi_paths:
@ -842,6 +853,9 @@ if mode == 'standard':
copy_file(os.path.join(cef_dir, 'cef_paths2.gypi'), \
os.path.join(output_dir, 'cef_paths2.gypi'), options.quiet)
# transfer Doxyfile
transfer_doxyfile(output_dir, options.quiet)
if platform == 'windows':
libcef_dll = 'libcef.dll'
libcef_dll_lib = '%s.lib' % libcef_dll
@ -1010,7 +1024,7 @@ if platform == 'windows':
sys.stdout.write(result['err'])
sys.stdout.write(result['out'])
src_dir = os.path.join(cef_dir, 'docs', 'html')
src_dir = os.path.join(cef_dir, 'docs')
if path_exists(src_dir):
# create the docs output directory
docs_output_dir = create_output_dir(output_dir_base + '_docs',