summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2015-08-16 14:09:10 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2015-08-16 14:09:10 +0300
commit2d5c7786646096c4906da30122df4912f9518327 (patch)
tree0add35e4855ba7f5d2e7b6fb681d99e812365e9f
parentf5d56b1dd73b224935ea53a66acd1fb4ebee0223 (diff)
Add Ffi support
-rw-r--r--CMakeLists.txt3
-rw-r--r--cmake/Modules/FindFfi.cmake40
-rw-r--r--src/lib/CMakeLists.txt2
3 files changed, 45 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4f10a61..91bb03d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,13 @@
1cmake_minimum_required(VERSION 2.8.1) 1cmake_minimum_required(VERSION 2.8.1)
2 2
3set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
4
3project(EDBG) 5project(EDBG)
4 6
5#set(EA_GEN_COMMON_DEFINITIONS -DEFL_EO_API_SUPPORT -DEFL_BETA_API_SUPPORT) 7#set(EA_GEN_COMMON_DEFINITIONS -DEFL_EO_API_SUPPORT -DEFL_BETA_API_SUPPORT)
6#add_definitions(${EA_GEN_COMMON_DEFINITIONS}) 8#add_definitions(${EA_GEN_COMMON_DEFINITIONS})
7 9
10find_package(Ffi REQUIRED)
8find_package(Eina REQUIRED) 11find_package(Eina REQUIRED)
9find_package(Eet REQUIRED) 12find_package(Eet REQUIRED)
10find_package(Eolian REQUIRED) 13find_package(Eolian REQUIRED)
diff --git a/cmake/Modules/FindFfi.cmake b/cmake/Modules/FindFfi.cmake
new file mode 100644
index 0000000..c9224d1
--- /dev/null
+++ b/cmake/Modules/FindFfi.cmake
@@ -0,0 +1,40 @@
1# - Try to find ffi
2# Once done this will define
3# FFI_FOUND - System has ffi
4# FFI_INCLUDE_DIRS - The ffi include directories
5# FFI_LIBRARIES - The libraries needed to use ffi
6# FFI_LDFLAGS_OTHER - Other LDFLAGS needed te use ffi.
7# FFI_DEFINITIONS - Compiler switches required for using ffi
8
9find_package(PkgConfig)
10if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER "2.8.1")
11 # "QUIET" was introduced in 2.8.2
12 set(_QUIET QUIET)
13endif ()
14pkg_check_modules(PC_LIBFFI ${_QUIET} libffi)
15#set(FFI_DEFINITIONS ${PC_LIBFFI_CFLAGS_OTHER})
16#set(FFI_LDFLAGS_OTHER ${PC_LIBFFI_LDFLAGS_OTHER})
17
18# before verison 2.8.11 variable CMAKE_LIBRARY_ARCHITECTURE wasn't automatically added to search path
19if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_LESS "2.8.11")
20 set(FIND_PATH_HINTS ${PC_LIBFFI_INCLUDEDIR}/${CMAKE_LIBRARY_ARCHITECTURE})
21endif ()
22
23find_path(FFI_INCLUDE_DIR ffi.h
24 HINTS ${PC_LIBFFI_INCLUDEDIR} ${PC_LIBFFI_INCLUDE_DIRS}
25 ${FIND_PATH_HINTS}
26 )
27
28find_library(FFI_LIBRARY NAMES ffi libffi
29 HINTS ${PC_LIBFFI_LIBDIR} ${PC_LIBFFI_LIBRARY_DIRS})
30
31set(FFI_INCLUDE_DIRS ${FFI_INCLUDE_DIR})
32set(FFI_LIBRARIES ${FFI_LIBRARY})
33
34#include(FindPackageHandleStandardArgs)
35# handle the QUIETLY and REQUIRED arguments and set EINA_FOUND to TRUE
36# if all listed variables are TRUE
37find_package_handle_standard_args(ffi DEFAULT_MSG
38 FFI_LIBRARY)
39
40mark_as_advanced(FFI_INCLUDE_DIRS FFI_LIBRARY)
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 6bd89a4..6079349 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -11,6 +11,7 @@ add_definitions(${EDBG_COMMON_DEFINITIONS})
11include_directories (${CMAKE_SOURCE_DIR}/src/lib) 11include_directories (${CMAKE_SOURCE_DIR}/src/lib)
12include_directories(${CMAKE_CURRENT_BINARY_DIR}) 12include_directories(${CMAKE_CURRENT_BINARY_DIR})
13include_directories( 13include_directories(
14 ${FFI_INCLUDE_DIRS}
14 ${EINA_INCLUDE_DIRS} 15 ${EINA_INCLUDE_DIRS}
15 ${EOLIAN_INCLUDE_DIRS} 16 ${EOLIAN_INCLUDE_DIRS}
16 ${EVAS_INCLUDE_DIRS} 17 ${EVAS_INCLUDE_DIRS}
@@ -31,6 +32,7 @@ target_link_libraries(edbg_preload
31 ) 32 )
32 33
33target_link_libraries(edbg_common 34target_link_libraries(edbg_common
35 ${FFI_LIBRARIES}
34 ${EINA_LIBRARIES} 36 ${EINA_LIBRARIES}
35 ${EO_LIBRARIES} 37 ${EO_LIBRARIES}
36 ${EOLIAN_LIBRARIES} 38 ${EOLIAN_LIBRARIES}