Browse Source

Add target for API doc

experiment/meta_header
Martchus 6 years ago
parent
commit
4d1c874b56
  1. 5
      CMakeLists.txt
  2. 17
      cmake/modules/AppTarget.cmake
  3. 17
      cmake/modules/BasicConfig.cmake
  4. 53
      cmake/modules/Doxygen.cmake
  5. 14
      cmake/modules/LibraryTarget.cmake
  6. 27
      cmake/modules/ListToString.cmake
  7. 20
      cmake/modules/TemplateFinder.cmake
  8. 14
      cmake/modules/WindowsResources.cmake
  9. 256
      cmake/templates/doxygen.in

5
CMakeLists.txt

@ -66,11 +66,15 @@ set(CMAKE_MODULE_FILES
cmake/modules/TestTarget.cmake
cmake/modules/AppTarget.cmake
cmake/modules/WindowsResources.cmake
cmake/modules/TemplateFinder.cmake
cmake/modules/Doxygen.cmake
cmake/modules/ListToString.cmake
)
set(CMAKE_TEMPLATE_FILES
cmake/templates/Config.cmake.in
cmake/templates/config.h.in
cmake/templates/desktop.in
cmake/templates/doxygen.in
)
if(MINGW)
list(APPEND CMAKE_TEMPLATE_FILES
@ -97,3 +101,4 @@ include(BasicConfig)
include(WindowsResources)
include(LibraryTarget)
include(TestTarget)
include(Doxygen)

17
cmake/modules/AppTarget.cmake

@ -72,21 +72,8 @@ if(NOT TARGET install-mingw-w64-strip)
endif()
# find template for *.desktop files
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/desktop.in")
# check own source directory
set(APP_DESKTOP_TEMPLATE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/desktop.in")
message(STATUS "Using template for *.desktop file from own source directory.")
elseif(EXISTS "${CPP_UTILITIES_SOURCE_DIR}/cmake/templates/desktop.in")
# check sources of c++utilities
set(APP_DESKTOP_TEMPLATE_FILE "${CPP_UTILITIES_SOURCE_DIR}/cmake/templates/desktop.in")
message(STATUS "Using template for *.desktop file from c++utilities source directory.")
elseif(EXISTS "${CPP_UTILITIES_CONFIG_DIRS}/templates/desktop.in")
# check installed version of c++utilities
set(APP_DESKTOP_TEMPLATE_FILE "${CPP_UTILITIES_CONFIG_DIRS}/templates/desktop.in")
message(STATUS "Using template for *.desktop file from c++utilities installation.")
else()
message(FATAL_ERROR "Template for *.desktop file can not be located.")
endif()
include(TemplateFinder)
find_template_file("desktop" CPP_UTILITIES APP_DESKTOP_TEMPLATE_FILE)
# function to add *.desktop files
function(add_custom_desktop_file

17
cmake/modules/BasicConfig.cmake

@ -30,21 +30,8 @@ if(NOT META_PROJECT_VARNAME_UPPER)
endif()
# find config.h template
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/config.h.in")
# check own source directory
set(CONFIG_H_TEMPLATE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/config.h.in")
message(STATUS "Using template for config.h from own source directory.")
elseif(EXISTS "${CPP_UTILITIES_SOURCE_DIR}/cmake/templates/config.h.in")
# check sources of c++utilities
set(CONFIG_H_TEMPLATE_FILE "${CPP_UTILITIES_SOURCE_DIR}/cmake/templates/config.h.in")
message(STATUS "Using template for config.h from c++utilities source directory.")
elseif(EXISTS "${CPP_UTILITIES_CONFIG_DIRS}/templates/config.h.in")
# check installed version of c++utilities
set(CONFIG_H_TEMPLATE_FILE "${CPP_UTILITIES_CONFIG_DIRS}/templates/config.h.in")
message(STATUS "Using template for config.h from c++utilities installation.")
else()
message(FATAL_ERROR "Template for config.h file can not be located.")
endif()
include(TemplateFinder)
find_template_file("config.h" CPP_UTILITIES CONFIG_H_TEMPLATE_FILE)
# add configuration header
configure_file(

53
cmake/modules/Doxygen.cmake

@ -0,0 +1,53 @@
# find doxygen.h template
include(TemplateFinder)
find_template_file("doxygen" CPP_UTILITIES DOXYGEN_TEMPLATE_FILE)
# find executables
find_program(DOXYGEN_BIN doxygen)
find_program(PERL_BIN perl)
if(NOT DOXYGEN_BIN)
message(WARNING "Doxygen not found, unable to add target for generating API documentation.")
endif()
# load cached configuration and other variables
set(DOXY_LANGUAGE "English" CACHE STRING "specifies language of the API documentation generated with Doxygen")
set(DOXY_CUSTOM_CONFIG "" CACHE STRING "specifies extra options for Doxygen")
set(META_DOXY_NUMBER 1)
set(META_DOXY_LANGUAGE "${DOC_LANGUAGE}")
set(DOXY_INPUT_FILES ${HEADER_FILES} ${SRC_FILES} ${TEST_HEADER_FILES} ${TEST_SRC_FILES} ${WIDGETS_HEADER_FILES} ${WIDGETS_SRC_FILES} ${QML_HEADER_FILES} ${QML_SRC_FILES})
set(DOXY_OUTPUT_FILES "")
# convert DOXY_INPUT_FILES to whitespace-separated list
include(ListToString)
list_to_string(" " "${CMAKE_CURRENT_SOURCE_DIR}/" "${DOXY_INPUT_FILES}" DOXY_INPUT_FILES_WHITESPACE_SEPARATED)
message("string: ${DOXY_INPUT_FILES_WHITESPACE_SEPARATED}")
# generate Doxygen configuration
configure_file(
"${DOXYGEN_TEMPLATE_FILE}"
"${CMAKE_CURRENT_BINARY_DIR}/doxygen.config"
)
# add target for generating API documentation
add_custom_target(${META_PROJECT_NAME}_apidoc
COMMAND "${DOXYGEN_BIN}" "${CMAKE_CURRENT_BINARY_DIR}/doxygen.config"
SOURCES ${DOXY_INPUT_FILES}
)
# add install target for API documentation
# TODO
foreach(API_DOC_OUTPUT_FILE ${API_DOC_OUTPUT_FILES})
get_filename_component(API_DOC_OUTPUT_DIR ${API_DOC_OUTPUT_FILE} DIRECTORY)
install(
FILES ${API_DOC_OUTPUT_FILE}
DESTINATION share/${META_PROJECT_NAME}/${API_DOC_OUTPUT_DIR}
COMPONENT cmake-modules
)
endforeach()
if(NOT TARGET install-api-doc)
add_custom_target(install-api-doc
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=api-doc -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
)
endif()

14
cmake/modules/LibraryTarget.cmake

@ -4,18 +4,8 @@
include(CMakePackageConfigHelpers)
# find template for CMake config file
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/Config.cmake.in")
# check own source directory
set(CONFIG_TEMPLATE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/Config.cmake.in")
elseif(EXISTS "${CPP_UTILITIES_SOURCE_DIR}/cmake/templates/Config.cmake.in")
# check sources of c++utilities
set(CONFIG_TEMPLATE_FILE "${CPP_UTILITIES_SOURCE_DIR}/cmake/templates/Config.cmake.in")
elseif(EXISTS "${CPP_UTILITIES_CONFIG_DIRS}/templates/Config.cmake.in")
# check installed version of c++utilities
set(CONFIG_TEMPLATE_FILE "${CPP_UTILITIES_CONFIG_DIRS}/templates/Config.cmake.in")
else()
message(FATAL_ERROR "Template for configuration file can not be located.")
endif()
include(TemplateFinder)
find_template_file("Config.cmake" CPP_UTILITIES CONFIG_TEMPLATE_FILE)
# set install destination for the CMake modules, config files and header files
set(HEADER_INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}/include")

27
cmake/modules/ListToString.cmake

@ -0,0 +1,27 @@
if(NOT DEFINED LIST_TO_STRING_EXISTS)
set(LIST_TO_STRING_EXISTS true)
function(list_to_string separator prefix input_list output_string_var)
set(res "")
# get list length
list(LENGTH input_list list_length)
# if the list has 0 or 1 element, there is no need to loop over
if(list_length LESS 2)
set(res "${input_list}")
else()
math(EXPR last_element_index "${list_length} - 1")
foreach(index RANGE ${last_element_index})
# get current item_value
list(GET input_list ${index} item_value)
if(NOT item_value STREQUAL "")
# .. and append non-empty value to output string
set(res "${res}${prefix}${item_value}")
# append separator if current element is NOT the last one.
if(NOT index EQUAL last_element_index)
set(res "${res}${separator}")
endif()
endif()
endforeach()
endif()
set(${output_string_var} "${res}" PARENT_SCOPE)
endfunction()
endif()

20
cmake/modules/TemplateFinder.cmake

@ -0,0 +1,20 @@
if(NOT DEFINED FIND_TEMPLATE_FILE_EXISTS)
set(FIND_TEMPLATE_FILE_EXISTS true)
function(find_template_file FILE_NAME PROJECT_VAR_NAME OUTPUT_VAR)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/${FILE_NAME}.in")
# check own source directory
set(${OUTPUT_VAR} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/${FILE_NAME}.in" PARENT_SCOPE)
message(STATUS "Using template for ${FILE_NAME} from own source directory.")
elseif(EXISTS "${${PROJECT_VAR_NAME}_SOURCE_DIR}/cmake/templates/${FILE_NAME}.in")
# check sources of project
set(${OUTPUT_VAR} "${${PROJECT_VAR_NAME}_SOURCE_DIR}/cmake/templates/${FILE_NAME}.in" PARENT_SCOPE)
message(STATUS "Using template for ${FILE_NAME} from ${PROJECT_NAME} source directory.")
elseif(EXISTS "${${PROJECT_VAR_NAME}_CONFIG_DIRS}/templates/${FILE_NAME}.in")
# check installed version of project
set(${OUTPUT_VAR} "${${PROJECT_VAR_NAME}_CONFIG_DIRS}/templates/${FILE_NAME}.in" PARENT_SCOPE)
message(STATUS "Using template for ${FILE_NAME} from ${PROJECT_NAME} installation.")
else()
message(FATAL_ERROR "Template for ${FILE_NAME} file can not be located.")
endif()
endfunction()
endif()

14
cmake/modules/WindowsResources.cmake

@ -6,18 +6,8 @@
if(MINGW)
# find rc template
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/windows.rc.in")
# check own source directory
set(RC_TEMPLATE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/windows.rc.in")
elseif(EXISTS "${CPP_UTILITIES_SOURCE_DIR}/cmake/templates/windows.rc.in")
# check sources of c++utilities
set(RC_TEMPLATE_FILE "${CPP_UTILITIES_SOURCE_DIR}/cmake/templates/windows.rc.in")
elseif(EXISTS "${CPP_UTILITIES_CONFIG_DIRS}/templates/windows.rc.in")
# check installed version of c++utilities
set(RC_TEMPLATE_FILE "${CPP_UTILITIES_CONFIG_DIRS}/templates/windows.rc.in")
else()
message(FATAL_ERROR "Template for Windows *.rc file can not be located.")
endif()
include(TemplateFinder)
find_template_file("windows.rc" CPP_UTILITIES RC_TEMPLATE_FILE)
# create Windows icon from png with ffmpeg if available
set(WINDOWS_ICON_PATH "")

256
cmake/templates/doxygen.in

@ -0,0 +1,256 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "@META_APP_NAME@"
PROJECT_NUMBER = "@META_DOXY_NUMBER@"
PROJECT_BRIEF = "@META_APP_DESCRIPTION@"
PROJECT_LOGO = "@META_DOXY_LOGO@"
OUTPUT_DIRECTORY = "@CMAKE_CURRENT_BINARY_DIR@/api-doc"
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = "@META_DOXY_LANGUAGE@"
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
QT_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
TCL_SUBST =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
AUTOLINK_SUPPORT = YES
BUILTIN_STL_SUPPORT = YES
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
LOOKUP_CACHE_SIZE = 0
EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
EXTRACT_PACKAGE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_MEMBERS_CTORS_1ST = NO
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
STRICT_PROTO_MATCHING = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
INPUT = @DOXY_INPUT_FILES_WHITESPACE_SEPARATED@
INPUT_ENCODING = UTF-8
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE =
SOURCE_BROWSER = YES
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = YES
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_EXTRA_STYLESHEET =
HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = YES
HTML_DYNAMIC_SECTIONS = NO
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = YES
QCH_FILE =
QHP_NAMESPACE = "@META_PROJECT_VARNAME@"
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = "@META_PROJECT_VARNAME@"
DISABLE_INDEX = NO
GENERATE_TREEVIEW = NO
ENUM_VALUES_PER_LINE = 4
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
USE_MATHJAX = NO
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
MATHJAX_EXTENSIONS =
MATHJAX_CODEFILE =
SEARCHENGINE = YES
SERVER_BASED_SEARCH = NO
EXTERNAL_SEARCH = NO
SEARCHENGINE_URL =
SEARCHDATA_FILE = searchdata.xml
EXTERNAL_SEARCH_ID =
EXTRA_SEARCH_MAPPINGS =
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4
EXTRA_PACKAGES =
LATEX_HEADER =
LATEX_FOOTER =
LATEX_EXTRA_FILES =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
LATEX_BIB_STYLE = plain
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_SUBDIR =
MAN_LINKS = NO
GENERATE_XML = NO
XML_OUTPUT = xml
XML_PROGRAMLISTING = YES
GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
GENERATE_AUTOGEN_DEF = NO
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
PERL_PATH = @PERL_BIN@
CLASS_DIAGRAMS = YES
MSCGEN_PATH =
DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
DOT_NUM_THREADS = 4
DOT_FONTNAME = Helvetica
DOT_FONTSIZE = 10
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
UML_LIMIT_NUM_FIELDS = 10
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = svg
INTERACTIVE_SVG = YES
DOT_PATH =
DOTFILE_DIRS =
MSCFILE_DIRS =
DIAFILE_DIRS =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
@DOXY_CUSTOM_CONFIG@
Loading…
Cancel
Save