Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added TokyoCabinet to CMake build

  • Loading branch information...
commit a2d0718befa1ef74e0a483c9d78709d7c2e806f7 1 parent 8c71756
@jeremytregunna jeremytregunna authored
View
2  addons/CMakeLists.txt
@@ -103,7 +103,7 @@ add_subdirectory(SystemCall)
#add_subdirectory(TagLib)
#add_subdirectory(Theora)
#add_subdirectory(Thread)
-#add_subdirectory(TokyoCabinet)
+add_subdirectory(TokyoCabinet)
add_subdirectory(Twitter)
add_subdirectory(UUID)
add_subdirectory(User)
View
42 addons/TokyoCabinet/CMakeLists.txt
@@ -0,0 +1,42 @@
+# Base Io build system
+# Written by Jeremy Tregunna <jeremy.tregunna@me.com>
+#
+# Builds the TokyoCabinet addon
+
+# Find tokyo-cabinet
+find_package(TokyoCabinet)
+
+# Create the _build bundle hierarchy if needed.
+make_build_bundle(_build)
+
+# Did we find tokyo-cabinet? if so, set up the targets and all the support
+# variables.
+if(TOKYOCABINET_FOUND)
+ # Output our dynamic library to the top-level _build hierarchy
+ set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/_build/dll)
+
+ # Additional include directories
+ include_directories(${TOKYOCABINET_INCLUDE_DIR})
+
+ # Generate the IoTokyoCabinetInit.c file.
+ # Argument SHOULD ALWAYS be the exact name of the addon, case is
+ # important.
+ generate_ioinit(TokyoCabinet)
+
+ # Our library sources.
+ set(SRCS
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/IoTokyoCabinet.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/IoTokyoCabinetCursor.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/IoTokyoCabinetPrefixCursor.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/IoTokyoCabinetInit.c"
+ )
+
+ # Now build the shared library
+ add_library(IoTokyoCabinet SHARED ${SRCS})
+ add_dependencies(IoTokyoCabinet iovmall)
+ target_link_libraries(IoTokyoCabinet iovmall ${TOKYOCABINET_LIBRARY})
+
+ # Install the addon to our global addons hierarchy.
+ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/io/addons)
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/_build DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/io/addons/TokyoCabinet)
+endif(TOKYOCABINET_FOUND)
View
23 modules/FindTokyoCabinet.cmake
@@ -0,0 +1,23 @@
+# Base Io build system
+# Written by Jeremy Tregunna <jeremy.tregunna@me.com>
+#
+# Find libtokyocabinet.
+
+FIND_PATH(TOKYOCABINET_INCLUDE_DIR tcutil.h tcbdb.h)
+
+SET(TOKYOCABINET_NAMES ${TOKYOCABINET_NAMES} tokyocabinet libtokyocabinet)
+FIND_LIBRARY(TOKYOCABINET_LIBRARY NAMES ${TOKYOCABINET_NAMES} PATH)
+
+IF(TOKYOCABINET_INCLUDE_DIR AND TOKYOCABINET_LIBRARY)
+ SET(TOKYOCABINET_FOUND TRUE)
+ENDIF(TOKYOCABINET_INCLUDE_DIR AND TOKYOCABINET_LIBRARY)
+
+IF(TOKYOCABINET_FOUND)
+ IF(NOT TokyoCabinet_FIND_QUIETLY)
+ MESSAGE(STATUS "Found TokyoCabinet: ${TOKYOCABINET_LIBRARY}")
+ ENDIF (NOT TokyoCabinet_FIND_QUIETLY)
+ELSE(TOKYOCABINET_FOUND)
+ IF(TokyoCabinet_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find tokyocabinet")
+ ENDIF(TokyoCabinet_FIND_REQUIRED)
+ENDIF (TOKYOCABINET_FOUND)
Please sign in to comment.
Something went wrong with that request. Please try again.