null+****@clear*****
null+****@clear*****
2012年 4月 16日 (月) 23:11:27 JST
Kouhei Sutou 2012-04-16 23:11:27 +0900 (Mon, 16 Apr 2012) New Revision: 9b04e290c98836e61131c6cd66d329e07dc90a89 Log: cmake: make buildable again Added files: build/cmake_modules/ReadFileList.cmake lib/libmrn_need_mysql_sources.am lib/libmrn_no_mysql_sources.am sources.am Removed files: build/cmake/files.cmake Modified files: .gitignore CMakeLists.txt Makefile.am lib/Makefile.am Modified: .gitignore (+2 -0) =================================================================== --- .gitignore 2012-04-16 16:33:30 +0900 (9f1748f) +++ .gitignore 2012-04-16 23:11:27 +0900 (1e11498) @@ -1,6 +1,7 @@ *.la *.lo *.o +*.so *.i *.ii *.s @@ -10,6 +11,7 @@ Makefile Makefile.in cscope.out +cmake_install.cmake /aclocal.m4 /packages/apt/debian/ /packages/apt/ubuntu/ Modified: CMakeLists.txt (+34 -20) =================================================================== --- CMakeLists.txt 2012-04-16 16:33:30 +0900 (8012a07) +++ CMakeLists.txt 2012-04-16 23:11:27 +0900 (25450f7) @@ -26,20 +26,48 @@ set(MRN_VERSION_IN_HEX "0x0${MRN_VERSION_MAJOR}${MRN_VERSION_MINOR}${MRN_VERSION_MICRO}") set(MRN_PACKAGE_STRING "${PROJECT_NAME} ${MRN_VERSION}") -include(build/cmake/files.cmake) +include(${CMAKE_SOURCE_DIR}/build/cmake_modules/ReadFileList.cmake) + +read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am MROONGA_SOURCES) +read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/lib/libmrn_no_mysql_sources.am + LIBMRN_NO_MYSQL_SOURCES) +string(REGEX REPLACE "([^;]+)" "lib/\\1" + LIBMRN_NO_MYSQL_SOURCES "${LIBMRN_NO_MYSQL_SOURCES}") +read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/lib/libmrn_need_mysql_sources.am + LIBMRN_NEED_MYSQL_SOURCES) +string(REGEX REPLACE "([^;]+)" "lib/\\1" + LIBMRN_NEED_MYSQL_SOURCES "${LIBMRN_NEED_MYSQL_SOURCES}") + +include(FindPkgConfig) +pkg_check_modules(GROONGA REQUIRED "groonga >= 2.0.0") + +include_directories( + "${PROJECT_BINARY_DIR}" + "${PROJECT_SOURCE_DIR}" + "${PROJECT_SOURCE_DIR}/lib" + ${MYSQL_INCLUDE_DIRS} + ${GROONGA_INCLUDE_DIRS} + ) + +link_directories( + ${GROONGA_LIBRARY_DIRS} + ) # TODO: set VERSIONINFO for Microsoft Visual C++. # http://msdn.microsoft.com/en-us/library/aa381058%28VS.85%29.aspx -add_library(ha_mroonga MODULE ${MROONGA_SOURCES}) +add_library(ha_mroonga MODULE + ${MROONGA_SOURCES} + ${LIBMRN_NO_MYSQL_SOURCES} + ${LIBMRN_NEED_MYSQL_SOURCES}) +set_source_files_properties(${MROONGA_SOURCES} PROPERTIES + COMPILE_FLAGS "-Werror -fno-implicit-templates -fno-exceptions -fno-rtti -felide-constructors") set_target_properties(ha_mroonga PROPERTIES COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN" PREFIX "" OUTPUT_NAME "ha_mroonga") -set_source_files_properties(${MROONGA_CPP_SOURCES} PROPERTIES - COMPILE_FLAGS "-Werror -fno-implicit-templates -fno-exceptions -fno-rtti -felide-constructors") +set_property(TARGET ha_mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "MRN_PARSER_DEFAULT=\"${DEFAULT_PARSER}\"") -include(FindPkgConfig) -pkg_check_modules(GROONGA REQUIRED "groonga >= 2.0.0") target_link_libraries(ha_mroonga ${GROONGA_LIBRARIES}) option(WITH_DEBUG "Enable debug options" OFF) @@ -84,20 +112,6 @@ set_mysql_config_value("--cflags" MYSQL_CFLAGS) set_mysql_config_value("--version" MYSQL_VERSION) set(DEFAULT_PARSER "TokenBigram" CACHE STRING "The default fulltext parser") -set_property(TARGET ha_mroonga APPEND PROPERTY - COMPILE_DEFINITIONS "MRN_PARSER_DEFAULT=\"${DEFAULT_PARSER}\"") - -include_directories( - "${PROJECT_BINARY_DIR}" - "${PROJECT_SOURCE_DIR}" - "${PROJECT_SOURCE_DIR}/lib" - ${MYSQL_INCLUDE_DIRS} - ${GROONGA_INCLUDE_DIRS} - ) - -link_directories( - ${GROONGA_LIBRARY_DIRS} - ) install(TARGETS ha_mroonga DESTINATION "${MYSQL_PLUGIN_DIR}") Modified: Makefile.am (+1 -14) =================================================================== --- Makefile.am 2012-04-16 16:33:30 +0900 (b4dc700) +++ Makefile.am 2012-04-16 23:11:27 +0900 (fa3013d) @@ -5,20 +5,7 @@ LOCALES = ja AM_CPPFLAGS = $(MYSQL_INC) $(GROONGA_CFLAGS) -I$(top_srcdir)/lib ACLOCAL_AMFLAGS = $$ACLOCAL_ARGS -noinst_HEADERS = \ - mrn_macro.hpp \ - mrn_sys.hpp \ - mrn_constants.hpp \ - ha_mroonga.hpp \ - mrn_table.hpp \ - mrn_err.h \ - mrn_mysql.h \ - mrn_mysql_compat.h - -sources = \ - ha_mroonga.cpp \ - mrn_sys.cpp \ - mrn_table.cpp +include sources.am libraries = \ $(top_builddir)/lib/libmrn_no_mysql.la \ Deleted: build/cmake/files.cmake (+0 -34) 100644 =================================================================== --- build/cmake/files.cmake 2012-04-16 16:33:30 +0900 (d204ad6) +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright(C) 2012 Kouhei Sutou <kou****@clear*****> -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 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 -# Lesser 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -set(MROONGA_C_SOURCES - mrn_sys.c - mrn_sys.h - - mrn_macro.h - mrn_err.h - mrn_mysql.h - mrn_mysql_compat.h - ) -set(MROONGA_CPP_SOURCES - ha_mroonga.cc - ha_mroonga.h - mrn_table.cc - mrn_table.h - lib/mrn_path_mapper.cpp - lib/mrn_path_mapper.hpp - ) -set(MROONGA_SOURCES ${MROONGA_C_SOURCES} ${MROONGA_CPP_SOURCES}) Added: build/cmake_modules/ReadFileList.cmake (+27 -0) 100644 =================================================================== --- /dev/null +++ build/cmake_modules/ReadFileList.cmake 2012-04-16 23:11:27 +0900 (0185879) @@ -0,0 +1,27 @@ +# 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 +# License version 2.1 as published by the Free Software Foundation. +# +# 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. +# +# 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 + +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: lib/Makefile.am (+2 -9) =================================================================== --- lib/Makefile.am 2012-04-16 16:33:30 +0900 (451faa9) +++ lib/Makefile.am 2012-04-16 23:11:27 +0900 (6065e6b) @@ -8,12 +8,5 @@ noinst_LTLIBRARIES = \ libmrn_no_mysql.la \ libmrn_need_mysql.la -libmrn_no_mysql_la_SOURCES = \ - mrn_path_mapper.cpp \ - mrn_path_mapper.hpp - -libmrn_need_mysql_la_SOURCES = \ - mrn_index_table_name.cpp \ - mrn_index_table_name.hpp \ - mrn_debug_column_access.cpp \ - mrn_debug_column_access.hpp +include libmrn_no_mysql_sources.am +include libmrn_need_mysql_sources.am Added: lib/libmrn_need_mysql_sources.am (+5 -0) 100644 =================================================================== --- /dev/null +++ lib/libmrn_need_mysql_sources.am 2012-04-16 23:11:27 +0900 (126e524) @@ -0,0 +1,5 @@ +libmrn_need_mysql_la_SOURCES = \ + mrn_index_table_name.cpp \ + mrn_index_table_name.hpp \ + mrn_debug_column_access.cpp \ + mrn_debug_column_access.hpp Added: lib/libmrn_no_mysql_sources.am (+3 -0) 100644 =================================================================== --- /dev/null +++ lib/libmrn_no_mysql_sources.am 2012-04-16 23:11:27 +0900 (d6fbf04) @@ -0,0 +1,3 @@ +libmrn_no_mysql_la_SOURCES = \ + mrn_path_mapper.cpp \ + mrn_path_mapper.hpp Added: sources.am (+12 -0) 100644 =================================================================== --- /dev/null +++ sources.am 2012-04-16 23:11:27 +0900 (a820f2c) @@ -0,0 +1,12 @@ +sources = \ + mrn_macro.hpp \ + mrn_sys.cpp \ + mrn_sys.hpp \ + mrn_constants.hpp \ + ha_mroonga.cpp \ + ha_mroonga.hpp \ + mrn_table.cpp \ + mrn_table.hpp \ + mrn_err.h \ + mrn_mysql.h \ + mrn_mysql_compat.h