Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
112 lines (90 loc) · 3.95 KB
/
Copy pathCMakeLists.txt
File metadata and controls
112 lines (90 loc) · 3.95 KB
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
cmake_minimum_required (VERSION 2.8)
# main bunch of sources (for libsphinx)
set (LIBSPHINX_SRCS sphinx.cpp sphinxexcerpt.cpp
sphinxquery.cpp sphinxsoundex.cpp sphinxmetaphone.cpp
sphinxstemen.cpp sphinxstemru.cpp sphinxstemcz.cpp
sphinxstemar.cpp sphinxutils.cpp sphinxstd.cpp
sphinxsort.cpp sphinxexpr.cpp sphinxfilter.cpp
sphinxsearch.cpp sphinxrt.cpp sphinxjson.cpp
sphinxaot.cpp sphinxplugin.cpp sphinxudf.c
sphinxqcache.cpp sphinxrlp.cpp)
set (INDEXER_SRCS indexer.cpp)
set (INDEXTOOL_SRCS indextool.cpp)
set (SEARCHD_SRCS searchd.cpp searchdha.cpp http/http_parser.c searchdhttp.cpp)
set (SPELLDUMP_SRCS spelldump.cpp)
set (TESTS_SRCS tests.cpp)
# The headers is not neccessary for executable build, but nesessary for MSVC and other projects
# all the (non-generated) headers
file (GLOB HEADERS "sphinx*.h" lz4.h lz4hc.h http/http_parser.h)
file (GLOB SEARCHD_H "searchd*.h" )
file (GLOB GHEADERS "yysphinx*.h")
source_group ("Generated Header Files" FILES ${GHEADERS})
add_custom_target (
generate_sphinxversion
COMMAND
${CMAKE_COMMAND}
-D SOURCE_DIR=${CMAKE_SOURCE_DIR}
-D BINARY_DIR=${CMAKE_BINARY_DIR}
-D SPHINX_TAG="${SPHINX_TAG}"
-P ${CMAKE_SOURCE_DIR}/sphinxrev.cmake
)
include_directories ("${SPHINXSEARCH_BINARY_DIR}/config")
add_definitions ("-DBUILD_WITH_CMAKE")
# our mega-lib
add_library (libsphinx STATIC ${LIBSPHINX_SRCS} ${HEADERS} ${GHEADERS})
add_dependencies (libsphinx generate_sphinxversion)
#message (STATUS "Extra libraries:${EXTRA_LIBRARIES}")
# our executables
add_executable (indexer ${INDEXER_SRCS})
add_executable (indextool ${INDEXTOOL_SRCS})
add_executable (searchd ${SEARCHD_SRCS} ${SEARCHD_H})
add_executable (spelldump ${SPELLDUMP_SRCS})
add_executable (tests ${TESTS_SRCS})
target_link_libraries (indexer libsphinx ${EXTRA_LIBRARIES})
target_link_libraries (indextool libsphinx ${EXTRA_LIBRARIES})
target_link_libraries (searchd libsphinx ${EXTRA_LIBRARIES})
target_link_libraries (spelldump libsphinx ${EXTRA_LIBRARIES})
target_link_libraries (tests libsphinx ${EXTRA_LIBRARIES})
# add the extra targets in the case we want on-the-fly grammar compiler
if (USE_BISON)
set (BISON_DIR "${SPHINXSEARCH_BINARY_DIR}/config")
BISON_TARGET (ExprParser sphinxexpr.y ${BISON_DIR}/bissphinxexpr.c)
BISON_TARGET (SelectParser sphinxselect.y ${BISON_DIR}/bissphinxselect.c)
BISON_TARGET (QueryParser sphinxquery.y ${BISON_DIR}/bissphinxquery.c)
BISON_TARGET (SQLParser sphinxql.y ${BISON_DIR}/bissphinxql.c)
BISON_TARGET (JsonParser sphinxjson.y ${BISON_DIR}/bissphinxjson.c)
set_property (SOURCE sphinxexpr.cpp APPEND PROPERTY
OBJECT_DEPENDS ${BISON_ExprParser_OUTPUT_SOURCE})
set_property (SOURCE sphinx.cpp APPEND PROPERTY
OBJECT_DEPENDS ${BISON_SelectParser_OUTPUT_SOURCE})
set_property (SOURCE sphinxquery.cpp APPEND PROPERTY
OBJECT_DEPENDS ${BISON_QueryParser_OUTPUT_SOURCE})
set_property (SOURCE searchd.cpp APPEND PROPERTY
OBJECT_DEPENDS ${BISON_SQLParser_OUTPUT_SOURCE})
set_property (SOURCE sphinxjson.cpp APPEND PROPERTY
OBJECT_DEPENDS ${BISON_JsonParser_OUTPUT_SOURCE})
endif (USE_BISON)
# add the extra targets in the case we want on-the-fly lex compiler
if (USE_FLEX)
set (FLEX_DIR "${SPHINXSEARCH_BINARY_DIR}/config")
FLEX_TARGET (SQLlex sphinxql.l ${FLEX_DIR}/flexsphinxql.c COMPILE_FLAGS "-i")
FLEX_TARGET (Jsonlex sphinxjson.l ${FLEX_DIR}/flexsphinxjson.c COMPILE_FLAGS "-i -Pyy2")
set_property (SOURCE searchd.cpp APPEND PROPERTY
OBJECT_DEPENDS ${FLEX_SQLlex_OUTPUTS})
set_property (SOURCE sphinxjson.cpp APPEND PROPERTY
OBJECT_DEPENDS ${FLEX_Jsonlex_OUTPUTS})
endif (USE_FLEX)
if (SPLIT_SYMBOLS)
include(helpers)
install_dbg (indexer)
install_dbg (indextool)
install_dbg (searchd)
install_dbg (spelldump)
install_dbg (tests)
endif (SPLIT_SYMBOLS)
INSTALL (TARGETS indexer indextool searchd spelldump RUNTIME DESTINATION bin COMPONENT APPLICATIONS)
# testrt is win-only project
if (WIN32)
add_executable (testrt testrt.cpp)
target_link_libraries (testrt libsphinx ${EXTRA_LIBRARIES})
endif (WIN32)