|
|
@@ -42,28 +42,48 @@ if (DOXYGEN_FOUND)
|
|
|
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)
|
|
|
- add_custom_command (OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/ScriptAPI.dox
|
|
|
- COMMAND ${PROJECT_ROOT_DIR}/Bin/ScriptCompiler -dumpapi ScriptAPI.dox AngelScriptAPI.h DEPENDS Urho3D ScriptCompiler
|
|
|
+ add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ScriptAPI.dox
|
|
|
+ COMMAND ${PROJECT_ROOT_DIR}/Bin/ScriptCompiler -dumpapi ScriptAPI.dox AngelScriptAPI.h
|
|
|
+ DEPENDS Urho3D ScriptCompiler
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
COMMENT "Dumping AngelScript API to ScriptAPI.dox")
|
|
|
+ else ()
|
|
|
+ add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ScriptAPI.dox COMMAND echo dummy >${CMAKE_CURRENT_BINARY_DIR}/ScriptAPI.dox)
|
|
|
+ endif ()
|
|
|
+ if (ENABLE_LUAJIT)
|
|
|
+ set (jit jit)
|
|
|
endif ()
|
|
|
- string (TOLOWER "${JIT}" jit) # Note: ${JIT} could be empty if LuaJIT is not enabled
|
|
|
if (TARGET lua${jit}_interpreter)
|
|
|
- add_custom_command (OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/LuaScriptAPI.dox
|
|
|
- COMMAND ${PROJECT_ROOT_DIR}/Bin/lua${jit} pkgToDox.lua ${CMAKE_CURRENT_SOURCE_DIR}/LuaScriptAPI.dox *.pkg DEPENDS Urho3D lua${jit}_interpreter ${PROJECT_ROOT_DIR}/Source/Engine/LuaScript/pkgs/pkgToDox.lua
|
|
|
+ add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox
|
|
|
+ COMMAND ${PROJECT_ROOT_DIR}/Bin/lua${jit} pkgToDox.lua ${CMAKE_CURRENT_SOURCE_DIR}/LuaScriptAPI.dox *.pkg
|
|
|
+ DEPENDS Urho3D lua${jit}_interpreter
|
|
|
WORKING_DIRECTORY ${PROJECT_ROOT_DIR}/Source/Engine/LuaScript/pkgs
|
|
|
COMMENT "Dumping LuaScript API to LuaScriptAPI.dox")
|
|
|
+ else ()
|
|
|
+ add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox COMMAND echo dummy >${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox)
|
|
|
endif ()
|
|
|
-
|
|
|
+
|
|
|
# If ENABLE_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 (ENABLE_DOCS_QUIET)
|
|
|
+ set (ENABLE_DOCS 1)
|
|
|
+ if (CMAKE_HOST_WIN32)
|
|
|
+ set (REDIRECT_STDOUT 1>nul) # In quiet mode, redirect standard output stream of Doxygen to a null device
|
|
|
+ else ()
|
|
|
+ set (REDIRECT_STDOUT 1>/dev/null)
|
|
|
+ endif ()
|
|
|
+ endif ()
|
|
|
if (ENABLE_DOCS)
|
|
|
set (ALL ALL)
|
|
|
endif ()
|
|
|
|
|
|
# Add custom 'doc' target for generating Urho3D documentation
|
|
|
add_custom_target (doc ${ALL}
|
|
|
- COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ScriptAPI.dox ${CMAKE_CURRENT_SOURCE_DIR}/LuaScriptAPI.dox # Note: these two dependencies need to be made explicit or otherwise CMake would not automatically 'refresh' them with provided custom command
|
|
|
+ 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
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
COMMENT "Generating documentation with Doxygen")
|
|
|
endif ()
|