Permalink
Browse files

Vorbis addon added to CMake build system

  • Loading branch information...
1 parent 7f2c108 commit 351b9249dd50e66a0de75279f395f02af85879c9 @jeremytregunna jeremytregunna committed May 10, 2010
Showing with 70 additions and 2 deletions.
  1. +1 −1 addons/CMakeLists.txt
  2. +46 −0 addons/Vorbis/CMakeLists.txt
  3. +0 −1 addons/Vorbis/Makefile
  4. +23 −0 modules/FindVorbis.cmake
View
@@ -109,6 +109,6 @@ add_subdirectory(UUID)
add_subdirectory(User)
add_subdirectory(VertexDB)
#add_subdirectory(Volcano)
-#add_subdirectory(Vorbis)
+add_subdirectory(Vorbis)
add_subdirectory(Yajl)
add_subdirectory(Zlib)
@@ -0,0 +1,46 @@
+# Base Io build system
+# Written by Jeremy Tregunna <jeremy.tregunna@me.com>
+#
+# Builds the Vorbis addon
+
+# Find vorbis
+find_package(Vorbis)
+
+# Create the _build bundle hierarchy if needed.
+make_build_bundle(_build)
+
+# Did we find vorbis? if so, set up the targets and all the support
+# variables.
+if(VORBIS_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(
+ ${VORBIS_INCLUDE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../Ogg/source
+ )
+
+ # Generate the IoVorbisInit.c file.
+ # Argument SHOULD ALWAYS be the exact name of the addon, case is
+ # important.
+ generate_ioinit(Vorbis)
+
+ # Our library sources.
+ set(SRCS
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/IoVorbisBlock.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/IoVorbisComment.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/IoVorbisDspState.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/IoVorbisInfo.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/IoVorbisInit.c"
+ )
+
+ # Now build the shared library
+ add_library(IoVorbis SHARED ${SRCS})
+ add_dependencies(IoVorbis iovmall)
+ target_link_libraries(IoVorbis iovmall ${VORBIS_LIBRARY} IoOgg)
+
+ # 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/Vorbis)
+endif(VORBIS_FOUND)
View
@@ -1 +0,0 @@
-include ../../Makefile.addon
View
@@ -0,0 +1,23 @@
+# Base Io build system
+# Written by Jeremy Tregunna <jeremy.tregunna@me.com>
+#
+# Find libvorbis.
+
+FIND_PATH(VORBIS_INCLUDE_DIR vorbis/codec.h)
+
+SET(VORBIS_NAMES ${VORBIS_NAMES} vorbis libvorbis)
+FIND_LIBRARY(VORBIS_LIBRARY NAMES ${VORBIS_NAMES} PATH)
+
+IF(VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY)
+ SET(VORBIS_FOUND TRUE)
+ENDIF(VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY)
+
+IF(VORBIS_FOUND)
+ IF(NOT Vorbis_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Vorbis: ${VORBIS_LIBRARY}")
+ ENDIF (NOT Vorbis_FIND_QUIETLY)
+ELSE(VORBIS_FOUND)
+ IF(Vorbis_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find vorbis")
+ ENDIF(Vorbis_FIND_REQUIRED)
+ENDIF (VORBIS_FOUND)

0 comments on commit 351b924

Please sign in to comment.