0022827: Make non-CPP source files (CDLs, headers) to appear in MS VS project files...
[occt.git] / dox / CMakeLists.txt
CommitLineData
adc33035 1project (Overview)
2
3# directory that contains all raw OCCT overview articles (markdown format)
4set (OCCT_OVERVIEW_DIR "${CMAKE_SOURCE_DIR}/dox")
5
6# directory that contains resources for the generation of OCCT documentation
7set (OCCT_OVERVIEW_RESOURCE_DIR "${OCCT_OVERVIEW_DIR}/resources")
8
9# directory that contains all generated OCCT articles
10set (OCCT_GENERATED_DOC_DIR "${CMAKE_BINARY_DIR}/doc")
11if (NOT EXISTS "${OCCT_GENERATED_DOC_DIR}")
12 file (MAKE_DIRECTORY "${OCCT_GENERATED_DOC_DIR}")
13endif()
14
15# directory that contains generated OCCT overview articles
16set (OCCT_GENERATED_OVERVIEW_DIR "${OCCT_GENERATED_DOC_DIR}/overview")
17if (NOT EXISTS "${OCCT_GENERATED_OVERVIEW_DIR}")
18 file (MAKE_DIRECTORY "${OCCT_GENERATED_OVERVIEW_DIR}")
19endif()
20
21# directory that contains generated OCCT overview articles in html format
22set (OCCT_GENERATED_HTML_OVERVIEW_DIR "${OCCT_GENERATED_OVERVIEW_DIR}/html")
23if (NOT EXISTS "${OCCT_GENERATED_HTML_OVERVIEW_DIR}")
24 file (MAKE_DIRECTORY "${OCCT_GENERATED_HTML_OVERVIEW_DIR}")
25endif()
26
27# read OCCT articles that should be generated
28set (OCCT_ARTICLES "")
29if (EXISTS "${OCCT_OVERVIEW_DIR}/FILES_HTML.txt" )
30 file (STRINGS "${OCCT_OVERVIEW_DIR}/FILES_HTML.txt" OCCT_ARTICLES REGEX "^[^#]+")
31else()
32 message (FATAL_ERROR "FILES_HTML.txt is not found in ${OCCT_OVERVIEW_DIR}")
33endif()
34
35# configuration file for doxygen
36set (OCCT_CONFIG_FOR_DOXYGEN "${OCCT_GENERATED_DOC_DIR}/occt.cfg")
37
38set (3RDPARTY_MATHJAX_RELATIVE_PATH "http://cdn.mathjax.org/mathjax/latest")
39
40OCCT_VERSION (OCCT_SOURCE_VERSION)
41
42configure_file ("${OCCT_OVERVIEW_RESOURCE_DIR}/occt_ug_html.doxyfile" "${OCCT_CONFIG_FOR_DOXYGEN}" COPYONLY)
43
44# Add common options for generation of Overview and User Guides
45file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nPROJECT_NUMBER = ${OCCT_SOURCE_VERSION}")
46file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nOUTPUT_DIRECTORY = ${OCCT_GENERATED_OVERVIEW_DIR}/.")
47file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nPROJECT_LOGO = ${OCCT_OVERVIEW_DIR}/resources/occ_logo.png")
48
49set (OCCT_ARTICLE_PARAM_INPUT "INPUT =")
50set (OCCT_ARTICLE_PARAM_IMAGEPATH "IMAGE_PATH = ${OCCT_OVERVIEW_DIR}/resources/ ")
51
52set (OCCT_ARTICLES_ABSPATH "")
53foreach (OCCT_ARTICLE ${OCCT_ARTICLES})
54 get_filename_component (OCCT_ARTICLE_ABSOLUTE_PATH "${OCCT_OVERVIEW_DIR}/${OCCT_ARTICLE}" ABSOLUTE)
55 get_filename_component (OCCT_ARTICLE_PARENT_DIR "${OCCT_ARTICLE_ABSOLUTE_PATH}" PATH)
56
57 if (EXISTS "${OCCT_ARTICLE_PARENT_DIR}/images")
58 set (OCCT_ARTICLE_PARAM_IMAGEPATH "${OCCT_ARTICLE_PARAM_IMAGEPATH} ${OCCT_ARTICLE_PARENT_DIR}/images")
59 endif()
60
61 set (OCCT_ARTICLE_PARAM_INPUT "${OCCT_ARTICLE_PARAM_INPUT} ${OCCT_ARTICLE_ABSOLUTE_PATH}")
62
63 set (SOURCE_GROUP_NAME "")
64
65 # add the file to appropriate source group
66 get_filename_component (CURRENT_TAIL_PATH "${OCCT_ARTICLE}" PATH)
67 while (CURRENT_TAIL_PATH AND NOT "${CURRENT_TAIL_PATH}" STREQUAL "..")
68 get_filename_component (CURRENT_DIR_NAME "${CURRENT_TAIL_PATH}" NAME)
69 set (SOURCE_GROUP_NAME "${CURRENT_DIR_NAME}\\${SOURCE_GROUP_NAME}")
70
71 # one step out (get parent directory)
72 get_filename_component (CURRENT_TAIL_PATH "${CURRENT_TAIL_PATH}" PATH)
73 endwhile()
74 SOURCE_GROUP ("${SOURCE_GROUP_NAME}" FILES ${OCCT_ARTICLE_ABSOLUTE_PATH})
75
76 list (APPEND OCCT_ARTICLES_ABSPATH ${OCCT_ARTICLE_ABSOLUTE_PATH})
77endforeach()
78
79file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\n${OCCT_ARTICLE_PARAM_INPUT}")
80file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\n${OCCT_ARTICLE_PARAM_IMAGEPATH}")
81
82# Add document type-specific options
83# generate tree view
84file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nGENERATE_TREEVIEW = YES")
85
86# HTML Search engine options
87file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nSEARCHENGINE = YES")
88file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nSERVER_BASED_SEARCH = YES")
89file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nEXTERNAL_SEARCH = NO")
90
91# Formula options
92file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nMATHJAX_RELPATH = ${3RDPARTY_MATHJAX_RELATIVE_PATH}")
93
94# Copy index file to provide fast access to HTML documentation
95file(COPY "${OCCT_OVERVIEW_RESOURCE_DIR}/index.html" DESTINATION "${OCCT_GENERATED_OVERVIEW_DIR}")
96
97add_custom_target (${PROJECT_NAME}
98 COMMAND ${3RDPARTY_DOXYGEN_EXECUTABLE} ${OCCT_CONFIG_FOR_DOXYGEN}
99 WORKING_DIRECTORY ${OCCT_GENERATED_DOC_DIR}
100 COMMENT "Generating OCCT overview documentation with Doxygen"
101 SOURCES ${OCCT_ARTICLES_ABSPATH}
102 VERBATIM)
103
104set_property (TARGET ${PROJECT_NAME} PROPERTY FOLDER "Documentation")