forked from madlib/archived_madlib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
172 lines (139 loc) · 6.78 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# ------------------------------------------------------------------------------
# MADlib Documentation
# ------------------------------------------------------------------------------
set(DOXYGEN_README_FILE "../ReadMe.txt" CACHE STRING
"Path to ReadMe file relative to the doc directory after installation")
set(DOXYGEN_LICENSE_DIR "../../license" CACHE STRING
"Path to license directory relative to the doc directory after installation")
configure_file(
mainpage.dox.in
"${CMAKE_CURRENT_BINARY_DIR}/mainpage.dox"
@ONLY
)
set(_DOXYGEN_INPUT_USER
"\"${CMAKE_CURRENT_BINARY_DIR}/mainpage.dox\""
"\"${CMAKE_SOURCE_DIR}/src/dbal\""
"\"${CMAKE_SOURCE_DIR}/src/modules\""
"\"${CMAKE_SOURCE_DIR}/src/ports\""
"\"${CMAKE_SOURCE_DIR}/src/utils\""
"\"${CMAKE_SOURCE_DIR}/methods\""
)
join_strings(DOXYGEN_INPUT_USER " " "${_DOXYGEN_INPUT_USER}")
set(_DOXYGEN_INPUT_DEVELOPER
"\"${CMAKE_SOURCE_DIR}/src/ports/postgres/dbconnector/main.cpp\""
${_DOXYGEN_INPUT_USER}
)
join_strings(DOXYGEN_INPUT_DEVELOPER " " "${_DOXYGEN_INPUT_DEVELOPER}")
set(DOXYGEN_USE_MATHJAX NO CACHE BOOL "In user documentation, render LaTeX formulas using MathJax")
set(DOXYGEN_INCLUDE_PATH "\"${CMAKE_SOURCE_DIR}/src\" \"${CMAKE_SOURCE_DIR}/src/ports/postgres\"")
# Note: Type PATH implies that the value is either a relative path to
# ${CMAKE_CURRENT_BINARY_DIR} (and CMake generates the full path) or as an
# absolute path. Therefore, paths not relative to ${CMAKE_CURRENT_BINARY_DIR}
# must be of type STRING!
set(MATHJAX_INSTALLATION "${CMAKE_BINARY_DIR}/third_party/downloads/mathjax" CACHE PATH
"Path to MathJax installation (used to clone MathJax repository; absolute or relative to \${CMAKE_BINARY_DIR}/doc)"
)
set(DOXYGEN_MATHJAX_RELPATH "${CMAKE_BINARY_DIR}/third_party/downloads/mathjax" CACHE STRING
"Path to MathJax installation (used by Doxygen; absolute or relative to \${DOXYGEN_HTML_OUTPUT})"
)
set(DOXYGEN_OUTPUT_DEVELOPER "${CMAKE_CURRENT_BINARY_DIR}/developer" CACHE PATH
"Base path where the documentation generated by Doxygen will be put (abolsute or relative to \${CMAKE_BINARY_DIR}/doc/etc)"
)
set(DOXYGEN_OUTPUT_USER "${CMAKE_CURRENT_BINARY_DIR}/user" CACHE PATH
"Base path where the documentation generated by Doxygen will be put (abolsute or relative to \${CMAKE_BINARY_DIR}/doc/etc)"
)
set(DOXYGEN_HTML_OUTPUT html CACHE STRING
"Path (relative to \${DOXYGEN_OUTPUT_<config>} where HTML docs will be put."
)
# -- Set macros for SQL/Python files -------------------------------------------
set(PORT_UC "DOXYGEN")
set(DBMS "doxygen")
set(DBMS_UC "${PORT_UC}")
set(${DBMS_UC}_VERSION_STRING "0.0.0")
set(${DBMS_UC}_VERSION_MAJOR "0")
set(${DBMS_UC}_VERSION_MINOR "0")
set(${DBMS_UC}_VERSION_PATCH "0")
set(${DBMS_UC}_ARCHITECTURE "all")
set(DBMS_FEATURES "__HAS_ORDERED_AGGREGATES__")
define_m4_macros(M4_DEFINES_CMD_LINE M4_DEFINES_CODE ${DBMS_FEATURES})
# -- Build doxysql (the SQL parser) using flex and bison -----------------------
find_package(FLEX 2.5.33)
find_package(BISON 2.4)
find_package(Doxygen)
if(FLEX_FOUND AND BISON_FOUND AND DOXYGEN_FOUND)
# The FindFLEX module by cmake unfortunately does not cover the
# case when FlexLexer.h is in a non-standard location.
get_dir_name(_FLEX_BASE "${FLEX_EXECUTABLE}")
get_dir_name(_FLEX_BASE "${_FLEX_BASE}")
find_path(_FLEX_INCLUDE_DIR
NAMES "FlexLexer.h"
HINTS "${_FLEX_BASE}/include"
)
if(_FLEX_INCLUDE_DIR)
include_directories(BEFORE "${_FLEX_INCLUDE_DIR}")
endif(_FLEX_INCLUDE_DIR)
BISON_TARGET(doxysqlParser src/sql.yy ${CMAKE_CURRENT_BINARY_DIR}/sql.parser.cc)
FLEX_TARGET(doxysqlScanner src/sql.ll ${CMAKE_CURRENT_BINARY_DIR}/sql.scanner.cc)
ADD_FLEX_BISON_DEPENDENCY(doxysqlScanner doxysqlParser)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(doxysql ${BISON_doxysqlParser_OUTPUTS}
${FLEX_doxysqlScanner_OUTPUTS})
set_target_properties(doxysql PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
# -- Copy executable and configuration files -----------------------------------
add_subdirectory(bin)
add_subdirectory(etc)
# -- Update MathJax ------------------------------------------------------------
add_custom_target(update_mathjax
COMMAND bin/update_mathjax.sh
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
if(USE_MATHJAX)
set(_MATHJAX_DEPENDENCY_USER update_mathjax)
endif(USE_MATHJAX)
# -- Run doxygen ---------------------------------------------------------------
set(_DOXYGEN_UNNEEDED_WARNINGS_FILTER egrep -v
"warning:.*\\(@param is not found in the argument list.*kwargs\\)\$|The following parameters.*kwargs\\) are not documented\\)|parameter 'kwargs'\$")
# Doxygen 1.7.5 does not accept absolute or relative paths for
# CITE_BIB_FILES (this is a bug). We therefore need to copy all bib files
# into "${CMAKE_BINARY_DIR}/doc/etc".
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/etc/literature.bib"
COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_SOURCE_DIR}/doc/literature.bib"
"${CMAKE_CURRENT_BINARY_DIR}/etc/literature.bib"
COMMENT "Copying bibliography into doxygen configuration directory."
)
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} user.doxyfile | ${_DOXYGEN_UNNEEDED_WARNINGS_FILTER}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/etc"
DEPENDS doxysql doxyBinFiles doxygen_css ${_MATHJAX_DEPENDENCY_USER}
"${CMAKE_CURRENT_BINARY_DIR}/etc/literature.bib"
COMMENT "Generating user-level documentation..."
VERBATIM
)
add_custom_target(devdoc
COMMAND ${DOXYGEN_EXECUTABLE} developer.doxyfile | ${_DOXYGEN_UNNEEDED_WARNINGS_FILTER}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/etc"
DEPENDS doxysql doxyBinFiles doxygen_css update_mathjax
"${CMAKE_CURRENT_BINARY_DIR}/etc/literature.bib"
COMMENT "Generating developer documentation..."
VERBATIM
)
# -- Install doc/user/html output directory to doc/html ------------------------
# We specify OPTIONAL, which means it will not be an error if the user
# documentation does not exist
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/user/html
DESTINATION doc
OPTIONAL
COMPONENT doc
PATTERN ".DS_Store" EXCLUDE
)
# -- Notify user if we could not run doxygen
else(FLEX_FOUND AND BISON_FOUND AND DOXYGEN_FOUND)
message(STATUS "Could not find recent versions of at least one of flex, "
"bison, doxygen, or dot (part of graphviz, needed for doxygen). "
"Documentation will not be built.")
endif(FLEX_FOUND AND BISON_FOUND AND DOXYGEN_FOUND)
# -- Add subdirectories --------------------------------------------------------
add_subdirectory(design)