diff --git a/frontend/CMakeLists.txt b/frontend/CMakeLists.txt index 25d3016..f22d309 100644 --- a/frontend/CMakeLists.txt +++ b/frontend/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.14) -project(ukui-search VERSION 1.0 LANGUAGES C CXX) +project(frontend VERSION 1.0 LANGUAGES C CXX) set(VERSION_MAJOR 2) set(VERSION_MINOR 2) @@ -66,18 +66,22 @@ qt5_create_translation(UKUI_SEARCH_QM_FILES ${CMAKE_CURRENT_SOURCE_DIR} ${UKUI_S file(GLOB UKUI_SEARCH_APP_WIDGET_TS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../translations/ukui-search/appwidget/*.ts) set_source_files_properties(${UKUI_SEARCH_APP_WIDGET_TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_BINARY_DIR}/frontend/.qm) qt5_create_translation(UKUI_SEARCH_APP_WIDGET_QM_FILES ${PROJECT_SOURCE_DIR} ${UKUI_SEARCH_APP_WIDGET_TS_FILES}) -add_executable(ukui-search +add_executable(frontend ${UKUI_SEARCH_SRC} ${QRC_FILES} ${UKUI_SEARCH_QM_FILES} ${UKUI_SEARCH_APP_WIDGET_QM_FILES}) +set_target_properties(frontend + PROPERTIES + OUTPUT_NAME ukui-search +) set(UKUI_SEARCH_QM_INSTALL_PATH /usr/share/ukui-search/translations/ukui-search) -target_compile_definitions(ukui-search PRIVATE +target_compile_definitions(frontend PRIVATE VERSION="${UKUI_SEARCH_VERSION}" UKUI_SEARCH_QM_INSTALL_PATH="${UKUI_SEARCH_QM_INSTALL_PATH}" ) -target_link_libraries(ukui-search PRIVATE +target_link_libraries(frontend PRIVATE KF5::WindowSystem Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::DBus @@ -87,14 +91,14 @@ target_link_libraries(ukui-search PRIVATE gsettings-qt ukui-appwidget-manager ukui-appwidget-provider - libukui-search + ukui-search chinese-segmentation kysdk-waylandhelper qtsingleapplication tcmalloc_minimal ) -target_include_directories(ukui-search PRIVATE +target_include_directories(frontend PRIVATE ../3rd-parties/qtsingleapplication/src ../libchinese-segmentation ../libsearch @@ -107,7 +111,6 @@ target_include_directories(ukui-search PRIVATE model search-app-widget-plugin view - xatom ) set(APP_WIDGET_FILES_PRE @@ -123,7 +126,7 @@ install(FILES install(FILES ${APP_WIDGET_FILES_PRE}/data/search.qml DESTINATION /usr/share/appwidget/qml/) install(FILES ${UKUI_SEARCH_APP_WIDGET_QM_FILES} DESTINATION /usr/share/appwidget/translations/) #二进制 -install(TARGETS ukui-search RUNTIME DESTINATION /usr/bin) +install(TARGETS frontend RUNTIME DESTINATION /usr/bin) #翻译 install(FILES ${UKUI_SEARCH_QM_FILES} DESTINATION ${UKUI_SEARCH_QM_INSTALL_PATH}) #desktop文件 diff --git a/libsearch/CMakeLists.txt b/libsearch/CMakeLists.txt index 263cfaa..e1d113e 100644 --- a/libsearch/CMakeLists.txt +++ b/libsearch/CMakeLists.txt @@ -1,3 +1,6 @@ +cmake_minimum_required(VERSION 3.14) +project(ukui-search VERSION 1.0 LANGUAGES C CXX) + set(VERSION_MAJOR 2) set(VERSION_MINOR 3) set(VERSION_MICRO 0) @@ -14,10 +17,10 @@ find_package(PkgConfig REQUIRED) find_package(KF5WindowSystem) find_package(qt5xdg) find_package(ukui-file-metadata) +find_package(xapian) set(LIBUKUI_SEARCH_EXTERNAL_LIBS "") set(LIBUKUI_SEARCH_PC_PKGS - xapian-core gio-2.0 glib-2.0 gio-unix-2.0 @@ -109,7 +112,7 @@ file(GLOB TS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../translations/libukui-search/*. set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_BINARY_DIR}/libsearch/.qm) qt5_create_translation(QM_FILES ${CMAKE_CURRENT_SOURCE_DIR} ${TS_FILES}) -add_library(libukui-search SHARED +add_library(${PROJECT_NAME} SHARED ${LIBUKUI_SEARCH_SRC} ${QRC_FILES} ${QM_FILES} @@ -152,12 +155,12 @@ include_directories( websearch ) -target_compile_definitions(libukui-search PRIVATE +target_compile_definitions(${PROJECT_NAME} PRIVATE PLUGIN_INSTALL_DIRS="/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/ukui-search-plugins" QT_NO_KEYWORDS ) -target_link_libraries(libukui-search PUBLIC +target_link_libraries(${PROJECT_NAME} PRIVATE KF5::WindowSystem Qt5Xdg Qt${QT_VERSION_MAJOR}::Concurrent @@ -180,7 +183,7 @@ set(CMAKE_CONFIG_INSTALL_DIR "/usr/share/cmake/ukui-search") set(HEADERS_INSTALL_DIR /usr/include/ukui-search) set(PC_INSTALL_DIR "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig") -target_include_directories(libukui-search PUBLIC $) +target_include_directories(${PROJECT_NAME} PUBLIC $) configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/ukui-search-config.cmake.in" @@ -196,18 +199,18 @@ configure_package_config_file( "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/ukui-search.pc" INSTALL_DESTINATION ${PC_INSTALL_DIR}) -set_target_properties(libukui-search PROPERTIES +set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${LIBUKUI_SEARCH_VERSION} SOVERSION ${VERSION_MAJOR} OUTPUT_NAME ukui-search ) -install(TARGETS libukui-search - EXPORT libukui-search +install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME} PUBLIC_HEADER DESTINATION ${HEADERS_INSTALL_DIR} LIBRARY DESTINATION /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} ) -install(EXPORT libukui-search - FILE ukui-search-targets.cmake +install(EXPORT ${PROJECT_NAME} + FILE ${PROJECT_NAME}-targets.cmake DESTINATION ${CMAKE_CONFIG_INSTALL_DIR}) install(FILES ${QM_FILES} DESTINATION /usr/share/ukui-search/translations/libukui-search) diff --git a/libsearch/ukui-search-config.cmake.in b/libsearch/ukui-search-config.cmake.in index b3a87d9..d413713 100644 --- a/libsearch/ukui-search-config.cmake.in +++ b/libsearch/ukui-search-config.cmake.in @@ -1,10 +1 @@ -@PACKAGE_INIT@ - -include(CMakeFindDependencyMacro) -find_dependency(chinese-segmentation) -find_dependency(Qt@QT_VERSION_MAJOR@Core "@REQUIRED_QT_VERSION@") -if(TARGET Qt6::Core) - find_dependency(Qt6Core5Compat @REQUIRED_QT_VERSION@) -endif() - include("${CMAKE_CURRENT_LIST_DIR}/ukui-search-targets.cmake") \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0846b57..a58d298 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -27,5 +27,5 @@ target_include_directories(tests PRIVATE target_link_libraries(tests PRIVATE # Remove: L${CMAKE_CURRENT_BINARY_DIR}/../libsearch/ Qt${QT_VERSION_MAJOR}::Core - libukui-search + ukui-search ) diff --git a/ukui-search-app-data-service/CMakeLists.txt b/ukui-search-app-data-service/CMakeLists.txt index f0c3363..e5a58fa 100644 --- a/ukui-search-app-data-service/CMakeLists.txt +++ b/ukui-search-app-data-service/CMakeLists.txt @@ -56,7 +56,7 @@ target_link_libraries(ukui-search-app-data-service PRIVATE Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Sql chinese-segmentation - libukui-search + ukui-search qtsingleapplication ) diff --git a/ukui-search-service-dir-manager/CMakeLists.txt b/ukui-search-service-dir-manager/CMakeLists.txt index 8f634c0..9dd96ae 100644 --- a/ukui-search-service-dir-manager/CMakeLists.txt +++ b/ukui-search-service-dir-manager/CMakeLists.txt @@ -61,7 +61,7 @@ target_link_libraries(ukui-search-service-dir-manager PRIVATE Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets qtsingleapplication - libukui-search + ukui-search ${UKUI_SEARCH_SERVICE_DIR_MANAGER_EXTERNAL_LIBS} ) install(FILES conf/com.ukui.search.fileindex.service DESTINATION /usr/share/dbus-1/services/) diff --git a/ukui-search-service/CMakeLists.txt b/ukui-search-service/CMakeLists.txt index fbc94ad..0633a09 100644 --- a/ukui-search-service/CMakeLists.txt +++ b/ukui-search-service/CMakeLists.txt @@ -62,7 +62,7 @@ target_link_libraries(ukui-search-service PRIVATE Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::RemoteObjects - libukui-search + ukui-search qtsingleapplication ${UKUI_SEARCH_SERVICE_EXTERNAL_LIBS} )