Permalink
Browse files

Added Yajl to CMake build system.

  • Loading branch information...
1 parent 556e594 commit a23e80a70f5e6a32405bc32f021e8a207bba3ab4 @jeremytregunna jeremytregunna committed May 8, 2010
Showing with 68 additions and 2 deletions.
  1. +7 −1 addons/AVCodec/CMakeLists.txt
  2. +1 −1 addons/CMakeLists.txt
  3. +37 −0 addons/Yajl/CMakeLists.txt
  4. +23 −0 modules/FindYajl.cmake
View
8 addons/AVCodec/CMakeLists.txt
@@ -24,6 +24,11 @@ if(FFMPEG_FOUND AND FFMPEG_SWSCALE_FOUND)
# Additional include directories
include_directories(${FFMPEG_INCLUDE_DIR})
+ # Generate the IoAVCodecInit.c file.
+ # Argument SHOULD ALWAYS be the exact name of the addon, case is
+ # important.
+ generate_ioinit(AVCodec)
+
# Our library sources.
file(GLOB SRCS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.c")
@@ -33,5 +38,6 @@ if(FFMPEG_FOUND AND FFMPEG_SWSCALE_FOUND)
target_link_libraries(IoAVCodec iovmall ${FFMPEG_LIBRARIES} ${FFMPEG_SWS_LIBRARIES})
# Install the addon to our global addons hierarchy.
- install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/io/addons)
+ 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/AVCodec)
endif(FFMPEG_FOUND AND FFMPEG_SWSCALE_FOUND)
View
2 addons/CMakeLists.txt
@@ -111,5 +111,5 @@ add_subdirectory(User)
#add_subdirectory(VertexDB)
#add_subdirectory(Volcano)
#add_subdirectory(Vorbis)
-#add_subdirectory(Yajl)
+add_subdirectory(Yajl)
#add_subdirectory(Zlib)
View
37 addons/Yajl/CMakeLists.txt
@@ -0,0 +1,37 @@
+# Base Io build system
+# Written by Jeremy Tregunna <jeremy.tregunna@me.com>
+#
+# Builds the Yajl addon
+
+# Find yajl
+find_package(Yajl)
+
+# Create the _build bundle hierarchy if needed.
+make_build_bundle(_build)
+
+# Did we find yajl? if so, set up the targets and all the support
+# variables.
+if(YAJL_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(${YAJL_INCLUDE_DIR})
+
+ # Generate the IoYajlInit.c file.
+ # Argument SHOULD ALWAYS be the exact name of the addon, case is
+ # important.
+ generate_ioinit(Yajl)
+
+ # Our library sources.
+ file(GLOB SRCS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.c")
+
+ # Now build the shared library
+ add_library(IoYajl SHARED ${SRCS})
+ add_dependencies(IoYajl iovmall)
+ target_link_libraries(IoYajl iovmall ${YAJL_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/Yajl)
+endif(YAJL_FOUND)
View
23 modules/FindYajl.cmake
@@ -0,0 +1,23 @@
+# Base Io build system
+# Written by Jeremy Tregunna <jeremy.tregunna@me.com>
+#
+# Find libyajl
+
+FIND_PATH(YAJL_INCLUDE_DIR yajl/yajl_common.h)
+
+SET(YAJL_NAMES ${YAJL_NAMES} yajl libyajl)
+FIND_LIBRARY(YAJL_LIBRARY NAMES ${YAJL_NAMES} PATH)
+
+IF(YAJL_INCLUDE_DIR AND YAJL_LIBRARY)
+ SET(YAJL_FOUND TRUE)
+ENDIF(YAJL_INCLUDE_DIR AND YAJL_LIBRARY)
+
+IF(YAJL_FOUND)
+ IF(NOT Yajl_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Yajl: ${YAJL_LIBRARY}")
+ ENDIF (NOT Yajl_FIND_QUIETLY)
+ELSE(YAJL_FOUND)
+ IF(Yajl_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find yajl")
+ ENDIF(Yajl_FIND_REQUIRED)
+ENDIF(YAJL_FOUND)

0 comments on commit a23e80a

Please sign in to comment.