|
|
@@ -69,59 +69,68 @@ if (DOXYGEN_FOUND) # When DOT is not found, the documentation build should
|
|
|
foreach (IDE XCODE MSVC Eclipse CodeBlocks)
|
|
|
enable_help (${IDE})
|
|
|
endforeach ()
|
|
|
- if (CMAKE_HOST_WIN32)
|
|
|
+ if (MSVC_HELP)
|
|
|
find_package (HTMLHelp)
|
|
|
find_package_handle_standard_args (HTMLHelp REQUIRED_VARS HTML_HELP_COMPILER HTML_HELP_INCLUDE_PATH HTML_HELP_LIBRARY)
|
|
|
if (NOT HTMLHelp_FOUND) # Only consider it as found when all the required variables are found
|
|
|
unset (HTML_HELP_COMPILER)
|
|
|
endif ()
|
|
|
endif ()
|
|
|
- configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
|
|
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/generated/Doxyfile)
|
|
|
endif ()
|
|
|
|
|
|
- # Dump AngelScript and LuaScript API to Doxygen file if the tool is available
|
|
|
- # CMake's custom command output is intentionally set to mismatch with the tool's output file location to achieve two desired side-effect results:
|
|
|
- # 1) 'make clean' does not remove the generated ScriptAPI.dox and LuaScriptAPI.dox in the 'Docs' subdirectory
|
|
|
- # 2) ScriptAPI.dox and LuaScriptAPI.dox always get refreshed first before the 'doc' target is being built (similar to VS-only PRE_BUILD custom command)
|
|
|
- if (TARGET ScriptCompiler AND NOT CMAKE_CROSSCOMPILING)
|
|
|
- add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ScriptAPI.dox
|
|
|
+ # Dump AngelScript and LuaScript API to Doxygen file if the corresponding host tool is available
|
|
|
+ if (TARGET ScriptCompiler)
|
|
|
+ add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated/ScriptAPI.dox ${CMAKE_CURRENT_BINARY_DIR}/generated/AngelScriptAPI.h
|
|
|
COMMAND ${CMAKE_BINARY_DIR}/bin/tool/ScriptCompiler -dumpapi ${CMAKE_SOURCE_DIR} ScriptAPI.dox AngelScriptAPI.h
|
|
|
- DEPENDS Urho3D ScriptCompiler
|
|
|
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
+ DEPENDS ScriptCompiler # ScriptCompiler implicitly depends on Urho3D already
|
|
|
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated
|
|
|
COMMENT "Dumping AngelScript API to ScriptAPI.dox")
|
|
|
else ()
|
|
|
- add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ScriptAPI.dox COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/ScriptAPI.dox)
|
|
|
+ execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/ScriptAPI.dox ${CMAKE_CURRENT_BINARY_DIR}/generated/ScriptAPI.dox)
|
|
|
+ execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/AngelScriptAPI.h ${CMAKE_CURRENT_BINARY_DIR}/generated/AngelScriptAPI.h)
|
|
|
endif ()
|
|
|
- if (TARGET tolua++ AND NOT CMAKE_CROSSCOMPILING)
|
|
|
+ if (TARGET tolua++)
|
|
|
file (GLOB PKGS RELATIVE ${CMAKE_SOURCE_DIR}/Source/Urho3D/LuaScript/pkgs ${CMAKE_SOURCE_DIR}/Source/Urho3D/LuaScript/pkgs/*.pkg)
|
|
|
list (SORT PKGS)
|
|
|
set (PKGLIST "// This is a generated file. DO NOT EDIT!\n\n")
|
|
|
foreach (PKG ${PKGS})
|
|
|
set (PKGLIST "${PKGLIST}$pfile \"${PKG}\"\n")
|
|
|
endforeach ()
|
|
|
- file (WRITE ${CMAKE_BINARY_DIR}/bin/tool/LuaPkgToDox.txt ${PKGLIST})
|
|
|
- add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox
|
|
|
- COMMAND ${CMAKE_BINARY_DIR}/bin/tool/tolua++ -L ToDoxHook.lua -P -o ${CMAKE_CURRENT_SOURCE_DIR}/LuaScriptAPI.dox ${CMAKE_BINARY_DIR}/bin/tool/LuaPkgToDox.txt
|
|
|
- DEPENDS Urho3D tolua++
|
|
|
+ file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/generated/LuaPkgToDox.txt.new ${PKGLIST})
|
|
|
+ execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/generated/LuaPkgToDox.txt.new ${CMAKE_CURRENT_BINARY_DIR}/generated/LuaPkgToDox.txt)
|
|
|
+ file (GLOB_RECURSE API_PKG_FILES ${CMAKE_SOURCE_DIR}/Source/Urho3D/LuaScript/pkgs/*.pkg)
|
|
|
+ add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated/LuaScriptAPI.dox
|
|
|
+ COMMAND ${CMAKE_BINARY_DIR}/bin/tool/tolua++ -L ToDoxHook.lua -P -o ${CMAKE_CURRENT_BINARY_DIR}/generated/LuaScriptAPI.dox ${CMAKE_CURRENT_BINARY_DIR}/generated/LuaPkgToDox.txt
|
|
|
+ DEPENDS tolua++ ${API_PKG_FILES} ${CMAKE_CURRENT_BINARY_DIR}/generated/LuaPkgToDox.txt ${CMAKE_SOURCE_DIR}/Source/Urho3D/LuaScript/pkgs/ToDoxHook.lua
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/Source/Urho3D/LuaScript/pkgs
|
|
|
COMMENT "Dumping LuaScript API to LuaScriptAPI.dox")
|
|
|
else ()
|
|
|
- add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox)
|
|
|
+ execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/LuaScriptAPI.dox ${CMAKE_CURRENT_BINARY_DIR}/generated/LuaScriptAPI.dox)
|
|
|
endif ()
|
|
|
|
|
|
- # If URHO3D_DOCS build option is set then add the custom 'doc' target into the default 'all' target, i.e. a normal build would not only build the software but also the documentation
|
|
|
+ # In quiet mode, redirect standard output stream of Doxygen to a null device
|
|
|
if (URHO3D_DOCS_QUIET)
|
|
|
- set (REDIRECT_STDOUT 1>${NULL_DEVICE}) # In quiet mode, redirect standard output stream of Doxygen to a null device
|
|
|
+ set (REDIRECT_STDOUT 1>${NULL_DEVICE})
|
|
|
endif ()
|
|
|
+ # If URHO3D_DOCS build option is set then add the custom 'doc' target into the default 'all' target, i.e. a normal build would not only build the software but also the documentation
|
|
|
if (URHO3D_DOCS)
|
|
|
set (ALL ALL)
|
|
|
endif ()
|
|
|
|
|
|
# Add custom 'doc' target for generating Urho3D documentation
|
|
|
- add_custom_target (doc ${ALL}
|
|
|
- COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile ${REDIRECT_STDOUT}
|
|
|
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ScriptAPI.dox ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox # Note: these two dependencies need to be made explicit or otherwise CMake would not automatically 'refresh' them with provided custom command
|
|
|
+ if (URHO3D_UPDATE_SOURCE_TREE)
|
|
|
+ foreach (FILE ScriptAPI.dox AngelScriptAPI.h LuaScriptAPI.dox)
|
|
|
+ list (APPEND UPDATE_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/generated/${FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
|
|
|
+ endforeach ()
|
|
|
+ endif ()
|
|
|
+ add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html
|
|
|
+ COMMAND ${DOXYGEN_EXECUTABLE} generated/Doxyfile ${REDIRECT_STDOUT}
|
|
|
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/generated/ScriptAPI.dox ${CMAKE_CURRENT_BINARY_DIR}/generated/LuaScriptAPI.dox
|
|
|
COMMENT "Generating documentation with Doxygen")
|
|
|
+ add_custom_target (doc ${ALL}
|
|
|
+ ${UPDATE_COMMANDS}
|
|
|
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/index.html)
|
|
|
endif ()
|
|
|
|
|
|
# Make sure html output directory exists and not empty
|