[Groonga-commit] groonga/groonga at ceee47a [master] cmake: support mruby build

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Sep 30 21:11:06 JST 2013


Kouhei Sutou	2013-09-30 21:11:06 +0900 (Mon, 30 Sep 2013)

  New Revision: ceee47ace809bf08a9a9886203729c94ba14972d
  https://github.com/groonga/groonga/commit/ceee47ace809bf08a9a9886203729c94ba14972d

  Message:
    cmake: support mruby build

  Copied files:
    vendor/CMakeLists.txt
      (from plugins/ruby/CMakeLists.txt)
    vendor/mruby/CMakeLists.txt
      (from plugins/ruby/CMakeLists.txt)
  Modified files:
    CMakeLists.txt
    config.h.cmake
    lib/CMakeLists.txt
    plugins/ruby/CMakeLists.txt
    plugins/suggest/CMakeLists.txt
    plugins/table/CMakeLists.txt
    src/CMakeLists.txt
    src/suggest/CMakeLists.txt

  Modified: CMakeLists.txt (+12 -0)
===================================================================
--- CMakeLists.txt    2013-09-30 21:08:21 +0900 (40da2bf)
+++ CMakeLists.txt    2013-09-30 21:11:06 +0900 (29ef6db)
@@ -348,6 +348,18 @@ else()
   set(GRN_WITH_MESSAGE_PACK FALSE)
 endif()
 
+option(GRN_WITH_MRUBY "use mruby" OFF)
+file(READ "${CMAKE_CURRENT_SOURCE_DIR}/mruby_version" MRUBY_VERSION)
+if(GRN_WITH_MRUBY)
+  set(MRUBY_INCLUDE_DIRS
+    "${CMAKE_CURRENT_SOURCE_DIR}/vendor/mruby-${MRUBY_VERSION}/include")
+  set(MRUBY_LIBS "$<TARGET_OBJECTS:mruby>")
+else()
+  set(MRUBY_INCLUDE_DIRS "")
+  set(MRUBY_LIBS "")
+endif()
+
+add_subdirectory(vendor)
 add_subdirectory(lib)
 add_subdirectory(src)
 add_subdirectory(plugins)

  Modified: config.h.cmake (+1 -0)
===================================================================
--- config.h.cmake    2013-09-30 21:08:21 +0900 (289a9e9)
+++ config.h.cmake    2013-09-30 21:11:06 +0900 (f43a117)
@@ -79,6 +79,7 @@
 #cmakedefine GRN_WITH_LZO
 #cmakedefine GRN_WITH_MECAB
 #cmakedefine GRN_WITH_MESSAGE_PACK
+#cmakedefine GRN_WITH_MRUBY
 #cmakedefine GRN_WITH_NFKC
 #cmakedefine GRN_WITH_ZEROMQ
 #cmakedefine GRN_WITH_ZLIB

  Modified: lib/CMakeLists.txt (+2 -2)
===================================================================
--- lib/CMakeLists.txt    2013-09-30 21:08:21 +0900 (9dba36d)
+++ lib/CMakeLists.txt    2013-09-30 21:11:06 +0900 (e580737)
@@ -19,7 +19,7 @@ add_definitions(
 
 include_directories(
   ${CMAKE_CURRENT_SOURCE_DIR}/dat
-  )
+  ${MRUBY_INCLUDE_DIRS})
 
 read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am LIBGROONGA_SOURCES)
 read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/dat/sources.am LIBGRNDAT_SOURCES)
@@ -36,7 +36,7 @@ set_source_files_properties(dat.cpp ${LIBGRNDAT_SOURCES}
 add_library(libgroonga SHARED
   ${LIBGROONGA_SOURCES}
   ${LIBGRNDAT_SOURCES}
-  $<TARGET_OBJECTS:mruby>)
+  ${MRUBY_LIBS})
 set_target_properties(libgroonga PROPERTIES OUTPUT_NAME "groonga")
 target_link_libraries(libgroonga
   ${EXECINFO_LIBS}

  Modified: plugins/ruby/CMakeLists.txt (+11 -9)
===================================================================
--- plugins/ruby/CMakeLists.txt    2013-09-30 21:08:21 +0900 (1e34fc7)
+++ plugins/ruby/CMakeLists.txt    2013-09-30 21:11:06 +0900 (b42e153)
@@ -15,13 +15,15 @@
 
 include_directories(
   ${CMAKE_CURRENT_SOURCE_DIR}/../../lib
-  )
+  ${MRUBY_INCLUDE_DIRS})
 
-read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am RUBY_SOURCES)
-add_library(eval MODULE ${RUBY_SOURCES})
-set_source_files_properties(${RUBY_SOURCES}
-  PROPERTIES
-  COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
-set_target_properties(eval PROPERTIES PREFIX "")
-target_link_libraries(eval libgroonga)
-install(TARGETS eval DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/ruby")
+if(GRN_WITH_MRUBY)
+  read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am RUBY_SOURCES)
+  add_library(eval MODULE ${RUBY_SOURCES})
+  set_source_files_properties(${RUBY_SOURCES}
+    PROPERTIES
+    COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
+  set_target_properties(eval PROPERTIES PREFIX "")
+  target_link_libraries(eval libgroonga)
+  install(TARGETS eval DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/ruby")
+endif()

  Modified: plugins/suggest/CMakeLists.txt (+1 -1)
===================================================================
--- plugins/suggest/CMakeLists.txt    2013-09-30 21:08:21 +0900 (f9e0735)
+++ plugins/suggest/CMakeLists.txt    2013-09-30 21:11:06 +0900 (5191939)
@@ -15,7 +15,7 @@
 
 include_directories(
   ${CMAKE_CURRENT_SOURCE_DIR}/../../lib
-  )
+  ${MRUBY_INCLUDE_DIRS})
 
 read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am SUGGEST_SOURCES)
 add_library(suggest MODULE ${SUGGEST_SOURCES})

  Modified: plugins/table/CMakeLists.txt (+1 -1)
===================================================================
--- plugins/table/CMakeLists.txt    2013-09-30 21:08:21 +0900 (e727348)
+++ plugins/table/CMakeLists.txt    2013-09-30 21:11:06 +0900 (eada039)
@@ -15,7 +15,7 @@
 
 include_directories(
   ${CMAKE_CURRENT_SOURCE_DIR}/../../lib
-  )
+  ${MRUBY_INCLUDE_DIRS})
 
 read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am TABLE_SOURCES)
 add_library(table MODULE ${TABLE_SOURCES})

  Modified: src/CMakeLists.txt (+5 -1)
===================================================================
--- src/CMakeLists.txt    2013-09-30 21:08:21 +0900 (024bbdd)
+++ src/CMakeLists.txt    2013-09-30 21:11:06 +0900 (258d186)
@@ -1,4 +1,4 @@
-# Copyright(C) 2012 Brazil
+# Copyright(C) 2012-2013 Brazil
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -13,6 +13,10 @@
 # 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(
+  ${MRUBY_INCLUDE_DIRS}
+  )
+
 add_subdirectory(suggest)
 
 read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/groonga_sources.am GROONGA_SOURCES)

  Modified: src/suggest/CMakeLists.txt (+3 -1)
===================================================================
--- src/suggest/CMakeLists.txt    2013-09-30 21:08:21 +0900 (fcf8172)
+++ src/suggest/CMakeLists.txt    2013-09-30 21:11:06 +0900 (f77ea10)
@@ -13,7 +13,9 @@
 # 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_CURRENT_SOURCE_DIR}/../../lib)
+include_directories(
+  ${CMAKE_CURRENT_SOURCE_DIR}/../../lib
+  ${MRUBY_INCLUDE_DIRS})
 
 read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/create_dataset_sources.am
   GROONGA_SUGGEST_CREATE_DATASET_SOURCES)

  Copied: vendor/CMakeLists.txt (+1 -12) 61%
===================================================================
--- plugins/ruby/CMakeLists.txt    2013-09-30 21:08:21 +0900 (1e34fc7)
+++ vendor/CMakeLists.txt    2013-09-30 21:11:06 +0900 (30c9bef)
@@ -13,15 +13,4 @@
 # 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_CURRENT_SOURCE_DIR}/../../lib
-  )
-
-read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am RUBY_SOURCES)
-add_library(eval MODULE ${RUBY_SOURCES})
-set_source_files_properties(${RUBY_SOURCES}
-  PROPERTIES
-  COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
-set_target_properties(eval PROPERTIES PREFIX "")
-target_link_libraries(eval libgroonga)
-install(TARGETS eval DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/ruby")
+add_subdirectory(mruby)

  Copied: vendor/mruby/CMakeLists.txt (+17 -9) 58%
===================================================================
--- plugins/ruby/CMakeLists.txt    2013-09-30 21:08:21 +0900 (1e34fc7)
+++ vendor/mruby/CMakeLists.txt    2013-09-30 21:11:06 +0900 (9f4aad4)
@@ -13,15 +13,23 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
+add_definitions(
+  -DDISABLE_GEMS
+  )
+
 include_directories(
-  ${CMAKE_CURRENT_SOURCE_DIR}/../../lib
+  "${CMAKE_CURRENT_SOURCE_DIR}/../mruby-${MRUBY_VERSION}/include"
+  "${CMAKE_CURRENT_SOURCE_DIR}/../mruby-${MRUBY_VERSION}/src"
   )
 
-read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am RUBY_SOURCES)
-add_library(eval MODULE ${RUBY_SOURCES})
-set_source_files_properties(${RUBY_SOURCES}
-  PROPERTIES
-  COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
-set_target_properties(eval PROPERTIES PREFIX "")
-target_link_libraries(eval libgroonga)
-install(TARGETS eval DESTINATION "${GRN_RELATIVE_PLUGINS_DIR}/ruby")
+if(GRN_WITH_MRUBY)
+  read_file_list("${CMAKE_CURRENT_SOURCE_DIR}/sources.am" MRUBY_SOURCES)
+  add_library(mruby OBJECT ${MRUBY_SOURCES})
+  set_source_files_properties(${MRUBY_SOURCES}
+    PROPERTIES
+    COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
+  set_target_properties(
+    mruby
+    PROPERTIES
+    POSITION_INDEPENDENT_CODE ON)
+endif()
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index