Commit 8b18a44f authored by Sergei Golubchik's avatar Sergei Golubchik

mroonga after-merge CMakeLists.txt fixes

1. remove erroneously committed *.orig
2. fix LZ4 detection on Mac OS X and FreeBSD. Cannot do

   pkg_check_modules(LIBLZ4 liblz4)
   find_library(LIBLZ4_LIBS ... )

because find_library(X) does not do anything if X is defined (documented),
and pkg_check_modules(Y) sets Y_LIBS to "" (undocumented!)
parent 1fdf1166
# -*- indent-tabs-mode: nil -*-
#
# Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
# Copyright(C) 2013 Kentoku SHIBA
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
cmake_minimum_required(VERSION 2.6)
project(mroonga)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
set(MRN_BUNDLED FALSE)
else()
set(MRN_BUNDLED TRUE)
endif()
include(TestBigEndian)
test_big_endian(BIG_ENDIAN)
if(BIG_ENDIAN)
set(MRN_BIG_ENDIAN_NOT_SUPPORTED_MESSAGE
"Mroonga doesn't support on big-endian")
if(MRN_BUNDLED)
message(STATUS ${MRN_BIG_ENDIAN_NOT_SUPPORTED_MESSAGE})
return()
else()
message(FATAL_ERROR ${MRN_BIG_ENDIAN_NOT_SUPPORTED_MESSAGE})
endif()
endif()
if(MSVC)
if(MSVC_VERSION LESS 1800)
set(MRN_OLD_MSVC_MESSAGE "Mroonga supports only MSVC 2013 or later")
if(MRN_BUNDLED)
message(STATUS ${MRN_OLD_MSVC_MESSAGE})
return()
else()
message(FATAL_ERROR ${MRN_OLD_MSVC_MESSAGE})
endif()
endif()
endif()
if(MRN_BUNDLED)
if(WITHOUT_MROONGA OR
WITHOUT_MROONGA_STORAGE_ENGINE OR
"${PLUGIN_MROONGA}" STREQUAL "NO")
return()
endif()
endif()
set(MRN_BUNDLED_GROONGA_RELATIVE_DIR "vendor/groonga")
set(MRN_BUNDLED_GROONGA_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/${MRN_BUNDLED_GROONGA_RELATIVE_DIR}")
if(EXISTS "${MRN_BUNDLED_GROONGA_DIR}")
set(MRN_GROONGA_BUNDLED TRUE)
else()
set(MRN_GROONGA_BUNDLED FALSE)
endif()
set(MRN_PLUGIN_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
if(MRN_BUNDLED)
set(MRN_SOURCE_DIR ${CMAKE_SOURCE_DIR}/storage/mroonga)
else()
set(MRN_SOURCE_DIR ${CMAKE_SOURCE_DIR})
endif()
file(READ ${MRN_SOURCE_DIR}/version MRN_VERSION)
file(READ ${MRN_SOURCE_DIR}/version_major MRN_VERSION_MAJOR)
file(READ ${MRN_SOURCE_DIR}/version_minor MRN_VERSION_MINOR)
file(READ ${MRN_SOURCE_DIR}/version_micro MRN_VERSION_MICRO)
file(READ ${MRN_SOURCE_DIR}/version_in_hex MRN_VERSION_IN_HEX)
file(READ ${MRN_SOURCE_DIR}/plugin_version MRN_PLUGIN_VERSION)
if(MRN_GROONGA_BUNDLED)
option(MRN_GROONGA_EMBED
"Embed libgroonga"
ON)
if(MRN_GROONGA_EMBED)
set(GRN_EMBED ON)
endif()
set(MRN_BUNDLED_GROONGA_NORMALIZER_MYSQL_DIR
"${MRN_BUNDLED_GROONGA_DIR}/vendor/plugins/groonga-normalizer-mysql")
option(MRN_GROONGA_NORMALIZER_MYSQL_EMBED
"Embed groonga-normalizer-mysql Groonga plugin"
ON)
if(EXISTS ${MRN_BUNDLED_GROONGA_NORMALIZER_MYSQL_DIR})
set(GROONGA_NORMALIZER_MYSQL_FOUND ON)
else()
set(GROONGA_NORMALIZER_MYSQL_FOUND OFF)
set(MRN_GROONGA_NORMALIZER_MYSQL_EMBED OFF)
endif()
if(MRN_GROONGA_NORMALIZER_MYSQL_EMBED)
set(GROONGA_NORMALIZER_MYSQL_EMBED ON)
endif()
file(READ "${MRN_BUNDLED_GROONGA_DIR}/bundled_lz4_version"
MRN_BUNDLED_LZ4_VERSION)
string(STRIP
"${MRN_BUNDLED_LZ4_VERSION}"
MRN_BUNDLED_LZ4_VERSION)
set(MRN_BUNDLED_LZ4_DIR
"${MRN_BUNDLED_GROONGA_DIR}/vendor/lz4-${MRN_BUNDLED_LZ4_VERSION}")
if(EXISTS ${MRN_BUNDLED_LZ4_DIR})
set(GRN_WITH_BUNDLED_LZ4 ON)
set(GRN_WITH_LZ4 "yes")
else()
set(GRN_WITH_LZ4 "no")
endif()
add_subdirectory("${MRN_BUNDLED_GROONGA_RELATIVE_DIR}")
else()
set(MRN_GROONGA_EMBED OFF)
file(READ ${MRN_SOURCE_DIR}/required_groonga_version REQUIRED_GROONGA_VERSION)
string(STRIP "${REQUIRED_GROONGA_VERSION}" REQUIRED_GROONGA_VERSION)
file(READ
${MRN_SOURCE_DIR}/required_groonga_normalizer_mysql_version
REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION)
string(STRIP
"${REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION}"
REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION)
endif()
set(MRN_PACKAGE_STRING "${PROJECT_NAME} ${MRN_VERSION}")
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(${MRN_SOURCE_DIR}/build/cmake_modules/ReadFileList.cmake)
set(MRN_C_COMPILE_FLAGS "")
set(MRN_CXX_COMPILE_FLAGS "")
macro(mrn_check_cflag flag)
string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
set(temporary_variable_name "CFLAG${temporary_variable_name}")
check_c_compiler_flag(${flag} ${temporary_variable_name})
if(${temporary_variable_name})
set(MRN_C_COMPILE_FLAGS "${MRN_C_COMPILE_FLAGS} ${flag}")
endif()
endmacro()
macro(mrn_check_cxxflag flag)
string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
set(temporary_variable_name "CXXFLAG${temporary_variable_name}")
check_cxx_compiler_flag(${flag} ${temporary_variable_name})
if(${temporary_variable_name})
set(MRN_CXX_COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS} ${flag}")
endif()
endmacro()
macro(mrn_build_flag flag)
mrn_check_cflag(${flag})
mrn_check_cxxflag(${flag})
endmacro()
if(MRN_BUNDLED)
set(MRN_RELATIVE_DIR_PREFIX "${MRN_SOURCE_DIR}/")
else()
set(MRN_RELATIVE_DIR_PREFIX "")
endif()
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am MRN_SOURCES)
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/lib/libmrn_no_mysql_sources.am
LIBMRN_NO_MYSQL_SOURCES)
string(REGEX REPLACE "([^;]+)" "${MRN_RELATIVE_DIR_PREFIX}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 "([^;]+)" "${MRN_RELATIVE_DIR_PREFIX}lib/\\1"
LIBMRN_NEED_MYSQL_SOURCES "${LIBMRN_NEED_MYSQL_SOURCES}")
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/udf/sources.am MRN_UDF_SOURCES)
string(REGEX REPLACE "([^;]+)" "${MRN_RELATIVE_DIR_PREFIX}udf/\\1"
MRN_UDF_SOURCES "${MRN_UDF_SOURCES}")
if(MRN_BUNDLED)
set(MYSQL_SOURCE_DIR ${CMAKE_SOURCE_DIR})
set(MYSQL_BUILD_DIR ${MYSQL_SOURCE_DIR})
set(MYSQL_CONFIG ${CMAKE_SOURCE_DIR}/scripts/mysql_config)
else()
set(MYSQL_SOURCE_DIR "/PATH/TO/MYSQL/SOURCE/DIRECTORY/"
CACHE PATH "MySQL source directory")
if(NOT EXISTS ${MYSQL_SOURCE_DIR})
message(FATAL_ERROR
"MySQL source directory (MYSQL_SOURCE_DIR) doesn't exist: <${MYSQL_SOURCE_DIR}>")
endif()
set(MYSQL_BUILD_DIR ${MYSQL_SOURCE_DIR} CACHE PATH "MySQL build directory")
set(MYSQL_CONFIG "mysql_config" CACHE PATH "mysql-config command path")
endif()
find_path(MYSQL_CONFIG "${MYSQL_CONFIG}")
if(EXISTS "${MYSQL_SOURCE_DIR}/storage/maria")
set(MYSQL_VARIANT "MariaDB")
else()
set(MYSQL_VARIANT "MySQL")
endif()
if(EXISTS "${MYSQL_SOURCE_DIR}/pcre")
set(MYSQL_REGEX_INCLUDE_DIR "${MYSQL_SOURCE_DIR}/pcre")
else()
set(MYSQL_REGEX_INCLUDE_DIR "${MYSQL_SOURCE_DIR}/regex")
endif()
if(EXISTS "${MYSQL_SOURCE_DIR}/extra/rapidjson")
set(MYSQL_RAPIDJSON_INCLUDE_DIR "${MYSQL_SOURCE_DIR}/extra/rapidjson/include")
else()
set(MYSQL_RAPIDJSON_INCLUDE_DIR)
endif()
if(EXISTS "${MYSQL_SOURCE_DIR}/libbinlogevents")
set(MYSQL_LIBBINLOGEVENTS_EXPORT_DIR
"${MYSQL_SOURCE_DIR}/libbinlogevents/export")
set(MYSQL_LIBBINLOGEVENTS_INCLUDE_DIR
"${MYSQL_BUILD_DIR}/libbinlogevents/include"
"${MYSQL_SOURCE_DIR}/libbinlogevents/include")
else()
set(MYSQL_LIBBINLOGEVENTS_EXPORT_DIR)
set(MYSQL_LIBBINLOGEVENTS_INCLUDE_DIR)
endif()
set(MYSQL_INCLUDE_DIRS
"${MYSQL_BUILD_DIR}/include"
"${MYSQL_SOURCE_DIR}/sql"
"${MYSQL_SOURCE_DIR}/include"
"${MYSQL_REGEX_INCLUDE_DIR}"
"${MYSQL_RAPIDJSON_INCLUDE_DIR}"
"${MYSQL_LIBBINLOGEVENTS_EXPORT_DIR}"
"${MYSQL_LIBBINLOGEVENTS_INCLUDE_DIR}"
"${MYSQL_SOURCE_DIR}")
if(MRN_BUNDLED)
set(MYSQL_PLUGIN_DIR "${INSTALL_PLUGINDIR}")
set(MYSQL_SERVICES_LIB_DIR "${MYSQL_BUILD_DIR}/libservices")
set(MYSQL_CFLAGS "${CMAKE_C_FLAGS}")
set(MYSQL_VERSION "${MYSQL_BASE_VERSION}")
else()
macro(SET_MYSQL_CONFIG_VALUE OPTION VARIABLE)
if(NOT ${VARIABLE})
execute_process(COMMAND "${MYSQL_CONFIG}" ${OPTION}
OUTPUT_VARIABLE MYSQL_CONFIG_OUTPUT)
string(STRIP ${MYSQL_CONFIG_OUTPUT} ${VARIABLE})
endif()
endmacro()
set_mysql_config_value("--plugindir" MYSQL_PLUGIN_DIR)
set_mysql_config_value("--variable=pkglibdir" MYSQL_PKG_LIB_DIR)
set(MYSQL_BUILD_LIBSERVICES_DIR "${MYSQL_BUILD_DIR}/libservices")
if(EXISTS "${MYSQL_BUILD_LIBSERVICES_DIR}/libmysqlservices.a")
set(MYSQL_SERVICES_LIB_DIR "${MYSQL_BUILD_LIBSERVICES_DIR}")
else()
set(MYSQL_SERVICES_LIB_DIR "${MYSQL_PKG_LIB_DIR}")
endif()
set_mysql_config_value("--cflags" MYSQL_CFLAGS)
set_mysql_config_value("--version" MYSQL_VERSION)
endif()
if(${MYSQL_VERSION} VERSION_LESS "5.5.0")
message(FATAL_ERROR
"Mroonga doesn't support MySQL < 5.5.0: <${MYSQL_VERSION}>")
return()
endif()
if(${MYSQL_VERSION} VERSION_GREATER "10.0.0" AND
${MYSQL_VERSION} VERSION_LESS "10.0.9")
message(FATAL_ERROR
"Mroonga doesn't support MariaDB 10.0.0-10.0.8: <${MYSQL_VERSION}>")
return()
endif()
if(MRN_GROONGA_BUNDLED)
set(GROONGA_INCLUDE_DIRS "${MRN_BUNDLED_GROONGA_DIR}/include")
set(GROONGA_LIBRARY_DIRS "${MRN_BUNDLED_GROONGA_DIR}/lib")
set(GROONGA_LIBRARIES "libgroonga")
set(MRN_LIBRARY_DIRS ${GROONGA_LIBRARY_DIRS})
set(MRN_LIBRARIES ${GROONGA_LIBRARIES})
if(MRN_GROONGA_NORMALIZER_MYSQL_EMBED)
set(MRN_LIBRARY_DIRS
${MRN_LIBRARY_DIRS}
"${MRN_BUNDLED_GROONGA_NORMALIZER_MYSQL_DIR}/normalizers")
set(MRN_LIBRARIES ${MRN_LIBRARIES} mysql_normalizer)
endif()
else()
include(FindPkgConfig)
pkg_check_modules(GROONGA REQUIRED "groonga >= ${REQUIRED_GROONGA_VERSION}")
pkg_check_modules(GROONGA_NORMALIZER_MYSQL
"groonga-normalizer-mysql >= ${REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION}")
set(MRN_LIBRARY_DIRS
${MRN_LIBRARY_DIRS}
${GROONGA_LIBRARY_DIRS})
set(MRN_LIBRARIES ${GROONGA_LIBRARIES})
endif()
include_directories(
"${PROJECT_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}/lib"
${MYSQL_INCLUDE_DIRS}
${GROONGA_INCLUDE_DIRS})
if(WIN32)
set(MYSQL_LIBRARY_DIRS
"${MYSQL_BUILD_DIR}/lib"
"${MYSQL_BUILD_DIR}/libmysqld")
else()
set(MYSQL_LIBRARY_DIRS
"${MYSQL_SERVICES_LIB_DIR}")
endif()
link_directories(
${MRN_LIBRARY_DIRS}
${MYSQL_LIBRARY_DIRS})
set(MRN_ALL_SOURCES
${MRN_SOURCES}
${MRN_UDF_SOURCES}
${LIBMRN_NO_MYSQL_SOURCES}
${LIBMRN_NEED_MYSQL_SOURCES})
if(MRN_BUNDLED)
mysql_add_plugin(mroonga
${MRN_ALL_SOURCES}
STORAGE_ENGINE MODULE_ONLY
LINK_LIBRARIES ${MRN_LIBRARIES})
else()
add_library(mroonga MODULE ${MRN_ALL_SOURCES})
set(MYSQL_LIBRARIES "mysqlservices")
target_link_libraries(mroonga ${GROONGA_LIBRARIES} ${MYSQL_LIBRARIES})
option(WITH_DEBUG "Enable debug options" OFF)
if(WITH_DEBUG)
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "SAFE_MUTEX")
if(CMAKE_COMPILER_IS_GNUCXX)
set(MRN_C_COMPILE_FLAGS "${MRN_C_COMPILE_FLAGS} -g3 -O0")
set(MRN_CXX_COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS} -g3 -O0")
endif()
else()
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "DBUG_OFF")
endif()
option(WITH_DEBUG_FULL "Enable full debug options" OFF)
if(WITH_DEBUG_FULL)
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "SAFE_MUTEX" "SAFEMALLOC")
endif()
option(DISABLE_FAST_MUTEXES "Force disabling fast mutex" OFF)
if(DISABLE_FAST_MUTEXES)
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "FORCE_FAST_MUTEX_DISABLED=1")
endif()
option(WITH_FAST_MUTEXES "Enable fast mutex" OFF)
if(WITH_FAST_MUTEXES)
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "MY_PTHREAD_FASTMUTEX")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
mrn_build_flag("-Wall")
mrn_build_flag("-Wextra")
mrn_build_flag("-Wno-unused-parameter")
mrn_build_flag("-Wno-strict-aliasing")
mrn_build_flag("-Wno-deprecated")
mrn_check_cxxflag("-fno-implicit-templates")
if(("${MYSQL_VARIANT}" STREQUAL "MariaDB") OR
("${MYSQL_VARIANT}" STREQUAL "MySQL" AND
${MYSQL_VERSION} VERSION_LESS "5.7.0"))
mrn_check_cxxflag("-fno-exceptions")
mrn_check_cxxflag("-fno-rtti")
endif()
mrn_check_cxxflag("-felide-constructors")
endif()
set_source_files_properties(${MRN_SOURCES} PROPERTIES
COMPILE_FLAGS "${MYSQL_CFLAGS} ${MRN_CXX_COMPILE_FLAGS}")
set_source_files_properties(${LIBMRN_NEED_MYSQL_SOURCES} PROPERTIES
COMPILE_FLAGS "${MYSQL_CFLAGS} ${MRN_CXX_COMPILE_FLAGS}")
set_source_files_properties(${MRN_UDF_SOURCES} PROPERTIES
COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS}")
set_source_files_properties(${LIBMRN_NO_MYSQL_SOURCES} PROPERTIES
COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS}")
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN")
set_target_properties(mroonga PROPERTIES
PREFIX ""
OUTPUT_NAME "ha_mroonga")
install(TARGETS mroonga DESTINATION "${MYSQL_PLUGIN_DIR}")
endif()
option(MRN_BUILD_FOR_EMBEDDED_SERVER
"Whether to build Mroonga for embedded server or not. You can't use Mroonga built for embedded server with non embedded server."
OFF)
if(MRN_BUILD_FOR_EMBEDDED_SERVER)
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "EMBEDDED_LIBRARY")
endif()
if(GROONGA_NORMALIZER_MYSQL_FOUND)
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "WITH_GROONGA_NORMALIZER_MYSQL=1")
if(MRN_GROONGA_NORMALIZER_MYSQL_EMBED)
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "MRN_GROONGA_NORMALIZER_MYSQL_EMBEDDED")
else()
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME=\"normalizers/mysql\"")
endif()
endif()
if(MRN_GROONGA_EMBED)
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "MRN_GROONGA_EMBEDDED")
endif()
set(MRN_DEFAULT_PARSER "" CACHE STRING
"The default fulltext parser (Deprecated. Use MRN_DEFAULT_TOKENIZER instead.)")
set(MRN_DEFAULT_TOKENIZER "" CACHE STRING
"The default tokenizer for fulltext index")
if(NOT ${MRN_DEFAULT_TOKENIZER} STREQUAL "")
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "MRN_DEFAULT_TOKENIZER=\"${MRN_DEFAULT_TOKENIZER}\"")
elseif(NOT ${MRN_DEFAULT_PARSER} STREQUAL "")
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "MRN_DEFAULT_TOKENIZER=\"${MRN_DEFAULT_PARSER}\"")
endif()
configure_file(
"${PROJECT_SOURCE_DIR}/mrn_version.h.in"
"${PROJECT_BINARY_DIR}/mrn_version.h")
configure_file(
"${PROJECT_SOURCE_DIR}/config.sh.in"
"${PROJECT_BINARY_DIR}/config.sh")
set(MRN_TEST_SUITE_DIR "${CMAKE_SOURCE_DIR}/mysql-test/suite/mroonga")
if(NOT EXISTS "${MRN_TEST_SUITE_DIR}")
set(MRN_TEST_SUITE_DIR "${PROJECT_SOURCE_DIR}/mysql-test/mroonga")
endif()
configure_file(
"${MRN_TEST_SUITE_DIR}/storage/r/information_schema_plugins.result.in"
"${MRN_TEST_SUITE_DIR}/storage/r/information_schema_plugins.result"
NEWLINE_STYLE LF)
configure_file(
"${MRN_TEST_SUITE_DIR}/storage/r/variable_version.result.in"
"${MRN_TEST_SUITE_DIR}/storage/r/variable_version.result"
NEWLINE_STYLE LF)
configure_file(
"${PROJECT_SOURCE_DIR}/data/install.sql.in"
"${PROJECT_BINARY_DIR}/data/install.sql")
if(MRN_BUNDLED)
set(MRN_DATA_DIR "${INSTALL_MYSQLSHAREDIR}/${PROJECT_NAME}")
else()
set(MRN_DATA_DIR "share/${PROJECT_NAME}")
endif()
install(FILES
"${PROJECT_SOURCE_DIR}/AUTHORS"
"${PROJECT_SOURCE_DIR}/COPYING"
"${PROJECT_BINARY_DIR}/data/install.sql"
"${PROJECT_SOURCE_DIR}/data/uninstall.sql"
DESTINATION "${MRN_DATA_DIR}/")
......@@ -355,13 +355,13 @@ if(NOT ${GRN_WITH_LZ4} STREQUAL "no")
if(GRN_WITH_BUNDLED_LZ4)
set(LIBLZ4_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/vendor/lz4-${GRN_BUNDLED_LZ4_VERSION}/lib")
set(LIBLZ4_LIBS liblz4)
set(LZ4_LIBS liblz4)
else()
if(NOT DEFINED LIBLZ4_FOUND)
pkg_check_modules(LIBLZ4 liblz4)
endif()
if(LIBLZ4_FOUND)
find_library(LIBLZ4_LIBS
find_library(LZ4_LIBS
NAMES ${LIBLZ4_LIBRARIES}
PATHS ${LIBLZ4_LIBRARY_DIRS}
NO_DEFAULT_PATH)
......
# Copyright(C) 2012-2016 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
# https://buildbot.askmonty.org/buildbot/builders/work-amd64-valgrind/builds/5263/steps/compile/logs/stdio
# says CMake 2.6.2... We want to drop old software support...
cmake_minimum_required(VERSION 2.6.2)
# cmake_minimum_required(VERSION 2.6.4) # CentOS 5
set(GRN_PROJECT_NAME "groonga")
set(GRN_PROJECT_LABEL "Groonga")
project("${GRN_PROJECT_NAME}")
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
set(GRN_BUNDLED FALSE)
else()
set(GRN_BUNDLED TRUE)
endif()
if(MSVC)
if(MSVC_VERSION LESS 1800)
set(GRN_OLD_MSVC_MESSAGE "Groonga supports only MSVC 2013 or later")
if(GRN_BUNDLED)
message(STATUS ${GRN_OLD_MSVC_MESSAGE})
return()
else()
message(FATAL_ERROR ${GRN_OLD_MSVC_MESSAGE})
endif()
endif()
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(CMAKE_COMPILER_IS_CLANGCC ON)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_COMPILER_IS_CLANGCXX ON)
endif()
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/base_version" VERSION)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/version.sh")
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/version.sh" GRN_VERSION)
else()
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/version.sh")
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git" AND EXISTS "/bin/sh")
execute_process(COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/version-gen.sh")
file(READ "${CMAKE_CURRENT_BINARY_DIR}/version.sh" GRN_VERSION)
else()
set(GRN_VERSION "${VERSION}")
endif()
endif()
endif()
string(REGEX REPLACE "(^.*=|\n)" "" GRN_VERSION "${GRN_VERSION}")
string(REGEX REPLACE "\\." "," GRN_VERSION_RC "${GRN_VERSION}")
string(REGEX REPLACE "-.*$" "" GRN_VERSION_RC "${GRN_VERSION_RC}")
include(CheckIncludeFile)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(FindPkgConfig)
include(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake_modules/ReadFileList.cmake)
if(DEFINED GRN_EMBED)
set(GRN_EMBED_DEFAULT ${GRN_EMBED})
else()
set(GRN_EMBED_DEFAULT OFF)
endif()
option(GRN_EMBED
"Build as a static library to embed into an application"
${GRN_EMBED_DEFAULT})
set(BIN_DIR "bin")
set(SBIN_DIR "sbin")
set(LIB_DIR "lib")
set(INCLUDE_DIR "include")
set(GRN_INCLUDE_DIR "include/groonga")
set(DATA_DIR "share")
set(GRN_DATA_DIR "${DATA_DIR}/${GRN_PROJECT_NAME}")
set(CONFIG_DIR "etc")
set(GRN_CONFIG_DIR "${CONFIG_DIR}/${GRN_PROJECT_NAME}")
set(GRN_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${GRN_CONFIG_DIR}/groonga.conf")
set(GRN_LOG_PATH
"${CMAKE_INSTALL_PREFIX}/var/log/${GRN_PROJECT_NAME}/${GRN_PROJECT_NAME}.log"
CACHE FILEPATH "log file path")
set(GRN_DEFAULT_ENCODING
"utf8"
CACHE STRING "Groonga's default encoding")
set(GRN_DEFAULT_MATCH_ESCALATION_THRESHOLD
0
CACHE STRING "Groonga's default match escalation threshold")
set(GRN_DEFAULT_DOCUMENT_ROOT_BASE
"html/admin"
CACHE PATH "Groonga's default document root base path")
set(GRN_DEFAULT_RELATIVE_DOCUMENT_ROOT
"share/${GRN_PROJECT_NAME}/${GRN_DEFAULT_DOCUMENT_ROOT_BASE}"
CACHE PATH "Groonga's default relative document root")
set(GRN_DEFAULT_DOCUMENT_ROOT
"${CMAKE_INSTALL_PREFIX}/${GRN_DATA_DIR}/${GRN_DEFAULT_DOCUMENT_ROOT_BASE}"
CACHE PATH "Groonga's default document root")
set(GRN_DEFAULT_DB_KEY
"auto"
CACHE STRING "Groonga's default DB key management algorithm")
set(GRN_STACK_SIZE
1024
CACHE STRING
"DANGER!!! Groonga's stack size. Normarlly, you should not change this variable.")
set(GRN_LOCK_TIMEOUT
900000
CACHE STRING
"timeout to acquire a lock.")
set(GRN_LOCK_WAIT_TIME_NANOSECOND
1000000
CACHE STRING
"wait time in nanosecond to acquire a lock.")
set(GRN_RELATIVE_PLUGINS_DIR
"${LIB_DIR}/${GRN_PROJECT_NAME}/plugins")
set(GRN_PLUGINS_DIR
"${CMAKE_INSTALL_PREFIX}/${GRN_RELATIVE_PLUGINS_DIR}")
set(GRN_PLUGIN_SUFFIX "${CMAKE_SHARED_MODULE_SUFFIX}")
set(GRN_DLL_FILENAME
"${CMAKE_SHARED_LIBRARY_PREFIX}groonga${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(GRN_QUERY_EXPANDER_TSV_RELATIVE_SYNONYMS_FILE
"${GRN_CONFIG_DIR}/synonyms.tsv")
set(GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE
"${CMAKE_INSTALL_PREFIX}/${GRN_QUERY_EXPANDER_TSV_RELATIVE_SYNONYMS_FILE}")
set(GRN_RELATIVE_RUBY_SCRIPTS_DIR
"${LIB_DIR}/${GRN_PROJECT_NAME}/scripts/ruby")
set(GRN_RUBY_SCRIPTS_DIR
"${CMAKE_INSTALL_PREFIX}/${GRN_RELATIVE_RUBY_SCRIPTS_DIR}")
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(GRN_C_COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS} -std=gnu99")
endif()
macro(check_cflag flag)
string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
set(temporary_variable_name "CFLAG${temporary_variable_name}")
check_c_compiler_flag(${flag} ${temporary_variable_name})
if(${temporary_variable_name})
set(GRN_C_COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS} ${flag}")
endif()
endmacro()
macro(check_cxxflag flag)
string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
set(temporary_variable_name "CXXFLAG${temporary_variable_name}")
check_cxx_compiler_flag(${flag} ${temporary_variable_name})
if(${temporary_variable_name})
set(GRN_CXX_COMPILE_FLAGS "${GRN_CXX_COMPILE_FLAGS} ${flag}")
endif()
endmacro()
macro(check_build_flag flag)
check_cflag(${flag})
check_cxxflag(${flag})
endmacro()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
check_build_flag("-Wall")
check_build_flag("-Wno-unused-but-set-variable")
check_cflag("-Wno-pointer-sign")
check_build_flag("-Wformat")
check_build_flag("-Wstrict-aliasing=2")
check_build_flag("-fno-strict-aliasing")
check_build_flag("-Wdisabled-optimization")
check_build_flag("-Wfloat-equal")
check_build_flag("-Wpointer-arith")
check_cflag("-Wbad-function-cast")
if(NOT CMAKE_COMPILER_IS_CLANGCXX)
check_build_flag("-Wcast-align")
endif()
# check_build_flag("-Wredundant-decls")
check_build_flag("-Wwrite-strings")
check_cxxflag("-fexceptions")
check_cxxflag("-fimplicit-templates")
endif()
if(NOT DEFINED CMAKE_C_COMPILE_OPTIONS_PIC)
# For old CMake
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
check_build_flag("-fPIC")
endif()
endif()
option(GRN_WITH_DEBUG "enable debug build." OFF)
if(GRN_WITH_DEBUG)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
set(GRN_C_COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS} -g3 -O0")
set(GRN_CXX_COMPILE_FLAGS "${GRN_CXX_COMPILE_FLAGS} -g3 -O0")
endif()
endif()
add_definitions(
-DHAVE_CONFIG_H
)
if(GRN_EMBED)
add_definitions(-DGRN_EMBEDDED)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
set(_GNU_SOURCE TRUE)
endif()
include_directories(
BEFORE
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/lib
)
macro(ac_check_headers header)
string(REGEX REPLACE "[/.]" "_" output_variable_name ${header})
string(TOUPPER "${output_variable_name}" output_variable_name)
set(output_variable_name "HAVE_${output_variable_name}")
check_include_file(${header} ${output_variable_name})
endmacro()
macro(ac_check_funcs function)
string(TOUPPER "${function}" output_variable_name)
set(output_variable_name "HAVE_${output_variable_name}")
check_function_exists(${function} ${output_variable_name})
endmacro()
macro(ac_check_symbols symbol files)
string(TOUPPER "${symbol}" output_variable_name)
set(output_variable_name "HAVE_${output_variable_name}")
check_symbol_exists(${symbol} ${files} ${output_variable_name})
endmacro()
macro(ac_check_lib library function)
string(REGEX REPLACE "[/.]" "_" output_variable_base_name ${library})
string(TOUPPER "${output_variable_base_name}" output_variable_base_name)
set(output_variable_name "HAVE_LIB${output_variable_base_name}")
set(location "${ARG2}")
check_library_exists(${library} ${function} "${location}"
${output_variable_name})
if(${output_variable_name})
set(${output_variable_base_name}_LIBS "${library}")
endif()
endmacro()
include(build/ac_macros/check_headers.m4)
include(build/ac_macros/check_functions.m4)
ac_check_symbols(fpclassify math.h)
ac_check_lib(m fpclassify)
ac_check_lib(dl dlopen)
ac_check_lib(execinfo backtrace)
if(HAVE_LIBEXECINFO)
set(HAVE_BACKTRACE TRUE)
else()
ac_check_funcs(backtrace)
endif()
ac_check_lib(rt clock_gettime)
if(HAVE_LIBRT)
set(HAVE_CLOCK_GETTIME TRUE)
endif()
if(GRN_EMBED)
check_library_exists(stdc++ __cxa_begin_catch "${ARG2}"
STDCPP)
if(STDCPP)
set(STDCPP_LIBS "stdc++")
endif()
endif()
if(UNIX)
ac_check_headers(pthread.h)
ac_check_lib(pthread pthread_mutex_init)
if(NOT ${HAVE_LIBPTHREAD})
message(FATAL_ERROR "No libpthread found")
endif()
ac_check_funcs(pthread_mutexattr_setpshared)
ac_check_funcs(pthread_condattr_setpshared)
endif()
option(GRN_WITH_NFKC "use NFKC based UTF8 normalization." ON)
if(WIN32)
ac_check_headers(winsock2.h)
if(NOT ${HAVE_WINSOCK2_H})
message(FATAL_ERROR "No winsock2.h found")
endif()
# FIXME: CMake couldn't detect ws2_32.lib on Windows 8 64bit.
# It may be caused by missing library search path for ws2_32.lib.
# It seems that Visual Studio (devenv.exe) can find it but link.exe
# can't. "cmake --build" can find it because it uses Visual Studio
# internally. So we assume that we always have ws2_32.lib on Windows.
# ac_check_lib(ws2_32 select)
set(HAVE_LIBWS2_32 TRUE)
set(WS2_32_LIBS "ws2_32.lib")
set(USE_SELECT TRUE)
else()
ac_check_headers(sys/epoll.h)
if(${HAVE_SYS_EPOLL_H})
ac_check_funcs(epoll_create)
if(${HAVE_EPOLL_CREATE})
set(USE_EPOLL TRUE)
endif()
endif()
if(NOT USE_EPOLL)
ac_check_headers(sys/event.h)
if(${HAVE_SYS_EVENT_H})
ac_check_funcs(kevent)
if(${HAVE_KEVENT})
set(USE_KQUEUE TRUE)
endif()
endif()
if(NOT USE_KQUEUE)
ac_check_headers(poll.h)
if(${HAVE_SYS_POLL_H})
ac_check_funcs(poll)
if(${HAVE_POLL})
set(USE_POLL TRUE)
endif()
endif()
if(NOT USE_POLL)
ac_check_funcs(select)
if(${HAVE_SELECT})
set(USE_SELECT TRUE)
ac_check_headers(sys/select.h)
endif()
if(NOT USE_SELECT)
message(FATAL_ERROR "All epoll/kqueue/poll/select are missing")
endif()
endif()
endif()
endif()
endif()
set(GRN_WITH_ZLIB "auto"
CACHE STRING "Support data compression by zlib.")
if(NOT ${GRN_WITH_ZLIB} STREQUAL "no")
ac_check_lib(z compress)
if(NOT HAVE_LIBZ)
if(${GRN_WITH_ZLIB} STREQUAL "yes")
message(FATAL_ERROR "No libz found")
endif()
set(GRN_WITH_ZLIB "no")
endif()
endif()
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/bundled_lz4_version"
GRN_BUNDLED_LZ4_VERSION)
string(STRIP
"${GRN_BUNDLED_LZ4_VERSION}"
GRN_BUNDLED_LZ4_VERSION)
option(GRN_WITH_BUNDLED_LZ4 "use bundled LZ4" OFF)
set(GRN_WITH_LZ4 "auto"
CACHE STRING "Support data compression by LZ4.")
if(NOT ${GRN_WITH_LZ4} STREQUAL "no")
if(GRN_WITH_BUNDLED_LZ4)
set(LIBLZ4_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/vendor/lz4-${GRN_BUNDLED_LZ4_VERSION}/lib")
set(LIBLZ4_LIBS liblz4)
else()
if(NOT DEFINED LIBLZ4_FOUND)
pkg_check_modules(LIBLZ4 liblz4)
endif()
if(LIBLZ4_FOUND)
find_library(LIBLZ4_LIBS
NAMES ${LIBLZ4_LIBRARIES}
PATHS ${LIBLZ4_LIBRARY_DIRS}
NO_DEFAULT_PATH)
set(GRN_WITH_LZ4 TRUE)
else()
if(${GRN_WITH_LZ4} STREQUAL "yes")
message(FATAL_ERROR "No LZ4 found")
endif()
set(GRN_WITH_LZ4 FALSE)
endif()
endif()
endif()
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/bundled_mecab_version"
GRN_BUNDLED_MECAB_VERSION)
string(STRIP
"${GRN_BUNDLED_MECAB_VERSION}"
GRN_BUNDLED_MECAB_VERSION)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/bundled_mecab_naist_jdic_version"
GRN_BUNDLED_MECAB_NAIST_JDIC_VERSION)
string(STRIP
"${GRN_BUNDLED_MECAB_NAIST_JDIC_VERSION}"
GRN_BUNDLED_MECAB_NAIST_JDIC_VERSION)
option(GRN_WITH_BUNDLED_MECAB "use bundled MeCab" OFF)
set(GRN_WITH_MECAB "auto"
CACHE STRING "use MeCab for morphological analysis")
if(NOT ${GRN_WITH_MECAB} STREQUAL "no")
if(GRN_WITH_BUNDLED_MECAB)
set(MECAB_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/vendor/mecab-${GRN_BUNDLED_MECAB_VERSION}/src")
set(MECAB_LIBRARY_DIRS
"${CMAKE_CURRENT_BUILD_DIR}/vendor/mecab")
set(MECAB_LIBRARIES libmecab)
else()
set(GRN_MECAB_CONFIG "mecab-config" CACHE FILEPATH "mecab-config path")
if(NOT CMAKE_CROSSCOMPILING)
find_program(GRN_MECAB_CONFIG_ABSOLUTE_PATH "${GRN_MECAB_CONFIG}")
endif()
if(EXISTS "${GRN_MECAB_CONFIG_ABSOLUTE_PATH}")
execute_process(COMMAND "${GRN_MECAB_CONFIG_ABSOLUTE_PATH}" --inc-dir
OUTPUT_VARIABLE MECAB_INCLUDE_DIRS
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "${GRN_MECAB_CONFIG_ABSOLUTE_PATH}" --libs-only-L
OUTPUT_VARIABLE MECAB_LIBRARY_DIRS
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(MECAB_LIBRARIES "mecab")
ac_check_lib(${MECAB_LIBRARIES} mecab_new)
if(HAVE_LIBMECAB)
set(GRN_WITH_MECAB TRUE)
else()
if(${GRN_WITH_MECAB} STREQUAL "yes")
message(FATAL_ERROR
"No MeCab library found: "
"include directories: <${MECAB_INCLUDE_DIRS}>, "
"library directories: <${MECAB_LIBRARY_DIRS}>")
endif()
set(GRN_WITH_MECAB FALSE)
endif()
else()
if(${GRN_WITH_MECAB} STREQUAL "yes")
message(FATAL_ERROR "No mecab-config found: <${GRN_MECAB_CONFIG}>")
endif()
set(GRN_WITH_MECAB FALSE)
endif()
endif()
else()
set(GRN_WITH_MECAB FALSE)
endif()
set(GRN_WITH_KYTEA "auto"
CACHE STRING "use KyTea for morphological analysis")
if(NOT ${GRN_WITH_KYTEA} STREQUAL "no")
if(NOT DEFINED KYTEA_FOUND)
pkg_check_modules(KYTEA kytea)
endif()
if(KYTEA_FOUND)
set(GRN_WITH_KYTEA TRUE)
else()
if(${GRN_WITH_KYTEA} STREQUAL "yes")
message(FATAL_ERROR "No KyTea found")
endif()
set(GRN_WITH_KYTEA FALSE)
endif()
else()
set(GRN_WITH_KYTEA FALSE)
endif()
set(GRN_WITH_LIBSTEMMER "auto"
CACHE STRING "use libstemmer for stemming token filter")
if(NOT ${GRN_WITH_LIBSTEMMER} STREQUAL "no")
if(NOT ("${GRN_WITH_LIBSTEMMER}" STREQUAL "yes" OR
"${GRN_WITH_LIBSTEMMER}" STREQUAL "auto"))
if("${LIBSTEMMER_INCLUDE_DIRS}" STREQUAL "")
set(LIBSTEMMER_INCLUDE_DIRS "${GRN_WITH_LIBSTEMMER}/include")
endif()
if("${LIBSTEMMER_LIBRARY_DIRS}" STREQUAL "")
set(LIBSTEMMER_LIBRARY_DIRS "${GRN_WITH_LIBSTEMMER}/lib")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
set(CMAKE_REQUIRED_INCLUDES
${CMAKE_REQUIRED_INCLUDES}
${LIBSTEMMER_INCLUDE_DIRS})
ac_check_headers(libstemmer.h)
ac_check_lib(stemmer sb_stemmer_list "${LIBSTEMMER_LIBRARY_DIRS}")
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
if(HAVE_LIBSTEMMER_H AND HAVE_LIBSTEMMER)
set(LIBSTEMMER_LIBRARIES "stemmer")
set(GRN_WITH_LIBSTEMMER TRUE)
else()
if(${GRN_WITH_LIBSTEMMER} STREQUAL "yes")
message(FATAL_ERROR "No libstemmer found")
endif()
set(GRN_WITH_LIBSTEMMER FALSE)
endif()
else()
set(GRN_WITH_LIBSTEMMER FALSE)
endif()
set(GRN_WITH_ZEROMQ "auto"
CACHE STRING "use ZeroMQ for suggestion")
if(NOT ${GRN_WITH_ZEROMQ} STREQUAL "no")
if(NOT DEFINED ZEROMQ_FOUND)
pkg_check_modules(ZEROMQ libzmq)
endif()
if(ZEROMQ_FOUND)
set(GRN_WITH_ZEROMQ TRUE)
else()
if(${GRN_WITH_ZEROMQ} STREQUAL "yes")
message(FATAL_ERROR "No ZeroMQ found")
endif()
set(GRN_WITH_ZEROMQ FALSE)
endif()
else()
set(GRN_WITH_ZEROMQ FALSE)
endif()
set(GRN_WITH_LIBEVENT "auto"
CACHE STRING "use libevent for suggestion")
if(NOT ${GRN_WITH_LIBEVENT} STREQUAL "no")
if("${GRN_WITH_LIBEVENT}" STREQUAL "yes" OR
"${GRN_WITH_LIBEVENT}" STREQUAL "auto")
set(LIBEVENT_INCLUDE_DIRS "")
set(LIBEVENT_LIBRARY_DIRS "")
else()
set(LIBEVENT_INCLUDE_DIRS "${GRN_WITH_LIBEVENT}/include")
set(LIBEVENT_LIBRARY_DIRS "${GRN_WITH_LIBEVENT}/lib")
endif()
set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
ac_check_lib(event event_init "${LIBEVENT_LIBRARY_DIRS}")
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
if(HAVE_LIBEVENT)
set(LIBEVENT_LIBRARIES "event")
set(GRN_WITH_LIBEVENT TRUE)
else()
if(${GRN_WITH_LIBEVENT} STREQUAL "yes")
message(FATAL_ERROR "No libevent found")
endif()
set(GRN_WITH_LIBEVENT FALSE)
endif()
else()
set(GRN_WITH_LIBEVENT FALSE)
endif()
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/bundled_message_pack_version"
GRN_BUNDLED_MESSAGE_PACK_VERSION)
string(STRIP
"${GRN_BUNDLED_MESSAGE_PACK_VERSION}"
GRN_BUNDLED_MESSAGE_PACK_VERSION)
option(GRN_WITH_BUNDLED_MESSAGE_PACK "use bundled MessagePack" OFF)
set(GRN_WITH_MESSAGE_PACK "auto"
CACHE STRING "use MessagePack for suggestion")
if(NOT ${GRN_WITH_MESSAGE_PACK} STREQUAL "no")
if(GRN_WITH_BUNDLED_MESSAGE_PACK)
set(MESSAGE_PACK_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/vendor/msgpack-${GRN_BUNDLED_MESSAGE_PACK_VERSION}/include")
set(MESSAGE_PACK_LIBS msgpackc)
else()
if(NOT DEFINED MESSAGE_PACK_FOUND)
pkg_check_modules(MESSAGE_PACK msgpack)
endif()
if(MESSAGE_PACK_FOUND)
find_library(MESSAGE_PACK_LIBS
NAMES ${MESSAGE_PACK_LIBRARIES}
PATHS ${MESSAGE_PACK_LIBRARY_DIRS}
NO_DEFAULT_PATH)
set(GRN_WITH_MESSAGE_PACK TRUE)
else()
if("${GRN_WITH_MESSAGE_PACK}" STREQUAL "yes" OR
"${GRN_WITH_MESSAGE_PACK}" STREQUAL "auto")
set(MESSAGE_PACK_INCLUDE_DIRS "")
set(MESSAGE_PACK_LIBRARY_DIRS "")
else()
set(MESSAGE_PACK_INCLUDE_DIRS "${GRN_WITH_MESSAGE_PACK}/include")
set(MESSAGE_PACK_LIBRARY_DIRS "${GRN_WITH_MESSAGE_PACK}/lib")
endif()
set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
ac_check_lib(msgpack msgpack_version "${MESSAGE_PACK_LIBRARY_DIRS}")
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
if(HAVE_LIBMSGPACK)
find_library(MESSAGE_PACK_LIBS
NAMES "msgpack"
PATHS ${MESSAGE_PACK_LIBRARY_DIRS}
NO_DEFAULT_PATH)
set(GRN_WITH_MESSAGE_PACK TRUE)
else()
if(${GRN_WITH_MESSAGE_PACK} STREQUAL "yes")
message(FATAL_ERROR "No MessagePack found")
endif()
set(GRN_WITH_MESSAGE_PACK FALSE)
endif()
endif()
endif()
else()
set(GRN_WITH_MESSAGE_PACK FALSE)
endif()
find_program(RUBY NAMES
"ruby2.3" "ruby23"
"ruby2.2" "ruby22"
"ruby2.1" "ruby21"
"ruby")
option(GRN_WITH_MRUBY "use mruby" OFF)
if(GRN_WITH_MRUBY)
set(MRUBY_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/vendor/mruby-source/include")
set(MRUBY_LIBS mruby)
else()
set(MRUBY_INCLUDE_DIRS "")
set(MRUBY_LIBS "")
endif()
set(MRUBY_DEFINITIONS "MRB_INT64" "HAVE_ONIGMO_H")
# TODO: Support using system Onigmo instead of bundled Onigmo.
set(GRN_WITH_ONIGMO ON)
set(ONIGMO_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/vendor/onigmo-source")
set(ONIGMO_LIBS onigmo)
# TODO: It's for Onigmo static link case. If we support system Onigmo,
# we need to remove it and add -DEXPORT to Onigmo build.
add_definitions(-DONIG_EXTERN=extern)
add_subdirectory(vendor)
if(GRN_EMBED)
add_subdirectory(plugins)
endif()
add_subdirectory(lib)
if(NOT GRN_EMBED)
add_subdirectory(src)
add_subdirectory(plugins)
add_subdirectory(include)
add_subdirectory(data)
endif()
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
set(GROONGA "${CMAKE_CURRENT_BINARY_DIR}/src/groonga")
set(GROONGA_SUGGEST_CREATE_DATASET
"${CMAKE_CURRENT_BINARY_DIR}/src/suggest/groonga-suggest-create-dataset")
set(GROONGA_BENCHMARK "${CMAKE_CURRENT_BINARY_DIR}/src/groonga-benchmark")
configure_file(config.sh.in "${CMAKE_CURRENT_BINARY_DIR}/config.sh" @ONLY)
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "${prefix}")
set(bindir "${CMAKE_INSTALL_PREFIX}/${BIN_DIR}")
set(sbindir "${CMAKE_INSTALL_PREFIX}/${SBIN_DIR}")
set(libdir "${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
set(includedir "${CMAKE_INSTALL_PREFIX}/${INCLUDE_DIR}")
set(datarootdir "${CMAKE_INSTALL_PREFIX}/${DATA_DIR}")
set(datadir "${datarootdir}")
set(expanded_pluginsdir "${GRN_PLUGINS_DIR}")
set(GRN_EXPANDED_DEFAULT_DOCUMENT_ROOT "${GRN_DEFAULT_DOCUMENT_ROOT}")
set(EXEEXT "${CMAKE_EXECUTABLE_SUFFIX}")
configure_file(groonga.pc.in "${CMAKE_CURRENT_BINARY_DIR}/groonga.pc" @ONLY)
if(NOT GRN_EMBED)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/groonga.pc"
DESTINATION "${LIB_DIR}/pkgconfig/")
endif()
install(FILES
"COPYING"
"README.md"
DESTINATION "${GRN_DATA_DIR}")
add_subdirectory(vendor/plugins)
......@@ -94,7 +94,7 @@ set(GRN_ALL_LIBRARIES
${RT_LIBS}
${PTHREAD_LIBS}
${Z_LIBS}
${LIBLZ4_LIBS}
${LZ4_LIBS}
${LIBZSTD_LIBS}
${MESSAGE_PACK_LIBS}
${DL_LIBS}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment