Kouhei Sutou
null+****@clear*****
Mon Feb 2 22:06:56 JST 2015
Kouhei Sutou 2015-02-02 22:06:56 +0900 (Mon, 02 Feb 2015) New Revision: a7724a9fb13b0e855d8d57cb7007d162b87c37ae https://github.com/groonga/groonga-normalizer-mysql/commit/a7724a9fb13b0e855d8d57cb7007d162b87c37ae Message: Support building as static library for embedding Use `cmake -DGROONGA_NORMALIZER_MYSQL_EMBED=ON` with cmake. Use `configure --enable-embed` with configure. But it's not tested. :< Modified files: .gitignore CMakeLists.txt configure.ac normalizers/CMakeLists.txt normalizers/mysql.c Modified: .gitignore (+1 -0) =================================================================== --- .gitignore 2015-02-01 18:55:24 +0900 (196946c) +++ .gitignore 2015-02-02 22:06:56 +0900 (f310bf9) @@ -2,6 +2,7 @@ .libs/ CMakeFiles/ *~ +*.a *.o *.so *.lo Modified: CMakeLists.txt (+6 -2) =================================================================== --- CMakeLists.txt 2015-02-01 18:55:24 +0900 (79b25bb) +++ CMakeLists.txt 2015-02-02 22:06:56 +0900 (0005db2) @@ -1,4 +1,4 @@ -# Copyright(C) 2013 Kouhei Sutou <kou �� clear-code.com> +# Copyright(C) 2013-2015 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 @@ -18,6 +18,10 @@ cmake_minimum_required(VERSION 2.6) project(groonga-normalizer-mysql) +option(GROONGA_NORMALIZER_MYSQL_EMBED + "Build as a static library to embed into an application" + OFF) + file(READ "${CMAKE_CURRENT_SOURCE_DIR}/version" VERSION) if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") @@ -53,7 +57,7 @@ link_directories( add_subdirectory(normalizers) -if(NOT GROONGA_NORMALIZER_MYSQL_BUNDLED) +if(NOT GROONGA_NORMALIZER_MYSQL_EMBED) configure_file( groonga-normalizer-mysql.pc.in "${CMAKE_CURRENT_BINARY_DIR}/groonga-normalizer-mysql.pc" Modified: configure.ac (+13 -1) =================================================================== --- configure.ac 2015-02-01 18:55:24 +0900 (6a1019c) +++ configure.ac 2015-02-02 22:06:56 +0900 (0e1927a) @@ -1,4 +1,4 @@ -# Copyright (C) 2013 Kouhei Sutou <kou �� clear-code.com> +# Copyright (C) 2013-2015 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 @@ -49,6 +49,18 @@ AC_SUBST(GROONGA) normalizers_pluginsdir="\${GROONGA_PLUGINS_DIR}/normalizers" AC_SUBST(normalizers_pluginsdir) +AC_ARG_ENABLE([embed], + AS_HELP_STRING([--enable-embed], + [Build as a static library to embed into an application (default: no)]), + [GROONGA_NORMALIZER_MYSQL_EMBED="$enableval"], + [GROONGA_NORMALIZER_MYSQL_EMBED="no"]) + +if test "x$GROONGA_NORMALIZER_MYSQL_EMBED" = "xno"; then + AC_DEFINE_UNQUOTED(GROONGA_NORMALIZER_MYSQL_EMBED, + [1], + [Define to 1 if groonga-normalizer-mysql is built for embedding.]) +fi + # check Ruby for test ac_cv_ruby_available="no" AC_ARG_WITH([ruby], Modified: normalizers/CMakeLists.txt (+11 -7) =================================================================== --- normalizers/CMakeLists.txt 2015-02-01 18:55:24 +0900 (ae290b6) +++ normalizers/CMakeLists.txt 2015-02-02 22:06:56 +0900 (81b2b96) @@ -1,4 +1,4 @@ -# Copyright(C) 2013 Kouhei Sutou <kou �� clear-code.com> +# Copyright(C) 2013-2015 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 @@ -17,11 +17,15 @@ 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 ${GROONGA_LIBRARIES}) -if(NOT MRN_GROONGA_BUNDLED) +if(GROONGA_NORMALIZER_MYSQL_EMBED) + add_library(mysql_normalizer STATIC ${MYSQL_SOURCES}) + set_property(TARGET mysql_normalizer APPEND PROPERTY + COMPILE_DEFINITIONS "GROONGA_NORMALIZER_MYSQL_EMBED") +else() + add_library(mysql_normalizer MODULE ${MYSQL_SOURCES}) + set_target_properties(mysql_normalizer PROPERTIES + PREFIX "" + OUTPUT_NAME "mysql") install(TARGETS mysql_normalizer DESTINATION "${NORMALIZERS_DIR}") endif() +target_link_libraries(mysql_normalizer ${GROONGA_LIBRARIES}) Modified: normalizers/mysql.c (+9 -1) =================================================================== --- normalizers/mysql.c 2015-02-01 18:55:24 +0900 (94acfb1) +++ normalizers/mysql.c 2015-02-02 22:06:56 +0900 (0b62659) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2013-2014 Kouhei Sutou <kou �� clear-code.com> + Copyright(C) 2013-2015 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 @@ -18,6 +18,14 @@ MA 02110-1301, USA */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#ifdef GRN_NORMALIZER_MYSQL_EMBED +# define GRN_PLUGIN_FUNCTION_TAG normalizers_mysql +#endif + #include <groonga/normalizer.h> #include <groonga/nfkc.h> -------------- next part -------------- HTML����������������������������... 다운로드