From 530236e8d48735761690a9cf1b090b9b182a701d Mon Sep 17 00:00:00 2001 From: Kan-Ru Chen Date: Tue, 27 Jan 2026 21:33:14 +0900 Subject: [PATCH] build: prepare standalone libchewing-data project --- CMakeLists.txt | 13 ++++++++++++- dict/chewing/CMakeLists.txt | 1 + misc/CMakeLists.txt | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96cc536..0ec6e2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.31.6...3.31.6) -project(libchewing-data LANGUAGES NONE) +project(libchewing-data VERSION 2026.1.27 LANGUAGES NONE) + +if(PROJECT_IS_TOP_LEVEL) + set(CMAKE_SYSTEM_NAME Generic) +endif() option(USE_SYSTEM_CHEWING_CLI "Use system-installed chewing-cli instead of building from source" ON) @@ -11,5 +15,12 @@ if(USE_SYSTEM_CHEWING_CLI) ) endif() +include(GNUInstallDirs) + add_subdirectory(dict/chewing) add_subdirectory(misc) + +if(PROJECT_IS_TOP_LEVEL) + set(CPACK_GENERATOR "ZIP") + include(CPack) +endif() diff --git a/dict/chewing/CMakeLists.txt b/dict/chewing/CMakeLists.txt index 707bdc8..3d42fe3 100644 --- a/dict/chewing/CMakeLists.txt +++ b/dict/chewing/CMakeLists.txt @@ -8,4 +8,5 @@ foreach(TARGET ${TARGETS}) COMMAND ${CHEWING_CLI} init --csv ${CMAKE_CURRENT_SOURCE_DIR}/${SRC} ${TARGET} DEPENDS ${SRC} ) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET} DESTINATION ${CMAKE_INSTALL_DATADIR}/libchewing) endforeach() diff --git a/misc/CMakeLists.txt b/misc/CMakeLists.txt index a30a93f..85b1b47 100644 --- a/misc/CMakeLists.txt +++ b/misc/CMakeLists.txt @@ -15,3 +15,5 @@ add_custom_command( ${CMAKE_CURRENT_SOURCE_DIR}/symbols.dat ) add_custom_target(misc ALL DEPENDS swkb.dat symbols.dat) + +install(FILES swkb.dat symbols.dat DESTINATION ${CMAKE_INSTALL_DATADIR}/libchewing)