Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added BigNum and SQLite3 addons to CMake

  • Loading branch information...
commit 6e404586997b2ef1fd7848eba22ff35b7dbc5c58 1 parent 0bf1493
@jeremytregunna jeremytregunna authored
View
31 addons/BigNum/CMakeLists.txt
@@ -0,0 +1,31 @@
+# Base Io build system
+# Written by Jeremy Tregunna <jeremy.tregunna@me.com>
+#
+# Builds the BigNum addon
+
+# Find libgmp
+find_package(GMP)
+
+# Create the _build bundle hierarchy if needed.
+make_build_bundle(_build)
+
+# Did we find libevent? if so, set up the targets and all the
+# support variables.
+if(GMP_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(${GMP_INCLUDE_DIR})
+
+ # Our library sources.
+ file(GLOB SRCS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.c")
+
+ # Now build the shared library
+ add_library(IoBigNum SHARED ${SRCS})
+ add_dependencies(IoBigNum iovmall)
+ target_link_libraries(IoBigNum iovmall ${GMP_LIBRARIES})
+
+ # Install the addon to our global addons hierarchy.
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/io/addons)
+endif(GMP_FOUND)
View
4 addons/CMakeLists.txt
@@ -20,7 +20,7 @@ add_subdirectory(AVCodec)
#add_subdirectory(AppleExtras)
add_subdirectory(AsyncRequest)
#add_subdirectory(Beanstalk)
-#add_subdirectory(BigNum)
+add_subdirectory(BigNum)
add_subdirectory(Bitly)
add_subdirectory(Blowfish)
#add_subdirectory(Box)
@@ -69,7 +69,7 @@ add_subdirectory(Regex)
#add_subdirectory(SGML)
add_subdirectory(SHA1)
#add_subdirectory(SQLite)
-#add_subdirectory(SQLite3)
+add_subdirectory(SQLite3)
#add_subdirectory(SampleRateConverter)
#add_subdirectory(SecureSocket)
#add_subdirectory(SkipDB)
View
32 addons/SQLite3/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Base Io build system
+# Written by Jeremy Tregunna <jeremy.tregunna@me.com>
+#
+# Builds the SQLite3 addon
+
+# Find SQLite version 3
+set(SQLITE_MIN_VERSION 3)
+find_package(Sqlite)
+
+# Create the _build bundle hierarchy if needed.
+make_build_bundle(_build)
+
+# Did we find libevent? if so, set up the targets and all the
+# support variables.
+if(SQLITE_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(${SQLITE_INCLUDE_DIRS})
+
+ # Our library sources.
+ file(GLOB SRCS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.c")
+
+ # Now build the shared library
+ add_library(IoSQLite3 SHARED ${SRCS})
+ add_dependencies(IoSQLite3 iovmall)
+ target_link_libraries(IoSQLite3 iovmall ${SQLITE_LIBRARIES})
+
+ # Install the addon to our global addons hierarchy.
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/io/addons)
+endif(SQLITE_FOUND)
View
19 modules/FindGMP.cmake
@@ -0,0 +1,19 @@
+# Try to find the GMP librairies
+# GMP_FOUND - system has GMP lib
+# GMP_INCLUDE_DIR - the GMP include directory
+# GMP_LIBRARIES - Libraries needed to use GMP
+
+if (GMP_INCLUDE_DIR AND GMP_LIBRARIES)
+ # Already in cache, be silent
+ set(GMP_FIND_QUIETLY TRUE)
+endif (GMP_INCLUDE_DIR AND GMP_LIBRARIES)
+
+find_path(GMP_INCLUDE_DIR NAMES gmp.h )
+find_library(GMP_LIBRARIES NAMES gmp libgmp )
+find_library(GMPXX_LIBRARIES NAMES gmpxx libgmpxx )
+MESSAGE(STATUS "GMP libs: " ${GMP_LIBRARIES} " " ${GMPXX_LIBRARIES} )
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES)
+
+mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES)
View
48 modules/FindSqlite.cmake
@@ -0,0 +1,48 @@
+# - Try to find the sqlite library
+# Once done this will define
+#
+# SQLITE_FOUND - system has sqlite
+# SQLITE_INCLUDE_DIRS - the sqlite include directory
+# SQLITE_LIBRARIES - Link these to use sqlite
+#
+# Define SQLITE_MIN_VERSION for which version desired.
+#
+
+INCLUDE(FindPkgConfig)
+
+IF(Sqlite_FIND_REQUIRED)
+ SET(_pkgconfig_REQUIRED "REQUIRED")
+ELSE(Sqlite_FIND_REQUIRED)
+ SET(_pkgconfig_REQUIRED "")
+ENDIF(Sqlite_FIND_REQUIRED)
+
+IF(SQLITE_MIN_VERSION)
+ PKG_SEARCH_MODULE(SQLITE ${_pkgconfig_REQUIRED} sqlite>=${SQLITE_MIN_VERSION})
+ELSE(SQLITE_MIN_VERSION)
+ PKG_SEARCH_MODULE(SQLITE ${_pkgconfig_REQUIRED} sqlite)
+ENDIF(SQLITE_MIN_VERSION)
+
+IF(NOT SQLITE_FOUND AND NOT PKG_CONFIG_FOUND)
+ FIND_PATH(SQLITE_INCLUDE_DIRS sqlite${SQLITE_MIN_VERSION}.h)
+ FIND_LIBRARY(SQLITE_LIBRARIES sqlite${SQLITE_MIN_VERSION})
+
+ # Report results
+ IF(SQLITE_LIBRARIES AND SQLITE_INCLUDE_DIRS)
+ SET(SQLITE_FOUND 1)
+ IF(NOT Sqlite_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Sqlite: ${SQLITE_LIBRARIES}")
+ ENDIF(NOT Sqlite_FIND_QUIETLY)
+ ELSE(SQLITE_LIBRARIES AND SQLITE_INCLUDE_DIRS)
+ IF(Sqlite_FIND_REQUIRED)
+ MESSAGE(SEND_ERROR "Could not find Sqlite")
+ ELSE(Sqlite_FIND_REQUIRED)
+ IF(NOT Sqlite_FIND_QUIETLY)
+ MESSAGE(STATUS "Could not find Sqlite")
+ ENDIF(NOT Sqlite_FIND_QUIETLY)
+ ENDIF(Sqlite_FIND_REQUIRED)
+ ENDIF(SQLITE_LIBRARIES AND SQLITE_INCLUDE_DIRS)
+ENDIF(NOT SQLITE_FOUND AND NOT PKG_CONFIG_FOUND)
+
+# Hide advanced variables from CMake GUIs
+MARK_AS_ADVANCED(SQLITE_LIBRARIES SQLITE_INCLUDE_DIRS)
+
Please sign in to comment.
Something went wrong with that request. Please try again.