Debian Codegraph @

plugins/language_model/CMakeLists.txt

raw
1 # Copyright (C) 2025 Sutou Kouhei <[email protected]>
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
17 set(LANGUAGE_MODEL_DIR "${GRN_RELATIVE_PLUGINS_DIR}/language_model")
18
19 if(GRN_WITH_FAISS)
20 set(KNN_SOURCES knn.cpp)
21 set_source_files_properties(
22 ${KNN_SOURCES} PROPERTIES COMPILE_FLAGS "${GRN_CXX_COMPILE_FLAGS}")
23 if(GRN_EMBED)
24 add_library(knn STATIC ${KNN_SOURCES})
25 set_target_properties(knn PROPERTIES POSITION_INDEPENDENT_CODE ON)
26 else()
27 add_library(knn MODULE ${KNN_SOURCES})
28 set_target_properties(knn PROPERTIES PREFIX "" OUTPUT_NAME "knn")
29 install(TARGETS knn DESTINATION "${LANGUAGE_MODEL_DIR}")
30 if(MSVC)
31 install(
32 FILES $<TARGET_PDB_FILE:knn
33 DESTINATION "${LANGUAGE_MODEL_DIR}"
34 OPTIONAL)
35 endif()
36 endif()
37 target_link_libraries(knn libgroonga faiss)
38 endif()