celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject celix git commit: CELIX-237: added FindFFI.cmake file and updated cmake file accordingly
Date Sat, 04 Jul 2015 15:18:56 GMT
Repository: celix
Updated Branches:
  refs/heads/feature/CELIX-237_rsa-ffi 6eaf4f4e8 -> 5b20ddb02


CELIX-237: added FindFFI.cmake file and updated cmake file accordingly


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/5b20ddb0
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/5b20ddb0
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/5b20ddb0

Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 5b20ddb020f151d0f6721e765671aa22d54f4af3
Parents: 6eaf4f4
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Sat Jul 4 17:24:18 2015 +0200
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Sat Jul 4 17:24:18 2015 +0200

----------------------------------------------------------------------
 .travis.yml                                     |  2 +-
 cmake/FindFFI.cmake                             | 45 ++++++++++++++++++++
 .../dynamic_function_interface/CMakeLists.txt   | 12 ++----
 .../CMakeLists.txt                              | 10 ++---
 4 files changed, 53 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/5b20ddb0/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index f3c5113..707b712 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,7 +2,7 @@ language: c
 
 before_install:
   - sudo apt-get update -qq
-  - sudo apt-get install -y uuid-dev libjansson-dev libxml2-dev libffi-dev lcov
+  - sudo apt-get install -y uuid-dev libxml2-dev libffi-dev lcov
 
 matrix:
   include:

http://git-wip-us.apache.org/repos/asf/celix/blob/5b20ddb0/cmake/FindFFI.cmake
----------------------------------------------------------------------
diff --git a/cmake/FindFFI.cmake b/cmake/FindFFI.cmake
new file mode 100644
index 0000000..9ee947c
--- /dev/null
+++ b/cmake/FindFFI.cmake
@@ -0,0 +1,45 @@
+
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+# - Try to find libffi define the variables for the binaries/headers and include 
+#
+# Once done this will define
+#  FFI_FOUND - System has libffi
+#  FFI_INCLUDE_DIRS - The package include directories
+#  FFI_LIBRARIES - The libraries needed to use this package
+
+find_path(FFI_INCLUDE_DIR ffi.h
+		PATHS $ENV{FFI_DIR} ${FFI_DIR} /usr /usr/local /opt/local
+          	PATH_SUFFIXES include include/ffi)
+
+find_library(FFI_LIBRARY NAMES ffi
+             	PATHS $ENV{FFI_DIR} ${FFI_DIR} /usr /usr/local /opt/local
+             	PATH_SUFFIXES lib lib64)
+
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set FFI_FOUND to TRUE
+# if all listed variables are TRUE
+find_package_handle_standard_args(FFI  DEFAULT_MSG
+                                  FFI_LIBRARY FFI_INCLUDE_DIR)
+mark_as_advanced(FFI_INCLUDE_DIR FFI_LIBRARY) 
+
+if(FFI_FOUND)
+	set(FFI_LIBRARIES ${FFI_LIBRARY})
+	set(FFI_INCLUDE_DIRS ${FFI_INCLUDE_DIR})
+endif()

http://git-wip-us.apache.org/repos/asf/celix/blob/5b20ddb0/remote_services/dynamic_function_interface/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/dynamic_function_interface/CMakeLists.txt b/remote_services/dynamic_function_interface/CMakeLists.txt
index 7825e07..f1a8890 100644
--- a/remote_services/dynamic_function_interface/CMakeLists.txt
+++ b/remote_services/dynamic_function_interface/CMakeLists.txt
@@ -3,17 +3,13 @@
 #
 find_package(Jansson REQUIRED)
 find_package(CppUTest REQUIRED)
-
-#set(FFI_LIB /lib64/libffi.so) #TODO add findPackag for lib ffi
-#set(FFI_LIB /opt/local/lib/libffi.dylib) 
-#set(FFI_INCLUDE /opt/local/lib/libffi-3.2.1/include)
-set(FFI_LIB /lib/libffi.so)
+find_package(FFI REQUIRED)
 
 include_directories( 
     ${CPPUTEST_INCLUDE_DIR}
     ${JANSSON_INCLUDE_DIRS}
     ${CMAKE_CURRENT_LIST_DIR}
-    ${FFI_INCLUDE}
+    ${FFI_INCLUDE_DIRS}
     memstream
 )
 
@@ -29,7 +25,7 @@ add_library(dfi
     avro_descriptor_translator.c
     ${MEMSTREAM_SOURCES}
 )
-target_link_libraries(dfi ${FFI_LIB} ${JANSSON_LIBRARY})
+target_link_libraries(dfi ${FFI_LIBRARIES} ${JANSSON_LIBRARY})
 
 
 #if (FRAMEWORK_TESTS)
@@ -41,7 +37,7 @@ target_link_libraries(dfi ${FFI_LIB} ${JANSSON_LIBRARY})
 	    tst/avro_descriptor_translator_tests.cpp
 	    tst/run_tests.cpp
 	)
-	target_link_libraries(dfi_tests dfi ${FFI_LIB} ${CPPUTEST_LIBRARY} ${JANSSON_LIBRARY}) 
+	target_link_libraries(dfi_tests dfi ${FFI_LIBRARIES} ${CPPUTEST_LIBRARY} ${JANSSON_LIBRARY})

 
 	add_custom_target(copy-input 
 	    COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_LIST_DIR}/schemas schemas

http://git-wip-us.apache.org/repos/asf/celix/blob/5b20ddb0/remote_services/remote_service_admin_http_ffi/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_http_ffi/CMakeLists.txt b/remote_services/remote_service_admin_http_ffi/CMakeLists.txt
index 1b9b823..6180ef0 100644
--- a/remote_services/remote_service_admin_http_ffi/CMakeLists.txt
+++ b/remote_services/remote_service_admin_http_ffi/CMakeLists.txt
@@ -18,13 +18,9 @@ celix_subproject(RSA_REMOTE_SERVICE_ADMIN_HTTP "Option to enable building
the Re
 if (RSA_REMOTE_SERVICE_ADMIN_HTTP)
     find_package(CURL REQUIRED)
     find_package(Jansson REQUIRED)
+    find_package(FFI REQUIRED)
     
-    #TODO add findPackage for libffi
-    #set(FFI_INCLUDE /opt/local/lib/libffi-3.2.1/include)
-    #set(FFI_LIB /opt/local/lib/libffi.dylib) 
-    set(FFI_LIB /lib/libffi.so)
-     
-    include_directories(${FFI_INCLUDE})
+    include_directories(${FFI_INCLUDE_DIRS})
     include_directories(${CURL_INCLUDE_DIRS})
     include_directories(${JANSSON_INCLUDE_DIRS})
     include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
@@ -51,5 +47,5 @@ if (RSA_REMOTE_SERVICE_ADMIN_HTTP)
 
 	install_bundle(remote_service_admin_http)
 
-  target_link_libraries(remote_service_admin_http celix_framework ${CURL_LIBRARIES} ${JANSSON_LIBRARIES}
${FFI_LIB}) 
+  target_link_libraries(remote_service_admin_http celix_framework ${CURL_LIBRARIES} ${JANSSON_LIBRARIES}
${FFI_LIBRARIES}) 
 endif (RSA_REMOTE_SERVICE_ADMIN_HTTP)


Mime
View raw message