Navigation Menu

Skip to content

Commit

Permalink
cmake: don't install additional modules if bundled with MariaDB
Browse files Browse the repository at this point in the history
Patch by Kentoku Shiba. Thanks!!!
  • Loading branch information
s-yata committed Jan 29, 2015
1 parent 87a778a commit 7974b44
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 42 deletions.
19 changes: 16 additions & 3 deletions CMakeLists.txt
Expand Up @@ -150,6 +150,9 @@ if(CMAKE_COMPILER_IS_GNUCXX)
check_cxxflag("-fexceptions")
check_cxxflag("-fimplicit-templates")
check_build_flag("-Wno-clobbered")
if(MRN_GROONGA_BUNDLED)
check_build_flag("-fPIC")
endif()
endif()

option(GRN_WITH_DEBUG "enable debug build." OFF)
Expand Down Expand Up @@ -224,6 +227,14 @@ ac_check_lib(rt clock_gettime)
if(HAVE_LIBRT)
set(HAVE_CLOCK_GETTIME TRUE)
endif()
if(MRN_GROONGA_BUNDLED)
ac_check_lib(m sincos)
check_library_exists(stdc++ __cxa_begin_catch "${ARG2}"
STDCPP)
if(STDCPP)
set(STDCPP_LIBS "stdc++")
endif()
endif()

if(UNIX)
ac_check_headers(pthread.h)
Expand Down Expand Up @@ -520,8 +531,10 @@ 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)

install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/groonga.pc"
DESTINATION "${LIB_DIR}/pkgconfig/")
if(NOT MRN_GROONGA_BUNDLED)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/groonga.pc"
DESTINATION "${LIB_DIR}/pkgconfig/")
endif()

add_subdirectory(vendor/plugins)
4 changes: 3 additions & 1 deletion data/CMakeLists.txt
Expand Up @@ -15,4 +15,6 @@

add_subdirectory(html)

install(FILES groonga.conf DESTINATION "${GRN_CONFIG_DIR}/")
if(NOT MRN_GROONGA_BUNDLED)
install(FILES groonga.conf DESTINATION "${GRN_CONFIG_DIR}/")
endif()
4 changes: 3 additions & 1 deletion data/html/CMakeLists.txt
Expand Up @@ -13,4 +13,6 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

install(DIRECTORY admin DESTINATION "${GRN_DATA_DIR}/html")
if(NOT MRN_GROONGA_BUNDLED)
install(DIRECTORY admin DESTINATION "${GRN_DATA_DIR}/html")
endif()
8 changes: 5 additions & 3 deletions include/CMakeLists.txt
Expand Up @@ -13,6 +13,8 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

install(FILES groonga.h DESTINATION "${GRN_INCLUDE_DIR}")
install(DIRECTORY groonga DESTINATION "${GRN_INCLUDE_DIR}"
FILES_MATCHING PATTERN "*.h")
if(NOT MRN_GROONGA_BUNDLED)
install(FILES groonga.h DESTINATION "${GRN_INCLUDE_DIR}")
install(DIRECTORY groonga DESTINATION "${GRN_INCLUDE_DIR}"
FILES_MATCHING PATTERN "*.h")
endif()
61 changes: 43 additions & 18 deletions lib/CMakeLists.txt
Expand Up @@ -39,31 +39,56 @@ set_source_files_properties(dat.cpp ${LIBGRNDAT_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_CXX_COMPILE_FLAGS}")

add_library(libgroonga SHARED
${LIBGROONGA_SOURCES}
${LIBGRNDAT_SOURCES}
${LIBGRNMRB_SOURCES}
${MRUBY_LIBS})
if(MRN_GROONGA_BUNDLED)
add_library(libgroonga STATIC
${LIBGROONGA_SOURCES}
${LIBGRNDAT_SOURCES}
${LIBGRNMRB_SOURCES}
${MRUBY_LIBS})
else()
add_library(libgroonga SHARED
${LIBGROONGA_SOURCES}
${LIBGRNDAT_SOURCES}
${LIBGRNMRB_SOURCES}
${MRUBY_LIBS})
endif()
set_target_properties(libgroonga PROPERTIES OUTPUT_NAME "groonga")
target_link_libraries(libgroonga
${EXECINFO_LIBS}
${RT_LIBS}
${PTHREAD_LIBS}
${Z_LIBS}
${LIBLZ4_LIBRARIES}
${DL_LIBS}
${WS2_32_LIBS})

install(TARGETS libgroonga
ARCHIVE DESTINATION "${LIB_DIR}"
LIBRARY DESTINATION "${LIB_DIR}"
RUNTIME DESTINATION "${BIN_DIR}")
if(NOT MRN_GROONGA_BUNDLED)
target_link_libraries(libgroonga
${EXECINFO_LIBS}
${RT_LIBS}
${PTHREAD_LIBS}
${Z_LIBS}
${LIBLZ4_LIBRARIES}
${DL_LIBS}
${WS2_32_LIBS})
install(TARGETS libgroonga
ARCHIVE DESTINATION "${LIB_DIR}"
LIBRARY DESTINATION "${LIB_DIR}"
RUNTIME DESTINATION "${BIN_DIR}")
else()
target_link_libraries(libgroonga
${EXECINFO_LIBS}
${RT_LIBS}
${PTHREAD_LIBS}
${Z_LIBS}
${LIBLZ4_LIBRARIES}
${DL_LIBS}
${M_LIBS}
${STDCPP_LIBS}
${WS2_32_LIBS})
endif()

if(GRN_WITH_MRUBY)
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/mrb/scripts/sources.am
RUBY_SCRIPTS)
string(REGEX REPLACE "([^;]+)" "mrb/scripts/\\1"
RUBY_SCRIPTS "${RUBY_SCRIPTS}")
if(NOT MRN_GROONGA_BUNDLED)
install(
FILES ${RUBY_SCRIPTS}
DESTINATION "${GRN_RELATIVE_RUBY_SCRIPTS_DIR}")
endif()
install(
FILES ${RUBY_SCRIPTS}
DESTINATION "${GRN_RELATIVE_RUBY_SCRIPTS_DIR}")
Expand Down
4 changes: 3 additions & 1 deletion plugins/query_expanders/CMakeLists.txt
Expand Up @@ -27,4 +27,6 @@ set_target_properties(tsv_query_expander PROPERTIES
PREFIX ""
OUTPUT_NAME "tsv")
target_link_libraries(tsv_query_expander libgroonga)
install(TARGETS tsv_query_expander DESTINATION "${QUERY_EXPANDERS_DIR}")
if(NOT MRN_GROONGA_BUNDLED)
install(TARGETS tsv_query_expander DESTINATION "${QUERY_EXPANDERS_DIR}")
endif()
8 changes: 6 additions & 2 deletions plugins/ruby/CMakeLists.txt
Expand Up @@ -27,7 +27,9 @@ if(GRN_WITH_MRUBY)
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
set_target_properties(eval PROPERTIES PREFIX "")
target_link_libraries(eval libgroonga)
install(TARGETS eval DESTINATION "${GRN_RELATIVE_RUBY_PLUGINS_DIR}")
if(NOT MRN_GROONGA_BUNDLED)
install(TARGETS eval DESTINATION "${GRN_RELATIVE_RUBY_PLUGINS_DIR}")
endif()

read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/load_sources.am RUBY_LOAD_SOURCES)
add_library(load MODULE ${RUBY_LOAD_SOURCES})
Expand All @@ -36,5 +38,7 @@ if(GRN_WITH_MRUBY)
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
set_target_properties(load PROPERTIES PREFIX "")
target_link_libraries(load libgroonga)
install(TARGETS load DESTINATION "${GRN_RELATIVE_RUBY_PLUGINS_DIR}")
if(NOT MRN_GROONGA_BUNDLED)
install(TARGETS load DESTINATION "${GRN_RELATIVE_RUBY_PLUGINS_DIR}")
endif()
endif()
4 changes: 3 additions & 1 deletion plugins/suggest/CMakeLists.txt
Expand Up @@ -24,4 +24,6 @@ set_source_files_properties(${SUGGEST_SOURCES}
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
set_target_properties(suggest PROPERTIES PREFIX "")
target_link_libraries(suggest libgroonga)
install(TARGETS suggest DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/suggest")
if(NOT MRN_GROONGA_BUNDLED)
install(TARGETS suggest DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/suggest")
endif()
4 changes: 3 additions & 1 deletion plugins/table/CMakeLists.txt
Expand Up @@ -24,4 +24,6 @@ set_source_files_properties(${TABLE_SOURCES}
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
set_target_properties(table PROPERTIES PREFIX "")
target_link_libraries(table libgroonga)
install(TARGETS table DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/table")
if(NOT MRN_GROONGA_BUNDLED)
install(TARGETS table DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/table")
endif()
8 changes: 6 additions & 2 deletions plugins/tokenizers/CMakeLists.txt
Expand Up @@ -30,7 +30,9 @@ if(GRN_WITH_MECAB)
PREFIX ""
OUTPUT_NAME "mecab")
target_link_libraries(mecab_tokenizer libgroonga ${MECAB_LIBRARIES})
install(TARGETS mecab_tokenizer DESTINATION "${TOKENIZERS_DIR}")
if(NOT MRN_GROONGA_BUNDLED)
install(TARGETS mecab_tokenizer DESTINATION "${TOKENIZERS_DIR}")
endif()
endif()

if(GRN_WITH_KYTEA)
Expand All @@ -45,5 +47,7 @@ if(GRN_WITH_KYTEA)
PREFIX ""
OUTPUT_NAME "kytea")
target_link_libraries(kytea_tokenizer libgroonga ${KYTEA_LIBRARIES})
install(TARGETS kytea_tokenizer DESTINATION "${TOKENIZERS_DIR}")
if(NOT MRN_GROONGA_BUNDLED)
install(TARGETS kytea_tokenizer DESTINATION "${TOKENIZERS_DIR}")
endif()
endif()
12 changes: 9 additions & 3 deletions src/CMakeLists.txt
Expand Up @@ -25,7 +25,9 @@ set_source_files_properties(${GROONGA_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
target_link_libraries(groonga libgroonga)
install(TARGETS groonga DESTINATION ${BIN_DIR})
if(NOT MRN_GROONGA_BUNDLED)
install(TARGETS groonga DESTINATION ${BIN_DIR})
endif()

if(NOT WIN32)
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/grnslap_sources.am GRNSLAP_SOURCES)
Expand All @@ -34,7 +36,9 @@ if(NOT WIN32)
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
target_link_libraries(grnslap libgroonga)
install(TARGETS grnslap DESTINATION ${BIN_DIR})
if(NOT MRN_GROONGA_BUNDLED)
install(TARGETS grnslap DESTINATION ${BIN_DIR})
endif()
endif()

read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/groonga_benchmark_sources.am
Expand All @@ -44,5 +48,7 @@ set_source_files_properties(${GROONGA_BENCHMARK_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
target_link_libraries(groonga-benchmark libgroonga)
install(TARGETS groonga-benchmark DESTINATION ${BIN_DIR})
if(NOT MRN_GROONGA_BUNDLED)
install(TARGETS groonga-benchmark DESTINATION ${BIN_DIR})
endif()

16 changes: 10 additions & 6 deletions src/suggest/CMakeLists.txt
Expand Up @@ -25,9 +25,11 @@ set_source_files_properties(${GROONGA_SUGGEST_CREATE_DATASET_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
target_link_libraries(groonga-suggest-create-dataset libgroonga)
install(
TARGETS groonga-suggest-create-dataset
DESTINATION ${BIN_DIR})
if(NOT MRN_GROONGA_BUNDLED)
install(
TARGETS groonga-suggest-create-dataset
DESTINATION ${BIN_DIR})
endif()

if(GRN_WITH_LIBEVENT AND GRN_WITH_ZEROMQ AND GRN_WITH_MESSAGE_PACK)
set(GRN_WITH_SUGGEST_LEARNER TRUE)
Expand Down Expand Up @@ -80,7 +82,9 @@ if(GRN_WITH_SUGGEST_LEARNER)
${ZEROMQ_LIBRARIES}
${MESSAGE_PACK_LIBRARIES})

install(
TARGETS groonga-suggest-learner groonga-suggest-httpd
DESTINATION ${BIN_DIR})
if(NOT MRN_GROONGA_BUNDLED)
install(
TARGETS groonga-suggest-learner groonga-suggest-httpd
DESTINATION ${BIN_DIR})
endif()
endif()

0 comments on commit 7974b44

Please sign in to comment.