• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
2
3project(doxygen LANGUAGES C CXX)
4
5# define some folders
6
7get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
8get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
9
10MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
11
12# target to generate documentation with Doxygen
13find_package(Doxygen)
14
15if(DOXYGEN_FOUND)
16    include(${RXCPP_DIR}/projects/CMake/shared.cmake)
17    set(EXAMPLES_DIR ${RXCPP_DIR}/Rx/v2/examples)
18
19    # Doxygen configuration
20    set(DOXY_CONF_DIR ${RXCPP_DIR}/projects/doxygen)
21    set(DOXY_CONF_FILE ${DOXY_CONF_DIR}/doxygen.conf)
22
23    # File with main page (index.html) content
24    set(DOXY_MAIN_PAGE ${DOXY_CONF_DIR}/mainpage.dox)
25    set(DOXY_FOOTER_HTML ${DOXY_CONF_DIR}/footer.html)
26
27    # Sources for processing location
28    set(DOXY_INPUT_DIR "${IX_SRC_DIR} ${RX_SRC_DIR} ${DOXY_MAIN_PAGE}")
29
30    # C++ examples location
31    set(DOXY_EXAMPLES_SRC_DIR ${EXAMPLES_DIR}/doxygen)
32    set(DOXY_EXAMPLES_BIN_DIR doxy_examples)
33
34    # Directories and files allowed for include-type command (\include, \example, \snippet etc)
35    set(DOXY_INCLUDE_DIR "${RXCPP_DIR} ${DOXY_EXAMPLES_SRC_DIR}")
36
37    # Resulting documentation to be placed here
38    set(DOXY_OUTPUT_DIR ${RXCPP_DIR}/projects/doxygen)
39
40    # Make Doxygen configuration from template with placeholders
41    configure_file(${DOXY_CONF_FILE}.in ${DOXY_CONF_FILE})
42
43    # Target to build examples
44    set(DOXY_EXAMPLE_SRC_LIST
45        ${DOXY_EXAMPLES_SRC_DIR}/main.cpp
46        ${DOXY_EXAMPLES_SRC_DIR}/all.cpp
47        ${DOXY_EXAMPLES_SRC_DIR}/amb.cpp
48        ${DOXY_EXAMPLES_SRC_DIR}/as_dynamic.cpp
49        ${DOXY_EXAMPLES_SRC_DIR}/blocking_observable.cpp
50        ${DOXY_EXAMPLES_SRC_DIR}/buffer.cpp
51        ${DOXY_EXAMPLES_SRC_DIR}/combine_latest.cpp
52        ${DOXY_EXAMPLES_SRC_DIR}/composite_exception.cpp
53        ${DOXY_EXAMPLES_SRC_DIR}/concat.cpp
54        ${DOXY_EXAMPLES_SRC_DIR}/concat_map.cpp
55        ${DOXY_EXAMPLES_SRC_DIR}/contains.cpp
56        ${DOXY_EXAMPLES_SRC_DIR}/create.cpp
57        ${DOXY_EXAMPLES_SRC_DIR}/defer.cpp
58        ${DOXY_EXAMPLES_SRC_DIR}/debounce.cpp
59        ${DOXY_EXAMPLES_SRC_DIR}/default_if_empty.cpp
60        ${DOXY_EXAMPLES_SRC_DIR}/delay.cpp
61        ${DOXY_EXAMPLES_SRC_DIR}/distinct.cpp
62        ${DOXY_EXAMPLES_SRC_DIR}/distinct_until_changed.cpp
63        ${DOXY_EXAMPLES_SRC_DIR}/element_at.cpp
64        ${DOXY_EXAMPLES_SRC_DIR}/empty.cpp
65        ${DOXY_EXAMPLES_SRC_DIR}/error.cpp
66        ${DOXY_EXAMPLES_SRC_DIR}/exists.cpp
67        ${DOXY_EXAMPLES_SRC_DIR}/filter.cpp
68        ${DOXY_EXAMPLES_SRC_DIR}/finally.cpp
69        ${DOXY_EXAMPLES_SRC_DIR}/flat_map.cpp
70        ${DOXY_EXAMPLES_SRC_DIR}/from.cpp
71        ${DOXY_EXAMPLES_SRC_DIR}/group_by.cpp
72        ${DOXY_EXAMPLES_SRC_DIR}/ignore_elements.cpp
73        ${DOXY_EXAMPLES_SRC_DIR}/interval.cpp
74        ${DOXY_EXAMPLES_SRC_DIR}/iterate.cpp
75        ${DOXY_EXAMPLES_SRC_DIR}/just.cpp
76        ${DOXY_EXAMPLES_SRC_DIR}/map.cpp
77        ${DOXY_EXAMPLES_SRC_DIR}/math.cpp
78        ${DOXY_EXAMPLES_SRC_DIR}/merge.cpp
79        ${DOXY_EXAMPLES_SRC_DIR}/merge_delay_error.cpp
80        ${DOXY_EXAMPLES_SRC_DIR}/never.cpp
81        ${DOXY_EXAMPLES_SRC_DIR}/observe_on.cpp
82        ${DOXY_EXAMPLES_SRC_DIR}/on_error_resume_next.cpp
83        ${DOXY_EXAMPLES_SRC_DIR}/pairwise.cpp
84        ${DOXY_EXAMPLES_SRC_DIR}/publish.cpp
85        ${DOXY_EXAMPLES_SRC_DIR}/range.cpp
86        ${DOXY_EXAMPLES_SRC_DIR}/reduce.cpp
87        ${DOXY_EXAMPLES_SRC_DIR}/ref_count.cpp
88        ${DOXY_EXAMPLES_SRC_DIR}/repeat.cpp
89        ${DOXY_EXAMPLES_SRC_DIR}/replay.cpp
90        ${DOXY_EXAMPLES_SRC_DIR}/retry.cpp
91        ${DOXY_EXAMPLES_SRC_DIR}/sample.cpp
92        ${DOXY_EXAMPLES_SRC_DIR}/scan.cpp
93        ${DOXY_EXAMPLES_SRC_DIR}/scope.cpp
94        ${DOXY_EXAMPLES_SRC_DIR}/sequence_equal.cpp
95        ${DOXY_EXAMPLES_SRC_DIR}/skip.cpp
96        ${DOXY_EXAMPLES_SRC_DIR}/skip_while.cpp
97        ${DOXY_EXAMPLES_SRC_DIR}/skip_last.cpp
98        ${DOXY_EXAMPLES_SRC_DIR}/skip_until.cpp
99        ${DOXY_EXAMPLES_SRC_DIR}/start_with.cpp
100        ${DOXY_EXAMPLES_SRC_DIR}/subscribe.cpp
101        ${DOXY_EXAMPLES_SRC_DIR}/subscribe_on.cpp
102        ${DOXY_EXAMPLES_SRC_DIR}/switch_if_empty.cpp
103        ${DOXY_EXAMPLES_SRC_DIR}/switch_on_next.cpp
104        ${DOXY_EXAMPLES_SRC_DIR}/take.cpp
105        ${DOXY_EXAMPLES_SRC_DIR}/take_last.cpp
106        ${DOXY_EXAMPLES_SRC_DIR}/take_until.cpp
107        ${DOXY_EXAMPLES_SRC_DIR}/take_while.cpp
108        ${DOXY_EXAMPLES_SRC_DIR}/tap.cpp
109        ${DOXY_EXAMPLES_SRC_DIR}/time_interval.cpp
110        ${DOXY_EXAMPLES_SRC_DIR}/timeout.cpp
111        ${DOXY_EXAMPLES_SRC_DIR}/timer.cpp
112        ${DOXY_EXAMPLES_SRC_DIR}/timestamp.cpp
113        ${DOXY_EXAMPLES_SRC_DIR}/with_latest_from.cpp
114        ${DOXY_EXAMPLES_SRC_DIR}/window.cpp
115        ${DOXY_EXAMPLES_SRC_DIR}/zip.cpp
116    )
117    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${DOXY_EXAMPLES_BIN_DIR})
118    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${DOXY_EXAMPLES_BIN_DIR})
119    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${DOXY_EXAMPLES_BIN_DIR})
120    add_executable(doxy_examples EXCLUDE_FROM_ALL ${DOXY_EXAMPLE_SRC_LIST})
121    add_executable(rxcpp::doxygen::examples ALIAS doxy_examples)
122    target_compile_options(doxy_examples PUBLIC ${RX_COMPILE_OPTIONS})
123    target_compile_features(doxy_examples PUBLIC ${RX_COMPILE_FEATURES})
124    target_include_directories(doxy_examples
125        PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR}
126        )
127    target_link_libraries(doxy_examples PRIVATE ${CMAKE_THREAD_LIBS_INIT})
128
129    # Target to execute examples and save their output
130    add_custom_command(
131        OUTPUT doxy_examples_output
132        COMMAND ${DOXY_EXAMPLES_BIN_DIR}/doxy_examples > ${DOXY_EXAMPLES_SRC_DIR}/output.txt
133        COMMENT "Execute examples for Doxygen documentation")
134
135    # Target to generate docs
136    add_custom_target(doc
137        COMMAND ${DOXYGEN_EXECUTABLE} ${DOXY_CONF_FILE}
138        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
139        DEPENDS doxy_examples doxy_examples_output
140        COMMENT "Generating documentation with Doxygen"
141        VERBATIM)
142endif()
143