Debian Codegraph @

plugins/functions/CMakeLists.txt

raw
1 # Copyright (C) 2015-2018 Brazil
2 # Copyright (C) 2024-2026 Sutou Kouhei <[email protected]>
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18 set(GRN_FUNCTIONS_PLUGIN_DIR "${GRN_RELATIVE_PLUGINS_DIR}/functions")
19
20 read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/vector_sources.am VECTOR_SOURCES)
21 set_source_files_properties(${VECTOR_SOURCES}
22 PROPERTIES COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
23 if(GRN_EMBED)
24 add_library(vector_functions STATIC ${VECTOR_SOURCES})
25 set_target_properties(vector_functions PROPERTIES POSITION_INDEPENDENT_CODE
26 ON)
27 else()
28 add_library(vector_functions MODULE ${VECTOR_SOURCES})
29 set_target_properties(vector_functions PROPERTIES PREFIX "" OUTPUT_NAME
30 "vector")
31 install(TARGETS vector_functions DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}")
32 if(MSVC AND CMAKE_VERSION VERSION_GREATER "3.1")
33 install(
34 FILES $<TARGET_PDB_FILE:vector_functions>
35 DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}"
36 OPTIONAL)
37 endif()
38 endif()
39 target_link_libraries(vector_functions libgroonga)
40
41 read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/string_sources.am STRING_SOURCES)
42 set_source_files_properties(${STRING_SOURCES}
43 PROPERTIES COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
44 if(GRN_EMBED)
45 add_library(string_functions STATIC ${STRING_SOURCES})
46 set_target_properties(string_functions PROPERTIES POSITION_INDEPENDENT_CODE
47 ON)
48 else()
49 add_library(string_functions MODULE ${STRING_SOURCES})
50 set_target_properties(string_functions PROPERTIES PREFIX "" OUTPUT_NAME
51 "string")
52 install(TARGETS string_functions DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}")
53 if(MSVC)
54 install(
55 FILES $<TARGET_PDB_FILE:string_functions>
56 DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}"
57 OPTIONAL)
58 endif()
59 endif()
60 target_link_libraries(string_functions libgroonga onigmo)
61 target_include_directories(string_functions PRIVATE ${ONIGMO_INCLUDE_DIRS})
62
63 read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/number_sources.am NUMBER_SOURCES)
64 set_source_files_properties(${NUMBER_SOURCES}
65 PROPERTIES COMPILE_FLAGS "${GRN_CXX_COMPILE_FLAGS}")
66 if(GRN_EMBED)
67 add_library(number_functions STATIC ${NUMBER_SOURCES})
68 set_target_properties(number_functions PROPERTIES POSITION_INDEPENDENT_CODE
69 ON)
70 else()
71 add_library(number_functions MODULE ${NUMBER_SOURCES})
72 set_target_properties(number_functions PROPERTIES PREFIX "" OUTPUT_NAME
73 "number")
74 install(TARGETS number_functions DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}")
75 if(MSVC)
76 install(
77 FILES $<TARGET_PDB_FILE:number_functions>
78 DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}"
79 OPTIONAL)
80 endif()
81 endif()
82 target_link_libraries(number_functions libgroonga "${M_LIBS}")
83
84 read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/time_sources.am TIME_SOURCES)
85 set_source_files_properties(${TIME_SOURCES} PROPERTIES COMPILE_FLAGS
86 "${GRN_C_COMPILE_FLAGS}")
87 if(GRN_EMBED)
88 add_library(time_functions STATIC ${TIME_SOURCES})
89 set_target_properties(time_functions PROPERTIES POSITION_INDEPENDENT_CODE ON)
90 else()
91 add_library(time_functions MODULE ${TIME_SOURCES})
92 set_target_properties(time_functions PROPERTIES PREFIX "" OUTPUT_NAME "time")
93 install(TARGETS time_functions DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}")
94 if(MSVC)
95 install(
96 FILES $<TARGET_PDB_FILE:time_functions>
97 DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}"
98 OPTIONAL)
99 endif()
100 endif()
101 target_link_libraries(time_functions libgroonga)
102
103 read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/index_column_sources.am
104 INDEX_COLUMN_SOURCES)
105 set_source_files_properties(${INDEX_COLUMN_SOURCES}
106 PROPERTIES COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
107 if(GRN_EMBED)
108 add_library(index_column_functions STATIC ${INDEX_COLUMN_SOURCES})
109 set_target_properties(index_column_functions
110 PROPERTIES POSITION_INDEPENDENT_CODE ON)
111 else()
112 add_library(index_column_functions MODULE ${INDEX_COLUMN_SOURCES})
113 set_target_properties(index_column_functions
114 PROPERTIES PREFIX "" OUTPUT_NAME "index_column")
115 install(TARGETS index_column_functions
116 DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}")
117 if(MSVC)
118 install(
119 FILES $<TARGET_PDB_FILE:index_column_functions>
120 DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}"
121 OPTIONAL)
122 endif()
123 endif()
124 target_link_libraries(index_column_functions libgroonga)
125
126 read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/math_sources.am MATH_SOURCES)
127 set_source_files_properties(${MATH_SOURCES} PROPERTIES COMPILE_FLAGS
128 "${GRN_C_COMPILE_FLAGS}")
129 if(GRN_EMBED)
130 add_library(math_functions STATIC ${MATH_SOURCES})
131 set_target_properties(math_functions PROPERTIES POSITION_INDEPENDENT_CODE ON)
132 else()
133 add_library(math_functions MODULE ${MATH_SOURCES})
134 set_target_properties(math_functions PROPERTIES PREFIX "" OUTPUT_NAME "math")
135 install(TARGETS math_functions DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}")
136 if(MSVC)
137 install(
138 FILES $<TARGET_PDB_FILE:math_functions>
139 DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}"
140 OPTIONAL)
141 endif()
142 endif()
143 target_link_libraries(math_functions libgroonga)
144
145 if(GRN_WITH_H3)
146 set(H3_SOURCES h3.c)
147 set_source_files_properties(${H3_SOURCES} PROPERTIES COMPILE_FLAGS
148 "${GRN_C_COMPILE_FLAGS}")
149 if(GRN_EMBED)
150 add_library(h3_functions STATIC ${H3_SOURCES})
151 set_target_properties(h3_functions PROPERTIES POSITION_INDEPENDENT_CODE ON)
152 else()
153 add_library(h3_functions MODULE ${H3_SOURCES})
154 set_target_properties(h3_functions PROPERTIES PREFIX "" OUTPUT_NAME "h3")
155 install(TARGETS h3_functions DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}")
156 if(MSVC)
157 install(
158 FILES $<TARGET_PDB_FILE:h3_functions>
159 DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}"
160 OPTIONAL)
161 endif()
162 endif()
163 target_link_libraries(h3_functions libgroonga)
164 endif()
165
166 if(GRN_WITH_LLAMA_CPP)
167 set(LANGUAGE_MODEL_SOURCES language_model.c)
168 set_source_files_properties(${LANGUAGE_MODEL_SOURCES}
169 PROPERTIES COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
170 if(GRN_EMBED)
171 add_library(language_model_functions STATIC ${LANGUAGE_MODEL_SOURCES})
172 set_target_properties(language_model_functions
173 PROPERTIES POSITION_INDEPENDENT_CODE ON)
174 else()
175 add_library(language_model_functions MODULE ${LANGUAGE_MODEL_SOURCES})
176 set_target_properties(language_model_functions
177 PROPERTIES PREFIX "" OUTPUT_NAME "language_model")
178 install(TARGETS language_model_functions
179 DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}")
180 if(MSVC)
181 install(
182 FILES $<TARGET_PDB_FILE:language_model_functions>
183 DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}"
184 OPTIONAL)
185 endif()
186 endif()
187 target_link_libraries(language_model_functions libgroonga)
188 endif()
189
190 read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/binary_sources.am BINARY_SOURCES)
191 set_source_files_properties(${BINARY_SOURCES}
192 PROPERTIES COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
193 if(GRN_EMBED)
194 add_library(binary_functions STATIC ${BINARY_SOURCES})
195 set_target_properties(binary_functions PROPERTIES POSITION_INDEPENDENT_CODE
196 ON)
197 else()
198 add_library(binary_functions MODULE ${BINARY_SOURCES})
199 set_target_properties(binary_functions PROPERTIES PREFIX "" OUTPUT_NAME
200 "binary")
201 install(TARGETS binary_functions DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}")
202 if(MSVC)
203 install(
204 FILES $<TARGET_PDB_FILE:binary_functions>
205 DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}"
206 OPTIONAL)
207 endif()
208 endif()
209 target_link_libraries(binary_functions libgroonga)