0022827: Make non-CPP source files (CDLs, headers) to appear in MS VS project files...
[occt.git] / dox / CMakeLists.txt
1 project (Overview)
2
3 # directory that contains all raw OCCT overview articles (markdown format)
4 set (OCCT_OVERVIEW_DIR "${CMAKE_SOURCE_DIR}/dox")
5
6 # directory that contains resources for the generation of OCCT documentation
7 set (OCCT_OVERVIEW_RESOURCE_DIR "${OCCT_OVERVIEW_DIR}/resources")
8
9 # directory that contains all generated OCCT articles
10 set (OCCT_GENERATED_DOC_DIR "${CMAKE_BINARY_DIR}/doc")
11 if (NOT EXISTS "${OCCT_GENERATED_DOC_DIR}")
12   file (MAKE_DIRECTORY "${OCCT_GENERATED_DOC_DIR}")
13 endif()
14
15 # directory that contains generated OCCT overview articles
16 set (OCCT_GENERATED_OVERVIEW_DIR "${OCCT_GENERATED_DOC_DIR}/overview")
17 if (NOT EXISTS "${OCCT_GENERATED_OVERVIEW_DIR}")
18   file (MAKE_DIRECTORY "${OCCT_GENERATED_OVERVIEW_DIR}")
19 endif()
20
21 # directory that contains generated OCCT overview articles in html format
22 set (OCCT_GENERATED_HTML_OVERVIEW_DIR "${OCCT_GENERATED_OVERVIEW_DIR}/html")
23 if (NOT EXISTS "${OCCT_GENERATED_HTML_OVERVIEW_DIR}")
24   file (MAKE_DIRECTORY "${OCCT_GENERATED_HTML_OVERVIEW_DIR}")
25 endif()
26
27 # read OCCT articles that should be generated
28 set (OCCT_ARTICLES "")
29 if (EXISTS "${OCCT_OVERVIEW_DIR}/FILES_HTML.txt" )
30   file (STRINGS "${OCCT_OVERVIEW_DIR}/FILES_HTML.txt" OCCT_ARTICLES REGEX "^[^#]+")
31 else()
32   message (FATAL_ERROR "FILES_HTML.txt is not found in ${OCCT_OVERVIEW_DIR}")
33 endif()
34
35 # configuration file for doxygen
36 set (OCCT_CONFIG_FOR_DOXYGEN "${OCCT_GENERATED_DOC_DIR}/occt.cfg")
37
38 set (3RDPARTY_MATHJAX_RELATIVE_PATH "http://cdn.mathjax.org/mathjax/latest")
39
40 OCCT_VERSION (OCCT_SOURCE_VERSION)
41
42 configure_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
45 file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nPROJECT_NUMBER         = ${OCCT_SOURCE_VERSION}")
46 file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nOUTPUT_DIRECTORY       = ${OCCT_GENERATED_OVERVIEW_DIR}/.")
47 file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nPROJECT_LOGO           = ${OCCT_OVERVIEW_DIR}/resources/occ_logo.png")
48
49 set (OCCT_ARTICLE_PARAM_INPUT     "INPUT                  =")
50 set (OCCT_ARTICLE_PARAM_IMAGEPATH "IMAGE_PATH             = ${OCCT_OVERVIEW_DIR}/resources/ ")
51
52 set (OCCT_ARTICLES_ABSPATH "")
53 foreach (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})
77 endforeach()
78
79 file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\n${OCCT_ARTICLE_PARAM_INPUT}")
80 file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\n${OCCT_ARTICLE_PARAM_IMAGEPATH}")
81
82 # Add document type-specific options
83 # generate tree view
84 file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nGENERATE_TREEVIEW      = YES")
85
86 # HTML Search engine options
87 file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nSEARCHENGINE           = YES")
88 file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nSERVER_BASED_SEARCH    = YES")
89 file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nEXTERNAL_SEARCH        = NO")
90
91 # Formula options
92 file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nMATHJAX_RELPATH        = ${3RDPARTY_MATHJAX_RELATIVE_PATH}")
93
94 # Copy index file to provide fast access to HTML documentation
95 file(COPY "${OCCT_OVERVIEW_RESOURCE_DIR}/index.html" DESTINATION "${OCCT_GENERATED_OVERVIEW_DIR}")
96
97 add_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
104 set_property (TARGET ${PROJECT_NAME} PROPERTY FOLDER "Documentation")