Kouhei Sutou
null+****@clear*****
Sat Mar 23 00:54:42 JST 2013
Kouhei Sutou 2013-03-23 00:54:42 +0900 (Sat, 23 Mar 2013) New Revision: 67edf0d4017d3712dc119961e1af6a6f34853890 https://github.com/groonga/groonga-normalizer-mysql/commit/67edf0d4017d3712dc119961e1af6a6f34853890 Message: Add CMake support It will not work yet. :p Added files: CMakeLists.txt build/Makefile.am build/cmake_modules/Makefile.am Copied files: build/cmake_modules/ReadFileList.cmake (from normalizers/CMakeLists.txt) Modified files: Makefile.am configure.ac normalizers/CMakeLists.txt Added: CMakeLists.txt (+51 -0) 100644 =================================================================== --- /dev/null +++ CMakeLists.txt 2013-03-23 00:54:42 +0900 (989cc25) @@ -0,0 +1,51 @@ +# Copyright(C) 2013 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +# MA 02110-1301, USA + +cmake_minimum_required(VERSION 2.6) +project(groonga-normalizer-mysql) + +file(READ "${CMAKE_SOURCE_DIR}/version" VERSION) + +include(FindPkgConfig) +include(${CMAKE_SOURCE_DIR}/build/cmake_modules/ReadFileList.cmake) + +file(READ ${CAMKE_SOURCE_DIR}/required_groonga_version GROONGA_REQUIRED_VERSION) +string(STRIP "${GROONGA_REQUIRED_VERSION}" GROONGA_REQUIRED_VERSION) + +pkg_check_modules(GROONGA REQUIRED "groonga >= ${GROONGA_REQUIRED_VERSION}") +_pkgconfig_invoke(groonga GROONGA PLUGINS_DIR "" --variable=pluginsdir) + +add_definitions( + -DHAVE_CONFIG_H + ) + +include_directories( + ${CMAKE_BINARY_DIR} + ${GROOGNA_INCLUDE_DIRS} + ) + +link_directories( + ${GROONGA_LIBRARY_DIRS} + ) + +add_subdirectory(normalizers) + +configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) + +configure_file(groonga.pc.in ${CMAKE_CURRENT_BINARY_DIR}/groonga.pc @ONLY) + +install(FILES groonga-normalizer-mysql.pc DESTINATION "${LIB_DIR}/pkgconfig/") Modified: Makefile.am (+4 -0) =================================================================== --- Makefile.am 2013-03-23 00:37:10 +0900 (2e0f1b2) +++ Makefile.am 2013-03-23 00:54:42 +0900 (749ce44) @@ -17,6 +17,7 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = \ + build \ normalizers \ packages \ test \ @@ -29,6 +30,9 @@ dist_doc_DATA = \ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = groonga-normalizer-mysql.pc +EXTRA_DIST = \ + CMakeLists.txt + update-tables: cd normalizers && $(MAKE) update-tables Added: build/Makefile.am (+18 -0) 100644 =================================================================== --- /dev/null +++ build/Makefile.am 2013-03-23 00:54:42 +0900 (4a73087) @@ -0,0 +1,18 @@ +# Copyright (C) 2013 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +SUBDIRS = \ + cmake_modules Added: build/cmake_modules/Makefile.am (+18 -0) 100644 =================================================================== --- /dev/null +++ build/cmake_modules/Makefile.am 2013-03-23 00:54:42 +0900 (44ac515) @@ -0,0 +1,18 @@ +# Copyright (C) 2013 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +EXTRA_DIST = \ + ReadFileList.cmake Copied: build/cmake_modules/ReadFileList.cmake (+13 -13) 50% =================================================================== --- normalizers/CMakeLists.txt 2013-03-23 00:37:10 +0900 (9f85773) +++ build/cmake_modules/ReadFileList.cmake 2013-03-23 00:54:42 +0900 (0185879) @@ -1,4 +1,4 @@ -# Copyright(C) 2013 Brazil +# Copyright(C) 2012 Brazil # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -13,15 +13,15 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -include_directories( - ${CMAKE_SOURCE_DIR}/lib - ) - -set(NORMALIZERS_DIR "${GRN_PLUGINS_DIR}/normalizers") -read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/mysql_sources.am MYSQL_SOURCES) -add_library(mysql_normalizer MODULE ${MYSQL_SOURCES}) -set_target_properties(mysql_normalizer PROPERTIES - PREFIX "" - OUTPUT_NAME "mysql") -target_link_libraries(mysql_normalizer libgroonga) -install(TARGETS mysql_normalizer DESTINATION "${NORMALIZERS_DIR}") +macro(read_file_list file_name output_variable) + file(READ ${file_name} ${output_variable}) + # Remove variable declaration at the first line: + # "libgroonga_la_SOURCES = \" -> "" + string(REGEX REPLACE "^.*=[ \t]*\\\\" "" + ${output_variable} "${${output_variable}}") + # Remove white spaces: " com.c \\\n com.h \\\n" -> "com.c\\com.h" + string(REGEX REPLACE "[ \t\n]" "" ${output_variable} "${${output_variable}}") + # Convert string to list: "com.c\\com.h" -> "com.c;com.h" + # NOTE: List in CMake is ";" separated string. + string(REGEX REPLACE "\\\\" ";" ${output_variable} "${${output_variable}}") +endmacro() Modified: configure.ac (+2 -0) =================================================================== --- configure.ac 2013-03-23 00:37:10 +0900 (8a8612f) +++ configure.ac 2013-03-23 00:54:42 +0900 (38d1254) @@ -111,6 +111,8 @@ AC_SUBST(GPG_UID) AC_CONFIG_FILES([ Makefile groonga-normalizer-mysql.pc + build/Makefile + build/cmake_modules/Makefile normalizers/Makefile packages/Makefile packages/apt/Makefile Modified: normalizers/CMakeLists.txt (+11 -13) =================================================================== --- normalizers/CMakeLists.txt 2013-03-23 00:37:10 +0900 (9f85773) +++ normalizers/CMakeLists.txt 2013-03-23 00:54:42 +0900 (249792d) @@ -1,27 +1,25 @@ -# Copyright(C) 2013 Brazil +# Copyright(C) 2013 Kouhei Sutou <kou �� clear-code.com> # # This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License version 2.1 as published by the Free Software Foundation. +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. +# Library General Public License for more details. # -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +# MA 02110-1301, USA -include_directories( - ${CMAKE_SOURCE_DIR}/lib - ) - -set(NORMALIZERS_DIR "${GRN_PLUGINS_DIR}/normalizers") +set(NORMALIZERS_DIR "${GROONGA_PLUGINS_DIR}/normalizers") read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/mysql_sources.am MYSQL_SOURCES) add_library(mysql_normalizer MODULE ${MYSQL_SOURCES}) set_target_properties(mysql_normalizer PROPERTIES PREFIX "" OUTPUT_NAME "mysql") -target_link_libraries(mysql_normalizer libgroonga) +target_link_libraries(mysql_normalizer ${GROONGA_LIBRARIES}) install(TARGETS mysql_normalizer DESTINATION "${NORMALIZERS_DIR}") -------------- next part -------------- HTML����������������������������...Download