Permalink
Browse files

Update chewing candidate word choosing and cmake

  • Loading branch information...
1 parent b7afa89 commit 8669ccd5fb80c841e3ef26f2e49952309be094cb @wengxt wengxt committed Jan 2, 2012
Showing with 286 additions and 145 deletions.
  1. +7 −1 CMakeLists.txt
  2. +37 −0 cmake/FindChewing.cmake
  3. +1 −0 config.h.in
  4. +5 −5 po/CMakeLists.txt
  5. +32 −0 po/fcitx-chewing.pot
  6. +8 −4 po/zh_CN.po
  7. +2 −5 src/CMakeLists.txt
  8. +194 −130 src/eim.c
View
@@ -2,6 +2,9 @@ cmake_minimum_required (VERSION 2.6)
project(fcitx-chewing)
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
+
+FIND_PACKAGE(Chewing REQUIRED)
FIND_PACKAGE(Gettext REQUIRED)
FIND_PACKAGE(Fcitx REQUIRED)
@@ -23,7 +26,10 @@ if(NOT DEFINED LIB_INSTALL_DIR)
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib)
endif()
-set(HAVE_CONFIG_H)
+configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/config.h"
+ )
set(libdir ${LIB_INSTALL_DIR})
View
@@ -0,0 +1,37 @@
+# - Try to find the CHEWING libraries
+# Once done this will define
+#
+# CHEWING_FOUND - system has CHEWING
+# CHEWING_INCLUDE_DIR - the CHEWING include directory
+# CHEWING_LIBRARIES - CHEWING library
+#
+# Copyright (c) 2010 Dario Freddi <drf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+if(CHEWING_INCLUDE_DIR AND CHEWING_LIBRARIES)
+ # Already in cache, be silent
+ set(CHEWING_FIND_QUIETLY TRUE)
+endif(CHEWING_INCLUDE_DIR AND CHEWING_LIBRARIES)
+
+find_package(PkgConfig)
+pkg_check_modules(PC_LIBCHEWING QUIET chewing)
+
+find_path(CHEWING_MAIN_INCLUDE_DIR
+ NAMES chewing.h
+ HINTS ${PC_LIBCHEWING_INCLUDEDIR}
+ PATH_SUFFIXES chewing)
+
+find_library(CHEWING_LIBRARIES
+ NAMES chewing
+ HINTS ${PC_LIBCHEWING_LIBDIR})
+
+_pkgconfig_invoke("chewing" CHEWING DATADIR "" "--variable=datadir")
+
+set(CHEWING_INCLUDE_DIR "${CHEWING_MAIN_INCLUDE_DIR}")
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CHEWING DEFAULT_MSG CHEWING_LIBRARIES CHEWING_MAIN_INCLUDE_DIR)
+
+mark_as_advanced(CHEWING_INCLUDE_DIR CHEWING_LIBRARIES)
View
@@ -0,0 +1 @@
+#define CHEWING_DATADIR "@CHEWING_DATADIR@"
View
@@ -2,9 +2,9 @@ set(PO_FILES zh_CN.po)
file(RELATIVE_PATH REL_SOURCE_ROOT ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
if ("${REL_SOURCE_ROOT}" STREQUAL "")
set(REL_SOURCE_ROOT ".")
-endif("${REL_SOURCE_ROOT}" STREQUAL "")
+endif("${REL_SOURCE_ROOT}" STREQUAL "")
-set(POT_FILE ${CMAKE_CURRENT_BINARY_DIR}/fcitx-chewing.pot)
+set(POT_FILE fcitx-chewing.pot)
configure_file(POTFILES.in.in ${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in)
@@ -14,10 +14,10 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/desc.po
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/getdescpo ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS getdescpo)
-add_custom_command(
- OUTPUT ${POT_FILE}
+add_custom_target(
+ pot
COMMAND INTLTOOL_EXTRACT=${INTLTOOL_EXTRACT} srcdir=${CMAKE_CURRENT_BINARY_DIR} ${INTLTOOL_UPDATE} --gettext-package fcitx-chewing --pot
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/conf.po ${CMAKE_CURRENT_BINARY_DIR}/desc.po
)
View
@@ -0,0 +1,32 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-01-02 13:48+0800\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: /home/saber/Develop/fcitx-chewing/data/fcitx-chewing.desc:4
+msgid "Priority of Chewing"
+msgstr ""
+
+# unknown
+#: /home/saber/Develop/fcitx-chewing/build/po/tmp/fcitx-chewing.conf.in.h:1
+#: /home/saber/Develop/fcitx-chewing/build/po/../..//src/eim.c:81
+msgid "Chewing"
+msgstr ""
+
+#: /home/saber/Develop/fcitx-chewing/build/po/tmp/fcitx-chewing.conf.in.h:2
+msgid "Chewing Wrapper For Fcitx"
+msgstr ""
View
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-01-01 06:59-0800\n"
+"POT-Creation-Date: 2012-01-02 13:48+0800\n"
"PO-Revision-Date: 2011-08-12 01:54+0800\n"
"Last-Translator: \n"
"Language-Team: Chinese Simplified <kde-i18n-doc@kde.org>\n"
@@ -17,11 +17,15 @@ msgstr ""
"X-Generator: Lokalize 1.2\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-#: /home/march/fcitx-chewing/build/po/tmp/fcitx-chewing.conf.in.h:1
-#: /home/march/fcitx-chewing/build/po/../..//src/eim.c:81
+#: /home/saber/Develop/fcitx-chewing/build/po/tmp/fcitx-chewing.conf.in.h:1
+#: /home/saber/Develop/fcitx-chewing/build/po/../..//src/eim.c:81
msgid "Chewing"
msgstr "酷音"
-#: /home/march/fcitx-chewing/build/po/tmp/fcitx-chewing.conf.in.h:2
+#: /home/saber/Develop/fcitx-chewing/build/po/tmp/fcitx-chewing.conf.in.h:2
msgid "Chewing Wrapper For Fcitx"
msgstr "Fcitx 的 酷音 封装"
+
+#: /home/saber/Develop/fcitx-chewing/data/fcitx-chewing.desc:4
+msgid "Priority of Chewing"
+msgstr ""
View
@@ -1,11 +1,8 @@
-include(FindPkgConfig)
-
-PKG_CHECK_MODULES(CHEWING REQUIRED "chewing" )
-
-include_directories (${CHEWING_INCLUDE_DIRS})
+include_directories (${CHEWING_INCLUDE_DIR})
include_directories (${FCITX4_FCITX_INCLUDE_DIRS})
include_directories (${FCITX4_FCITX_CONFIG_INCLUDE_DIRS})
include_directories (${FCITX4_FCITX_UTILS_INCLUDE_DIRS})
+include_directories (${PROJECT_BINARY_DIR})
set( fcitx_chewing_sources
eim.c
Oops, something went wrong.

0 comments on commit 8669ccd

Please sign in to comment.