You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by al...@apache.org on 2016/12/05 20:52:27 UTC

nifi-minifi-cpp git commit: MINIFI-139 - Resolved OS X 10.12 build failures by introducing Cmake find modules for LevelDB and UUID for both includes and libraries.

Repository: nifi-minifi-cpp
Updated Branches:
  refs/heads/master e678ef30f -> 3bc335c8d


MINIFI-139 - Resolved OS X 10.12 build failures by introducing Cmake
find modules for LevelDB and UUID for both includes and libraries.

This closes #26.

Signed-off-by: Aldrin Piri <al...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/commit/3bc335c8
Tree: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/tree/3bc335c8
Diff: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/diff/3bc335c8

Branch: refs/heads/master
Commit: 3bc335c8d5b57d93868eef3e4ab68042d0d561dd
Parents: e678ef3
Author: Jeremy Dyer <jd...@gmail.com>
Authored: Tue Nov 29 21:09:37 2016 -0500
Committer: Aldrin Piri <al...@apache.org>
Committed: Mon Dec 5 15:45:57 2016 -0500

----------------------------------------------------------------------
 NOTICE                   |  8 ++++++-
 cmake/FindLeveldb.cmake  | 50 +++++++++++++++++++++++++++++++++++++++++++
 cmake/FindUUID.cmake     | 37 ++++++++++++++++++++++++++++++++
 libminifi/CMakeLists.txt | 10 +++++++++
 main/CMakeLists.txt      | 10 +++++++--
 5 files changed, 112 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/3bc335c8/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index e1743a6..3badb13 100644
--- a/NOTICE
+++ b/NOTICE
@@ -2,4 +2,10 @@ Apache NiFi MiNiFi
 Copyright 2016 The Apache Software Foundation
 
 This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
\ No newline at end of file
+The Apache Software Foundation (http://www.apache.org/).
+
+This includes derived works from the Apache Celix (ASLv2 licensed) project (https://github.com/apache/celix):
+Copyright 2015 The Apache Software Foundation
+The derived work is adapted from
+  celix/cmake/FindUUID.cmake
+and can be found in cmake/FindUUID.cmake
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/3bc335c8/cmake/FindLeveldb.cmake
----------------------------------------------------------------------
diff --git a/cmake/FindLeveldb.cmake b/cmake/FindLeveldb.cmake
new file mode 100644
index 0000000..73ac693
--- /dev/null
+++ b/cmake/FindLeveldb.cmake
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# 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 qrequired 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.
+
+
+# Find module for Leveldb library and includes
+#  LEVELDB_FOUND - if system found LEVELDB library
+#  LEVELDB_INCLUDE_DIRS - The LEVELDB include directories
+#  LEVELDB_LIBRARIES - The libraries needed to use LEVELDB
+#  LEVELDB_DEFINITIONS - Compiler switches required for using LEVELDB
+
+# For OS X do not attempt to use the OS X application frameworks or bundles.
+set (CMAKE_FIND_FRAMEWORK NEVER)
+set (CMAKE_FIND_APPBUNDLE NEVER)
+
+find_path(LEVELDB_INCLUDE_DIR
+    NAMES leveldb/db.h
+    PATHS /usr/local/include /usr/include
+    DOC "LevelDB include header"
+)
+
+find_library(LEVELDB_LIBRARY 
+    NAMES libleveldb.dylib libleveldb.so
+    PATHS /usr/local/lib /usr/lib/x86_64-linux-gnu
+    DOC "LevelDB library"
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LEVELDB DEFAULT_MSG LEVELDB_INCLUDE_DIR LEVELDB_LIBRARY)
+
+if (LEVELDB_FOUND)
+    set(LEVELDB_LIBRARIES ${LEVELDB_LIBRARY} )
+    set(LEVELDB_INCLUDE_DIRS ${LEVELDB_INCLUDE_DIR} )
+    set(LEVELDB_DEFINITIONS )
+endif()
+
+mark_as_advanced(LEVELDB_ROOT_DIR LEVELDB_INCLUDE_DIR LEVELDB_LIBRARY)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/3bc335c8/cmake/FindUUID.cmake
----------------------------------------------------------------------
diff --git a/cmake/FindUUID.cmake b/cmake/FindUUID.cmake
new file mode 100644
index 0000000..2402d08
--- /dev/null
+++ b/cmake/FindUUID.cmake
@@ -0,0 +1,37 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# 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.
+
+
+find_path(UUID_INCLUDE_DIR
+	NAMES uuid/uuid.h
+	HINTS ${UUID_DIR}/include
+			$ENV{UUID_DIR}/include
+	PATHS /usr/include
+          /usr/local/include )
+
+find_library(UUID_LIBRARY NAMES uuid
+             PATHS /usr/lib /usr/local/lib /usr/local/lib64 /lib/i386-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu)
+
+set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR})
+set(UUID_LIBRARIES ${UUID_LIBRARY})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(UUID  DEFAULT_MSG
+                                  UUID_LIBRARY UUID_INCLUDE_DIR)
+
+
+mark_as_advanced(UUID_INCLUDE_DIRS UUID_LIBRARIES)

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/3bc335c8/libminifi/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/libminifi/CMakeLists.txt b/libminifi/CMakeLists.txt
index 3e5eb87..ff1634a 100644
--- a/libminifi/CMakeLists.txt
+++ b/libminifi/CMakeLists.txt
@@ -56,3 +56,13 @@ if (LIBXML2_FOUND)
 else ()
     # Build from our local version
 endif (LIBXML2_FOUND)
+
+# Include LevelDB
+find_package (Leveldb REQUIRED)
+if (LEVELDB_FOUND)
+	include_directories(${LEVELDB_INCLUDE_DIRS})
+	target_link_libraries (minifi ${LEVELDB_LIBRARIES})
+else ()
+    message( FATAL_ERROR "LevelDB was not found. Please install LevelDB" )
+endif (LEVELDB_FOUND)
+

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/3bc335c8/main/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index 0f66cda..3e0bbc4 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -25,6 +25,9 @@ ENDIF(POLICY CMP0048)
 
 include_directories(../include ../libminifi/include ../thirdparty/yaml-cpp-yaml-cpp-0.5.3/include ../thirdparty/leveldb-1.18/include ../thirdparty/)
 
+find_package(Boost REQUIRED)
+include_directories(${Boost_INCLUDE_DIRS})
+
 # Include libxml2
 find_package(LibXml2)
 if (LIBXML2_FOUND)
@@ -41,8 +44,11 @@ if(CMAKE_THREAD_LIBS_INIT)
   target_link_libraries(minifiexe "${CMAKE_THREAD_LIBS_INIT}")
 endif()
 
-# Link against minifi, yaml-cpp and uuid
-target_link_libraries(minifiexe minifi yaml-cpp uuid leveldb)
+# Include UUID
+find_package(UUID REQUIRED)
+
+# Link against minifi, yaml-cpp, uuid, and leveldb
+target_link_libraries(minifiexe minifi yaml-cpp ${UUID_LIBRARIES} ${LEVELDB_LIBRARIES})
 set_target_properties(minifiexe
         PROPERTIES OUTPUT_NAME minifi)