diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d671f64b1..55a9e0a06a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,7 +233,7 @@ if(CUSTOM_MALLOC) include(GetMiMalloc) set(CUSTOM_MALLOC_LIB mimalloc-static) elseif (CUSTOM_MALLOC STREQUAL rpmalloc) - include(RpMalloc) + include(GetRpMalloc) set(CUSTOM_MALLOC_LIB rpmalloc) else() message(FATAL_ERROR "Invalid CUSTOM_MALLOC") @@ -258,8 +258,7 @@ endif() # ossp-uuid if(NOT WIN32) - include(BundledOSSPUUID) - use_bundled_osspuuid(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + include(GetOSSPUUID) endif() # libsodium @@ -321,7 +320,7 @@ if (NOT _gsl_lite_real_target) endif() target_compile_definitions(${_gsl_lite_real_target} INTERFACE ${GslDefinitions}) -include(Date) +include(GetDate) include(GetMagicEnum) include(GetRangeV3) include(GetAsio) diff --git a/bootstrap/cli.py b/bootstrap/cli.py index 58518a2c0a..c014630425 100644 --- a/bootstrap/cli.py +++ b/bootstrap/cli.py @@ -62,7 +62,9 @@ def run_conan_install(minifi_options: MinifiOptions, package_manager: PackageMan print("Conan install skipped because USE_CONAN is OFF") return True conan_options = add_conan_options_from_cmake_options(["ENABLE_ALL", "ENABLE_LIBARCHIVE", "ENABLE_ROCKSDB", "ENABLE_SFTP", "ENABLE_PROMETHEUS", "ENABLE_BZIP2", "ENABLE_LZMA", "ENABLE_MQTT", - "ENABLE_COUCHBASE", "ENABLE_KAFKA", "ENABLE_OPC", "SKIP_TESTS"], minifi_options) + "ENABLE_COUCHBASE", "ENABLE_KAFKA", "ENABLE_OPC", "ENABLE_GCP", "ENABLE_GRPC_FOR_LOKI", "ENABLE_BUSTACHE", "ENABLE_KUBERNETES", + "ENABLE_AZURE", "ENABLE_LLAMACPP", "ENABLE_AWS", "PORTABLE", "SKIP_TESTS"], + minifi_options) if minifi_options.custom_malloc is not None and minifi_options.custom_malloc.value not in (None, "OFF"): conan_options += f' -o "&:custom_malloc={minifi_options.custom_malloc.value}"' @@ -73,7 +75,7 @@ def run_conan_install(minifi_options: MinifiOptions, package_manager: PackageMan if not export_custom_conan_recipes(minifi_options, package_manager): return False - compiler_settings = " --settings=compiler.cppstd=23" + compiler_settings = " -s:a compiler.cppstd=23" generator_setting = " -c tools.cmake.cmaketoolchain:generator=Ninja" if minifi_options.use_ninja.value == "ON" else "" conan_remote_add_cmd = "conan remote add nifi-conan https://apache.jfrog.io/artifactory/api/conan/nifi-conan --force" if not package_manager.run_cmd(conan_remote_add_cmd): diff --git a/cmake/Abseil.cmake b/cmake/Abseil.cmake index 7b8ee7aea6..de94599e4e 100644 --- a/cmake/Abseil.cmake +++ b/cmake/Abseil.cmake @@ -28,8 +28,8 @@ set(PC ${Bash_EXECUTABLE} -c "set -x &&\ FetchContent_Declare( absl - URL https://github.com/abseil/abseil-cpp/archive/refs/tags/20260107.1.tar.gz - URL_HASH SHA256=4314e2a7cbac89cac25a2f2322870f343d81579756ceff7f431803c2c9090195 + URL https://github.com/abseil/abseil-cpp/archive/refs/tags/20260526.0.tar.gz + URL_HASH SHA256=6e1aee535473414164bf83e4ebc40240dec71a4701f8a642d906e95bea1aea0c PATCH_COMMAND "${PC}" OVERRIDE_FIND_PACKAGE SYSTEM diff --git a/cmake/AzureSdkCpp.cmake b/cmake/AzureSdkCpp.cmake index 0f1cbdd51f..672a582279 100644 --- a/cmake/AzureSdkCpp.cmake +++ b/cmake/AzureSdkCpp.cmake @@ -46,20 +46,18 @@ set(BUILD_TESTING OFF CACHE INTERNAL "") set(BUILD_SAMPLES OFF CACHE INTERNAL "") set(DISABLE_AMQP ON CACHE INTERNAL "") -set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/azure-sdk-cpp/wil.patch") -set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/azure-sdk-cpp/fix-openssl-helper.patch") -set(PATCH_FILE_3 "${CMAKE_SOURCE_DIR}/thirdparty/azure-sdk-cpp/fix-managed-identity.patch") -set(PATCH_FILE_4 "${CMAKE_SOURCE_DIR}/thirdparty/azure-sdk-cpp/include-cinttypes-for-uint8_t-gcc15-fix.patch") +set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/azure-sdk-cpp/all/patches/wil.patch") +set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/azure-sdk-cpp/all/patches/fix-openssl-helper.patch") +set(PATCH_FILE_3 "${CMAKE_SOURCE_DIR}/thirdparty/azure-sdk-cpp/all/patches/include-cinttypes-for-uint8_t-gcc15-fix.patch") set(PC ${Bash_EXECUTABLE} -c "set -x &&\ (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_1}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_1}\\\") &&\ (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_2}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_2}\\\") &&\ - (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_3}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_3}\\\") &&\ - (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_4}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_4}\\\")") + (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_3}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_3}\\\")") FetchContent_Declare(asdkext - URL https://github.com/Azure/azure-sdk-for-cpp/archive/refs/tags/azure-storage-queues_12.7.0.tar.gz - URL_HASH "SHA256=a2d52cf30a36c1000cd6ee87fa60d5e3aa8d5b01a1716e5bc684dd5a507d76d5" + URL https://github.com/Azure/azure-sdk-for-cpp/archive/refs/tags/azure-storage-blobs_12.18.0.tar.gz + URL_HASH "SHA256=0f266f91cf00b79bb6c7c6f99e44942b43a7141db565556a4298f6ebe3a86fcc" PATCH_COMMAND "${PC}" SYSTEM ) diff --git a/cmake/BundledAwsSdkCpp.cmake b/cmake/BundledAwsSdkCpp.cmake index cebffaccce..e784f872f8 100644 --- a/cmake/BundledAwsSdkCpp.cmake +++ b/cmake/BundledAwsSdkCpp.cmake @@ -18,10 +18,10 @@ function(use_bundled_libaws SOURCE_DIR BINARY_DIR) find_package(OpenSSL REQUIRED) find_package(ZLIB REQUIRED) - set(DLL_EXPORT_INJECTION_PATCH "${SOURCE_DIR}/thirdparty/aws-sdk-cpp/dll-export-injection.patch") - set(FIX_FINDING_S2N_PATCH "${SOURCE_DIR}/thirdparty/aws-sdk-cpp/fix-finding-s2n.patch") - set(S2N_OPENSSL_PATCH "${SOURCE_DIR}/thirdparty/aws-sdk-cpp/s2n.patch") - set(AWS_C_CAL_OPENSSL_PATCH "${SOURCE_DIR}/thirdparty/aws-sdk-cpp/aws-c-cal.patch") + set(DLL_EXPORT_INJECTION_PATCH "${SOURCE_DIR}/thirdparty/aws-sdk-cpp/all/patches/dll-export-injection.patch") + set(FIX_FINDING_S2N_PATCH "${SOURCE_DIR}/thirdparty/aws-sdk-cpp/all/patches/fix-finding-s2n.patch") + set(S2N_OPENSSL_PATCH "${SOURCE_DIR}/thirdparty/aws-sdk-cpp/all/patches/s2n.patch") + set(AWS_C_CAL_OPENSSL_PATCH "${SOURCE_DIR}/thirdparty/aws-sdk-cpp/all/patches/aws-c-cal.patch") if (WIN32) set(REMOVE_FIND_CMAKE_COMMAND "powershell -Command \\\"Remove-Item -Path ./* -Include 'FindOpenSSL.cmake', 'Findcrypto.cmake' -Recurse -Force\\\"") diff --git a/cmake/BundledOSSPUUID.cmake b/cmake/BundledOSSPUUID.cmake index 0a28526253..218d407589 100644 --- a/cmake/BundledOSSPUUID.cmake +++ b/cmake/BundledOSSPUUID.cmake @@ -20,9 +20,9 @@ function(use_bundled_osspuuid SOURCE_DIR BINARY_DIR) message("Using bundled ossp-uuid") - set(PATCH_FILE1 "${SOURCE_DIR}/thirdparty/ossp-uuid/ossp-uuid-mac-fix.patch") - set(PATCH_FILE2 "${SOURCE_DIR}/thirdparty/ossp-uuid/ossp-uuid-no-prog.patch") - set(PATCH_FILE3 "${SOURCE_DIR}/thirdparty/ossp-uuid/ossp-uuid-update-config-guess.patch") + set(PATCH_FILE1 "${SOURCE_DIR}/thirdparty/ossp-uuid/all/patches/ossp-uuid-mac-fix.patch") + set(PATCH_FILE2 "${SOURCE_DIR}/thirdparty/ossp-uuid/all/patches/ossp-uuid-no-prog.patch") + set(PATCH_FILE3 "${SOURCE_DIR}/thirdparty/ossp-uuid/all/patches/ossp-uuid-update-config-guess.patch") set(PC ${Bash_EXECUTABLE} -c "set -x &&\ (\"${Patch_EXECUTABLE}\" -p1 -R -s -f --dry-run -i \"${PATCH_FILE1}\" || \"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE1}\") &&\ (\"${Patch_EXECUTABLE}\" -p1 -R -s -f --dry-run -i \"${PATCH_FILE2}\" || \"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE2}\") &&\ diff --git a/cmake/Bustache.cmake b/cmake/Bustache.cmake index e4f1b6889c..97036d6b80 100644 --- a/cmake/Bustache.cmake +++ b/cmake/Bustache.cmake @@ -21,9 +21,9 @@ include(GetFmt) set(BUSTACHE_USE_FMT ON CACHE STRING "" FORCE) -set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/bustache/add-append.patch") -set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/bustache/fix-deprecated-literal-operator.patch") -set(PATCH_FILE_3 "${CMAKE_SOURCE_DIR}/thirdparty/bustache/remove_installs.patch") +set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/bustache/all/patches/add-append.patch") +set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/bustache/all/patches/fix-deprecated-literal-operator.patch") +set(PATCH_FILE_3 "${CMAKE_SOURCE_DIR}/thirdparty/bustache/all/patches/remove_installs.patch") set(PC ${Bash_EXECUTABLE} -c "set -x &&\ (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_1}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_1}\\\") &&\ diff --git a/cmake/Date.cmake b/cmake/Date.cmake index ad0ae665e1..92c3d65761 100644 --- a/cmake/Date.cmake +++ b/cmake/Date.cmake @@ -17,35 +17,6 @@ include(FetchContent) -if (WIN32) - # tzdata and windowsZones.xml from unicode cldr-common are required to be installed for date-tz operation on Windows - FetchContent_Declare(tzdata - URL https://data.iana.org/time-zones/releases/tzdata2026b.tar.gz - URL_HASH SHA256=114543d9f19a6bfeb5bca43686aea173d38755a3db1f2eec112647ae92c6f544 - SYSTEM - ) - FetchContent_GetProperties(tzdata) - if (NOT tzdata_POPULATED) - FetchContent_Populate(tzdata) - endif() - - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/tzdata) - - file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cldr-common-38.1/common/supplemental/windowsZones.xml - DESTINATION ${CMAKE_BINARY_DIR}/tzdata) - - file(COPY ${tzdata_SOURCE_DIR}/ - DESTINATION ${CMAKE_BINARY_DIR}/tzdata) - - install(DIRECTORY ${tzdata_SOURCE_DIR}/ - DESTINATION tzdata - COMPONENT bin) - - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cldr-common-38.1/common/supplemental/windowsZones.xml - DESTINATION tzdata - COMPONENT bin) -endif() - FetchContent_Declare(date_src URL https://github.com/HowardHinnant/date/archive/refs/tags/v3.0.4.tar.gz URL_HASH SHA256=56e05531ee8994124eeb498d0e6a5e1c3b9d4fccbecdf555fe266631368fb55f diff --git a/cmake/ExpressionLanguage.cmake b/cmake/ExpressionLanguage.cmake index 27a331c3e7..4ce4e8f68b 100644 --- a/cmake/ExpressionLanguage.cmake +++ b/cmake/ExpressionLanguage.cmake @@ -16,45 +16,7 @@ # under the License. if(WIN32) - include(FetchContent) - - set(BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}") - - set(PATCH_FILE "${CMAKE_SOURCE_DIR}/thirdparty/winflexbison/minimum_cmake_version.patch") - - set(PC ${Bash_EXECUTABLE} -c "set -x &&\ - (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE}\\\")") - - FetchContent_Declare( - winflexbison - URL "https://github.com/lexxmark/winflexbison/archive/refs/tags/v2.5.25.tar.gz" - URL_HASH "SHA256=8e1b71e037b524ba3f576babb0cf59182061df1f19cd86112f085a882560f60b" - PATCH_COMMAND "${PC}" - SYSTEM - ) - FetchContent_GetProperties("winflexbison") - - if(NOT winflexbison_POPULATED) - FetchContent_Populate("winflexbison") - execute_process( - COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release . - WORKING_DIRECTORY ${winflexbison_SOURCE_DIR} - COMMAND_ERROR_IS_FATAL ANY - ) - - execute_process( - COMMAND ${CMAKE_COMMAND} --build . --config Release - WORKING_DIRECTORY ${winflexbison_SOURCE_DIR} - COMMAND_ERROR_IS_FATAL ANY - ) - endif() - - set(BISON_EXECUTABLE "${winflexbison_SOURCE_DIR}/bin/Release/win_bison.exe" CACHE PATH "bison executable") - set(FLEX_EXECUTABLE "${winflexbison_SOURCE_DIR}/bin/Release/win_flex.exe" CACHE PATH "flex executable") - - include_directories(${winflexbison_SOURCE_DIR}/flex/src/) - - list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/winflexbison") + include(GetWinFlexBison) endif() # On macOS brew installed bison and flex are preferred diff --git a/cmake/GenerateGrafanaLokiProto.cmake b/cmake/GenerateGrafanaLokiProto.cmake new file mode 100644 index 0000000000..db68658c9f --- /dev/null +++ b/cmake/GenerateGrafanaLokiProto.cmake @@ -0,0 +1,74 @@ +# 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. + +set(LOKI_PROTOBUF_GENERATED_DIR ${CMAKE_BINARY_DIR}/grafana-loki-protobuf-generated) +file(MAKE_DIRECTORY ${LOKI_PROTOBUF_GENERATED_DIR}) + +if(MINIFI_GRPC_SOURCE STREQUAL "CONAN") + find_package(protobuf CONFIG REQUIRED) + find_package(gRPC CONFIG REQUIRED) + + find_program(LOKI_PROTOC_EXECUTABLE + NAMES protoc + PATHS "${protobuf_INCLUDE_DIR}/../bin" + NO_DEFAULT_PATH + REQUIRED) + + add_custom_command( + OUTPUT + ${LOKI_PROTOBUF_GENERATED_DIR}/grafana-loki-push.grpc.pb.cc + ${LOKI_PROTOBUF_GENERATED_DIR}/grafana-loki-push.grpc.pb.h + ${LOKI_PROTOBUF_GENERATED_DIR}/grafana-loki-push.pb.h + ${LOKI_PROTOBUF_GENERATED_DIR}/grafana-loki-push.pb.cc + COMMAND ${LOKI_PROTOC_EXECUTABLE} + ARGS + --plugin=protoc-gen-grpc=$ + --proto_path=. + --grpc_out=${LOKI_PROTOBUF_GENERATED_DIR} + --cpp_out=${LOKI_PROTOBUF_GENERATED_DIR} + grafana-loki-push.proto + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/protos + DEPENDS + protobuf::protoc + gRPC::grpc_cpp_plugin + ${CMAKE_CURRENT_SOURCE_DIR}/protos/grafana-loki-push.proto + ) +elseif(MINIFI_GRPC_SOURCE STREQUAL "BUILD") + set(LOKI_PROTOBUF_GENERATED_DIR ${CMAKE_BINARY_DIR}/grafana-loki-protobuf-generated) + file(MAKE_DIRECTORY ${LOKI_PROTOBUF_GENERATED_DIR}) + + add_custom_command( + OUTPUT + ${LOKI_PROTOBUF_GENERATED_DIR}/grafana-loki-push.grpc.pb.cc + ${LOKI_PROTOBUF_GENERATED_DIR}/grafana-loki-push.grpc.pb.h + ${LOKI_PROTOBUF_GENERATED_DIR}/grafana-loki-push.pb.h + ${LOKI_PROTOBUF_GENERATED_DIR}/grafana-loki-push.pb.cc + COMMAND ${PROTOBUF_COMPILER} + ARGS + --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} + --proto_path=. + --proto_path=${protobuf_SOURCE_DIR}/src + --grpc_out=${LOKI_PROTOBUF_GENERATED_DIR} + --cpp_out=${LOKI_PROTOBUF_GENERATED_DIR} + grafana-loki-push.proto + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/protos + DEPENDS + protobuf::protoc + grpc_cpp_plugin + ${CMAKE_CURRENT_SOURCE_DIR}/protos/grafana-loki-push.proto + ) +endif() diff --git a/cmake/GetAwsSdkCpp.cmake b/cmake/GetAwsSdkCpp.cmake new file mode 100644 index 0000000000..57578aa680 --- /dev/null +++ b/cmake/GetAwsSdkCpp.cmake @@ -0,0 +1,25 @@ +# 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. + +if(MINIFI_AWS_SDK_CPP_SOURCE STREQUAL "CONAN") + message("Using Conan to install AWS SDK for C++") + find_package(AWSSDK REQUIRED GLOBAL) +elseif(MINIFI_AWS_SDK_CPP_SOURCE STREQUAL "BUILD") + message("Using CMake to build AWS SDK for C++ from source") + include(BundledAwsSdkCpp) + use_bundled_libaws(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) +endif() diff --git a/cmake/GetAzureSdkCpp.cmake b/cmake/GetAzureSdkCpp.cmake new file mode 100644 index 0000000000..038c8beb91 --- /dev/null +++ b/cmake/GetAzureSdkCpp.cmake @@ -0,0 +1,24 @@ +# 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. + +if(MINIFI_AZURE_SDK_CPP_SOURCE STREQUAL "CONAN") + message("Using Conan to install Azure SDK for C++") + find_package(AzureSDK REQUIRED) +elseif(MINIFI_AZURE_SDK_CPP_SOURCE STREQUAL "BUILD") + message("Using CMake to build Azure SDK for C++ from source") + include(AzureSdkCpp) +endif() diff --git a/cmake/GetBustache.cmake b/cmake/GetBustache.cmake new file mode 100644 index 0000000000..c9441fe64f --- /dev/null +++ b/cmake/GetBustache.cmake @@ -0,0 +1,24 @@ +# 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. + +if(MINIFI_BUSTACHE_SOURCE STREQUAL "CONAN") + message("Using Conan to install Bustache") + find_package(bustache REQUIRED) +elseif(MINIFI_BUSTACHE_SOURCE STREQUAL "BUILD") + message("Using CMake to build Bustache from source") + include(Bustache) +endif() diff --git a/cmake/GetDate.cmake b/cmake/GetDate.cmake new file mode 100644 index 0000000000..f7c84cdb4e --- /dev/null +++ b/cmake/GetDate.cmake @@ -0,0 +1,58 @@ +# 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. + +if (WIN32) + include(FetchContent) + + # tzdata and windowsZones.xml from unicode cldr-common are required to be installed for date-tz operation on Windows + FetchContent_Declare(tzdata + URL https://data.iana.org/time-zones/releases/tzdata2026b.tar.gz + URL_HASH SHA256=114543d9f19a6bfeb5bca43686aea173d38755a3db1f2eec112647ae92c6f544 + SYSTEM + ) + FetchContent_GetProperties(tzdata) + if (NOT tzdata_POPULATED) + FetchContent_Populate(tzdata) + endif() + + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/tzdata) + + file(COPY ${CMAKE_SOURCE_DIR}/thirdparty/cldr-common-38.1/common/supplemental/windowsZones.xml + DESTINATION ${CMAKE_BINARY_DIR}/tzdata) + + file(COPY ${tzdata_SOURCE_DIR}/ + DESTINATION ${CMAKE_BINARY_DIR}/tzdata) + + install(DIRECTORY ${tzdata_SOURCE_DIR}/ + DESTINATION tzdata + COMPONENT bin) + + install(FILES ${CMAKE_SOURCE_DIR}/thirdparty/cldr-common-38.1/common/supplemental/windowsZones.xml + DESTINATION tzdata + COMPONENT bin) +endif() + +if(MINIFI_DATE_SOURCE STREQUAL "CONAN") + message("Using Conan to install date") + find_package(date REQUIRED) + if(NOT TARGET date::tz) + add_library(date::tz ALIAS date::date-tz) + endif() +elseif(MINIFI_DATE_SOURCE STREQUAL "BUILD") + message("Using CMake to build date from source") + include(Date) +endif() diff --git a/cmake/GetGoogleCloudCpp.cmake b/cmake/GetGoogleCloudCpp.cmake new file mode 100644 index 0000000000..11b9039e67 --- /dev/null +++ b/cmake/GetGoogleCloudCpp.cmake @@ -0,0 +1,31 @@ +# 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. + +if(MINIFI_GCP_SOURCE STREQUAL "CONAN") + message("Using Conan to install Google Cloud C++") + find_package(GoogleCloudCpp REQUIRED) + if (NOT SKIP_TESTS) + find_package(GTest REQUIRED) + include(GoogleTest) + set_target_properties(GTest::gtest_main PROPERTIES IMPORTED_GLOBAL TRUE) + set_target_properties(GTest::gmock PROPERTIES IMPORTED_GLOBAL TRUE) + set(MINIFI_GCP_TEST_GTEST_LIBRARIES GTest::gtest_main GTest::gmock CACHE INTERNAL "") + endif() +elseif(MINIFI_GCP_SOURCE STREQUAL "BUILD") + message("Using CMake to build Google Cloud C++ from source") + include(GoogleCloudCpp) +endif() diff --git a/cmake/GetGrpc.cmake b/cmake/GetGrpc.cmake new file mode 100644 index 0000000000..3aed3c078e --- /dev/null +++ b/cmake/GetGrpc.cmake @@ -0,0 +1,27 @@ +# 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. + +if(MINIFI_GRPC_SOURCE STREQUAL "CONAN") + message("Using Conan to install gRPC") + find_package(protobuf CONFIG REQUIRED) + find_package(gRPC CONFIG REQUIRED) + set(PROTOBUF_INCLUDE_DIR "${protobuf_INCLUDE_DIR}" CACHE STRING "" FORCE) + set(GRPC_INCLUDE_DIR "${gRPC_INCLUDE_DIR}" CACHE STRING "" FORCE) +elseif(MINIFI_GRPC_SOURCE STREQUAL "BUILD") + message("Using CMake to build gRPC from source") + include(Grpc) +endif() diff --git a/cmake/GetJoltTests.cmake b/cmake/GetJoltTests.cmake new file mode 100644 index 0000000000..1c06f0a071 --- /dev/null +++ b/cmake/GetJoltTests.cmake @@ -0,0 +1,24 @@ +# 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. + +if(MINIFI_JOLT_TESTS_SOURCE STREQUAL "CONAN") + message("Using Conan to install jolt test resources") + find_package(jolt-tests REQUIRED) +elseif(MINIFI_JOLT_TESTS_SOURCE STREQUAL "BUILD") + message("Using CMake to fetch jolt test resources from source") + include(JoltTests) +endif() diff --git a/cmake/GetKubernetesClientC.cmake b/cmake/GetKubernetesClientC.cmake new file mode 100644 index 0000000000..c3141e985f --- /dev/null +++ b/cmake/GetKubernetesClientC.cmake @@ -0,0 +1,24 @@ +# 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. + +if(MINIFI_KUBERNETES_CLIENT_C_SOURCE STREQUAL "CONAN") + message("Using Conan to install Kubernetes Client C") + find_package(kubernetes REQUIRED) +elseif(MINIFI_KUBERNETES_CLIENT_C_SOURCE STREQUAL "BUILD") + message("Using CMake to build Kubernetes Client C from source") + include(KubernetesClientC) +endif() diff --git a/cmake/GetLlamaCpp.cmake b/cmake/GetLlamaCpp.cmake new file mode 100644 index 0000000000..19965d405a --- /dev/null +++ b/cmake/GetLlamaCpp.cmake @@ -0,0 +1,24 @@ +# 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. + +if(MINIFI_LLAMACPP_SOURCE STREQUAL "CONAN") + message("Using Conan to install LlamaCpp") + find_package(llamacpp REQUIRED) +elseif(MINIFI_LLAMACPP_SOURCE STREQUAL "BUILD") + message("Using CMake to build LlamaCpp from source") + include(LlamaCpp) +endif() diff --git a/cmake/GetOSSPUUID.cmake b/cmake/GetOSSPUUID.cmake new file mode 100644 index 0000000000..369c0c3f95 --- /dev/null +++ b/cmake/GetOSSPUUID.cmake @@ -0,0 +1,25 @@ +# 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. + +if(MINIFI_OSSP_UUID_SOURCE STREQUAL "CONAN") + message("Using Conan to install ossp-uuid") + find_package(ossp-uuid REQUIRED) +elseif(MINIFI_OSSP_UUID_SOURCE STREQUAL "BUILD") + message("Using CMake to build ossp-uuid from source") + include(BundledOSSPUUID) + use_bundled_osspuuid(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) +endif() diff --git a/cmake/GetRpMalloc.cmake b/cmake/GetRpMalloc.cmake new file mode 100644 index 0000000000..ec35ec42e0 --- /dev/null +++ b/cmake/GetRpMalloc.cmake @@ -0,0 +1,24 @@ +# 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. + +if(MINIFI_RPMALLOC_SOURCE STREQUAL "CONAN") + message("Using Conan to install rpmalloc") + find_package(rpmalloc REQUIRED) +elseif(MINIFI_RPMALLOC_SOURCE STREQUAL "BUILD") + message("Using CMake to build rpmalloc from source") + include(RpMalloc) +endif() diff --git a/cmake/GetWinFlexBison.cmake b/cmake/GetWinFlexBison.cmake new file mode 100644 index 0000000000..131a45523d --- /dev/null +++ b/cmake/GetWinFlexBison.cmake @@ -0,0 +1,72 @@ +# 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. + +if(MINIFI_WINFLEXBISON_SOURCE STREQUAL "CONAN") + message("Using Conan to install winflexbison") + find_program(WIN_FLEX_EXECUTABLE NAMES win_flex REQUIRED) + find_program(WIN_BISON_EXECUTABLE NAMES win_bison REQUIRED) + + set(BISON_EXECUTABLE "${WIN_BISON_EXECUTABLE}" CACHE PATH "bison executable") + set(FLEX_EXECUTABLE "${WIN_FLEX_EXECUTABLE}" CACHE PATH "flex executable") + + get_filename_component(WINFLEXBISON_BIN_DIR "${WIN_FLEX_EXECUTABLE}" DIRECTORY) + get_filename_component(WINFLEXBISON_ROOT_DIR "${WINFLEXBISON_BIN_DIR}" DIRECTORY) + include_directories("${WINFLEXBISON_ROOT_DIR}/include") + + list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/winflexbison") +elseif(MINIFI_WINFLEXBISON_SOURCE STREQUAL "BUILD") + message("Using CMake to build winflexbison from source") + include(FetchContent) + + set(BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}") + + set(PATCH_FILE "${CMAKE_SOURCE_DIR}/thirdparty/winflexbison/minimum_cmake_version.patch") + + set(PC ${Bash_EXECUTABLE} -c "set -x &&\ + (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE}\\\")") + + FetchContent_Declare( + winflexbison + URL "https://github.com/lexxmark/winflexbison/archive/refs/tags/v2.5.25.tar.gz" + URL_HASH "SHA256=8e1b71e037b524ba3f576babb0cf59182061df1f19cd86112f085a882560f60b" + PATCH_COMMAND "${PC}" + SYSTEM + ) + FetchContent_GetProperties("winflexbison") + + if(NOT winflexbison_POPULATED) + FetchContent_Populate("winflexbison") + execute_process( + COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release . + WORKING_DIRECTORY ${winflexbison_SOURCE_DIR} + COMMAND_ERROR_IS_FATAL ANY + ) + + execute_process( + COMMAND ${CMAKE_COMMAND} --build . --config Release + WORKING_DIRECTORY ${winflexbison_SOURCE_DIR} + COMMAND_ERROR_IS_FATAL ANY + ) + endif() + + set(BISON_EXECUTABLE "${winflexbison_SOURCE_DIR}/bin/Release/win_bison.exe" CACHE PATH "bison executable") + set(FLEX_EXECUTABLE "${winflexbison_SOURCE_DIR}/bin/Release/win_flex.exe" CACHE PATH "flex executable") + + include_directories(${winflexbison_SOURCE_DIR}/flex/src/) + + list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/winflexbison") +endif() diff --git a/cmake/GoogleCloudCpp.cmake b/cmake/GoogleCloudCpp.cmake index 4042cb0ae6..eb29609d1f 100644 --- a/cmake/GoogleCloudCpp.cmake +++ b/cmake/GoogleCloudCpp.cmake @@ -20,9 +20,9 @@ include(FetchContent) include(Abseil) include(Crc32c) -set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/google-cloud-cpp/remove-find_package.patch") -set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/google-cloud-cpp/nlohmann_lib_as_interface.patch") -set(PATCH_FILE_3 "${CMAKE_SOURCE_DIR}/thirdparty/google-cloud-cpp/c++23_fixes.patch") +set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/google-cloud-cpp/all/patches/remove-find_package.patch") +set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/google-cloud-cpp/all/patches/nlohmann_lib_as_interface.patch") +set(PATCH_FILE_3 "${CMAKE_SOURCE_DIR}/thirdparty/google-cloud-cpp/all/patches/c++23_fixes.patch") set(PC ${Bash_EXECUTABLE} -c "set -x &&\ (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_1}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_1}\\\") &&\ (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_2}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_2}\\\") &&\ @@ -57,3 +57,5 @@ if (WIN32) add_compile_definitions(_SILENCE_CXX20_REL_OPS_DEPRECATION_WARNING _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING CURL_STATICLIB) endif() FetchContent_MakeAvailable(google-cloud-cpp) + +set(MINIFI_GCP_TEST_GTEST_LIBRARIES gtest_main gmock CACHE INTERNAL "") diff --git a/cmake/Grpc.cmake b/cmake/Grpc.cmake index ea5357f66b..de461cb4d6 100644 --- a/cmake/Grpc.cmake +++ b/cmake/Grpc.cmake @@ -30,20 +30,16 @@ set(gRPC_ZLIB_PROVIDER "package" CACHE STRING "" FORCE) set(gRPC_SSL_PROVIDER "package" CACHE STRING "" FORCE) set(gRPC_PROTOBUF_PROVIDER "package" CACHE STRING "" FORCE) -set(PATCH_FILE1 "${CMAKE_SOURCE_DIR}/thirdparty/grpc/fix-protobuf-find-package.patch") -set(PATCH_FILE2 "${CMAKE_SOURCE_DIR}/thirdparty/grpc/fix-memory-request-missing-string-include.patch") -set(PATCH_FILE3 "${CMAKE_SOURCE_DIR}/thirdparty/grpc/fix-glob-missing-algorithm-include.patch") -set(PATCH_FILE4 "${CMAKE_SOURCE_DIR}/thirdparty/grpc/fix-msvc-auto-return-type-template-arg.patch") +set(PATCH_FILE1 "${CMAKE_SOURCE_DIR}/thirdparty/grpc/all/patches/fix-protobuf-find-package.patch") +set(PATCH_FILE2 "${CMAKE_SOURCE_DIR}/thirdparty/grpc/all/patches/fix-msvc-auto-return-type-template-arg.patch") set(PC ${Bash_EXECUTABLE} -c "set -x &&\ (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE1}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE1}\\\") &&\ - (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE2}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE2}\\\") &&\ - (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE3}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE3}\\\") &&\ - (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE4}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE4}\\\")") + (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE2}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE2}\\\")") FetchContent_Declare( grpc GIT_REPOSITORY https://github.com/grpc/grpc - GIT_TAG v1.80.0 + GIT_TAG v1.82.0 GIT_SUBMODULES "third_party/cares/cares third_party/re2 third_party/upb" PATCH_COMMAND "${PC}" SYSTEM @@ -55,3 +51,7 @@ add_dependencies(grpc++ OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB) set(GRPC_INCLUDE_DIR "${grpc_SOURCE_DIR}/include" CACHE STRING "" FORCE) set(GRPC_CPP_PLUGIN "$" CACHE STRING "" FORCE) + +if (NOT TARGET gRPC::grpc++) + add_library(gRPC::grpc++ ALIAS grpc++) +endif() diff --git a/cmake/KubernetesClientC.cmake b/cmake/KubernetesClientC.cmake index 1167e811c4..df4fcb2845 100644 --- a/cmake/KubernetesClientC.cmake +++ b/cmake/KubernetesClientC.cmake @@ -51,7 +51,7 @@ FetchContent_Declare(websockets FetchContent_MakeAvailable(yaml websockets) set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) -set(K8S_PATCH_FILE "${CMAKE_SOURCE_DIR}/thirdparty/kubernetes-client-c/remove-findpackage.patch") +set(K8S_PATCH_FILE "${CMAKE_SOURCE_DIR}/thirdparty/kubernetes-client-c/all/patches/remove-findpackage.patch") set(K8S_PC ${Bash_EXECUTABLE} -c "set -x &&\ (${Patch_EXECUTABLE} -R -p1 -s -f --dry-run -i ${K8S_PATCH_FILE} || ${Patch_EXECUTABLE} -p1 -i ${K8S_PATCH_FILE})") FetchContent_Declare(kubernetes @@ -64,4 +64,10 @@ FetchContent_Declare(kubernetes FetchContent_MakeAvailable(kubernetes) +target_include_directories(kubernetes INTERFACE $) + target_link_libraries(websockets CURL::libcurl OpenSSL::Crypto OpenSSL::SSL) + +if (NOT TARGET kubernetes::kubernetes) + add_library(kubernetes::kubernetes ALIAS kubernetes) +endif() diff --git a/cmake/LlamaCpp.cmake b/cmake/LlamaCpp.cmake index d9e764379c..01b130b751 100644 --- a/cmake/LlamaCpp.cmake +++ b/cmake/LlamaCpp.cmake @@ -31,7 +31,7 @@ else() set(GGML_NATIVE "ON" CACHE STRING "" FORCE) endif() -set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/llamacpp/mtmd-fix.patch") +set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/llamacpp/all/patches/mtmd-fix.patch") set(PC ${Bash_EXECUTABLE} -c "set -x &&\ (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_1}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_1}\\\")") @@ -50,6 +50,10 @@ if(MSVC AND TARGET llama) target_compile_options(llama PRIVATE /Zc:__cplusplus) endif() +add_library(llama-cpp::llama ALIAS llama) +add_library(llama-cpp::common ALIAS llama-common) +add_library(llama-cpp::mtmd ALIAS mtmd) + set(LLAMACPP_INCLUDE_DIRS "${llamacpp_SOURCE_DIR}/include" "${llamacpp_SOURCE_DIR}/ggml/include" diff --git a/cmake/MiNiFiOptions.cmake b/cmake/MiNiFiOptions.cmake index 9d8069ed14..6c9c34a229 100644 --- a/cmake/MiNiFiOptions.cmake +++ b/cmake/MiNiFiOptions.cmake @@ -140,41 +140,55 @@ add_minifi_multi_option(MINIFI_PACKAGING_TYPE "Selects the packaging format for # BUILD: Fetch and build from source using CMake FetchContent or ExternalProject # CONAN: Use Conan packages -add_minifi_multi_option(MINIFI_LZ4_SOURCE "Retrieves lz4 from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_LIBCURL_SOURCE "Retrieves LibCURL from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_OPENSSL_SOURCE "Retrieves OpenSSL from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_ZLIB_SOURCE "Retrieves ZLib from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_ROCKSDB_SOURCE "Retrieves RocksDB from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_ZSTD_SOURCE "Retrieves Zstd from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_BZIP2_SOURCE "Retrieves BZip2 from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_CIVETWEB_SOURCE "Retrieves CivetWeb from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_LIBXML2_SOURCE "Retrieves LibXml2 from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_FMT_SOURCE "Retrieves Fmt from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_SPDLOG_SOURCE "Retrieves Spdlog from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_CATCH2_SOURCE "Retrieves Catch2 from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_LIBARCHIVE_SOURCE "Retrieves libarchive from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_LUA_SOURCE "Retrieves Lua from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_SOL2_SOURCE "Retrieves Sol2 from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_ARGPARSE_SOURCE "Retrieves Argparse from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_JEMALLOC_SOURCE "Retrieves jemalloc from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_LIBSODIUM_SOURCE "Retrieves Libsodium from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_LIBSSH2_SOURCE "Retrieves Libssh2 from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_BENCHMARK_SOURCE "Retrieves benchmark from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_GSL_LITE_SOURCE "Retrieves gsl-lite from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_JSONCONS_SOURCE "Retrieves jsoncons from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_JSONSCHEMA_VALIDATOR_SOURCE "Retrieves json-schema-validator from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_MIMALLOC_SOURCE "Retrieves mimalloc from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_PUGIXML_SOURCE "Retrieves PugiXML from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_YAMLCPP_SOURCE "Retrieves yaml-cpp from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_PROMETHEUS_SOURCE "Retrieves prometheus-cpp from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_RANGEV3_SOURCE "Retrieves range-v3 from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_LIBLZMA_SOURCE "Retrieves LibLZMA from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_PAHO_MQTT_C_SOURCE "Retrieves paho-mqtt-c from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_COUCHBASE_SOURCE "Retrieves Couchbase from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_ASIO_SOURCE "Retrieves Asio from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_KAFKA_SOURCE "Retrieves librdkafka from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_MAGIC_ENUM_SOURCE "Retrieves magic_enum from provided source" "BUILD;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_OPC_SOURCE "Retrieves open62541 from provided source" "BUILD;CONAN" "BUILD") +add_minifi_multi_option(MINIFI_DEFAULT_DEPENDENCY_SOURCE "Retrieves dependencies from provided source by default" "BUILD;CONAN" "BUILD") + +add_minifi_multi_option(MINIFI_LZ4_SOURCE "Retrieves lz4 from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_LIBCURL_SOURCE "Retrieves LibCURL from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_OPENSSL_SOURCE "Retrieves OpenSSL from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_ZLIB_SOURCE "Retrieves ZLib from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_ROCKSDB_SOURCE "Retrieves RocksDB from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_ZSTD_SOURCE "Retrieves Zstd from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_BZIP2_SOURCE "Retrieves BZip2 from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_CIVETWEB_SOURCE "Retrieves CivetWeb from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_LIBXML2_SOURCE "Retrieves LibXml2 from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_FMT_SOURCE "Retrieves Fmt from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_SPDLOG_SOURCE "Retrieves Spdlog from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_CATCH2_SOURCE "Retrieves Catch2 from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_LIBARCHIVE_SOURCE "Retrieves libarchive from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_LUA_SOURCE "Retrieves Lua from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_SOL2_SOURCE "Retrieves Sol2 from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_ARGPARSE_SOURCE "Retrieves Argparse from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_JEMALLOC_SOURCE "Retrieves jemalloc from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_LIBSODIUM_SOURCE "Retrieves Libsodium from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_LIBSSH2_SOURCE "Retrieves Libssh2 from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_BENCHMARK_SOURCE "Retrieves benchmark from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_GSL_LITE_SOURCE "Retrieves gsl-lite from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_JSONCONS_SOURCE "Retrieves jsoncons from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_JSONSCHEMA_VALIDATOR_SOURCE "Retrieves json-schema-validator from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_MIMALLOC_SOURCE "Retrieves mimalloc from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_PUGIXML_SOURCE "Retrieves PugiXML from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_YAMLCPP_SOURCE "Retrieves yaml-cpp from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_PROMETHEUS_SOURCE "Retrieves prometheus-cpp from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_RANGEV3_SOURCE "Retrieves range-v3 from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_LIBLZMA_SOURCE "Retrieves LibLZMA from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_PAHO_MQTT_C_SOURCE "Retrieves paho-mqtt-c from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_COUCHBASE_SOURCE "Retrieves Couchbase from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_ASIO_SOURCE "Retrieves Asio from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_KAFKA_SOURCE "Retrieves librdkafka from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_MAGIC_ENUM_SOURCE "Retrieves magic_enum from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_OPC_SOURCE "Retrieves open62541 from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_OSSP_UUID_SOURCE "Retrieves ossp-uuid from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_JOLT_TESTS_SOURCE "Retrieves jolt test resources from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_RPMALLOC_SOURCE "Retrieves rpmalloc from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_BUSTACHE_SOURCE "Retrieves Bustache from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_GCP_SOURCE "Retrieves Google Cloud Platform SDK from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_GRPC_SOURCE "Retrieves gRPC from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_KUBERNETES_CLIENT_C_SOURCE "Retrieves Kubernetes Client C SDK from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_AZURE_SDK_CPP_SOURCE "Retrieves Azure SDK for C++ from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_LLAMACPP_SOURCE "Retrieves llama.cpp from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_DATE_SOURCE "Retrieves date from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_WINFLEXBISON_SOURCE "Retrieves winflexbison from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") +add_minifi_multi_option(MINIFI_AWS_SDK_CPP_SOURCE "Retrieves AWS SDK for C++ from provided source" "BUILD;CONAN" "${MINIFI_DEFAULT_DEPENDENCY_SOURCE}") # Docker options diff --git a/cmake/Protobuf.cmake b/cmake/Protobuf.cmake index ee5523cd02..c8c78f531c 100644 --- a/cmake/Protobuf.cmake +++ b/cmake/Protobuf.cmake @@ -20,8 +20,8 @@ set(protobuf_BUILD_TESTS OFF CACHE BOOL "" FORCE) FetchContent_Declare( protobuf - URL https://github.com/protocolbuffers/protobuf/archive/refs/tags/v34.1.tar.gz - URL_HASH SHA256=a83103b7ed3afaeedee9a212c8f65825444f58144f5e075b73c83f2b4ff27b62 + URL https://github.com/protocolbuffers/protobuf/archive/refs/tags/v35.0.tar.gz + URL_HASH SHA256=e127ea69dd7be4e88abdd95845fb6c30d25d96971d95827e92b70e2e910d46a1 ) FetchContent_MakeAvailable(protobuf) diff --git a/cmake/WholeArchive.cmake b/cmake/WholeArchive.cmake index bb18c250fe..1b8a207d6e 100644 --- a/cmake/WholeArchive.cmake +++ b/cmake/WholeArchive.cmake @@ -15,17 +15,45 @@ # specific language governing permissions and limitations # under the License. +# Resolve the concrete static-library targets to pass to $ for ITEM. +# A conan package exposes each library through an INTERFACE target whose actual +# IMPORTED archive is referenced in INTERFACE_LINK_LIBRARIES as a CONAN_LIB::* target. +# Only used on Apple/Windows, where whole-archiving needs an explicit file. +function(_resolve_wholearchive_libs ITEM OUT_LIBS) + if(TARGET ${ITEM}) + get_target_property(_item_type ${ITEM} TYPE) + if(_item_type STREQUAL "INTERFACE_LIBRARY") + get_target_property(_interface_libs ${ITEM} INTERFACE_LINK_LIBRARIES) + set(_resolved "") + if(_interface_libs) + foreach(_entry IN LISTS _interface_libs) + string(REGEX MATCHALL "CONAN_LIB::[A-Za-z0-9._-]+" _matches "${_entry}") + list(APPEND _resolved ${_matches}) + endforeach() + endif() + if(NOT _resolved) + message(FATAL_ERROR "target_wholearchive_library: could not resolve a concrete static library for interface target '${ITEM}'") + endif() + set(${OUT_LIBS} ${_resolved} PARENT_SCOPE) + return() + endif() + endif() + set(${OUT_LIBS} ${ITEM} PARENT_SCOPE) +endfunction() + function(target_wholearchive_library TARGET ITEM) if (APPLE) target_link_libraries(${TARGET} ${ITEM}) - target_link_libraries(${TARGET} -Wl,-force_load,$) + _resolve_wholearchive_libs(${ITEM} _libs) + foreach(_lib IN LISTS _libs) + target_link_libraries(${TARGET} -Wl,-force_load,$) + endforeach() elseif(WIN32) target_link_libraries(${TARGET} ${ITEM}) - if(${CMAKE_VERSION} VERSION_LESS "3.13.0") - set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " /WHOLEARCHIVE:${ITEM}") - else() - target_link_options(${TARGET} PRIVATE "/WHOLEARCHIVE:${ITEM}") - endif() + _resolve_wholearchive_libs(${ITEM} _libs) + foreach(_lib IN LISTS _libs) + target_link_options(${TARGET} PRIVATE "/WHOLEARCHIVE:$") + endforeach() else() target_link_libraries(${TARGET} -Wl,--whole-archive ${ITEM} -Wl,--no-whole-archive) endif() @@ -34,18 +62,23 @@ endfunction(target_wholearchive_library) function(target_wholearchive_library_private TARGET ITEM) if (APPLE) target_link_libraries(${TARGET} PRIVATE ${ITEM}) - target_link_libraries(${TARGET} PRIVATE -Wl,-force_load,$) - add_dependencies(${TARGET} ${ITEM}) + _resolve_wholearchive_libs(${ITEM} _libs) + foreach(_lib IN LISTS _libs) + target_link_libraries(${TARGET} PRIVATE -Wl,-force_load,$) + endforeach() elseif(WIN32) target_link_libraries(${TARGET} PRIVATE ${ITEM}) - if(${CMAKE_VERSION} VERSION_LESS "3.13.0") - set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " /WHOLEARCHIVE:$") - else() - target_link_options(${TARGET} PRIVATE "/WHOLEARCHIVE:$") - endif() - add_dependencies(${TARGET} ${ITEM}) + _resolve_wholearchive_libs(${ITEM} _libs) + foreach(_lib IN LISTS _libs) + target_link_options(${TARGET} PRIVATE "/WHOLEARCHIVE:$") + endforeach() else() target_link_libraries(${TARGET} PRIVATE -Wl,--whole-archive ${ITEM} -Wl,--no-whole-archive) - add_dependencies(${TARGET} ${ITEM}) + endif() + if(TARGET ${ITEM}) + get_target_property(_item_type ${ITEM} TYPE) + if(NOT _item_type STREQUAL "INTERFACE_LIBRARY") + add_dependencies(${TARGET} ${ITEM}) + endif() endif() endfunction(target_wholearchive_library_private) diff --git a/conanfile.py b/conanfile.py index ad032bb4b2..d688e479fb 100644 --- a/conanfile.py +++ b/conanfile.py @@ -22,9 +22,8 @@ required_conan_version = ">=2.0" -shared_requires = ("openssl/3.6.2", "libcurl/8.20.0", "civetweb/1.16", "libxml2/2.15.3", "fmt/12.1.0", "spdlog/1.17.0", "catch2/3.15.0", "zlib/1.3.2", "zstd/1.5.7", - "sol2/3.5.0", "argparse/3.2", "libsodium/1.0.22", "gsl-lite/1.1.0", "jsoncons/1.7.0", - "json-schema-validator/2.4.0", "pugixml/1.16", "yaml-cpp/0.9.0", "range-v3/0.12.0", "magic_enum/0.9.8@minifi/develop") +shared_requires = ("civetweb/1.16", "libxml2/2.15.3", "fmt/12.1.0", "spdlog/1.17.0", "catch2/3.15.0", "zstd/1.5.7", "sol2/3.5.0", "argparse/3.2", "libsodium/1.0.22", "gsl-lite/1.1.0", + "jsoncons/1.7.0", "json-schema-validator/2.4.0", "pugixml/1.16", "yaml-cpp/0.9.0", "range-v3/0.12.0", "magic_enum/0.9.8@minifi/develop", "date/3.0.4") shared_sources = ("CMakeLists.txt", "libminifi/*", "extensions/*", "minifi_main/*", "behave_framework/*", "bin/*", "bootstrap/*", "cmake/*", "conf/*", "controller/*", "core-framework/*", "docs/*", "encrypt-config/*", "etc/*", "examples/*", "extension-framework/*", "fips/*", "minifi-api/*", "packaging/*", "thirdparty/*", "docker/*", "LICENSE", "NOTICE", @@ -39,12 +38,16 @@ class MiNiFiCppMain(ConanFile): license = "Apache-2.0" settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps" - options = {"shared": [True, False], "fPIC": [True, False], "custom_malloc": [False, "jemalloc", "mimalloc", "rpmalloc"], "enable_all": [True, False], "enable_rocksdb": [True, False], - "enable_libarchive": [True, False], "enable_sftp": [True, False], "enable_prometheus": [True, False], "enable_bzip2": [True, False], "enable_lzma": [True, False], - "enable_mqtt": [True, False], "enable_couchbase": [True, False], "enable_kafka": [True, False], "enable_opc": [True, False], "skip_tests": [True, False]} + options = {"shared": [True, False], "fPIC": [True, False], "custom_malloc": [False, "jemalloc", "mimalloc", "rpmalloc"], "enable_all": [True, False], "enable_libarchive": [True, False], + "enable_rocksdb": [True, False], "enable_sftp": [True, False], "enable_prometheus": [True, False], "enable_bzip2": [True, False], "enable_lzma": [True, False], + "enable_mqtt": [True, False], "enable_couchbase": [True, False], "enable_kafka": [True, False], "enable_opc": [True, False], "enable_gcp": [True, False], + "enable_grpc_for_loki": [True, False], "enable_bustache": [True, False], "enable_kubernetes": [True, False], "enable_azure": [True, False], "enable_llamacpp": [True, False], + "enable_aws": [True, False], "skip_tests": [True, False], "portable": [True, False]} - default_options = {"shared": False, "fPIC": True, "custom_malloc": False, "enable_all": False, "enable_rocksdb": False, "enable_libarchive": False, "enable_sftp": False, "enable_prometheus": False, - "enable_bzip2": False, "enable_lzma": False, "enable_mqtt": False, "enable_couchbase": False, "enable_kafka": False, "enable_opc": False, "skip_tests": False} + default_options = {"shared": False, "fPIC": True, "custom_malloc": False, "enable_all": False, "enable_libarchive": False, "enable_rocksdb": False, "enable_sftp": False, + "enable_prometheus": False, "enable_bzip2": False, "enable_lzma": False, "enable_mqtt": False, "enable_couchbase": False, "enable_kafka": False, "enable_opc": False, + "enable_gcp": False, "enable_grpc_for_loki": False, "enable_bustache": False, "enable_kubernetes": False, "enable_azure": False, "enable_llamacpp": False, "enable_aws": False, + "skip_tests": False, "portable": True} exports_sources = shared_sources @@ -54,18 +57,24 @@ def requirements(self): self.requires("lua/5.4.8", force=True) self.requires("asio/1.38.0", force=True) self.requires("lz4/1.10.0", force=True) + self.requires("libcurl/8.20.0", force=True) + self.requires("openssl/3.6.2", force=True) + self.requires("zlib/1.3.2", force=True) + self.requires("nlohmann_json/3.12.0", force=True) + if self.settings.os != "Windows": + self.requires("ossp-uuid/1.6.2@minifi/develop") if self.options.enable_libarchive: self.requires("libarchive/3.8.7") if self.options.enable_rocksdb: self.requires("rocksdb/11.1.1@minifi/develop") - if self.options.enable_all or self.options.enable_sftp: - self.requires("libssh2/1.11.1") - if self.options.enable_all or self.options.enable_prometheus: - self.requires("prometheus-cpp/1.3.0") if self.options.enable_bzip2: self.requires("bzip2/1.0.8") if self.options.enable_lzma: self.requires("xz_utils/5.8.3") + if self.options.enable_all or self.options.enable_sftp: + self.requires("libssh2/1.11.1") + if self.options.enable_all or self.options.enable_prometheus: + self.requires("prometheus-cpp/1.3.0") if self.options.enable_all or self.options.enable_mqtt: self.requires("paho-mqtt-c/1.3.16") if self.options.enable_all or self.options.enable_couchbase: @@ -79,17 +88,41 @@ def requirements(self): self.requires("librdkafka/2.14.2") if self.options.enable_all or self.options.enable_opc: self.requires("open62541/1.5.4@minifi/develop") + if self.options.enable_all or self.options.enable_bustache: + self.requires("bustache/0.1.0@minifi/develop") + if self.options.enable_all or self.options.enable_grpc_for_loki: + self.requires("grpc/1.82.0@minifi/develop", force=True) + if self.options.enable_all or self.options.enable_gcp: + self.requires("google-cloud-cpp/2.47.1@minifi/develop") + if not self.options.skip_tests: + self.requires("gtest/1.17.0") + if (self.options.enable_all or self.options.enable_kubernetes) and self.settings.os != "Windows": + self.requires("kubernetes/0.14.0@minifi/develop") + if self.options.enable_all or self.options.enable_azure: + self.requires("azure-sdk-for-cpp/12.18.0@minifi/develop") + if self.options.enable_all or self.options.enable_llamacpp: + self.requires("llama-cpp/b8944@minifi/develop") + if self.options.enable_all or self.options.enable_aws: + self.requires("aws-sdk-cpp/1.11.807@minifi/develop") if self.options.custom_malloc == "jemalloc": self.requires("jemalloc/5.3.1") elif self.options.custom_malloc == "mimalloc": self.requires("mimalloc/3.3.2") + elif self.options.custom_malloc == "rpmalloc": + self.requires("rpmalloc/1.4.5@minifi/develop") if not self.options.skip_tests: self.requires("benchmark/1.9.5") + self.requires("jolt-tests/0.1.8@minifi/develop") + + def build_requirements(self): + if self.settings.os == "Windows": + self.tool_requires("winflexbison/2.5.25") def configure(self): self.options["libarchive"].with_openssl = True + self.options["date"].tz_db = "manual" if self.settings.os == "Windows" else "system" if self.options.enable_all or self.options.enable_bzip2: self.options["libarchive"].with_bzip2 = True if self.options.enable_all or self.options.enable_lzma: @@ -99,45 +132,19 @@ def configure(self): self.options["librdkafka"].sasl = False self.options["librdkafka"].zstd = True self.options["librdkafka"].zlib = True + if (self.options.enable_all or self.options.get_safe("enable_gcp")) and not self.options.skip_tests: + self.options["google-cloud-cpp"].with_mocks = True + if self.options.enable_all or self.options.get_safe("enable_aws"): + self.options["aws-sdk-cpp"].s3 = True + self.options["aws-sdk-cpp"].kinesis = True + setattr(self.options["aws-sdk-cpp"], "s3-crt", True) + setattr(self.options["aws-sdk-cpp"], "text-to-speech", False) + if self.options.enable_all or self.options.get_safe("enable_llamacpp"): + self.options["llama-cpp"].portable = self.options.portable def generate(self): tc = CMakeToolchain(self) - - tc.variables["MINIFI_LZ4_SOURCE"] = "CONAN" - tc.variables["MINIFI_LIBCURL_SOURCE"] = "CONAN" - tc.variables["MINIFI_OPENSSL_SOURCE"] = "CONAN" - tc.variables["MINIFI_ZLIB_SOURCE"] = "CONAN" - tc.variables["MINIFI_ROCKSDB_SOURCE"] = "CONAN" - tc.variables["MINIFI_ZSTD_SOURCE"] = "CONAN" - tc.variables["MINIFI_BZIP2_SOURCE"] = "CONAN" - tc.variables["MINIFI_CIVETWEB_SOURCE"] = "CONAN" - tc.variables["MINIFI_LIBXML2_SOURCE"] = "CONAN" - tc.variables["MINIFI_FMT_SOURCE"] = "CONAN" - tc.variables["MINIFI_SPDLOG_SOURCE"] = "CONAN" - tc.variables["MINIFI_CATCH2_SOURCE"] = "CONAN" - tc.variables["MINIFI_LIBARCHIVE_SOURCE"] = "CONAN" - tc.variables["MINIFI_LUA_SOURCE"] = "CONAN" - tc.variables["MINIFI_SOL2_SOURCE"] = "CONAN" - tc.variables["MINIFI_ARGPARSE_SOURCE"] = "CONAN" - tc.variables["MINIFI_LIBSODIUM_SOURCE"] = "CONAN" - tc.variables["MINIFI_GSL_LITE_SOURCE"] = "CONAN" - tc.variables["MINIFI_JSONCONS_SOURCE"] = "CONAN" - tc.variables["MINIFI_PUGIXML_SOURCE"] = "CONAN" - tc.variables["MINIFI_YAMLCPP_SOURCE"] = "CONAN" - tc.variables["MINIFI_JEMALLOC_SOURCE"] = "CONAN" - tc.variables["MINIFI_MIMALLOC_SOURCE"] = "CONAN" - tc.variables["MINIFI_LIBSSH2_SOURCE"] = "CONAN" - tc.variables["MINIFI_PROMETHEUS_SOURCE"] = "CONAN" - tc.variables["MINIFI_RANGEV3_SOURCE"] = "CONAN" - tc.variables["MINIFI_BENCHMARK_SOURCE"] = "CONAN" - tc.variables["MINIFI_JSONSCHEMA_VALIDATOR_SOURCE"] = "CONAN" - tc.variables["MINIFI_LIBLZMA_SOURCE"] = "CONAN" - tc.variables["MINIFI_PAHO_MQTT_C_SOURCE"] = "CONAN" - tc.variables["MINIFI_COUCHBASE_SOURCE"] = "CONAN" - tc.variables["MINIFI_ASIO_SOURCE"] = "CONAN" - tc.variables["MINIFI_KAFKA_SOURCE"] = "CONAN" - tc.variables["MINIFI_MAGIC_ENUM_SOURCE"] = "CONAN" - tc.variables["MINIFI_OPC_SOURCE"] = "CONAN" + tc.variables["MINIFI_DEFAULT_DEPENDENCY_SOURCE"] = "CONAN" tc.generate() def build(self): diff --git a/extensions/aws/CMakeLists.txt b/extensions/aws/CMakeLists.txt index b99135e789..4ba08eb681 100644 --- a/extensions/aws/CMakeLists.txt +++ b/extensions/aws/CMakeLists.txt @@ -21,8 +21,7 @@ if (NOT (ENABLE_ALL OR ENABLE_AWS)) return() endif() -include(BundledAwsSdkCpp) -use_bundled_libaws(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) +include(GetAwsSdkCpp) include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) include_directories(controllerservices processors s3 ${CMAKE_SOURCE_DIR}/extensions/aws) diff --git a/extensions/azure/CMakeLists.txt b/extensions/azure/CMakeLists.txt index 10bf4b50ab..fbc771ba60 100644 --- a/extensions/azure/CMakeLists.txt +++ b/extensions/azure/CMakeLists.txt @@ -21,7 +21,7 @@ if (NOT (ENABLE_ALL OR ENABLE_AZURE)) return() endif() -include(AzureSdkCpp) +include(GetAzureSdkCpp) include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) diff --git a/extensions/bustache/CMakeLists.txt b/extensions/bustache/CMakeLists.txt index 1a771b0ae6..da15e7f761 100644 --- a/extensions/bustache/CMakeLists.txt +++ b/extensions/bustache/CMakeLists.txt @@ -21,7 +21,7 @@ if (NOT (ENABLE_ALL OR ENABLE_BUSTACHE)) return() endif() -include(Bustache) +include(GetBustache) include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) diff --git a/extensions/gcp/CMakeLists.txt b/extensions/gcp/CMakeLists.txt index 2fc42260c2..c00e6db122 100644 --- a/extensions/gcp/CMakeLists.txt +++ b/extensions/gcp/CMakeLists.txt @@ -21,7 +21,7 @@ if (NOT (ENABLE_ALL OR ENABLE_GCP)) return() endif() -include(GoogleCloudCpp) +include(GetGoogleCloudCpp) include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) file(GLOB SOURCES "*.cpp" "controllerservices/*.cpp" "processors/*.cpp") diff --git a/extensions/gcp/tests/CMakeLists.txt b/extensions/gcp/tests/CMakeLists.txt index 89fe308e95..718243c244 100644 --- a/extensions/gcp/tests/CMakeLists.txt +++ b/extensions/gcp/tests/CMakeLists.txt @@ -16,6 +16,7 @@ # specific language governing permissions and limitations # under the License. # + file(GLOB GCS_TESTS "*.cpp") FOREACH(testfile ${GCS_TESTS}) get_filename_component(testfilename "${testfile}" NAME_WE) @@ -30,13 +31,17 @@ FOREACH(testfile ${GCS_TESTS}) target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/extensions/standard-processors") target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/extensions/gcp") - target_include_directories(${testfilename} SYSTEM BEFORE PRIVATE ${googletest_INCLUDE_DIRS}) - target_include_directories(${testfilename} SYSTEM BEFORE PRIVATE ${googletest_SOURCE_DIR}/googletest/include) - target_include_directories(${testfilename} SYSTEM BEFORE PRIVATE ${googletest_SOURCE_DIR}/googlemock/include) + if(MINIFI_GCP_SOURCE STREQUAL "BUILD") + target_include_directories(${testfilename} SYSTEM BEFORE PRIVATE ${googletest_INCLUDE_DIRS}) + target_include_directories(${testfilename} SYSTEM BEFORE PRIVATE ${googletest_SOURCE_DIR}/googletest/include) + target_include_directories(${testfilename} SYSTEM BEFORE PRIVATE ${googletest_SOURCE_DIR}/googlemock/include) + endif() + + target_link_libraries(${testfilename} ${MINIFI_GCP_TEST_GTEST_LIBRARIES}) + createTests("${testfilename}") target_link_libraries(${testfilename} minifi-gcp) - target_link_libraries(${testfilename} gtest_main gmock) target_link_libraries(${testfilename} libminifi-c-unittest) gtest_add_tests(TARGET "${testfilename}") diff --git a/extensions/grafana-loki/CMakeLists.txt b/extensions/grafana-loki/CMakeLists.txt index 177b74aa35..63fdf34e32 100644 --- a/extensions/grafana-loki/CMakeLists.txt +++ b/extensions/grafana-loki/CMakeLists.txt @@ -23,20 +23,12 @@ endif() include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) if (ENABLE_GRPC_FOR_LOKI) - include(Grpc) - - set(LOKI_PROTOBUF_GENERATED_DIR ${CMAKE_BINARY_DIR}/grafana-loki-protobuf-generated) - file(MAKE_DIRECTORY ${LOKI_PROTOBUF_GENERATED_DIR}) - - add_custom_command( - OUTPUT ${LOKI_PROTOBUF_GENERATED_DIR}/grafana-loki-push.grpc.pb.cc ${LOKI_PROTOBUF_GENERATED_DIR}/grafana-loki-push.grpc.pb.h ${LOKI_PROTOBUF_GENERATED_DIR}/grafana-loki-push.pb.h ${LOKI_PROTOBUF_GENERATED_DIR}/grafana-loki-push.pb.cc - COMMAND ${PROTOBUF_COMPILER} --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} --proto_path=. --proto_path=${protobuf_SOURCE_DIR}/src --grpc_out=${LOKI_PROTOBUF_GENERATED_DIR} --cpp_out=${LOKI_PROTOBUF_GENERATED_DIR} grafana-loki-push.proto - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/protos - DEPENDS protobuf::protoc grpc_cpp_plugin) + include(GetGrpc) + include(GenerateGrafanaLokiProto) add_library(grafana-loki-protos ${LOKI_PROTOBUF_GENERATED_DIR}/grafana-loki-push.grpc.pb.cc ${LOKI_PROTOBUF_GENERATED_DIR}/grafana-loki-push.pb.cc) - target_include_directories(grafana-loki-protos SYSTEM PRIVATE BEFORE "${LOKI_PROTOBUF_GENERATED_DIR}" "${GRPC_INCLUDE_DIR}" "${PROTOBUF_INCLUDE_DIR}") - target_link_libraries(grafana-loki-protos grpc++ protobuf::libprotobuf) + target_include_directories(grafana-loki-protos SYSTEM BEFORE PRIVATE "${LOKI_PROTOBUF_GENERATED_DIR}" "${GRPC_INCLUDE_DIR}" "${PROTOBUF_INCLUDE_DIR}") + target_link_libraries(grafana-loki-protos gRPC::grpc++ protobuf::libprotobuf) file(GLOB SOURCES "*.cpp") @@ -55,7 +47,7 @@ add_minifi_library(minifi-grafana-loki SHARED ${SOURCES}) target_link_libraries(minifi-grafana-loki ${LIBMINIFI}) if (ENABLE_GRPC_FOR_LOKI) - target_include_directories(minifi-grafana-loki SYSTEM PRIVATE BEFORE "${LOKI_PROTOBUF_GENERATED_DIR}" "${GRPC_INCLUDE_DIR}" "${PROTOBUF_INCLUDE_DIR}") + target_include_directories(minifi-grafana-loki SYSTEM BEFORE PRIVATE "${LOKI_PROTOBUF_GENERATED_DIR}" "${GRPC_INCLUDE_DIR}" "${PROTOBUF_INCLUDE_DIR}") target_link_libraries(minifi-grafana-loki grafana-loki-protos) add_dependencies(minifi-grafana-loki grafana-loki-protos) if (MSVC) diff --git a/extensions/kubernetes/ApiClient.cpp b/extensions/kubernetes/ApiClient.cpp index 2856c96b58..ba7317fdca 100644 --- a/extensions/kubernetes/ApiClient.cpp +++ b/extensions/kubernetes/ApiClient.cpp @@ -17,9 +17,9 @@ #include "ApiClient.h" extern "C" { -#include "config/incluster_config.h" -#include "config/kube_config.h" -#include "include/apiClient.h" +#include "kubernetes/config/incluster_config.h" +#include "kubernetes/config/kube_config.h" +#include "kubernetes/include/apiClient.h" } #include "utils/StringUtils.h" diff --git a/extensions/kubernetes/CMakeLists.txt b/extensions/kubernetes/CMakeLists.txt index fcaf72166e..aef5efe10a 100644 --- a/extensions/kubernetes/CMakeLists.txt +++ b/extensions/kubernetes/CMakeLists.txt @@ -18,12 +18,12 @@ if (NOT (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND (ENABLE_ALL OR ENABLE_KUBERNETES return() endif() -include(KubernetesClientC) +include(GetKubernetesClientC) include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) file(GLOB SOURCES "*.cpp" "controllerservice/*.cpp" "processors/*.cpp") add_minifi_library(minifi-kubernetes-extensions SHARED ${SOURCES}) -target_link_libraries(minifi-kubernetes-extensions ${LIBMINIFI} kubernetes) +target_link_libraries(minifi-kubernetes-extensions ${LIBMINIFI} kubernetes::kubernetes) register_extension(minifi-kubernetes-extensions "KUBERNETES EXTENSIONS" KUBERNETES-EXTENSIONS "This enables Kubernetes support" "extensions/kubernetes/tests") diff --git a/extensions/kubernetes/MetricsApi.cpp b/extensions/kubernetes/MetricsApi.cpp index fbcfb7a9c8..933557a3d9 100644 --- a/extensions/kubernetes/MetricsApi.cpp +++ b/extensions/kubernetes/MetricsApi.cpp @@ -19,7 +19,7 @@ #include extern "C" { -#include "include/generic.h" +#include "kubernetes/include/generic.h" } #include "ApiClient.h" diff --git a/extensions/kubernetes/controllerservice/KubernetesControllerService.cpp b/extensions/kubernetes/controllerservice/KubernetesControllerService.cpp index e13bd185e8..695de593c4 100644 --- a/extensions/kubernetes/controllerservice/KubernetesControllerService.cpp +++ b/extensions/kubernetes/controllerservice/KubernetesControllerService.cpp @@ -20,7 +20,7 @@ #include extern "C" { -#include "api/CoreV1API.h" +#include "kubernetes/api/CoreV1API.h" } #include "core/Resource.h" diff --git a/extensions/llamacpp/CMakeLists.txt b/extensions/llamacpp/CMakeLists.txt index d8fd187a21..b45c6861e7 100644 --- a/extensions/llamacpp/CMakeLists.txt +++ b/extensions/llamacpp/CMakeLists.txt @@ -21,7 +21,12 @@ if (NOT (ENABLE_ALL OR ENABLE_LLAMACPP)) return() endif() -include(LlamaCpp) +set(ADDITIONAL_LIBS "") +if(MINIFI_LLAMACPP_SOURCE STREQUAL "CONAN") + find_package(nlohmann_json REQUIRED) + set(ADDITIONAL_LIBS "nlohmann_json::nlohmann_json") +endif() +include(GetLlamaCpp) include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) @@ -31,7 +36,7 @@ add_minifi_library(minifi-llamacpp SHARED ${SOURCES}) target_include_directories(minifi-llamacpp PUBLIC "${CMAKE_SOURCE_DIR}/extensions/llamacpp") target_include_directories(minifi-llamacpp PUBLIC "${LLAMACPP_INCLUDE_DIRS}") -target_link_libraries(minifi-llamacpp minifi-cpp-extension-lib llama mtmd llama-common) +target_link_libraries(minifi-llamacpp minifi-cpp-extension-lib llama-cpp::llama llama-cpp::mtmd llama-cpp::common "${ADDITIONAL_LIBS}") register_c_api_extension(minifi-llamacpp "LLAMACPP EXTENSION" LLAMACPP-EXTENSION "Provides llama.cpp support" "extensions/llamacpp/tests") diff --git a/extensions/standard-processors/tests/CMakeLists.txt b/extensions/standard-processors/tests/CMakeLists.txt index 6d87a34339..f751d042c7 100644 --- a/extensions/standard-processors/tests/CMakeLists.txt +++ b/extensions/standard-processors/tests/CMakeLists.txt @@ -17,7 +17,7 @@ # under the License. # -include(JoltTests) +include(GetJoltTests) file(GLOB PROCESSOR_UNIT_TESTS "unit/*.cpp" "unit/modbus/*.cpp") file(GLOB PROCESSOR_INTEGRATION_TESTS "integration/*.cpp") diff --git a/thirdparty/aws-sdk-cpp/all/conandata.yml b/thirdparty/aws-sdk-cpp/all/conandata.yml new file mode 100644 index 0000000000..4dda212ce2 --- /dev/null +++ b/thirdparty/aws-sdk-cpp/all/conandata.yml @@ -0,0 +1,22 @@ +# 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. + +sources: + "1.11.807": + url: "https://github.com/aws/aws-sdk-cpp.git" +patches: + "1.11.807": + - patch_file: patches/dll-export-injection.patch + - patch_file: patches/fix-finding-s2n.patch diff --git a/thirdparty/aws-sdk-cpp/all/conanfile.py b/thirdparty/aws-sdk-cpp/all/conanfile.py new file mode 100644 index 0000000000..f42b813eae --- /dev/null +++ b/thirdparty/aws-sdk-cpp/all/conanfile.py @@ -0,0 +1,673 @@ +# 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. + +# Recipe based on https://github.com/conan-io/conan-center-index/blob/master/recipes/aws-sdk-cpp/all/conanfile.py + +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, export_conandata_patches, patch, rm, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Git, Version + +required_conan_version = ">=2" + + +class AwsSdkCppConan(ConanFile): + name = "aws-sdk-cpp" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/aws/aws-sdk-cpp" + description = "AWS SDK for C++" + topics = ("aws", "cpp", "cross-platform", "amazon", "cloud") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + # This list comes from tools/code-generation/api-description, which then generates the sdk sources + # To generate for a new one, run the build once and check src/generated/src inside your build_folder, remove the common aws-sdk-cpp prefix + # NON_GENERATED_CLIENT_LIST in src/cmake/sdks.cmake contains extra ones that should also be added here + # and that's the list of sdks. Then join it to this one + _sdks = ( + "AWSMigrationHub", + "accessanalyzer", + "account", + "acm", + "acm-pca", + "aiops", + "amp", + "amplify", + "amplifybackend", + "amplifyuibuilder", + "apigateway", + "apigatewaymanagementapi", + "apigatewayv2", + "appconfig", + "appconfigdata", + "appfabric", + "appflow", + "appintegrations", + "application-autoscaling", + "application-insights", + "application-signals", + "applicationcostprofiler", + "appmesh", + "apprunner", + "appstream", + "appsync", + "arc-region-switch", + "arc-zonal-shift", + "artifact", + "athena", + "auditmanager", + "autoscaling", + "autoscaling-plans", + "awstransfer", + "b2bi", + "backup", + "backup-gateway", + "backupsearch", + "batch", + "bcm-dashboards", + "bcm-data-exports", + "bcm-pricing-calculator", + "bcm-recommended-actions", + "bedrock", + "bedrock-agent", + "bedrock-agent-runtime", + "bedrock-agentcore", + "bedrock-agentcore-control", + "bedrock-data-automation", + "bedrock-data-automation-runtime", + "bedrock-runtime", + "billing", + "billingconductor", + "braket", + "budgets", + "ce", + "chatbot", + "chime", + "chime-sdk-identity", + "chime-sdk-media-pipelines", + "chime-sdk-meetings", + "chime-sdk-messaging", + "chime-sdk-voice", + "cleanrooms", + "cleanroomsml", + "cloud9", + "cloudcontrol", + "clouddirectory", + "cloudformation", + "cloudfront", + "cloudfront-keyvaluestore", + "cloudhsm", + "cloudhsmv2", + "cloudsearch", + "cloudsearchdomain", + "cloudtrail", + "cloudtrail-data", + "codeartifact", + "codebuild", + "codecatalyst", + "codecommit", + "codeconnections", + "codedeploy", + "codeguru-reviewer", + "codeguru-security", + "codeguruprofiler", + "codepipeline", + "codestar-connections", + "codestar-notifications", + "cognito-identity", + "cognito-idp", + "cognito-sync", + "comprehend", + "comprehendmedical", + "compute-optimizer", + "config", + "connect", + "connect-contact-lens", + "connectcampaigns", + "connectcampaignsv2", + "connectcases", + "connectparticipant", + "controlcatalog", + "controltower", + "cost-optimization-hub", + "cur", + "customer-profiles", + "databrew", + "dataexchange", + "datapipeline", + "datasync", + "datazone", + "dax", + "deadline", + "detective", + "devicefarm", + "devops-guru", + "directconnect", + "directory-service-data", + "discovery", + "dlm", + "dms", + "docdb", + "docdb-elastic", + "drs", + "ds", + "dsql", + "dynamodb", + "dynamodbstreams", + "ebs", + "ec2", + "ec2-instance-connect", + "ecr", + "ecr-public", + "ecs", + "eks", + "eks-auth", + "elasticache", + "elasticbeanstalk", + "elasticfilesystem", + "elasticloadbalancing", + "elasticloadbalancingv2", + "elasticmapreduce", + "elastictranscoder", + "email", + "emr-containers", + "emr-serverless", + "entityresolution", + "es", + "eventbridge", + "events", + "evidently", + "evs", + "finspace", + "finspace-data", + "firehose", + "fis", + "fms", + "forecast", + "forecastquery", + "frauddetector", + "freetier", + "fsx", + "gamelift", + "gameliftstreams", + "geo-maps", + "geo-places", + "geo-routes", + "glacier", + "globalaccelerator", + "glue", + "grafana", + "greengrass", + "greengrassv2", + "groundstation", + "guardduty", + "health", + "healthlake", + "iam", + "identitystore", + "imagebuilder", + "importexport", + "inspector", + "inspector-scan", + "inspector2", + "internetmonitor", + "invoicing", + "iot", + "iot-data", + "iot-jobs-data", + "iot-managed-integrations", + "iotanalytics", + "iotdeviceadvisor", + "iotevents", + "iotevents-data", + "iotfleetwise", + "iotsecuretunneling", + "iotsitewise", + "iotthingsgraph", + "iottwinmaker", + "iotwireless", + "ivs", + "ivs-realtime", + "ivschat", + "kafka", + "kafkaconnect", + "kendra", + "kendra-ranking", + "keyspaces", + "keyspacesstreams", + "kinesis", + "kinesis-video-archived-media", + "kinesis-video-media", + "kinesis-video-signaling", + "kinesis-video-webrtc-storage", + "kinesisanalytics", + "kinesisanalyticsv2", + "kinesisvideo", + "kms", + "lakeformation", + "lambda", + "launch-wizard", + "lex", + "lex-models", + "lexv2-models", + "lexv2-runtime", + "license-manager", + "license-manager-linux-subscriptions", + "license-manager-user-subscriptions", + "lightsail", + "location", + "logs", + "lookoutequipment", + "m2", + "machinelearning", + "macie2", + "mailmanager", + "managedblockchain", + "managedblockchain-query", + "marketplace-agreement", + "marketplace-catalog", + "marketplace-deployment", + "marketplace-entitlement", + "marketplace-reporting", + "marketplacecommerceanalytics", + "mediaconnect", + "mediaconvert", + "medialive", + "mediapackage", + "mediapackage-vod", + "mediapackagev2", + "mediastore", + "mediastore-data", + "mediatailor", + "medical-imaging", + "memorydb", + "meteringmarketplace", + "mgn", + "migration-hub-refactor-spaces", + "migrationhub-config", + "migrationhuborchestrator", + "migrationhubstrategy", + "monitoring", + "mpa", + "mq", + "mturk-requester", + "mwaa", + "neptune", + "neptune-graph", + "neptunedata", + "network-firewall", + "networkflowmonitor", + "networkmanager", + "networkmonitor", + "notifications", + "notificationscontacts", + "oam", + "observabilityadmin", + "odb", + "omics", + "opensearch", + "opensearchserverless", + "organizations", + "osis", + "outposts", + "panorama", + "partnercentral-selling", + "payment-cryptography", + "payment-cryptography-data", + "pca-connector-ad", + "pca-connector-scep", + "pcs", + "personalize", + "personalize-events", + "personalize-runtime", + "pi", + "pinpoint", + "pinpoint-email", + "pinpoint-sms-voice-v2", + "pipes", + "polly", + "pricing", + "proton", + "qapps", + "qbusiness", + "qconnect", + "quicksight", + "ram", + "rbin", + "rds", + "rds-data", + "redshift", + "redshift-data", + "redshift-serverless", + "rekognition", + "repostspace", + "resiliencehub", + "resource-explorer-2", + "resource-groups", + "resourcegroupstaggingapi", + "rolesanywhere", + "route53", + "route53-recovery-cluster", + "route53-recovery-control-config", + "route53-recovery-readiness", + "route53domains", + "route53profiles", + "route53resolver", + "rtbfabric", + "rum", + "s3", + "s3-crt", + "s3control", + "s3outposts", + "s3tables", + "s3vectors", + "sagemaker", + "sagemaker-a2i-runtime", + "sagemaker-edge", + "sagemaker-featurestore-runtime", + "sagemaker-geospatial", + "sagemaker-metrics", + "sagemaker-runtime", + "savingsplans", + "scheduler", + "schemas", + "sdb", + "secretsmanager", + "security-ir", + "securityhub", + "securitylake", + "serverlessrepo", + "service-quotas", + "servicecatalog", + "servicecatalog-appregistry", + "servicediscovery", + "sesv2", + "shield", + "signer", + "simspaceweaver", + "sms-voice", + "snow-device-management", + "snowball", + "sns", + "socialmessaging", + "sqs", + "ssm", + "ssm-contacts", + "ssm-guiconnect", + "ssm-incidents", + "ssm-quicksetup", + "ssm-sap", + "sso", + "sso-admin", + "sso-oidc", + "states", + "storagegateway", + "sts", + "supplychain", + "support", + "support-app", + "swf", + "synthetics", + "taxsettings", + "textract", + "timestream-influxdb", + "timestream-query", + "timestream-write", + "tnb", + "transcribe", + "transcribestreaming", + "translate", + "trustedadvisor", + "verifiedpermissions", + "voice-id", + "vpc-lattice", + "waf", + "waf-regional", + "wafv2", + "wellarchitected", + "wisdom", + "workdocs", + "workmail", + "workmailmessageflow", + "workspaces", + "workspaces-instances", + "workspaces-thin-client", + "workspaces-web", + "xray", + # Extra modules that are not generated but exist upstream + "access-management", + "text-to-speech", + "queues", + "s3-encryption", + "identity-management", + "transfer" + ) + options = { + **{ + "shared": [True, False], + "fPIC": [True, False], + "min_size": [True, False], + }, + **{sdk_name: [None, True, False] for sdk_name in _sdks}, + } + default_options = { + **{ + "shared": False, + "fPIC": True, + "min_size": False + }, + **{sdk_name: None for sdk_name in _sdks}, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + for sdk_name in self._sdks: + if self.options.get_safe(sdk_name) == None: # noqa + setattr(self.options, sdk_name, False) + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("openssl/3.6.2", transitive_headers=True) + if self.settings.os != "Windows": + # Used transitively in core/http/curl/CurlHandleContainer.h public header + self.requires("libcurl/8.20.0", transitive_headers=True) + if self.settings.os == "Linux": + # Pulseaudio -> libcap, libalsa only support linux, don't use pulseaudio on other platforms + if self.options.get_safe("text-to-speech"): + # Used transitively in text-to-speech/PulseAudioPCMOutputDriver.h public header + self.requires("pulseaudio/14.2", transitive_headers=True, transitive_libs=True) + # zlib is used if ENABLE_ZLIB_REQUEST_COMPRESSION is enabled, set ot ON by default + self.requires("zlib/1.3.2") + + def validate_build(self): + if self.settings_build.os == "Windows" and self.settings.os == "Android": + raise ConanInvalidConfiguration("Cross-building from Windows to Android is not supported") + + if (self.options.shared + and self.settings.compiler == "gcc" + and Version(self.settings.compiler.version) < "6.0"): + raise ConanInvalidConfiguration( + "Doesn't support gcc5 / shared. " + "See https://github.com/conan-io/conan-center-index/pull/4401#issuecomment-802631744" + ) + + def validate(self): + if (is_msvc(self) and self.options.shared + and not self.dependencies["aws-c-common"].options.shared): + raise ConanInvalidConfiguration(f"{self.ref} with shared is not supported with aws-c-common static") + + def source(self): + git = Git(self) + git.run("init .") + git.run("remote add origin https://github.com/aws/aws-sdk-cpp.git") + git.run(f"fetch --depth 1 origin refs/tags/{self.version}") + git.run("checkout --force FETCH_HEAD") + git.run("submodule update --init --recursive --depth 1") + + for patch_data in self.conan_data.get("patches", {}).get(self.version, []): + patch_file = patch_data["patch_file"] + patch(self, patch_file=os.path.join(self.export_sources_folder, patch_file), + base_path=self.source_folder, strip=0, fuzz=True) + + def _enabled_sdks(self): + return [sdk for sdk in self._sdks + if self.options.get_safe(sdk)] + + def generate(self): + tc = CMakeToolchain(self) + # All option() are defined before project() in upstream CMakeLists, + # therefore we must use cache_variables + + build_only = ["core"] + self._enabled_sdks() + tc.cache_variables["BUILD_ONLY"] = ";".join(build_only) + + tc.cache_variables["ENABLE_UNITY_BUILD"] = True + tc.cache_variables["ENABLE_TESTING"] = False + tc.cache_variables["AUTORUN_UNIT_TESTS"] = False + tc.cache_variables["BUILD_DEPS"] = True + tc.cache_variables["USE_OPENSSL"] = True + tc.cache_variables["ENABLE_OPENSSL_ENCRYPTION"] = True + # Point the SDK's / s2n's OpenSSL discovery at the conan-provided OpenSSL. + tc.cache_variables["OPENSSL_ROOT_DIR"] = self.dependencies["openssl"].package_folder + + tc.cache_variables["MINIMIZE_SIZE"] = self.options.min_size + tc.cache_variables['AWS_STATIC_MSVC_RUNTIME_LIBRARY'] = self.settings.os == "Windows" and self.settings.get_safe("compiler.runtime") == "static" + + tc.cache_variables["USE_CRT_HTTP_CLIENT"] = True + + if self.settings.os == "Windows": + tc.cache_variables["FORCE_EXPORT_CORE_API"] = True + tc.cache_variables["FORCE_EXPORT_S3_API"] = True + tc.cache_variables["FORCE_EXPORT_S3_CRT_API"] = True + tc.cache_variables["FORCE_EXPORT_KINESIS_API"] = True + + if cross_building(self): + tc.cache_variables["CURL_HAS_H2_EXITCODE"] = "0" + tc.cache_variables["CURL_HAS_H2_EXITCODE__TRYRUN_OUTPUT"] = "" + tc.cache_variables["CURL_HAS_TLS_PROXY_EXITCODE"] = "0" + tc.cache_variables["CURL_HAS_TLS_PROXY_EXITCODE__TRYRUN_OUTPUT"] = "" + if is_msvc(self): + tc.preprocessor_definitions["_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING"] = "1" + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + if is_msvc(self): + copy(self, "*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + rm(self, "*.lib", os.path.join(self.package_folder, "bin")) + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "AWSSDK") + + is_windows = self.settings.os == "Windows" + is_apple = self.settings.os == "Macos" + has_s2n = self.settings.os in ["Linux", "FreeBSD"] + + # CRT libraries built in-tree from the SDK submodules (BUILD_DEPS=ON). Target names + # and link edges mirror cmake/BundledAwsSdkCpp.cmake; the edges below are the complete + # dependency set so the flattened static-link order is always valid. + def crt_component(name, requires=None): + comp = self.cpp_info.components[name] + comp.set_property("cmake_target_name", f"AWS::{name}") + comp.libs = [name] + comp.requires = requires or [] + + crt_component("aws-c-common") + crt_component("aws-checksums", ["aws-c-common"]) + crt_component("aws-c-sdkutils", ["aws-c-common"]) + crt_component("aws-c-cal", ["aws-c-common"]) + crt_component("aws-c-compression", ["aws-c-common"]) + crt_component("aws-c-io", ["aws-c-common", "aws-c-cal"] + (["s2n"] if has_s2n else [])) + crt_component("aws-c-event-stream", ["aws-c-common", "aws-checksums", "aws-c-io"]) + crt_component("aws-c-http", ["aws-c-common", "aws-c-compression", "aws-c-cal", "aws-c-io"]) + crt_component("aws-c-auth", ["aws-c-common", "aws-c-cal", "aws-c-io", "aws-c-http", "aws-c-sdkutils"]) + crt_component("aws-c-mqtt", ["aws-c-common", "aws-c-http", "aws-c-io"]) + crt_component("aws-c-s3", ["aws-c-common", "aws-c-cal", "aws-c-auth", "aws-c-http", "aws-c-io", "aws-checksums"]) + crt_component("aws-crt-cpp", ["aws-c-common", "aws-c-sdkutils", "aws-c-io", "aws-c-cal", "aws-c-compression", + "aws-c-http", "aws-c-auth", "aws-c-mqtt", "aws-checksums", "aws-c-event-stream", "aws-c-s3"]) + + if has_s2n: + s2n = self.cpp_info.components["s2n"] + s2n.set_property("cmake_target_name", "AWS::s2n") + s2n.libs = ["s2n"] + s2n.requires = ["openssl::openssl"] + + # core component + core = self.cpp_info.components["core"] + core.set_property("cmake_target_name", "AWS::aws-cpp-sdk-core") + core.set_property("pkg_config_name", "aws-sdk-cpp-core") + core.libs = ["aws-cpp-sdk-core"] + core.requires = ["aws-crt-cpp", "aws-c-event-stream", "zlib::zlib", "openssl::openssl"] + if not is_windows: + core.requires.append("libcurl::curl") + + # SDK client components (s3, s3-crt, kinesis, ...) + for sdk in self._enabled_sdks(): + comp = self.cpp_info.components[sdk] + comp.set_property("cmake_target_name", f"AWS::aws-cpp-sdk-{sdk}") + comp.set_property("pkg_config_name", f"aws-sdk-cpp-{sdk}") + comp.libs = ["aws-cpp-sdk-" + sdk] + comp.requires = ["core"] + if self.options.get_safe("s3-crt"): + self.cpp_info.components["s3-crt"].requires.append("aws-crt-cpp") + + # platform-specific system libs / frameworks (mirrors BundledAwsSdkCpp.cmake:157-226) + if is_windows: + core.system_libs.extend([ + "userenv", "ws2_32", "wininet", "bcrypt", "version", + "secur32", "crypt32", "shlwapi", "winhttp"]) + # aws-c-io's Windows TLS (windows_pki_utils.c) needs the NCrypt API. + self.cpp_info.components["aws-c-io"].system_libs.append("ncrypt") + if self.options.get_safe("text-to-speech"): + self.cpp_info.components["text-to-speech"].system_libs.append("winmm") + elif is_apple: + core.frameworks.extend(["CoreFoundation", "Security", "Network"]) + if self.options.get_safe("text-to-speech"): + self.cpp_info.components["text-to-speech"].frameworks.extend(["CoreAudio", "AudioToolbox"]) + + if self.settings.os in ["Linux", "FreeBSD"]: + core.system_libs.extend(["atomic", "pthread", "dl", "rt", "m"]) + if self.options.get_safe("text-to-speech"): + self.cpp_info.components["text-to-speech"].requires.append("pulseaudio::pulseaudio") diff --git a/thirdparty/aws-sdk-cpp/aws-c-cal.patch b/thirdparty/aws-sdk-cpp/all/patches/aws-c-cal.patch similarity index 100% rename from thirdparty/aws-sdk-cpp/aws-c-cal.patch rename to thirdparty/aws-sdk-cpp/all/patches/aws-c-cal.patch diff --git a/thirdparty/aws-sdk-cpp/dll-export-injection.patch b/thirdparty/aws-sdk-cpp/all/patches/dll-export-injection.patch similarity index 100% rename from thirdparty/aws-sdk-cpp/dll-export-injection.patch rename to thirdparty/aws-sdk-cpp/all/patches/dll-export-injection.patch diff --git a/thirdparty/aws-sdk-cpp/fix-finding-s2n.patch b/thirdparty/aws-sdk-cpp/all/patches/fix-finding-s2n.patch similarity index 100% rename from thirdparty/aws-sdk-cpp/fix-finding-s2n.patch rename to thirdparty/aws-sdk-cpp/all/patches/fix-finding-s2n.patch diff --git a/thirdparty/aws-sdk-cpp/s2n.patch b/thirdparty/aws-sdk-cpp/all/patches/s2n.patch similarity index 100% rename from thirdparty/aws-sdk-cpp/s2n.patch rename to thirdparty/aws-sdk-cpp/all/patches/s2n.patch diff --git a/thirdparty/aws-sdk-cpp/config.yml b/thirdparty/aws-sdk-cpp/config.yml new file mode 100644 index 0000000000..30f58865d7 --- /dev/null +++ b/thirdparty/aws-sdk-cpp/config.yml @@ -0,0 +1,18 @@ +# 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. + +versions: + "1.11.807": + folder: "all" diff --git a/thirdparty/azure-sdk-cpp/all/conandata.yml b/thirdparty/azure-sdk-cpp/all/conandata.yml new file mode 100644 index 0000000000..f773dd5e86 --- /dev/null +++ b/thirdparty/azure-sdk-cpp/all/conandata.yml @@ -0,0 +1,23 @@ +# 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. + +sources: + "12.18.0": + url: "https://github.com/Azure/azure-sdk-for-cpp/archive/refs/tags/azure-storage-blobs_12.18.0.tar.gz" + sha256: "0f266f91cf00b79bb6c7c6f99e44942b43a7141db565556a4298f6ebe3a86fcc" +patches: + "12.18.0": + - patch_file: "patches/fix-openssl-helper.patch" + - patch_file: "patches/include-cinttypes-for-uint8_t-gcc15-fix.patch" diff --git a/thirdparty/azure-sdk-cpp/all/conanfile.py b/thirdparty/azure-sdk-cpp/all/conanfile.py new file mode 100644 index 0000000000..8b15856de8 --- /dev/null +++ b/thirdparty/azure-sdk-cpp/all/conanfile.py @@ -0,0 +1,194 @@ +# 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. + +# Recipe based on https://github.com/conan-io/conan-center-index/blob/master/recipes/azure-sdk-for-cpp/all/conanfile.py + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMakeToolchain, CMake, CMakeDeps, cmake_layout +from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.scm import Version +import glob +import os + +required_conan_version = ">=2.1" + +class AzureSDKForCppConan(ConanFile): + name = "azure-sdk-for-cpp" + description = "Microsoft Azure Storage Client Library for C++" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Azure/azure-sdk-for-cpp" + topics = ("azure", "cpp", "cross-platform", "microsoft", "cloud") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + + options = { + "shared": [True, False], + "fPIC": [True, False], + "transport_winhttp": [True, False], + "transport_curl": [True, False] + } + + default_options = { + "shared": False, + "fPIC": True, + "transport_winhttp": False, + "transport_curl": True + } + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + for cmake_file in glob.glob(os.path.join(self.source_folder, "sdk", "identity", "azure-identity", "**", "CMakeLists.txt"), recursive=True): + replace_in_file(self, cmake_file, + "set(CMAKE_CXX_STANDARD 14)", + "set(CMAKE_CXX_STANDARD 17)", + strict=False) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + else: + del self.options.transport_winhttp + + def configure(self): + if self.options.get_safe("shared"): + self.options.rm_safe("fPIC") + + def requirements(self): + self.requires("openssl/3.6.2") + self.requires("libxml2/2.15.3") + + if self.settings.os == "Windows": + # wil is always required on windows since azure-identity can't be disabled via cmake. + # azure-identity and wil are not necessary for storage if skip_test=True, but MS + # doesn't currently support that build option... + self.requires("wil/1.0.260126.7") + + if self.options.transport_curl: + self.requires("libcurl/8.20.0") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + + if self.settings.os == "Windows": + if not self.options.transport_curl and not self.options.get_safe("transport_winhttp"): + raise ConanInvalidConfiguration("On Windows, HTTP Transport options: transport_winhttp or transport_curl must be enabled.") + elif not self.options.transport_curl: + raise ConanInvalidConfiguration("The HTTP Transport option transport_curl must be enabled.") + + if self.settings.compiler == 'gcc' and Version(self.settings.compiler.version) < "6": + raise ConanInvalidConfiguration("Building requires GCC >= 6") + + if (self.settings.compiler == 'clang' or self.settings.compiler == "apple-clang") and Version(self.settings.compiler.version) < "10": + raise ConanInvalidConfiguration("Building requires Clang >= 10") + + def generate(self): + tc = CMakeToolchain(self) + + tc.cache_variables["BUILD_TESTING"] = "OFF" + tc.cache_variables["ENABLE_PROXY_TESTS"] = "OFF" + + tc.cache_variables["BUILD_TRANSPORT_CURL"] = self.options.transport_curl + + if self.settings.os == "Windows": + # if transport_curl and transport_winhttp are both enabled, the SDK uses win_http by default + # when the transport is not manually overridden when the classes are instantiated + tc.cache_variables["BUILD_TRANSPORT_WINHTTP"] = self.options.get_safe("transport_winhttp") + + tc.cache_variables["BUILD_DOCUMENTATION"] = "OFF" + tc.cache_variables["BUILD_SAMPLES"] = "OFF" + tc.cache_variables["BUILD_PERFORMANCE_TESTS"] = "OFF" + + tc.cache_variables["FETCH_SOURCE_DEPS"] = "OFF" + + tc.cache_variables["WARNINGS_AS_ERRORS"] = "OFF" + + tc.cache_variables["DISABLE_AZURE_CORE_OPENTELEMETRY"] = "ON" + + tc.cache_variables["DISABLE_AMQP"] = "ON" + + tc.cache_variables["DISABLE_RUST_IN_BUILD"] = "ON" + + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE.txt", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "AzureSDK") + + # core component + self.cpp_info.components["azure-core"].set_property("cmake_target_name", "Azure::azure-core") + self.cpp_info.components["azure-core"].libs = ["azure-core"] + + self.cpp_info.components["azure-core"].requires.extend(["openssl::openssl", "libxml2::libxml2"]) + + if self.settings.os == "Windows" and self.options.get_safe("transport_winhttp"): + self.cpp_info.components["azure-core"].requires.append("wil::wil") + self.cpp_info.components["azure-core"].system_libs = ["winhttp"] + if self.options.transport_curl: + self.cpp_info.components["azure-core"].requires.append("libcurl::libcurl") + + self.cpp_info.components["azure-storage-common"].set_property("cmake_target_name", "Azure::azure-storage-common") + self.cpp_info.components["azure-storage-common"].libs = ["azure-storage-common"] + self.cpp_info.components["azure-storage-common"].requires = ["azure-core"] + if not self.settings.os == "Windows": + self.cpp_info.components["azure-storage-common"].requires.extend(["openssl::openssl", "libxml2::libxml2"]) + else: + self.cpp_info.components["azure-storage-common"].system_libs = ["bcrypt", "webservices"] + + self.cpp_info.components["azure-storage-blobs"].set_property("cmake_target_name", "Azure::azure-storage-blobs") + self.cpp_info.components["azure-storage-blobs"].libs = ["azure-storage-blobs"] + self.cpp_info.components["azure-storage-blobs"].requires = ["azure-core", "azure-storage-common"] + + self.cpp_info.components["azure-storage-files-shares"].set_property("cmake_target_name", "Azure::azure-storage-files-shares") + self.cpp_info.components["azure-storage-files-shares"].libs = ["azure-storage-files-shares"] + self.cpp_info.components["azure-storage-files-shares"].requires = ["azure-core", "azure-storage-common"] + + self.cpp_info.components["azure-identity"].set_property("cmake_target_name", "Azure::azure-identity") + self.cpp_info.components["azure-identity"].libs = ["azure-identity"] + self.cpp_info.components["azure-identity"].requires = ["azure-core"] + if self.settings.os == "Windows": + self.cpp_info.components["azure-identity"].system_requires = ["bcrypt", "crypt32"] + else: + self.cpp_info.components["azure-identity"].requires.append("openssl::openssl") + + self.cpp_info.components["azure-storage-files-datalake"].set_property("cmake_target_name", "Azure::azure-storage-files-datalake") + self.cpp_info.components["azure-storage-files-datalake"].libs = ["azure-storage-files-datalake"] + self.cpp_info.components["azure-storage-files-datalake"].requires = ["azure-core", "azure-storage-common", "azure-storage-blobs"] + + if self.settings.os == "Windows": + self.cpp_info.components["azure-identity"].requires.append("wil::wil") diff --git a/thirdparty/azure-sdk-cpp/fix-openssl-helper.patch b/thirdparty/azure-sdk-cpp/all/patches/fix-openssl-helper.patch similarity index 100% rename from thirdparty/azure-sdk-cpp/fix-openssl-helper.patch rename to thirdparty/azure-sdk-cpp/all/patches/fix-openssl-helper.patch diff --git a/thirdparty/azure-sdk-cpp/include-cinttypes-for-uint8_t-gcc15-fix.patch b/thirdparty/azure-sdk-cpp/all/patches/include-cinttypes-for-uint8_t-gcc15-fix.patch similarity index 100% rename from thirdparty/azure-sdk-cpp/include-cinttypes-for-uint8_t-gcc15-fix.patch rename to thirdparty/azure-sdk-cpp/all/patches/include-cinttypes-for-uint8_t-gcc15-fix.patch diff --git a/thirdparty/azure-sdk-cpp/wil.patch b/thirdparty/azure-sdk-cpp/all/patches/wil.patch similarity index 100% rename from thirdparty/azure-sdk-cpp/wil.patch rename to thirdparty/azure-sdk-cpp/all/patches/wil.patch diff --git a/thirdparty/azure-sdk-cpp/config.yml b/thirdparty/azure-sdk-cpp/config.yml new file mode 100644 index 0000000000..c3c82b75b6 --- /dev/null +++ b/thirdparty/azure-sdk-cpp/config.yml @@ -0,0 +1,18 @@ +# 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. + +versions: + "12.18.0": + folder: "all" diff --git a/thirdparty/azure-sdk-cpp/fix-managed-identity.patch b/thirdparty/azure-sdk-cpp/fix-managed-identity.patch deleted file mode 100644 index 7e52ead066..0000000000 --- a/thirdparty/azure-sdk-cpp/fix-managed-identity.patch +++ /dev/null @@ -1,15 +0,0 @@ -Azure SDK C++ commit fixes this in commit b33fb227ce56f2e93625521d34be2f8970869199, should be available in the next release - -diff --git a/sdk/identity/azure-identity/src/managed_identity_source.cpp b/sdk/identity/azure-identity/src/managed_identity_source.cpp -index 93a5969bf..c3d203a58 100644 ---- a/sdk/identity/azure-identity/src/managed_identity_source.cpp -+++ b/sdk/identity/azure-identity/src/managed_identity_source.cpp -@@ -527,7 +527,7 @@ std::unique_ptr ImdsManagedIdentitySource::Create( - - imdsUrl = Core::Url{imdsEndpointEnvVarValue}; - } -- imdsUrl.SetPath("/metadata/identity/oauth2/token"); -+ imdsUrl.SetPath("metadata/identity/oauth2/token"); - - return std::unique_ptr( - new ImdsManagedIdentitySource(clientId, objectId, resourceId, imdsUrl, options)); diff --git a/thirdparty/bustache/all/conandata.yml b/thirdparty/bustache/all/conandata.yml new file mode 100644 index 0000000000..e841ce597d --- /dev/null +++ b/thirdparty/bustache/all/conandata.yml @@ -0,0 +1,31 @@ +# 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. + +sources: + # Pinned to the same commit (af10816) used by the bundled Bustache.cmake build. + "0.1.0": + url: "https://github.com/jamboree/bustache/archive/af10816ce3d2ff8577fd27caa2c1005c01d8069b.tar.gz" + sha256: "b5f8216609f139169d9770e82e709d719d186ecaec5a2f90b4961d8e7ee4b72f" +patches: + "0.1.0": + - patch_file: "patches/add-append.patch" + patch_description: "Add append(begin, end) helper used by MiNiFi" + patch_type: "portability" + - patch_file: "patches/fix-deprecated-literal-operator.patch" + patch_description: "Fix deprecated literal operator spacing for newer compilers" + patch_type: "portability" + - patch_file: "patches/remove_installs.patch" + patch_description: "Remove upstream install rules; the recipe packages the artifacts explicitly" + patch_type: "conan" diff --git a/thirdparty/bustache/all/conanfile.py b/thirdparty/bustache/all/conanfile.py new file mode 100644 index 0000000000..f62764d89a --- /dev/null +++ b/thirdparty/bustache/all/conanfile.py @@ -0,0 +1,81 @@ +# 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. + +import os + +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get + +required_conan_version = ">=2.0" + + +class BustacheConan(ConanFile): + name = "bustache" + description = "C++20 implementation of the {{mustache}} templates" + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/jamboree/bustache" + topics = ("mustache", "template", "text") + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("fmt/12.1.0", transitive_headers=True, transitive_libs=True) + + def validate(self): + check_min_cppstd(self, 20) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + apply_conandata_patches(self) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.variables["BUSTACHE_USE_FMT"] = True + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "README.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.hpp", src=os.path.join(self.source_folder, "include"), + dst=os.path.join(self.package_folder, "include"), keep_path=True) + copy(self, "*.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "bustache") + self.cpp_info.set_property("cmake_target_name", "bustache") + self.cpp_info.libs = ["bustache"] + self.cpp_info.defines = ["BUSTACHE_USE_FMT"] diff --git a/thirdparty/bustache/add-append.patch b/thirdparty/bustache/all/patches/add-append.patch similarity index 100% rename from thirdparty/bustache/add-append.patch rename to thirdparty/bustache/all/patches/add-append.patch diff --git a/thirdparty/bustache/fix-deprecated-literal-operator.patch b/thirdparty/bustache/all/patches/fix-deprecated-literal-operator.patch similarity index 100% rename from thirdparty/bustache/fix-deprecated-literal-operator.patch rename to thirdparty/bustache/all/patches/fix-deprecated-literal-operator.patch diff --git a/thirdparty/bustache/remove_installs.patch b/thirdparty/bustache/all/patches/remove_installs.patch similarity index 100% rename from thirdparty/bustache/remove_installs.patch rename to thirdparty/bustache/all/patches/remove_installs.patch diff --git a/thirdparty/bustache/config.yml b/thirdparty/bustache/config.yml new file mode 100644 index 0000000000..5b6af14d10 --- /dev/null +++ b/thirdparty/bustache/config.yml @@ -0,0 +1,18 @@ +# 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. + +versions: + "0.1.0": + folder: all diff --git a/thirdparty/google-cloud-cpp/all/conandata.yml b/thirdparty/google-cloud-cpp/all/conandata.yml new file mode 100644 index 0000000000..8125cfb9d2 --- /dev/null +++ b/thirdparty/google-cloud-cpp/all/conandata.yml @@ -0,0 +1,24 @@ +# 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. + +sources: + "2.47.1": + url: "https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v2.47.1.tar.gz" + sha256: "8863056af88460e449264a976f64a0c9f4f3d98477cdad7770c2dca353fea68c" +patches: + "2.47.1": + - patch_file: "patches/c++23_fixes.patch" + patch_description: "Fix C++23 compatibility issues" + patch_type: "portability" diff --git a/thirdparty/google-cloud-cpp/all/conanfile.py b/thirdparty/google-cloud-cpp/all/conanfile.py new file mode 100644 index 0000000000..fcc16e5dc3 --- /dev/null +++ b/thirdparty/google-cloud-cpp/all/conanfile.py @@ -0,0 +1,156 @@ +# 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. + +# Recipe based on https://github.com/conan-io/conan-center-index/blob/master/recipes/google-cloud-cpp/2.x/conanfile.py only building storage component +import os + +from conan import ConanFile +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=2.0.0" + + +class GoogleCloudCppConan(ConanFile): + name = "google-cloud-cpp" + description = "C++ Client Libraries for Google Cloud Services (storage only)" + license = "Apache-2.0" + topics = ( + "google", + "cloud", + "google-cloud-storage", + "google-cloud-platform", + ) + homepage = "https://github.com/googleapis/google-cloud-cpp" + url = "https://github.com/conan-io/conan-center-index" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = {"shared": [True, False], "fPIC": [True, False], "with_mocks": [True, False]} + default_options = {"shared": False, "fPIC": True, "with_mocks": False} + + short_paths = True + + @property + def _is_legacy_one_profile(self): + return not hasattr(self, "settings_build") + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def validate(self): + # As-of 2022-03, google-cloud-cpp only supports "Visual Studio >= 2019", + # and Visual Studio < 2019 is out of mainline support. + # The wikipedia page says this maps to 192* for the MSVC version: + # https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B + check_min_vs(self, "192") + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported by Visual Studio") + + if hasattr(self, "settings_build") and cross_building(self): + raise ConanInvalidConfiguration( + "Recipe not prepared for cross-building (yet)" + ) + + if (self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "6.0"): + raise ConanInvalidConfiguration("Clang version must be at least 6.0.") + + if self.settings.compiler.cppstd: + check_min_cppstd(self, 14) + + if (self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5.4"): + raise ConanInvalidConfiguration("Building requires GCC >= 5.4") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def requirements(self): + self.requires("abseil/20260526.0", transitive_headers=True) + self.requires("nlohmann_json/3.12.0") + self.requires("crc32c/1.1.2") + self.requires("libcurl/8.20.0") + self.requires("openssl/3.6.2") + self.requires("zlib/1.3.2") + if self.options.with_mocks: + self.requires("gtest/1.17.0", transitive_headers=True) + + def generate(self): + # google-cloud-cpp's storage-only build path never calls find_package(Threads), but google_cloud_cpp_common/storage still link against Threads::Threads. + threads_include = os.path.join(self.generators_folder, "conan_threads.cmake") + with open(threads_include, "w") as f: + f.write("find_package(Threads REQUIRED)\n") + + tc = CMakeToolchain(self) + tc.variables["CMAKE_PROJECT_INCLUDE"] = threads_include.replace("\\", "/") + tc.variables["BUILD_TESTING"] = False + tc.variables["GOOGLE_CLOUD_CPP_WITH_MOCKS"] = self.options.with_mocks + tc.variables["GOOGLE_CLOUD_CPP_ENABLE_MACOS_OPENSSL_CHECK"] = False + tc.variables["GOOGLE_CLOUD_CPP_ENABLE_WERROR"] = False + tc.variables["GOOGLE_CLOUD_CPP_ENABLE"] = "storage" + tc.generate() + VirtualBuildEnv(self).generate() + if self._is_legacy_one_profile: + VirtualRunEnv(self).generate(scope="build") + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, path=os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, path=os.path.join(self.package_folder, "lib", "pkgconfig")) + if self.options.with_mocks: + copy(self, "canonical_errors.h", + src=os.path.join(self.source_folder, "google", "cloud", "storage", "testing"), + dst=os.path.join(self.package_folder, "include", "google", "cloud", "storage", "testing")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "GoogleCloudCpp") + + self.cpp_info.components["common"].requires = ["abseil::absl_any", "abseil::absl_flat_hash_map", "abseil::absl_memory", "abseil::absl_optional", "abseil::absl_time"] + self.cpp_info.components["common"].libs = ["google_cloud_cpp_common"] + self.cpp_info.components["common"].names["pkg_config"] = "google_cloud_cpp_common" + + self.cpp_info.components["rest_internal"].requires = ["common", "libcurl::libcurl", "openssl::ssl", "openssl::crypto", "zlib::zlib"] + self.cpp_info.components["rest_internal"].libs = ["google_cloud_cpp_rest_internal"] + self.cpp_info.components["rest_internal"].names["pkg_config"] = "google_cloud_cpp_rest_internal" + + self.cpp_info.components["storage"].requires = ["rest_internal", "common", "nlohmann_json::nlohmann_json", "abseil::absl_memory", "abseil::absl_strings", "abseil::absl_str_format", "abseil::absl_time", "abseil::absl_variant", "crc32c::crc32c", "libcurl::libcurl", "openssl::ssl", "openssl::crypto", "zlib::zlib"] + self.cpp_info.components["storage"].libs = ["google_cloud_cpp_storage"] + self.cpp_info.components["storage"].names["pkg_config"] = "google_cloud_cpp_storage" + if self.options.with_mocks: + self.cpp_info.components["storage"].requires.append("gtest::gmock") diff --git a/thirdparty/google-cloud-cpp/c++23_fixes.patch b/thirdparty/google-cloud-cpp/all/patches/c++23_fixes.patch similarity index 100% rename from thirdparty/google-cloud-cpp/c++23_fixes.patch rename to thirdparty/google-cloud-cpp/all/patches/c++23_fixes.patch diff --git a/thirdparty/google-cloud-cpp/nlohmann_lib_as_interface.patch b/thirdparty/google-cloud-cpp/all/patches/nlohmann_lib_as_interface.patch similarity index 100% rename from thirdparty/google-cloud-cpp/nlohmann_lib_as_interface.patch rename to thirdparty/google-cloud-cpp/all/patches/nlohmann_lib_as_interface.patch diff --git a/thirdparty/google-cloud-cpp/remove-find_package.patch b/thirdparty/google-cloud-cpp/all/patches/remove-find_package.patch similarity index 100% rename from thirdparty/google-cloud-cpp/remove-find_package.patch rename to thirdparty/google-cloud-cpp/all/patches/remove-find_package.patch diff --git a/thirdparty/google-cloud-cpp/config.yml b/thirdparty/google-cloud-cpp/config.yml new file mode 100644 index 0000000000..ed00453f88 --- /dev/null +++ b/thirdparty/google-cloud-cpp/config.yml @@ -0,0 +1,3 @@ +versions: + "2.47.1": + folder: "all" diff --git a/thirdparty/google-cloud-cpp/remove_installation.patch b/thirdparty/google-cloud-cpp/remove_installation.patch deleted file mode 100644 index 4984d77f71..0000000000 --- a/thirdparty/google-cloud-cpp/remove_installation.patch +++ /dev/null @@ -1,258 +0,0 @@ -Subject: [PATCH] remove export ---- -Index: google/cloud/google_cloud_cpp_common.cmake -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/google/cloud/google_cloud_cpp_common.cmake b/google/cloud/google_cloud_cpp_common.cmake ---- a/google/cloud/google_cloud_cpp_common.cmake (revision e9eb0d1d8295966e7bca38c0ddf6529299db4f2b) -+++ b/google/cloud/google_cloud_cpp_common.cmake (date 1751639900095) -@@ -233,24 +233,7 @@ - - create_bazel_config(google_cloud_cpp_common YEAR 2018) - --# Export the CMake targets to make it easy to create configuration files. --install( -- EXPORT google_cloud_cpp_common-targets -- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_common" -- COMPONENT google_cloud_cpp_development) -- --# Install the libraries and headers in the locations determined by --# GNUInstallDirs --install( -- TARGETS google_cloud_cpp_common -- EXPORT google_cloud_cpp_common-targets -- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -- COMPONENT google_cloud_cpp_runtime -- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -- COMPONENT google_cloud_cpp_runtime -- NAMELINK_COMPONENT google_cloud_cpp_development -- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -- COMPONENT google_cloud_cpp_development) -+# Removed EXPORT of google_cloud_cpp_common-targets - - google_cloud_cpp_install_headers(google_cloud_cpp_common include/google/cloud) - -@@ -277,13 +260,6 @@ - VERSION ${PROJECT_VERSION} - COMPATIBILITY ExactVersion) - --install( -- FILES -- "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_common-config.cmake" -- "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_common-config-version.cmake" -- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_common" -- COMPONENT google_cloud_cpp_development) -- - if (GOOGLE_CLOUD_CPP_WITH_MOCKS) - # Create a header-only library for the mocks. We use a CMake `INTERFACE` - # library for these, a regular library would not work on macOS (where the -@@ -314,11 +290,7 @@ - DESTINATION "include/google/cloud/mocks" - COMPONENT google_cloud_cpp_development) - -- # Export the CMake targets to make it easy to create configuration files. -- install( -- EXPORT google_cloud_cpp_mocks-targets -- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_mocks" -- COMPONENT google_cloud_cpp_development) -+ # Removed EXPORT of google_cloud_cpp_mocks-targets - - install( - TARGETS google_cloud_cpp_mocks -@@ -337,13 +309,6 @@ - "google_cloud_cpp_mocks-config-version.cmake" - VERSION ${PROJECT_VERSION} - COMPATIBILITY ExactVersion) -- -- install( -- FILES -- "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_mocks-config.cmake" -- "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_mocks-config-version.cmake" -- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_mocks" -- COMPONENT google_cloud_cpp_development) - endif () - - if (BUILD_TESTING) -Index: google/cloud/google_cloud_cpp_rest_internal.cmake -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/google/cloud/google_cloud_cpp_rest_internal.cmake b/google/cloud/google_cloud_cpp_rest_internal.cmake ---- a/google/cloud/google_cloud_cpp_rest_internal.cmake (revision e9eb0d1d8295966e7bca38c0ddf6529299db4f2b) -+++ b/google/cloud/google_cloud_cpp_rest_internal.cmake (date 1751633114501) -@@ -169,11 +169,7 @@ - add_library(google-cloud-cpp::rest_internal ALIAS - google_cloud_cpp_rest_internal) - --# Export the CMake targets to make it easy to create configuration files. --install( -- EXPORT google_cloud_cpp_rest_internal-targets -- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_rest_internal" -- COMPONENT google_cloud_cpp_development) -+# # Removed EXPORT of google_cloud_cpp_rest_internal-targets - - # Install the libraries and headers in the locations determined by - # GNUInstallDirs -Index: google/cloud/google_cloud_cpp_rest_protobuf_internal.cmake -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/google/cloud/google_cloud_cpp_rest_protobuf_internal.cmake b/google/cloud/google_cloud_cpp_rest_protobuf_internal.cmake ---- a/google/cloud/google_cloud_cpp_rest_protobuf_internal.cmake (revision e9eb0d1d8295966e7bca38c0ddf6529299db4f2b) -+++ b/google/cloud/google_cloud_cpp_rest_protobuf_internal.cmake (date 1751642044339) -@@ -51,25 +51,7 @@ - - create_bazel_config(google_cloud_cpp_rest_protobuf_internal YEAR 2022) - --# Export the CMake targets to make it easy to create configuration files. --install( -- EXPORT google_cloud_cpp_rest_protobuf_internal-targets -- DESTINATION -- "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_rest_protobuf_internal" -- COMPONENT google_cloud_cpp_development) -- --# Install the libraries and headers in the locations determined by --# GNUInstallDirs --install( -- TARGETS google_cloud_cpp_rest_protobuf_internal -- EXPORT google_cloud_cpp_rest_protobuf_internal-targets -- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -- COMPONENT google_cloud_cpp_runtime -- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -- COMPONENT google_cloud_cpp_runtime -- NAMELINK_COMPONENT google_cloud_cpp_development -- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -- COMPONENT google_cloud_cpp_development) -+# Removed installation - - google_cloud_cpp_install_headers(google_cloud_cpp_rest_protobuf_internal - include/google/cloud) -Index: google/cloud/storage/google_cloud_cpp_storage_grpc.cmake -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/google/cloud/storage/google_cloud_cpp_storage_grpc.cmake b/google/cloud/storage/google_cloud_cpp_storage_grpc.cmake ---- a/google/cloud/storage/google_cloud_cpp_storage_grpc.cmake (revision e9eb0d1d8295966e7bca38c0ddf6529299db4f2b) -+++ b/google/cloud/storage/google_cloud_cpp_storage_grpc.cmake (date 1751642129371) -@@ -294,11 +294,6 @@ - "absl_time" - ${EXTRA_MODULES}) - --install( -- EXPORT storage_grpc-targets -- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_storage_grpc" -- COMPONENT google_cloud_cpp_development) -- - # Create and install the CMake configuration files. - configure_file("config-grpc.cmake.in" - "google_cloud_cpp_storage_grpc-config.cmake" @ONLY) -@@ -307,25 +302,6 @@ - VERSION ${PROJECT_VERSION} - COMPATIBILITY ExactVersion) - --install( -- FILES -- "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_storage_grpc-config.cmake" -- "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_storage_grpc-config-version.cmake" -- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_storage_grpc" -- COMPONENT google_cloud_cpp_development) -- --install( -- TARGETS google_cloud_cpp_storage_grpc google_cloud_cpp_storage_protos -- # TODO(#13857) - remove the backwards compatibility shims -- google_cloud_cpp_experimental_storage_grpc -- EXPORT storage_grpc-targets -- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -- COMPONENT google_cloud_cpp_runtime -- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -- COMPONENT google_cloud_cpp_runtime -- NAMELINK_COMPONENT google_cloud_cpp_development -- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -- COMPONENT google_cloud_cpp_development) - - google_cloud_cpp_install_headers(google_cloud_cpp_storage_grpc - include/google/cloud/storage) -Index: google/cloud/spanner/CMakeLists.txt -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/google/cloud/spanner/CMakeLists.txt b/google/cloud/spanner/CMakeLists.txt ---- a/google/cloud/spanner/CMakeLists.txt (revision e9eb0d1d8295966e7bca38c0ddf6529299db4f2b) -+++ b/google/cloud/spanner/CMakeLists.txt (date 1751642142713) -@@ -300,24 +300,7 @@ - create_bazel_config(google_cloud_cpp_spanner_rest YEAR "2023") - endif () - --# Export the CMake targets to make it easy to create configuration files. --install( -- EXPORT spanner-targets -- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_spanner" -- COMPONENT google_cloud_cpp_development) -- --# Install the libraries and headers in the locations determined by --# GNUInstallDirs --install( -- TARGETS google_cloud_cpp_spanner google_cloud_cpp_spanner_protos -- EXPORT spanner-targets -- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -- COMPONENT google_cloud_cpp_runtime -- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -- COMPONENT google_cloud_cpp_runtime -- NAMELINK_COMPONENT google_cloud_cpp_development -- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -- COMPONENT google_cloud_cpp_development) -+# Remove installation - - google_cloud_cpp_install_headers("google_cloud_cpp_spanner" - "include/google/cloud/spanner") -Index: google/cloud/storage/google_cloud_cpp_storage.cmake -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/google/cloud/storage/google_cloud_cpp_storage.cmake b/google/cloud/storage/google_cloud_cpp_storage.cmake ---- a/google/cloud/storage/google_cloud_cpp_storage.cmake (revision e9eb0d1d8295966e7bca38c0ddf6529299db4f2b) -+++ b/google/cloud/storage/google_cloud_cpp_storage.cmake (date 1751642105444) -@@ -313,22 +313,7 @@ - - create_bazel_config(google_cloud_cpp_storage) - --# Export the CMake targets to make it easy to create configuration files. --install( -- EXPORT storage-targets -- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_storage" -- COMPONENT google_cloud_cpp_development) -- --install( -- TARGETS google_cloud_cpp_storage -- EXPORT storage-targets -- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -- COMPONENT google_cloud_cpp_runtime -- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -- COMPONENT google_cloud_cpp_runtime -- NAMELINK_COMPONENT google_cloud_cpp_development -- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -- COMPONENT google_cloud_cpp_development) -+# Removed EXPORT of storage-targets - - google_cloud_cpp_install_headers(google_cloud_cpp_storage - include/google/cloud/storage) -@@ -361,12 +346,6 @@ - VERSION ${PROJECT_VERSION} - COMPATIBILITY ExactVersion) - --install( -- FILES -- "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_storage-config.cmake" -- "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_storage-config-version.cmake" -- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_storage" -- COMPONENT google_cloud_cpp_development) - - install( - FILES testing/mock_client.h diff --git a/thirdparty/grpc/all/cmake/grpc_plugin_template.cmake.in b/thirdparty/grpc/all/cmake/grpc_plugin_template.cmake.in new file mode 100644 index 0000000000..5ab1d94fab --- /dev/null +++ b/thirdparty/grpc/all/cmake/grpc_plugin_template.cmake.in @@ -0,0 +1,31 @@ +if(NOT TARGET @target_name@) + # Find @executable_name@ + ## Workaround for legacy "cmake" generator in case of cross-build + if(CMAKE_CROSSCOMPILING) + find_program(@find_program_variable@ + NAMES @executable_name@ + PATHS ENV PATH + NO_DEFAULT_PATH + ) + endif() + ## And here this will work fine with "CMakeToolchain" (for native & cross-build) + ## and legacy "cmake" generator in case of native build + if(NOT @find_program_variable@) + find_program(@find_program_variable@ NAMES @executable_name@) + endif() + ## Last resort: we search in package folder directly + if(NOT @find_program_variable@) + find_program(@find_program_variable@ + NAMES @executable_name@ + PATHS "${CMAKE_CURRENT_LIST_DIR}/@relative_path@bin/" + NO_DEFAULT_PATH + ) + endif() + + # Define @target_name@ imported target + if(@find_program_variable@) + get_filename_component(@find_program_variable@ "${@find_program_variable@}" ABSOLUTE) + add_executable(@target_name@ IMPORTED) + set_property(TARGET @target_name@ PROPERTY IMPORTED_LOCATION ${@find_program_variable@}) + endif() +endif() diff --git a/thirdparty/grpc/all/conan_cmake_project_include.cmake b/thirdparty/grpc/all/conan_cmake_project_include.cmake new file mode 100644 index 0000000000..56713eae38 --- /dev/null +++ b/thirdparty/grpc/all/conan_cmake_project_include.cmake @@ -0,0 +1,18 @@ +# 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. + +if (TARGET check_epollexclusive) + set_target_properties(check_epollexclusive PROPERTIES LINKER_LANGUAGE CXX) +endif() diff --git a/thirdparty/grpc/all/conandata.yml b/thirdparty/grpc/all/conandata.yml new file mode 100644 index 0000000000..9acfb37b5a --- /dev/null +++ b/thirdparty/grpc/all/conandata.yml @@ -0,0 +1,24 @@ +# 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. + +sources: + "1.82.0": + url: "https://github.com/grpc/grpc/archive/refs/tags/v1.82.0.tar.gz" + sha256: "d6851f59b9c4edb3218d2659a3abf1138e5bb4d2871c9e89c9330ed71756ed0b" +patches: + "1.82.0": + - patch_file: "patches/fix-msvc-auto-return-type-template-arg.patch" + patch_description: "Temporary patch for issue https://github.com/grpc/grpc/issues/41436" + patch_type: "fix" diff --git a/thirdparty/grpc/all/conanfile.py b/thirdparty/grpc/all/conanfile.py new file mode 100644 index 0000000000..71b4aa0186 --- /dev/null +++ b/thirdparty/grpc/all/conanfile.py @@ -0,0 +1,343 @@ +# 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. + +# Recipe based on https://github.com/conan-io/conan-center-index/blob/master/recipes/grpc/all/conanfile.py with added patches and removing with_libsystemd option + +import os +import yaml + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building, valid_min_cppstd, check_min_cppstd +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain, CMakeDeps +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rmdir +from conan.tools.microsoft import check_min_vs, is_msvc + +required_conan_version = ">=2.0.5" + +class GrpcConan(ConanFile): + name = "grpc" + description = "Google's RPC (remote procedure call) library and framework." + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/grpc/grpc" + topics = ("rpc",) + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + + options = { + "shared": [True, False], + "fPIC": [True, False], + "codegen": [True, False], + "csharp_ext": [True, False], + "cpp_plugin": [True, False], + "csharp_plugin": [True, False], + "node_plugin": [True, False], + "objective_c_plugin": [True, False], + "php_plugin": [True, False], + "python_plugin": [True, False], + "ruby_plugin": [True, False], + "otel_plugin": [True, False], + "secure": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "codegen": True, + "csharp_ext": False, + "cpp_plugin": True, + "csharp_plugin": False, + "node_plugin": False, + "objective_c_plugin": False, + "php_plugin": False, + "python_plugin": False, + "ruby_plugin": False, + "otel_plugin": False, + "secure": False + } + + _target_info = None + + @property + def _grpc_plugin_template(self): + return "grpc_plugin_template.cmake.in" + + @property + def _cxxstd_required(self): + return 17 + + def export(self): + copy(self, f"target_info/grpc_{self.version}.yml", src=self.recipe_folder, dst=self.export_folder) + + def export_sources(self): + copy(self, "conan_cmake_project_include.cmake", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) + copy(self, f"cmake/{self._grpc_plugin_template}", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.options["protobuf"].shared = True + + if cross_building(self): + self.options["grpc"].shared = True + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + # abseil requires: + # transitive_headers=True because grpc headers include abseil headers + # transitive_libs=True because generated code (grpc_cpp_plugin) require symbols from abseil + self.requires("protobuf/7.35.0", transitive_headers=True) + self.requires("abseil/20260526.0", force=True, transitive_headers=True, transitive_libs=True) + self.requires("re2/[>=20251105]") + self.requires("c-ares/[>=1.19.1 <2]") + self.requires("openssl/[>=1.1 <4]") + self.requires("zlib/1.3.2") + if self.options.get_safe("otel_plugin"): + self.requires("opentelemetry-cpp/1.14.2") + + def package_id(self): + del self.info.options.secure + + def validate(self): + check_min_vs(self, "190") + + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported by Visual Studio") + + check_min_cppstd(self, self._cxxstd_required) + + if self.options.shared and not self.dependencies.host["protobuf"].options.shared: + raise ConanInvalidConfiguration( + "If built as shared protobuf must be shared as well. " + "Please, use `protobuf:shared=True`.", + ) + + abseil_cppstd = self.dependencies.host['abseil'].info.settings.compiler.cppstd + if abseil_cppstd != self.settings.compiler.cppstd: + raise ConanInvalidConfiguration(f"grpc and abseil must be built with the same compiler.cppstd setting") + + def build_requirements(self): + # cmake >=3.25 required to use `cmake -E env --modify` below + self.tool_requires("cmake/[>=3.25]") + self.tool_requires("protobuf/") + if cross_building(self): + # when cross compiling we need pre compiled grpc plugins for protoc + self.tool_requires(f"grpc/{self.version}") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + apply_conandata_patches(self) + + # Let Conan define CMAKE_MSVC_RUNTIME_LIBRARY + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "include(cmake/msvc_static_runtime.cmake)", "") + + def generate(self): + tc = CMakeToolchain(self) + + tc.cache_variables["CMAKE_PROJECT_grpc_INCLUDE"] = os.path.join(self.source_folder, "conan_cmake_project_include.cmake") + + tc.cache_variables["gRPC_BUILD_CODEGEN"] = self.options.codegen + tc.cache_variables["gRPC_BUILD_CSHARP_EXT"] = self.options.csharp_ext + tc.cache_variables["gRPC_BUILD_TESTS"] = "OFF" + + # We need the generated cmake/ files (bc they depend on the list of targets, which is dynamic) + tc.cache_variables["gRPC_INSTALL"] = True + tc.cache_variables["gRPC_INSTALL_SHAREDIR"] = "res/grpc" + + # tell grpc to use the find_package versions + tc.cache_variables["gRPC_ZLIB_PROVIDER"] = "package" + tc.cache_variables["gRPC_CARES_PROVIDER"] = "package" + tc.cache_variables["gRPC_RE2_PROVIDER"] = "package" + tc.cache_variables["gRPC_SSL_PROVIDER"] = "package" + tc.cache_variables["gRPC_PROTOBUF_PROVIDER"] = "package" + tc.cache_variables["gRPC_ABSL_PROVIDER"] = "package" + tc.cache_variables["gRPC_OPENTELEMETRY_PROVIDER"] = "package" + + tc.cache_variables["gRPC_BUILD_GRPC_CPP_PLUGIN"] = self.options.cpp_plugin + tc.cache_variables["gRPC_BUILD_GRPC_CSHARP_PLUGIN"] = self.options.csharp_plugin + tc.cache_variables["gRPC_BUILD_GRPC_NODE_PLUGIN"] = self.options.node_plugin + tc.cache_variables["gRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN"] = self.options.objective_c_plugin + tc.cache_variables["gRPC_BUILD_GRPC_PHP_PLUGIN"] = self.options.php_plugin + tc.cache_variables["gRPC_BUILD_GRPC_PYTHON_PLUGIN"] = self.options.python_plugin + tc.cache_variables["gRPC_BUILD_GRPC_RUBY_PLUGIN"] = self.options.ruby_plugin + tc.cache_variables["gRPC_BUILD_GRPCPP_OTEL_PLUGIN"] = self.options.get_safe("otel_plugin", False) + + # Never download unnecessary archives + tc.cache_variables["gRPC_DOWNLOAD_ARCHIVES"] = False + + # Consumed targets (abseil) via interface target_compiler_feature can propagate newer standards + if not valid_min_cppstd(self, self._cxxstd_required): + tc.cache_variables["CMAKE_CXX_STANDARD"] = self._cxxstd_required + + if is_apple_os(self): + # workaround for: install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable + tc.cache_variables["CMAKE_MACOSX_BUNDLE"] = False + + tc.generate() + + cmake_deps = CMakeDeps(self) + cmake_deps.generate() + + def _patch_sources(self): + # Management of shared libs when grpc has shared dependencies (like protobuf) + # As the grpc_cpp_plugin that executes during the build will need those packages shared libs + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + variable, repl = None, None + if self.settings_build.os == "Macos": + # On macOS if all the following are true: + # - protoc from protobuf has shared library dependencies + # - grpc_cpp_plugin has shared library deps (when crossbuilding) + # - using `make` as the cmake generator + # Make will run commands via `/bin/sh` which will strip all env vars that start with `DYLD*` + # This workaround wraps the protoc command to be invoked by CMake with a modified environment + variable, repl = "DYLD_LIBRARY_PATH", "$ENV{DYLD_LIBRARY_PATH}" # to bypass OSX restrictions + elif not cross_building(self) and self.settings_build.os == "Linux": + # CMAKE_LIBRARY_PATH is defined by conan_toolchain.cmake, in Linux it is "lib" dir of .so dependencies + variable, repl = "LD_LIBRARY_PATH", "$" # to allow using protobuf/abseil as shared deps + elif not cross_building(self) and self.settings_build.os == "Windows": + # CONAN_RUNTIME_LIB_DIRS defined by conan_toolchain.cmake points to the "bin" folder in Linux, containing the DLLs + variable, repl = "PATH", "$" # to allow using protobuf/abseil as shared deps + + if variable and repl: + replace_in_file(self, cmakelists, + "COMMAND ${_gRPC_PROTOBUF_PROTOC_EXECUTABLE}", + f'COMMAND ${{CMAKE_COMMAND}} -E env --modify "{variable}=path_list_prepend:{repl}" ${{_gRPC_PROTOBUF_PROTOC_EXECUTABLE}}') + + if self.settings.os == "Macos": + # See https://github.com/grpc/grpc/issues/36654#issuecomment-2228569158 + replace_in_file(self, cmakelists, f"target_compile_features(upb_textformat_lib PUBLIC cxx_std_{self._cxxstd_required})", + f"""target_compile_features(upb_textformat_lib PUBLIC cxx_std_{self._cxxstd_required}) + target_link_options(upb_textformat_lib PRIVATE -Wl,-undefined,dynamic_lookup) + target_link_options(upb_json_lib PRIVATE -Wl,-undefined,dynamic_lookup) + """) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + @property + def target_info(self): + if self._target_info: + return self._target_info + target_info_file = os.path.join(self.recipe_folder, "target_info", f"grpc_{self.version}.yml") + with open(target_info_file) as f: + self._target_info = yaml.safe_load(f) + return self._target_info + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + # Create one custom module file per executable in order to emulate + # CMake executables imported targets of grpc plugins. + for plugin_info in self.target_info["grpc_plugins"]: + target = plugin_info["target"] + executable = plugin_info["executable"] + option_name = executable.replace("grpc_", "") + if self.options.get_safe(option_name): + self._create_executable_module_file(target, executable) + + def _create_executable_module_file(self, target, executable): + module_abs_path = os.path.join(self.package_folder, self._module_path) + + # Copy our CMake module template file to package folder + copy(self, self._grpc_plugin_template, src=os.path.join(self.source_folder, "cmake"), dst=module_abs_path) + + # Rename it + dst_file = os.path.join(module_abs_path, f"{executable}.cmake") + rename(self, os.path.join(module_abs_path, self._grpc_plugin_template), dst_file) + + # Replace placeholders + replace_in_file(self, dst_file, "@target_name@", target) + replace_in_file(self, dst_file, "@executable_name@", executable) + + find_program_var = "{}_PROGRAM".format(executable.upper()) + replace_in_file(self, dst_file, "@find_program_variable@", find_program_var) + + module_folder_depth = len(os.path.normpath(self._module_path).split(os.path.sep)) + rel_path = "".join(["../"] * module_folder_depth) + replace_in_file(self, dst_file, "@relative_path@", rel_path) + + @property + def _module_path(self): + return os.path.join("lib", "cmake", "conan_trick") + + @property + def _grpc_components(self): + system_libs = [] + if self.settings.os == "Windows": + system_libs = ["crypt32", "ws2_32", "wsock32"] + elif self.settings.os in ["Linux", "FreeBSD"]: + system_libs = ["m", "pthread"] + + targets = self.target_info['grpc_targets'] + components = {} + for target in targets: + if self.options.secure and target['name'] in ["grpc_unsecure", "grpc++_unsecure"]: + continue + if not self.options.codegen and target['name'] in ["grpc++_reflection", "grpcpp_channelz"]: + continue + components[target['name']] = { + "lib": target['lib'], + "requires": target.get('requires', []), + "system_libs": system_libs, + "frameworks": target.get('frameworks', []), + } + + return components + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "gRPC") + self.cpp_info.resdirs = ["res"] + ssl_roots_file_path = os.path.join(self.package_folder, "res", "grpc", "roots.pem") + self.runenv_info.define_path("GRPC_DEFAULT_SSL_ROOTS_FILE_PATH", ssl_roots_file_path) + + for component, values in self._grpc_components.items(): + target = values.get("lib") + lib = values.get("lib") + self.cpp_info.components[component].set_property("cmake_target_name", "gRPC::{}".format(target)) + # actually only gpr, grpc, grpc_unsecure, grpc++ and grpc++_unsecure should have a .pc file + self.cpp_info.components[component].set_property("pkg_config_name", target) + self.cpp_info.components[component].libs = [lib] + self.cpp_info.components[component].requires = values.get("requires", []) + self.cpp_info.components[component].system_libs = values.get("system_libs", []) + if is_apple_os(self): + self.cpp_info.components[component].frameworks = values.get("frameworks", []) + + # Executable imported targets are added through custom CMake module files, + # since conan generators don't know how to emulate these kind of targets. + grpc_modules = [] + for plugin_info in self.target_info["grpc_plugins"]: + executable = plugin_info["executable"] + option_name = executable.replace("grpc_", "") + if self.options.get_safe(option_name): + grpc_module_filename = "{}.cmake".format(executable) + grpc_modules.append(os.path.join(self._module_path, grpc_module_filename)) + self.cpp_info.set_property("cmake_build_modules", grpc_modules) diff --git a/thirdparty/grpc/fix-msvc-auto-return-type-template-arg.patch b/thirdparty/grpc/all/patches/fix-msvc-auto-return-type-template-arg.patch similarity index 91% rename from thirdparty/grpc/fix-msvc-auto-return-type-template-arg.patch rename to thirdparty/grpc/all/patches/fix-msvc-auto-return-type-template-arg.patch index f7be83b976..de6ca850c5 100644 --- a/thirdparty/grpc/fix-msvc-auto-return-type-template-arg.patch +++ b/thirdparty/grpc/all/patches/fix-msvc-auto-return-type-template-arg.patch @@ -1,7 +1,9 @@ Temporary patch for issue https://github.com/grpc/grpc/issues/41436 +diff --git a/src/core/call/call_filters.h b/src/core/call/call_filters.h +index 4ec8ac8473..95be3e008c 100644 --- a/src/core/call/call_filters.h +++ b/src/core/call/call_filters.h -@@ -1627,17 +1627,26 @@ +@@ -1627,17 +1627,26 @@ constexpr bool MethodHasChannelAccess = true; template constexpr bool AnyMethodHasChannelAccess = (MethodHasChannelAccess || ...); @@ -35,9 +37,11 @@ Temporary patch for issue https://github.com/grpc/grpc/issues/41436 } } // namespace filters_detail +diff --git a/src/core/lib/channel/promise_based_filter.h b/src/core/lib/channel/promise_based_filter.h +index 15fa55a4e7..178c12af8e 100644 --- a/src/core/lib/channel/promise_based_filter.h +++ b/src/core/lib/channel/promise_based_filter.h -@@ -1120,6 +1120,37 @@ +@@ -1122,6 +1122,37 @@ MakeFilterCall(Derived* derived) { return GetContext()->ManagedNew>(derived); } @@ -75,7 +79,7 @@ Temporary patch for issue https://github.com/grpc/grpc/issues/41436 } // namespace promise_filter_detail // Base class for promise-based channel filters. -@@ -1190,22 +1221,16 @@ +@@ -1192,22 +1223,16 @@ class ImplementChannelFilter : public ChannelFilter, CallArgs call_args, NextPromiseFactory next_promise_factory) final { auto* call = promise_filter_detail::MakeFilterCall( static_cast(this)); diff --git a/thirdparty/grpc/fix-protobuf-find-package.patch b/thirdparty/grpc/all/patches/fix-protobuf-find-package.patch similarity index 100% rename from thirdparty/grpc/fix-protobuf-find-package.patch rename to thirdparty/grpc/all/patches/fix-protobuf-find-package.patch diff --git a/thirdparty/grpc/all/target_info/grpc_1.82.0.yml b/thirdparty/grpc/all/target_info/grpc_1.82.0.yml new file mode 100644 index 0000000000..878fc92656 --- /dev/null +++ b/thirdparty/grpc/all/target_info/grpc_1.82.0.yml @@ -0,0 +1,266 @@ +# 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. + +grpc_version: 1.82.0 +grpc_targets: + - name: "address_sorting" + lib: "address_sorting" + - name: "gpr" + lib: "gpr" + requires: + - abseil::absl_base + - abseil::absl_config + - abseil::absl_core_headers + - abseil::absl_log_severity + - abseil::absl_cleanup + - abseil::absl_flags + - abseil::absl_flags_marshalling + - abseil::absl_any_invocable + - abseil::absl_bind_front + - abseil::absl_check + - abseil::absl_log_globals + - abseil::absl_log + - abseil::absl_memory + - abseil::absl_bits + - abseil::absl_random_random + - abseil::absl_status + - abseil::absl_cord + - abseil::absl_str_format + - abseil::absl_strings + - abseil::absl_synchronization + - abseil::absl_time + - abseil::absl_optional + - name: "_grpc" + lib: "grpc" + requires: + - upb_json_lib + - upb_textformat_lib + - re2::re2 + - zlib::zlib + - abseil::absl_algorithm_container + - abseil::absl_no_destructor + - abseil::absl_btree + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_node_hash_map + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_random_bit_gen_ref + - abseil::absl_random_distributions + - abseil::absl_statusor + - abseil::absl_string_view + - abseil::absl_span + - abseil::absl_utility + - c-ares::cares + - gpr + - openssl::ssl + - openssl::crypto + - address_sorting + frameworks: ['CoreFoundation'] + - name: "grpc_unsecure" + lib: "grpc_unsecure" + requires: + - upb_textformat_lib + - zlib::zlib + - abseil::absl_algorithm_container + - abseil::absl_no_destructor + - abseil::absl_btree + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_node_hash_map + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_random_bit_gen_ref + - abseil::absl_random_distributions + - abseil::absl_statusor + - abseil::absl_string_view + - abseil::absl_span + - abseil::absl_utility + - c-ares::cares + - gpr + - address_sorting + frameworks: ['CoreFoundation'] + - name: "upb_base_lib" + lib: "upb_base_lib" + - name: "upb_descriptor_lib" + lib: "upb_descriptor_lib" + - name: "upb_mini_descriptor_lib" + lib: "upb_mini_descriptor_lib" + requires: + - upb_mini_table_lib + - abseil::absl_strings + - name: "upb_wire_lib" + lib: "upb_wire_lib" + requires: + - utf8_range_lib + - upb_message_lib + - name: "upb_json_lib" + lib: "upb_json_lib" + requires: + - upb_lex_lib + - upb_reflection_lib + - name: "upb_mem_lib" + lib: "upb_mem_lib" + - name: "upb_message_lib" + lib: "upb_message_lib" + requires: + - upb_mini_table_lib + - name: "upb_textformat_lib" + lib: "upb_textformat_lib" + requires: + - upb_lex_lib + - upb_reflection_lib + - name: "upb_hash_lib" + lib: "upb_hash_lib" + requires: + - upb_base_lib + - upb_mem_lib + - name: "upb_lex_lib" + lib: "upb_lex_lib" + - name: "upb_mini_table_lib" + lib: "upb_mini_table_lib" + requires: + - upb_hash_lib + - name: "upb_reflection_lib" + lib: "upb_reflection_lib" + requires: + - upb_mini_descriptor_lib + - upb_descriptor_lib + - upb_wire_lib + - name: "utf8_range_lib" + lib: "utf8_range_lib" + - name: "grpc++" + lib: "grpc++" + requires: + - abseil::absl_dynamic_annotations + - abseil::absl_prefetch + - abseil::absl_layout + - abseil::absl_absl_check + - abseil::absl_absl_log + - abseil::absl_charset + - abseil::absl_strings_internal + - _grpc + - protobuf::libprotobuf + - name: "grpc++_alts" + lib: "grpc++_alts" + requires: + - grpc++ + - name: "grpc++_error_details" + lib: "grpc++_error_details" + requires: + - grpc++ + - name: "grpc++_reflection" + lib: "grpc++_reflection" + requires: + - grpc++ + - name: "grpc++_unsecure" + lib: "grpc++_unsecure" + requires: + - abseil::absl_dynamic_annotations + - abseil::absl_prefetch + - abseil::absl_layout + - abseil::absl_absl_check + - abseil::absl_absl_log + - abseil::absl_charset + - abseil::absl_strings_internal + - grpc_unsecure + - protobuf::libprotobuf + - name: "grpc_authorization_provider" + lib: "grpc_authorization_provider" + requires: + - upb_textformat_lib + - re2::re2 + - zlib::zlib + - abseil::absl_no_destructor + - abseil::absl_btree + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_inlined_vector + - abseil::absl_node_hash_map + - abseil::absl_function_ref + - abseil::absl_hash + - abseil::absl_type_traits + - abseil::absl_statusor + - abseil::absl_string_view + - abseil::absl_span + - abseil::absl_utility + - c-ares::cares + - gpr + - address_sorting + - name: "grpc_plugin_support" + lib: "grpc_plugin_support" + requires: + - utf8_range_lib + - zlib::zlib + - abseil::absl_algorithm_container + - abseil::absl_base + - abseil::absl_config + - abseil::absl_core_headers + - abseil::absl_dynamic_annotations + - abseil::absl_no_destructor + - abseil::absl_prefetch + - abseil::absl_cleanup + - abseil::absl_btree + - abseil::absl_fixed_array + - abseil::absl_flat_hash_map + - abseil::absl_flat_hash_set + - abseil::absl_layout + - abseil::absl_any_invocable + - abseil::absl_function_ref + - abseil::absl_overload + - abseil::absl_hash + - abseil::absl_absl_check + - abseil::absl_absl_log + - abseil::absl_memory + - abseil::absl_type_traits + - abseil::absl_bits + - abseil::absl_status + - abseil::absl_statusor + - abseil::absl_charset + - abseil::absl_cord + - abseil::absl_strings_internal + - abseil::absl_str_format + - abseil::absl_string_view + - abseil::absl_strings + - abseil::absl_synchronization + - abseil::absl_time + - abseil::absl_optional + - abseil::absl_span + - abseil::absl_utility + - protobuf::libprotobuf + - protobuf::libprotoc + - name: "grpcpp_channelz" + lib: "grpcpp_channelz" + requires: + - grpc++ +grpc_plugins: + - target: "gRPC::grpc_cpp_plugin" + executable: "grpc_cpp_plugin" + - target: "gRPC::grpc_csharp_plugin" + executable: "grpc_csharp_plugin" + - target: "gRPC::grpc_node_plugin" + executable: "grpc_node_plugin" + - target: "gRPC::grpc_objective_c_plugin" + executable: "grpc_objective_c_plugin" + - target: "gRPC::grpc_php_plugin" + executable: "grpc_php_plugin" + - target: "gRPC::grpc_python_plugin" + executable: "grpc_python_plugin" + - target: "gRPC::grpc_ruby_plugin" + executable: "grpc_ruby_plugin" diff --git a/thirdparty/grpc/config.yml b/thirdparty/grpc/config.yml new file mode 100644 index 0000000000..a69bf44bda --- /dev/null +++ b/thirdparty/grpc/config.yml @@ -0,0 +1,18 @@ +# 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. + +versions: + "1.82.0": + folder: "all" diff --git a/thirdparty/grpc/fix-glob-missing-algorithm-include.patch b/thirdparty/grpc/fix-glob-missing-algorithm-include.patch deleted file mode 100644 index 7aa7e30288..0000000000 --- a/thirdparty/grpc/fix-glob-missing-algorithm-include.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/src/core/util/glob.cc b/src/core/util/glob.cc -index 1b1c16e23d..555d595722 100644 ---- a/src/core/util/glob.cc -+++ b/src/core/util/glob.cc -@@ -12,6 +12,7 @@ - // See the License for the specific language governing permissions and - // limitations under the License. - -+#include - #include "absl/strings/string_view.h" - - namespace grpc_core { diff --git a/thirdparty/grpc/fix-memory-request-missing-string-include.patch b/thirdparty/grpc/fix-memory-request-missing-string-include.patch deleted file mode 100644 index ba68a608a8..0000000000 --- a/thirdparty/grpc/fix-memory-request-missing-string-include.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/include/grpc/event_engine/memory_request.h b/include/grpc/event_engine/memory_request.h -index 5c74bdb..abc1234 100644 ---- a/include/grpc/event_engine/memory_request.h -+++ b/include/grpc/event_engine/memory_request.h -@@ -17,6 +17,7 @@ - #include - #include - -+#include - #include "absl/strings/string_view.h" - - namespace grpc_event_engine { diff --git a/thirdparty/jolt-tests/all/conandata.yml b/thirdparty/jolt-tests/all/conandata.yml new file mode 100644 index 0000000000..1a92376979 --- /dev/null +++ b/thirdparty/jolt-tests/all/conandata.yml @@ -0,0 +1,19 @@ +# 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. + +sources: + "0.1.8": + url: "https://github.com/bazaarvoice/jolt/archive/refs/tags/jolt-0.1.8.tar.gz" + sha256: "7423c5b98244260f89a975f5e21150c02a6a1fa88e3af07c90d43fef0eebdcbb" diff --git a/thirdparty/jolt-tests/all/conanfile.py b/thirdparty/jolt-tests/all/conanfile.py new file mode 100644 index 0000000000..204ae6ab92 --- /dev/null +++ b/thirdparty/jolt-tests/all/conanfile.py @@ -0,0 +1,55 @@ +# 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. + +import os + +from conan import ConanFile +from conan.tools.files import copy, get, save + +required_conan_version = ">=2.0" + + +class JoltTestsConan(ConanFile): + name = "jolt-tests" + description = "Jolt JSON transformation test resources used by the MiNiFi C++ unit tests" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/bazaarvoice/jolt" + topics = ("jolt", "json", "transform", "test-data") + package_type = "build-scripts" + # No settings: this package ships only test data, so it is configuration independent. + + # Test resources the MiNiFi unit tests consume, relative to the extracted source root. + _res_subdir = "jolt-core/src/test/resources/json/shiftr" + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, self._res_subdir), + dst=os.path.join(self.package_folder, "res", self._res_subdir)) + # Expose jolt_tests_SOURCE_DIR the same way the bundled FetchContent build does, so the + # consumer can build "${jolt_tests_SOURCE_DIR}/jolt-core/src/test/resources/json/shiftr". + save(self, os.path.join(self.package_folder, "res", "conan-jolt-tests-variables.cmake"), + 'set(jolt_tests_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}")\n') + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "jolt-tests") + self.cpp_info.set_property("cmake_build_modules", [os.path.join("res", "conan-jolt-tests-variables.cmake")]) + self.cpp_info.builddirs = ["res"] + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.bindirs = [] diff --git a/thirdparty/jolt-tests/config.yml b/thirdparty/jolt-tests/config.yml new file mode 100644 index 0000000000..fc4714fe56 --- /dev/null +++ b/thirdparty/jolt-tests/config.yml @@ -0,0 +1,18 @@ +# 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. + +versions: + "0.1.8": + folder: all diff --git a/thirdparty/kubernetes-client-c/all/conandata.yml b/thirdparty/kubernetes-client-c/all/conandata.yml new file mode 100644 index 0000000000..14d69a8a7a --- /dev/null +++ b/thirdparty/kubernetes-client-c/all/conandata.yml @@ -0,0 +1,19 @@ +# 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. + +sources: + "0.14.0": + url: "https://github.com/kubernetes-client/c/archive/refs/tags/v0.14.0.tar.gz" + sha256: "52216183b540cd10cfe33da326c7a529c127e9bca3cc512533059374591cbdc4" diff --git a/thirdparty/kubernetes-client-c/all/conanfile.py b/thirdparty/kubernetes-client-c/all/conanfile.py new file mode 100644 index 0000000000..e67e9a8b95 --- /dev/null +++ b/thirdparty/kubernetes-client-c/all/conanfile.py @@ -0,0 +1,86 @@ +# 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. + +# Recipe based on https://github.com/conan-io/conan-center-index/blob/master/recipes/kubernetes/all/conanfile.py +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.files import get, copy, rmdir +from conan.errors import ConanInvalidConfiguration +from os.path import join + +required_conan_version = ">=2.4" + +class kubernetesRecipe(ConanFile): + name = "kubernetes" + package_type = "library" + + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/kubernetes-client/c" + description = "Official C client library for Kubernetes" + topics = ("kubernetes", "k8s", "kubernetes-client", "k8s-client") + + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False], "fPIC": [True, False]} + default_options = {"shared": False, "fPIC": True} + + implements = ["auto_shared_fpic", "auto_language"] + languages = "C" + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def validate(self): + if self.settings.compiler == "msvc": + raise ConanInvalidConfiguration(f"{self.ref} can not be used on msvc.") + + def requirements(self): + self.requires("libcurl/8.20.0", transitive_headers=True) + self.requires("openssl/3.6.2") + self.requires("libwebsockets/4.3.2", transitive_headers=True) + self.requires("libyaml/0.2.5") + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_STATIC_LIBS"] = not self.options.shared + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder="kubernetes") + cmake.build() + + def package(self): + copy(self, "*.h", src=join(self.source_folder, "kubernetes", "api"), dst=join(self.package_folder, "include/kubernetes/api"), keep_path=False) + copy(self, "*.h", src=join(self.source_folder, "kubernetes", "model"), dst=join(self.package_folder, "include/kubernetes/model"), keep_path=False) + copy(self, "*.h", src=join(self.source_folder, "kubernetes", "config"), dst=join(self.package_folder, "include/kubernetes/config"), keep_path=False) + copy(self, "*.h", src=join(self.source_folder, "kubernetes", "include"), dst=join(self.package_folder, "include/kubernetes/include"), keep_path=False) + copy(self, "*.h", src=join(self.source_folder, "kubernetes", "websocket"), dst=join(self.package_folder, "include/kubernetes/websocket"), keep_path=False) + copy(self, "*.h", src=join(self.source_folder, "kubernetes", "external"), dst=join(self.package_folder, "include/kubernetes/external"), keep_path=False) + copy(self, "*.h", src=join(self.source_folder, "kubernetes", "watch"), dst=join(self.package_folder, "include/kubernetes/watch"), keep_path=False) + copy(self, "LICENSE", src=join(self.source_folder), dst=join(self.package_folder, "licenses"), keep_path=False) + cmake = CMake(self) + cmake.install() + rmdir(self, join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["kubernetes"] diff --git a/thirdparty/kubernetes-client-c/remove-findpackage.patch b/thirdparty/kubernetes-client-c/all/patches/remove-findpackage.patch similarity index 100% rename from thirdparty/kubernetes-client-c/remove-findpackage.patch rename to thirdparty/kubernetes-client-c/all/patches/remove-findpackage.patch diff --git a/thirdparty/kubernetes-client-c/config.yml b/thirdparty/kubernetes-client-c/config.yml new file mode 100644 index 0000000000..5bdbaddbf4 --- /dev/null +++ b/thirdparty/kubernetes-client-c/config.yml @@ -0,0 +1,18 @@ +# 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. + +versions: + "0.14.0": + folder: "all" diff --git a/thirdparty/llamacpp/all/conandata.yml b/thirdparty/llamacpp/all/conandata.yml new file mode 100644 index 0000000000..63bb038284 --- /dev/null +++ b/thirdparty/llamacpp/all/conandata.yml @@ -0,0 +1,23 @@ +# 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. + +sources: + "b8944": + url: "https://github.com/ggml-org/llama.cpp/archive/refs/tags/b8944.tar.gz" + sha256: "ca231c8aca086f56bad3ed371f6dc5b01e971e812a8ddf67564f087390c0e781" +patches: + "b8944": + - patch_file: "patches/mtmd-fix.patch" + strip: 1 diff --git a/thirdparty/llamacpp/all/conanfile.py b/thirdparty/llamacpp/all/conanfile.py new file mode 100644 index 0000000000..6bed1d3ccf --- /dev/null +++ b/thirdparty/llamacpp/all/conanfile.py @@ -0,0 +1,257 @@ +# 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. + +# Recipe based on https://github.com/conan-io/conan-center-index/blob/master/recipes/llama-cpp/all/conanfile.py + +import os +import textwrap + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import save, copy, get, rmdir, export_conandata_patches, apply_conandata_patches + +required_conan_version = ">=2.0.9" + + +class LlamaCppConan(ConanFile): + name = "llama-cpp" + description = "Inference of LLaMA model in pure C/C++" + topics = ("llama", "llm", "ai") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ggerganov/llama.cpp" + license = "MIT" + settings = "os", "arch", "compiler", "build_type" + package_type = "library" + + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_examples": [True, False], + "with_cuda": [True, False], + "with_curl": [True, False], + "with_vulkan": [True, False], + "portable": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "with_examples": False, + "with_cuda": False, + "with_curl": False, + "with_vulkan": False, + "portable": True + } + + implements = ["auto_shared_fpic"] + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if is_apple_os(self): + del self.options.with_vulkan + + @property + def _cuda_build_module(self): + # Adding this to the package info is necessary if we want consumers of llama to link correctly when + # they activate the CUDA option. In the future, when we have a CUDA recipe this could be removed. + cuda_target = "ggml-cuda" + return textwrap.dedent(f"""\ + find_dependency(CUDAToolkit REQUIRED) + if (WIN32) + # As of CUDA 12.3.1, Windows does not offer a static cublas library + target_link_libraries({cuda_target} INTERFACE CUDA::cudart_static CUDA::cublas CUDA::cublasLt CUDA::cuda_driver) + else () + target_link_libraries({cuda_target} INTERFACE CUDA::cudart_static CUDA::cublas_static CUDA::cublasLt_static CUDA::cuda_driver) + endif() + """) + + def validate(self): + check_min_cppstd(self, 17) + + def validate_build(self): + if self.settings.compiler == "msvc" and "arm" in self.settings.arch: + raise ConanInvalidConfiguration("llama-cpp does not support ARM architecture on msvc, it recommends to use clang instead") + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_curl: + self.requires("libcurl/8.20.0") + + if self.options.get_safe("with_vulkan"): + self.requires("vulkan-loader/[>=1.3 <1.5]") + + def build_requirements(self): + if self.options.get_safe("with_vulkan"): + self.tool_requires("shaderc/[>=2025.3]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + apply_conandata_patches(self) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + + tc = CMakeToolchain(self) + if self.settings.compiler == "msvc": + # llama-chat.cpp's LU8 macro relies on __cplusplus to cast u8 literals to (const char*), + # but MSVC only reports the real __cplusplus value with /Zc:__cplusplus. Without it, the + # literals stay char8_t under /std:c++latest and fail to compile. + tc.extra_cxxflags.append("/Zc:__cplusplus") + tc.variables["BUILD_SHARED_LIBS"] = bool(self.options.shared) + tc.variables["LLAMA_STANDALONE"] = False + tc.variables["LLAMA_BUILD_TESTS"] = False + tc.variables["LLAMA_BUILD_EXAMPLES"] = self.options.get_safe("with_examples") + tc.variables["LLAMA_CURL"] = self.options.get_safe("with_curl") + tc.variables["LLAMA_BUILD_SERVER"] = False + tc.variables["LLAMA_BUILD_TOOLS"] = False + tc.variables["LLAMA_BUILD_COMMON"] = True + tc.variables["GGML_OPENMP"] = False + tc.variables["GGML_METAL"] = False + tc.variables["GGML_BLAS"] = False + if cross_building(self): + tc.variables["LLAMA_NATIVE"] = False + tc.variables["GGML_NATIVE_DEFAULT"] = False + + tc.variables["GGML_BUILD_TESTS"] = False + tc.variables["GGML_BUILD_EXAMPLES"] = False + tc.variables["GGML_CUDA"] = self.options.get_safe("with_cuda") + + if self.options.get_safe("with_vulkan"): + tc.variables["GGML_VULKAN"] = True + shaderc_bin_path = os.path.join(self.dependencies.build["shaderc"].cpp_info.bindir, "glslc").replace("\\", "/") + tc.variables["Vulkan_GLSLC_EXECUTABLE"] = shaderc_bin_path + + if self.options.portable: + tc.variables["GGML_NATIVE"] = False + else: + tc.variables["GGML_NATIVE"] = True + + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + copy(self, "*", os.path.join(self.source_folder, "models"), os.path.join(self.package_folder, "res", "models")) + copy(self, "*.h*", os.path.join(self.source_folder, "common"), os.path.join(self.package_folder, "include", "common")) + copy(self, "*.h*", os.path.join(self.source_folder, "tools", "mtmd"), os.path.join(self.package_folder, "include", "mtmd")) + copy(self, "*mtmd*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*mtmd*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*mtmd*.so", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*mtmd*.dylib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*mtmd*.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*common*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*common*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*common*.so", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*common*.dylib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*common*.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*httplib*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*httplib*.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + if self.options.with_cuda and not self.options.shared: + save(self, os.path.join(self.package_folder, "lib", "cmake", "llama-cpp-cuda-static.cmake"), self._cuda_build_module) + + def _get_backends(self): + results = ["cpu"] + if self.options.with_cuda: + results.append("cuda") + if self.options.get_safe("with_vulkan"): + results.append("vulkan") + return results + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "llamacpp") + self.cpp_info.components["ggml"].libs = ["ggml"] + self.cpp_info.components["ggml"].resdirs = ["res"] + self.cpp_info.components["ggml"].set_property("cmake_target_name", "ggml::all") + if self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.components["ggml"].system_libs.append("dl") + + self.cpp_info.components["llama"].libs = ["llama"] + self.cpp_info.components["llama"].resdirs = ["res"] + self.cpp_info.components["llama"].requires.append("ggml") + + self.cpp_info.components["common"].includedirs = [os.path.join("include", "common")] + if self.options.shared: + self.cpp_info.components["common"].libs = ["llama-common"] + else: + self.cpp_info.components["common"].libs = ["llama-common", "llama-common-base", "cpp-httplib"] + self.cpp_info.components["common"].requires = ["llama"] + + self.cpp_info.components["mtmd"].libs = ["mtmd"] + self.cpp_info.components["mtmd"].includedirs = ["include"] + self.cpp_info.components["mtmd"].requires = ["llama", "common"] + + if self.options.with_curl: + self.cpp_info.components["common"].requires.append("libcurl::libcurl") + self.cpp_info.components["common"].defines.append("LLAMA_USE_CURL") + + if is_apple_os(self): + self.cpp_info.components["common"].frameworks.extend(["Foundation", "Accelerate", "Metal"]) + elif self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.components["common"].system_libs.extend(["dl", "m", "pthread", "gomp"]) + + if self.options.with_cuda and not self.options.shared: + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + module_path = os.path.join("lib", "cmake", "llama-cpp-cuda-static.cmake") + self.cpp_info.set_property("cmake_build_modules", [module_path]) + + self.cpp_info.components["ggml-base"].libs = ["ggml-base"] + self.cpp_info.components["ggml-base"].resdirs = ["res"] + self.cpp_info.components["ggml-base"].set_property("cmake_target_name", "ggml-base") + + self.cpp_info.components["ggml"].requires = ["ggml-base"] + if self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.components["ggml-base"].system_libs.extend(["dl", "m", "pthread"]) + + + if self.options.shared: + self.cpp_info.components["llama"].defines.append("LLAMA_SHARED") + self.cpp_info.components["ggml-base"].defines.append("GGML_SHARED") + self.cpp_info.components["ggml"].defines.append("GGML_SHARED") + + backends = self._get_backends() + for backend in backends: + self.cpp_info.components[f"ggml-{backend}"].libs = [f"ggml-{backend}"] + self.cpp_info.components[f"ggml-{backend}"].resdirs = ["res"] + self.cpp_info.components[f"ggml-{backend}"].set_property("cmake_target_name", f"ggml-{backend}") + if self.options.shared: + self.cpp_info.components[f"ggml-{backend}"].defines.append("GGML_BACKEND_SHARED") + self.cpp_info.components["ggml"].defines.append(f"GGML_USE_{backend.upper()}") + self.cpp_info.components["ggml"].requires.append(f"ggml-{backend}") + + if backend == "vulkan": + self.cpp_info.components["ggml-vulkan"].requires.append("vulkan-loader::vulkan-loader") + + if is_apple_os(self): + if "blas" in backends: + self.cpp_info.components["ggml-blas"].frameworks.append("Accelerate") + if "metal" in backends: + self.cpp_info.components["ggml-metal"].frameworks.extend(["Metal", "MetalKit", "Foundation", "CoreFoundation"]) diff --git a/thirdparty/llamacpp/mtmd-fix.patch b/thirdparty/llamacpp/all/patches/mtmd-fix.patch similarity index 100% rename from thirdparty/llamacpp/mtmd-fix.patch rename to thirdparty/llamacpp/all/patches/mtmd-fix.patch diff --git a/thirdparty/llamacpp/config.yml b/thirdparty/llamacpp/config.yml new file mode 100644 index 0000000000..b758deb664 --- /dev/null +++ b/thirdparty/llamacpp/config.yml @@ -0,0 +1,18 @@ +# 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. + +versions: + "b8944": + folder: "all" diff --git a/thirdparty/ossp-uuid/all/conandata.yml b/thirdparty/ossp-uuid/all/conandata.yml new file mode 100644 index 0000000000..103595a675 --- /dev/null +++ b/thirdparty/ossp-uuid/all/conandata.yml @@ -0,0 +1,30 @@ +# 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. + +sources: + "1.6.2": + url: "https://deb.debian.org/debian/pool/main/o/ossp-uuid/ossp-uuid_1.6.2.orig.tar.gz" + sha256: "11a615225baa5f8bb686824423f50e4427acd3f70d394765bdff32801f0fd5b0" +patches: + "1.6.2": + - patch_file: "patches/ossp-uuid-mac-fix.patch" + patch_description: "Fix MAC address resolution and multicast bit handling" + patch_type: "portability" + - patch_file: "patches/ossp-uuid-no-prog.patch" + patch_description: "Do not build or install the uuid command line program" + patch_type: "portability" + - patch_file: "patches/ossp-uuid-update-config-guess.patch" + patch_description: "Update config.guess to support modern platforms" + patch_type: "portability" diff --git a/thirdparty/ossp-uuid/all/conanfile.py b/thirdparty/ossp-uuid/all/conanfile.py new file mode 100644 index 0000000000..1874575939 --- /dev/null +++ b/thirdparty/ossp-uuid/all/conanfile.py @@ -0,0 +1,95 @@ +# 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. + +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout + +required_conan_version = ">=2.0" + + +class OsspUuidConan(ConanFile): + name = "ossp-uuid" + description = "OSSP uuid is an ISO-C:1999 API and CLI for generating DCE, ISO/IEC and RFC 4122 Universally Unique Identifiers (UUID)" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://www.ossp.org/pkg/lib/uuid/" + topics = ("uuid", "unique-identifier", "guid") + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + # ossp-uuid only supports in-source builds + self.folders.build = self.folders.source + + def validate(self): + if self.settings.os == "Windows": + raise ConanInvalidConfiguration("ossp-uuid does not support Windows") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args.append("--with-cxx") + tc.configure_args.append("--without-perl") + tc.configure_args.append("--without-php") + tc.configure_args.append("--without-pgsql") + tc.configure_args.append("--disable-shared") + tc.configure_args.append("--enable-static") + if self.settings.build_type == "Debug": + tc.configure_args.append("--enable-debug=yes") + tc.generate() + + def build(self): + for patch_data in self.conan_data.get("patches", {}).get(self.version, []): + patch_file = os.path.join(self.export_sources_folder, patch_data["patch_file"]) + self.run(f'patch -p1 -N -i "{patch_file}"', cwd=self.source_folder) + autotools = Autotools(self) + autotools.configure(build_script_folder=self.source_folder) + autotools.make() + + def package(self): + copy(self, "README", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "ossp-uuid") + + self.cpp_info.components["libuuid"].set_property("cmake_target_name", "OSSP::libuuid") + self.cpp_info.components["libuuid"].libs = ["uuid"] + + self.cpp_info.components["libuuid++"].set_property("cmake_target_name", "OSSP::libuuid++") + self.cpp_info.components["libuuid++"].libs = ["uuid++"] + self.cpp_info.components["libuuid++"].requires = ["libuuid"] diff --git a/thirdparty/ossp-uuid/ossp-uuid-mac-fix.patch b/thirdparty/ossp-uuid/all/patches/ossp-uuid-mac-fix.patch similarity index 100% rename from thirdparty/ossp-uuid/ossp-uuid-mac-fix.patch rename to thirdparty/ossp-uuid/all/patches/ossp-uuid-mac-fix.patch diff --git a/thirdparty/ossp-uuid/ossp-uuid-no-prog.patch b/thirdparty/ossp-uuid/all/patches/ossp-uuid-no-prog.patch similarity index 100% rename from thirdparty/ossp-uuid/ossp-uuid-no-prog.patch rename to thirdparty/ossp-uuid/all/patches/ossp-uuid-no-prog.patch diff --git a/thirdparty/ossp-uuid/ossp-uuid-update-config-guess.patch b/thirdparty/ossp-uuid/all/patches/ossp-uuid-update-config-guess.patch similarity index 99% rename from thirdparty/ossp-uuid/ossp-uuid-update-config-guess.patch rename to thirdparty/ossp-uuid/all/patches/ossp-uuid-update-config-guess.patch index 4b2a619a80..e707c11aac 100644 --- a/thirdparty/ossp-uuid/ossp-uuid-update-config-guess.patch +++ b/thirdparty/ossp-uuid/all/patches/ossp-uuid-update-config-guess.patch @@ -1,4 +1,4 @@ - diff --git a/config.guess b/config.guess +diff --git a/config.guess b/config.guess index ca2a03c..69188da 100755 --- a/config.guess +++ b/config.guess diff --git a/thirdparty/ossp-uuid/config.yml b/thirdparty/ossp-uuid/config.yml new file mode 100644 index 0000000000..82a6c1e459 --- /dev/null +++ b/thirdparty/ossp-uuid/config.yml @@ -0,0 +1,18 @@ +# 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. + +versions: + "1.6.2": + folder: all diff --git a/thirdparty/rpmalloc/all/CMakeLists.txt b/thirdparty/rpmalloc/all/CMakeLists.txt new file mode 100644 index 0000000000..4547796ce3 --- /dev/null +++ b/thirdparty/rpmalloc/all/CMakeLists.txt @@ -0,0 +1,28 @@ +# 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. + +cmake_minimum_required(VERSION 3.15) +project(rpmalloc C) + +# rpmalloc does not ship a CMake build; this mirrors the bundled RpMalloc.cmake target. +add_library(rpmalloc STATIC rpmalloc/rpmalloc.c) +target_include_directories(rpmalloc PUBLIC + $ + $) +target_compile_definitions(rpmalloc PRIVATE ENABLE_OVERRIDE=1 ENABLE_PRELOAD=1) + +include(GNUInstallDirs) +install(TARGETS rpmalloc ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(FILES rpmalloc/rpmalloc.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/thirdparty/rpmalloc/all/conandata.yml b/thirdparty/rpmalloc/all/conandata.yml new file mode 100644 index 0000000000..1d4dc8d2fb --- /dev/null +++ b/thirdparty/rpmalloc/all/conandata.yml @@ -0,0 +1,19 @@ +# 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. + +sources: + "1.4.5": + url: "https://github.com/mjansson/rpmalloc/archive/refs/tags/1.4.5.tar.gz" + sha256: "2513626697ef72a60957acc8caed17c39931a55c1a49202707de195742683d69" diff --git a/thirdparty/rpmalloc/all/conanfile.py b/thirdparty/rpmalloc/all/conanfile.py new file mode 100644 index 0000000000..9164b1b1b9 --- /dev/null +++ b/thirdparty/rpmalloc/all/conanfile.py @@ -0,0 +1,69 @@ +# 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. + +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get + +required_conan_version = ">=2.0" + + +class RpmallocConan(ConanFile): + name = "rpmalloc" + description = "rpmalloc is a public domain, cross platform lock free thread caching 16-byte aligned memory allocator" + license = "Unlicense" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mjansson/rpmalloc" + topics = ("malloc", "allocator", "memory") + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } + + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "rpmalloc") + self.cpp_info.set_property("cmake_target_name", "rpmalloc") + self.cpp_info.libs = ["rpmalloc"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread"] diff --git a/thirdparty/rpmalloc/config.yml b/thirdparty/rpmalloc/config.yml new file mode 100644 index 0000000000..9ab51109d3 --- /dev/null +++ b/thirdparty/rpmalloc/config.yml @@ -0,0 +1,18 @@ +# 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. + +versions: + "1.4.5": + folder: all