Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added SampleRateConverter addon to CMake build system

  • Loading branch information...
commit 897a0bb826ffb3d602f286015e542ad34e6efc19 1 parent dbefa0e
@jeremytregunna jeremytregunna authored
View
2  addons/CMakeLists.txt
@@ -91,7 +91,7 @@ add_subdirectory(Regex)
add_subdirectory(SHA1)
#add_subdirectory(SQLite)
add_subdirectory(SQLite3)
-#add_subdirectory(SampleRateConverter)
+add_subdirectory(SampleRateConverter)
#add_subdirectory(SecureSocket)
#add_subdirectory(SkipDB) # XXX: Disabled...why?
add_subdirectory(Socket)
View
40 addons/SampleRateConverter/CMakeLists.txt
@@ -0,0 +1,40 @@
+# Base Io build system
+# Written by Jeremy Tregunna <jeremy.tregunna@me.com>
+#
+# Builds the SampleRateConverter addon
+
+# Find curses
+find_package(SampleRate)
+
+# Create the _build bundle hierarchy if needed.
+make_build_bundle(_build)
+
+# Did we find curses? if so, set up the targets and all the support
+# variables.
+if(SAMPLERATE_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(${SAMPLERATE_INCLUDE_DIR})
+
+ # Generate the IoSampleRateConverterInit.c file.
+ # Argument SHOULD ALWAYS be the exact name of the addon, case is
+ # important.
+ generate_ioinit(SampleRateConverter)
+
+ # Our library sources.
+ set(SRCS
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/IoSampleRateConverter.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/IoSampleRateConverterInit.c"
+ )
+
+ # Now build the shared library
+ add_library(IoSampleRateConverter SHARED ${SRCS})
+ add_dependencies(IoSampleRateConverter iovmall)
+ target_link_libraries(IoSampleRateConverter iovmall ${SAMPLERATE_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/SampleRateConverter)
+endif(SAMPLERATE_FOUND)
View
23 modules/FindSampleRate.cmake
@@ -0,0 +1,23 @@
+# Base Io build system
+# Written by Jeremy Tregunna <jeremy.tregunna@me.com>
+#
+# Find libsamplerate.
+
+FIND_PATH(SAMPLERATE_INCLUDE_DIR samplerate.h)
+
+SET(SAMPLERATE_NAMES ${SAMPLERATE_NAMES} samplerate libsamplerate)
+FIND_LIBRARY(SAMPLERATE_LIBRARY NAMES ${SAMPLERATE_NAMES} PATH)
+
+IF(SAMPLERATE_INCLUDE_DIR AND SAMPLERATE_LIBRARY)
+ SET(SAMPLERATE_FOUND TRUE)
+ENDIF(SAMPLERATE_INCLUDE_DIR AND SAMPLERATE_LIBRARY)
+
+IF(SAMPLERATE_FOUND)
+ IF(NOT SampleRate_FIND_QUIETLY)
+ MESSAGE(STATUS "Found SampleRate: ${SAMPLERATE_LIBRARY}")
+ ENDIF (NOT SampleRate_FIND_QUIETLY)
+ELSE(SAMPLERATE_FOUND)
+ IF(SampleRate_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find samplerate")
+ ENDIF(SampleRate_FIND_REQUIRED)
+ENDIF (SAMPLERATE_FOUND)
Please sign in to comment.
Something went wrong with that request. Please try again.