Permalink
Browse files

CFFI is now using PkgConfig in addition to direct header search. Merg…

…ed jer's changes.
  • Loading branch information...
2 parents 111b77b + 871258d commit 38e628f4f685d4a02a2da6de31979911d29402f8 @petrm petrm committed May 11, 2010
Showing with 53 additions and 27 deletions.
  1. +15 −1 CMakeLists.txt
  2. +1 −1 addons/CFFI/CMakeLists.txt
  3. +1 −1 addons/CMakeLists.txt
  4. +1 −1 addons/Clutter/source/IoClutterActorBox.c
  5. +35 −23 modules/FindFFI.cmake
View
16 CMakeLists.txt
@@ -83,8 +83,22 @@ add_subdirectory(libs)
add_subdirectory(tools)
add_subdirectory(addons)
-# Make sure the top level _build dir exists. We put libraries and binaries here.
+# Hook into the io build system. Maybe one day we can get rid of this part
+# too?
+#./_build/binaries/io_static$(BINARY_SUFFIX) build.io
+# @if [ -f errors ]; then cat errors; echo; echo "Note: addons do not build when libs or headers are missing"; echo; rm errors; fi
make_build_bundle(_build)
+#add_custom_target(io_build_system ALL DEPENDS io io_static COMMENT "Building Addons")
+#add_custom_command(
+# TARGET io_build_system
+# COMMAND ${PROJECT_BINARY_DIR}/_build/binaries/io_static${BINARY_SUFFIX} ${PROJECT_SOURCE_DIR}/build.io
+#)
+
+# Ensure our hierarchy exists in /usr/local/lib for Io-related files.
+file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/io)
+
+# Install the addons.
+#install(DIRECTORY addons DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/io/)
# Next we NEED to copy all the libs headers into one single dir in the bundle.
copy_files(coroutine_headers ${PROJECT_SOURCE_DIR}/libs/coroutine/source/*.h ${CMAKE_CURRENT_BINARY_DIR}/_build/headers)
View
2 addons/CFFI/CMakeLists.txt 100644 → 100755
@@ -16,7 +16,7 @@ if(FFI_FOUND)
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/_build/dll)
# Additional include directories
- include_directories(${FFI_INCLUDE_DIR})
+ include_directories(${FFI_INCLUDE_DIRS})
# Generate the IoCFFIInit.c file.
# Argument SHOULD ALWAYS be the exact name of the addon, case is
View
2 addons/CMakeLists.txt
@@ -77,7 +77,7 @@ add_subdirectory(NotificationCenter)
#add_subdirectory(ObjcBridge) # XXX: Broken for me -- Objective-C 2.0 not supported
add_subdirectory(Obsidian)
add_subdirectory(Ogg)
-add_subdirectory(OpenGL) # XXX: Looks fixed
+add_subdirectory(OpenGL)
#add_subdirectory(PortAudio) # XXX: Dependency broken for me
add_subdirectory(PostgreSQL)
#add_subdirectory(Postgres)
View
2 addons/Clutter/source/IoClutterActorBox.c
@@ -114,7 +114,7 @@ IO_METHOD(IoClutterActorBox, with) {
IOSYMBOL("area"), IONUMBER(clutter_actor_box_get_area(actorBox))
);
- return clone;
+ return klone;
}
//doc ClutterActorBox origin
View
58 modules/FindFFI.cmake
@@ -1,23 +1,35 @@
-# Base Io build system
-# Written by Jeremy Tregunna <jeremy.tregunna@me.com>
-#
-# Find libFFI.
-
-FIND_PATH(FFI_INCLUDE_DIR ffi.h /usr/lib/libffi-3.0.9/include)
-
-SET(FFI_NAMES ${FFI_NAMES} ffi libffi)
-FIND_LIBRARY(FFI_LIBRARY NAMES ${FFI_NAMES} PATH /usr/lib/libffi)
-
-IF(FFI_INCLUDE_DIR AND FFI_LIBRARY)
- SET(FFI_FOUND TRUE)
-ENDIF(FFI_INCLUDE_DIR AND FFI_LIBRARY)
-
-IF(FFI_FOUND)
- IF(NOT FFI_FIND_QUIETLY)
- MESSAGE(STATUS "Found FFI: ${FFI_LIBRARY}")
- ENDIF (NOT FFI_FIND_QUIETLY)
-ELSE(FFI_FOUND)
- IF(FFI_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Could not find FFI")
- ENDIF(FFI_FIND_REQUIRED)
-ENDIF (FFI_FOUND)
+# Try to find the FFI librairies
+# FFI_FOUND - system has FFI lib
+# FFI_INCLUDE_DIR - the FFI include directory
+# FFI_LIBRARIES - Libraries needed to use FFI
+
+if (FFI_INCLUDE_DIRS AND FFI_LIBRARIES)
+ # Already in cache, be silent
+ set(FFI_FIND_QUIETLY TRUE)
+endif (FFI_INCLUDE_DIRS AND FFI_LIBRARIES)
+
+INCLUDE(FindPkgConfig)
+
+IF ( FFI_FIND_REQUIRED )
+ SET( _pkgconfig_REQUIRED "REQUIRED" )
+ELSE ( FFI_FIND_REQUIRED )
+ SET( _pkgconfig_REQUIRED "" )
+ENDIF ( FFI_FIND_REQUIRED )
+
+
+PKG_SEARCH_MODULE( FFI ${_pkgconfig_REQUIRED} libffi )
+IF ( PKG_CONFIG_FOUND )
+SET ( FFI_FOUND TRUE )
+ENDIF ( PKG_CONFIG_FOUND )
+
+IF ( NOT FFI_FOUND AND NOT PKG_CONFIG_FOUND )
+ find_path(FFI_INCLUDE_DIR NAMES ffi.h )
+ find_library(FFI_LIBRARIES NAMES ffi libffi )
+ SET(FFI_INCLUDE_DIRS ${FFI_INCLUDE_DIR})
+ENDIF ( NOT FFI_FOUND AND NOT PKG_CONFIG_FOUND )
+
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFI DEFAULT_MSG FFI_INCLUDE_DIRS FFI_LIBRARIES)
+
+mark_as_advanced(FFI_INCLUDE_DIRS FFI_LIBRARIES)

0 comments on commit 38e628f

Please sign in to comment.