arpadboda commented on a change in pull request #661: MINIFICPP-1022 - 
Refactored third party build system
URL: https://github.com/apache/nifi-minifi-cpp/pull/661#discussion_r349583860
 
 

 ##########
 File path: cmake/BundledAwsSdkCpp.cmake
 ##########
 @@ -0,0 +1,178 @@
+# 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_libaws SOURCE_DIR BINARY_DIR)
+    # Define byproducts
+    if (WIN32)
+        set(SUFFIX "lib")
+    else()
+        set(SUFFIX "a")
+    endif()
+    set(BYPRODUCTS
+            "lib/libaws-cpp-sdk-core.${SUFFIX}"
+            "lib/libaws-cpp-sdk-s3.${SUFFIX}")
+
+    FOREACH(BYPRODUCT ${BYPRODUCTS})
+        LIST(APPEND AWSSDK_LIBRARIES_LIST 
"${BINARY_DIR}/thirdparty/libaws-install/${BYPRODUCT}")
+    ENDFOREACH(BYPRODUCT)
+
+    # Set build options
+    set(AWS_C_COMMON_CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS}
+            -DCMAKE_PREFIX_PATH=${BINARY_DIR}/thirdparty/libaws-install
+            -DCMAKE_INSTALL_PREFIX=${BINARY_DIR}/thirdparty/libaws-install
+            -DENABLE_TESTING=OFF
+            -DBUILD_SHARED_LIBS=OFF)
+
+    append_third_party_passthrough_args(AWS_C_COMMON_CMAKE_ARGS 
"${AWS_C_COMMON_CMAKE_ARGS}")
+
+    set(AWS_CHECKSUM_CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS}
+            -DCMAKE_PREFIX_PATH=${BINARY_DIR}/thirdparty/libaws-install
+            -DCMAKE_INSTALL_PREFIX=${BINARY_DIR}/thirdparty/libaws-install
+            -DBUILD_SHARED_LIBS=OFF)
+
+    append_third_party_passthrough_args(AWS_CHECKSUM_CMAKE_ARGS 
"${AWS_CHECKSUM_CMAKE_ARGS}")
+
+    set(AWS_C_EVENT_STREAM_CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS}
+            -DCMAKE_PREFIX_PATH=${BINARY_DIR}/thirdparty/libaws-install
+            -DCMAKE_INSTALL_PREFIX=${BINARY_DIR}/thirdparty/libaws-install
+            -DBUILD_SHARED_LIBS=OFF)
+
+    append_third_party_passthrough_args(AWS_C_EVENT_STREAM_CMAKE_ARGS 
"${AWS_C_EVENT_STREAM_CMAKE_ARGS}")
+
+    set(AWS_SDK_CPP_CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS}
+            -DCMAKE_PREFIX_PATH=${BINARY_DIR}/thirdparty/libaws-install
+            -DCMAKE_INSTALL_PREFIX=${BINARY_DIR}/thirdparty/libaws-install
+            -DBUILD_ONLY=s3
+            -DENABLE_TESTING=OFF
+            -DBUILD_SHARED_LIBS=OFF
+            -DENABLE_UNITY_BUILD=ON
+            -DBUILD_DEPS=OFF)
+
+    append_third_party_passthrough_args(AWS_SDK_CPP_CMAKE_ARGS 
"${AWS_SDK_CPP_CMAKE_ARGS}")
+
+    # Build project
+    ExternalProject_Add(
+            aws-c-common-external
+            GIT_REPOSITORY "https://github.com/awslabs/aws-c-common.git";
+            GIT_TAG "ac02e1728d740bb9106b6ea727cd3378f8ea438a"
+            SOURCE_DIR "${BINARY_DIR}/thirdparty/aws-c-common-src"
+            INSTALL_DIR "${BINARY_DIR}/thirdparty/libaws-install"
+            LIST_SEPARATOR % # This is needed for passing semicolon-separated 
lists
+            CMAKE_ARGS ${AWS_C_COMMON_CMAKE_ARGS}
+            BUILD_BYPRODUCTS 
"${BINARY_DIR}/thirdparty/libaws-install/lib/libaws-c-common.${SUFFIX}"
+            EXCLUDE_FROM_ALL TRUE
+    )
+    ExternalProject_Add(
+            aws-checksum-external
+            GIT_REPOSITORY "https://github.com/awslabs/aws-checksums.git";
+            GIT_TAG "41dc36d14b0898bd34e3f91c808fcb00f5e21875"
+            SOURCE_DIR "${BINARY_DIR}/thirdparty/aws-checksums-src"
+            INSTALL_DIR "${BINARY_DIR}/thirdparty/libaws-install"
+            LIST_SEPARATOR % # This is needed for passing semicolon-separated 
lists
+            CMAKE_ARGS ${AWS_CHECKSUM_CMAKE_ARGS}
+            BUILD_BYPRODUCTS 
"${BINARY_DIR}/thirdparty/libaws-install/lib/libaws-checksums.${SUFFIX}"
+            EXCLUDE_FROM_ALL TRUE
+    )
+    ExternalProject_Add(
+            aws-c-event-stream-external
+            GIT_REPOSITORY "https://github.com/awslabs/aws-c-event-stream.git";
+            GIT_TAG "97ab2e57e83ad114679dbee0dcfb5048640debe7"
+            SOURCE_DIR "${BINARY_DIR}/thirdparty/aws-c-event-stream-src"
+            INSTALL_DIR "${BINARY_DIR}/thirdparty/libaws-install"
+            LIST_SEPARATOR % # This is needed for passing semicolon-separated 
lists
+            CMAKE_ARGS ${AWS_C_EVENT_STREAM_CMAKE_ARGS}
+            BUILD_BYPRODUCTS 
"${BINARY_DIR}/thirdparty/libaws-install/lib/libaws-c-event-stream.${SUFFIX}"
+            EXCLUDE_FROM_ALL TRUE
+    )
+    ExternalProject_Add(
+            aws-sdk-cpp-external
+            GIT_REPOSITORY "https://github.com/aws/aws-sdk-cpp.git";
+            GIT_TAG "1.7.109"
+            SOURCE_DIR "${BINARY_DIR}/thirdparty/aws-sdk-cpp-src"
+            INSTALL_DIR "${BINARY_DIR}/thirdparty/libaws-install"
+            LIST_SEPARATOR % # This is needed for passing semicolon-separated 
lists
+            CMAKE_ARGS ${AWS_SDK_CPP_CMAKE_ARGS}
+            BUILD_BYPRODUCTS "${AWSSDK_LIBRARIES_LIST}"
+            EXCLUDE_FROM_ALL TRUE
+    )
+
+    # Set dependencies
+    add_dependencies(aws-c-common-external CURL::libcurl OpenSSL::Crypto 
OpenSSL::SSL ZLIB::ZLIB)
+    add_dependencies(aws-checksum-external CURL::libcurl OpenSSL::Crypto 
OpenSSL::SSL ZLIB::ZLIB)
+    add_dependencies(aws-c-event-stream-external CURL::libcurl OpenSSL::Crypto 
OpenSSL::SSL ZLIB::ZLIB)
+    add_dependencies(aws-c-event-stream-external aws-c-common-external 
aws-checksum-external)
+    add_dependencies(aws-sdk-cpp-external CURL::libcurl OpenSSL::Crypto 
OpenSSL::SSL ZLIB::ZLIB)
 
 Review comment:
   Do we need this?
   Guess dependencies are transitive in Cmake, so I wonder if the line below 
this does the job alone. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to