This is an automated email from the ASF dual-hosted git repository.

aldrin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git


The following commit(s) were added to refs/heads/master by this push:
     new 1aa9ed4  MINIFICPP-503 and MINIFICPP-507 ( Partial ): Remove 
compression downloads to module
1aa9ed4 is described below

commit 1aa9ed47ac97ed3ebd2e356c09ce731521160f5a
Author: Marc Parisi <[email protected]>
AuthorDate: Thu May 30 12:35:18 2019 -0400

    MINIFICPP-503 and MINIFICPP-507 ( Partial ): Remove compression downloads 
to module
    
    This closes #578.
    
    Signed-off-by: Aldrin Piri <[email protected]>
---
 CMakeLists.txt                       | 95 +++++++++---------------------------
 cmake/Compression.cmake              | 57 ++++++++++++++++++++++
 extensions/libarchive/CMakeLists.txt |  3 --
 extensions/script/CMakeLists.txt     |  3 --
 4 files changed, 81 insertions(+), 77 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 91657e8..d996fe0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -182,24 +182,23 @@ if (NOT OPENSSL_OFF)
                else()
                        #set(OPENSSL_ROOT_DIR "/usr/lib/x86_64-linux-gnu")
                endif()
-       
-               # Include OpenSSL
-               find_package (OpenSSL REQUIRED)
-       
        else()
                include(LibreSSL)
                use_libre_ssl(${CMAKE_CURRENT_SOURCE_DIR} 
${CMAKE_CURRENT_BINARY_DIR})
                list(APPEND CMAKE_MODULE_PATH 
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/ssl")
-               find_package (OpenSSL REQUIRED)
-       endif()
-if (OPENSSL_FOUND)
-  include_directories(${OPENSSL_INCLUDE_DIR})
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOPENSSL_SUPPORT")
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL_SUPPORT")
-  MESSAGE("OpenSSL found at ${OPENSSL_LIBRARIES}")
-else ()
-  message( FATAL_ERROR "OpenSSL was not found. Please install OpenSSL" )
-endif (OPENSSL_FOUND)
+       endif() 
+       
+       find_package (OpenSSL REQUIRED)
+
+       if (OPENSSL_FOUND)
+         include_directories(${OPENSSL_INCLUDE_DIR})
+         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOPENSSL_SUPPORT")
+         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL_SUPPORT")
+         MESSAGE("OpenSSL found at ${OPENSSL_LIBRARIES}")
+       else ()
+         message( FATAL_ERROR "OpenSSL was not found. Please install OpenSSL" )
+       endif (OPENSSL_FOUND)
+       
 else()
        list(APPEND CMAKE_MODULE_PATH 
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/winssl")
 endif()
@@ -227,51 +226,16 @@ set(PASSTHROUGH_CMAKE_ARGS -DANDROID_ABI=${ANDROID_ABI}
         ${OPENSSL_PASSTHROUGH}
         -G${CMAKE_GENERATOR})
 
-if(WIN32 OR NOT USE_SYSTEM_ZLIB)
-  message("Using bundled zlib")
+include(Compression)
 
-  if (WIN32)
-  if (CMAKE_BUILD_TYPE MATCHES RelWithDebInfo OR CMAKE_BUILD_TYPE MATCHES 
Release)
-  set(BYPRODUCT "thirdparty/zlib-install/lib/zlibstatic.lib")
-  else()
-  set(BYPRODUCT "thirdparty/zlib-install/lib/zlibstaticd.lib")
-  endif()
-  else()
-  set(BYPRODUCT "thirdparty/zlib-install/lib/libz.a")
-  endif()
-  ExternalProject_Add(
-    zlib-external
-    GIT_REPOSITORY "https://github.com/madler/zlib.git";
-    GIT_TAG "cacf7f1d4e3d44d871b605da3b647f07d718623f"  # Version 1.2.11
-    SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/zlib-src"
-    CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS}
-               
"-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/thirdparty/zlib-install"
-    BUILD_BYPRODUCTS ${BYPRODUCT}
-  )
-
-
-  add_library(z STATIC IMPORTED)
-  set_target_properties(z PROPERTIES IMPORTED_LOCATION 
"${CMAKE_CURRENT_BINARY_DIR}/${BYPRODUCT}")
-
-  set(ZLIB_BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/${BYPRODUCT}" CACHE STRING 
"" FORCE)
-  set(ZLIB_BYPRODUCT_INCLUDE 
"${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib/include" CACHE STRING "" FORCE)
-  set(ZLIB_BIN_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/libressl-install/" 
CACHE STRING "" FORCE)
-
-  add_dependencies(z zlib-external)
-  set(ZLIB_FOUND "YES" CACHE STRING "" FORCE)
-  set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib/include" 
CACHE STRING "" FORCE)
-  set(ZLIB_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib/include" 
CACHE STRING "" FORCE)
-
-  set(ZLIB_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/${BYPRODUCT}" CACHE STRING "" 
FORCE)
-  set(ZLIB_LIBRARIES "${ZLIB_LIBRARY}" CACHE STRING "" FORCE)
-  set(ZLIB_LIBRARY_RELEASE "${CMAKE_CURRENT_BINARY_DIR}/${BYPRODUCT}" CACHE 
STRING "" FORCE)
-  set(ZLIB_LIBRARY_DEBUG "${CMAKE_CURRENT_BINARY_DIR}/${BYPRODUCT}" CACHE 
STRING "" FORCE)
-
-  list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/zlib/dummy")
-else()
-  find_package (ZLIB REQUIRED)
+if(WIN32 OR NOT USE_SYSTEM_ZLIB)
+       use_bundled_zlib(${CMAKE_CURRENT_SOURCE_DIR} 
${CMAKE_CURRENT_BINARY_DIR})
+       find_package (OpenSSL REQUIRED)
+       list(APPEND CMAKE_MODULE_PATH "${SOURCE_DIR}/cmake/zlib/dummy")
 endif()
 
+find_package (ZLIB REQUIRED)
+
 if (ZLIB_FOUND)
   include_directories(${ZLIB_INCLUDE_DIRS})
 endif()
@@ -430,21 +394,10 @@ else()
 endif()
 
 if(BOOTSTRAP)
-    add_subdirectory(thirdparty/cxxopts)
-    createExtension(BOOTSTRAP "BOOTSTRAP" "Bootstraps documentation and other 
features" "extensions/bootstrap")
-    # we don't currently need this route. A follow on should help re-write 
processor documentation from what exists in code, so this will remain here 
-       # execute_process(COMMAND 
${CMAKE_BINARY_DIR}/extensions/bootstrap/bstrp --inputc2docs 
"${CMAKE_SOURCE_DIR}/PROCESSORS.md" --outputc2docs 
"${CMAKE_SOURCE_DIR}/libminifi/include/agent/agent_docs.h")
-    return()
-endif()
-
-message("-------- BOOTSTRAP BEGIN --------")
-execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"
-                        -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-                        -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
-                        -DBOOTSTRAP=ON
-                        ${CMAKE_SOURCE_DIR}
-               WORKING_DIRECTORY "${workdir}")
-message("-------- BOOTSTRAP END --------")
+       # display an error message for those using the bootstrap
+    message(FATAL_ERROR "Bootstrapping is no longer needed within the agent")
+endif()
+
                
 add_subdirectory(libminifi)
 
diff --git a/cmake/Compression.cmake b/cmake/Compression.cmake
new file mode 100644
index 0000000..2d03733
--- /dev/null
+++ b/cmake/Compression.cmake
@@ -0,0 +1,57 @@
+# 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.
+
+function(use_bundled_zlib SOURCE_DIR BINARY_DIR)
+ message("Using bundled zlib")
+  if (WIN32)
+  if (CMAKE_BUILD_TYPE MATCHES RelWithDebInfo OR CMAKE_BUILD_TYPE MATCHES 
Release)
+  set(BYPRODUCT "thirdparty/zlib-install/lib/zlibstatic.lib")
+  else()
+  set(BYPRODUCT "thirdparty/zlib-install/lib/zlibstaticd.lib")
+  endif()
+  else()
+  set(BYPRODUCT "thirdparty/zlib-install/lib/libz.a")
+  endif()
+  ExternalProject_Add(
+    zlib-external
+    GIT_REPOSITORY "https://github.com/madler/zlib.git";
+    GIT_TAG "cacf7f1d4e3d44d871b605da3b647f07d718623f"  # Version 1.2.11
+    SOURCE_DIR "${BINARY_DIR}/thirdparty/zlib-src"
+    CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS}
+               "-DCMAKE_INSTALL_PREFIX=${BINARY_DIR}/thirdparty/zlib-install"
+    BUILD_BYPRODUCTS ${BYPRODUCT}
+  )
+
+
+  add_library(z STATIC IMPORTED)
+  set_target_properties(z PROPERTIES IMPORTED_LOCATION 
"${BINARY_DIR}/${BYPRODUCT}")
+
+  set(ZLIB_BYPRODUCT "${BINARY_DIR}/${BYPRODUCT}" CACHE STRING "" FORCE)
+  set(ZLIB_BYPRODUCT_INCLUDE "${SOURCE_DIR}/thirdparty/zlib/include" CACHE 
STRING "" FORCE)
+  set(ZLIB_BIN_DIR "${BINARY_DIR}/thirdparty/libressl-install/" CACHE STRING 
"" FORCE)
+
+  add_dependencies(z zlib-external)
+  set(ZLIB_FOUND "YES" CACHE STRING "" FORCE)
+  set(ZLIB_INCLUDE_DIR "${SOURCE_DIR}/thirdparty/zlib/include" CACHE STRING "" 
FORCE)
+  set(ZLIB_INCLUDE_DIRS "${SOURCE_DIR}/thirdparty/zlib/include" CACHE STRING 
"" FORCE)
+
+  set(ZLIB_LIBRARY "${BINARY_DIR}/${BYPRODUCT}" CACHE STRING "" FORCE)
+  set(ZLIB_LIBRARIES "${ZLIB_LIBRARY}" CACHE STRING "" FORCE)
+  set(ZLIB_LIBRARY_RELEASE "${BINARY_DIR}/${BYPRODUCT}" CACHE STRING "" FORCE)
+  set(ZLIB_LIBRARY_DEBUG "${BINARY_DIR}/${BYPRODUCT}" CACHE STRING "" FORCE)  
+  
+endfunction(use_bundled_zlib)
\ No newline at end of file
diff --git a/extensions/libarchive/CMakeLists.txt 
b/extensions/libarchive/CMakeLists.txt
index bc4798f..3463999 100644
--- a/extensions/libarchive/CMakeLists.txt
+++ b/extensions/libarchive/CMakeLists.txt
@@ -38,9 +38,6 @@ endif()
 # Include UUID
 target_link_libraries(minifi-archive-extensions ${LIBMINIFI})
 target_link_libraries(minifi-archive-extensions archive_static )
-#find_package(ZLIB REQUIRED)
-#include_directories(${ZLIB_INCLUDE_DIRS})
-#target_link_libraries (minifi-archive-extensions ${ZLIB_LIBRARIES})
 if (WIN32)
     set_target_properties(minifi-archive-extensions PROPERTIES
         LINK_FLAGS "/WHOLEARCHIVE"
diff --git a/extensions/script/CMakeLists.txt b/extensions/script/CMakeLists.txt
index d410471..bbb53f6 100644
--- a/extensions/script/CMakeLists.txt
+++ b/extensions/script/CMakeLists.txt
@@ -93,9 +93,6 @@ if (ENABLE_LUA_SCRIPTING)
     target_link_libraries(minifi-script-extensions minifi-lua-extensions)
 endif()
 
-find_package(ZLIB REQUIRED)
-include_directories(${ZLIB_INCLUDE_DIRS})
-target_link_libraries (minifi-script-extensions ${ZLIB_LIBRARIES})
 if (WIN32)
     set_target_properties(minifi-script-extensions PROPERTIES
         LINK_FLAGS "/WHOLEARCHIVE"

Reply via email to