summaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorBYVoid <byvoid.kcp@gmail.com>2011-08-11 18:19:08 +0800
committerPeng Wu <alexepico@gmail.com>2011-08-12 10:39:03 +0800
commitc47a095c10f6104fefb7d0406b7f4076ed47f16c (patch)
treea4c3261f5e406b5b6c60f4636f327db9d668bedc /data
parentbd70f3fe77a2eda3b902c1514b07fbc821c9c1b4 (diff)
downloadlibpinyin-c47a095c10f6104fefb7d0406b7f4076ed47f16c.tar.gz
libpinyin-c47a095c10f6104fefb7d0406b7f4076ed47f16c.tar.xz
libpinyin-c47a095c10f6104fefb7d0406b7f4076ed47f16c.zip
Add cmake scripts.
Diffstat (limited to 'data')
-rw-r--r--data/CMakeLists.txt72
1 files changed, 72 insertions, 0 deletions
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
new file mode 100644
index 0000000..90375e6
--- /dev/null
+++ b/data/CMakeLists.txt
@@ -0,0 +1,72 @@
+set(
+ BINARY_MODEL_DATA
+ gb_char.bin
+ gbk_char.bin
+ phrase_index.bin
+ pinyin_index.bin
+ bigram.db
+)
+
+set(
+ BINARY_MODEL_DATA_FILES
+ ${CMAKE_BINARY_DIR}/data/gb_char.bin
+ ${CMAKE_BINARY_DIR}/data/gbk_char.bin
+ ${CMAKE_BINARY_DIR}/data/phrase_index.bin
+ ${CMAKE_BINARY_DIR}/data/pinyin_index.bin
+ ${CMAKE_BINARY_DIR}/data/bigram.db
+)
+
+set(
+ gen_binary_files_BIN
+ ${CMAKE_BINARY_DIR}/utils/storage/gen_binary_files
+)
+
+set(
+ import_interpolation_BIN
+ ${CMAKE_BINARY_DIR}/utils/storage/import_interpolation
+)
+
+add_custom_target(
+ data
+ ALL
+ DEPENDS
+ ${BINARY_MODEL_DATA}
+)
+
+add_custom_command(
+ OUTPUT
+ gb_char.bin
+ gbk_char.bin
+ phrase_index.bin
+ pinyin_index.bin
+ COMMENT
+ "Building binary model data..."
+ COMMAND
+ ${gen_binary_files_BIN} --table-dir ${CMAKE_SOURCE_DIR}/data
+ DEPENDS
+ gen_binary_files
+)
+
+add_custom_command(
+ OUTPUT
+ bigram.db
+ COMMENT
+ "Building binary bigram data..."
+ COMMAND
+ ${import_interpolation_BIN} < ${CMAKE_SOURCE_DIR}/data/interpolation.text
+ DEPENDS
+ import_interpolation
+)
+
+install(
+ FILES
+ ${BINARY_MODEL_DATA_FILES}
+ DESTINATION
+ ${DIR_SHARE_LIBPINYIN}/data
+)
+
+set_directory_properties(
+ PROPERTIES
+ ADDITIONAL_MAKE_CLEAN_FILES
+ ${BINARY_MODEL_DATA_FILES}
+) \ No newline at end of file