diff --git a/.github/conan/compatibility.py b/.github/conan/compatibility.py new file mode 100644 index 0000000000..cb6d69b7b8 --- /dev/null +++ b/.github/conan/compatibility.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. + +from conan.tools.build import supported_cppstd, supported_cstd + + +def cppstd_compat(conanfile): + # It will try to find packages with all the cppstd versions + extension_properties = getattr(conanfile, "extension_properties", {}) + compiler = conanfile.settings.get_safe("compiler") + compiler_version = conanfile.settings.get_safe("compiler.version") + cppstd = conanfile.settings.get_safe("compiler.cppstd") + if not compiler or not compiler_version: + return [] + factors = [] # List of list, each sublist is a potential combination + if cppstd is not None and extension_properties.get("compatibility_cppstd") is not False: + cppstd_possible_values = supported_cppstd(conanfile) + if cppstd_possible_values is None: + conanfile.output.warning(f'No cppstd compatibility defined for compiler "{compiler}"') + else: # The current cppst must be included in case there is other factor + factors.append([{"compiler.cppstd": v} for v in cppstd_possible_values]) + + cstd = conanfile.settings.get_safe("compiler.cstd") + if cstd is not None and extension_properties.get("compatibility_cstd") is not False: + cstd_possible_values = supported_cstd(conanfile) + if cstd_possible_values is None: + conanfile.output.warning(f'No cstd compatibility defined for compiler "{compiler}"') + else: + factors.append([{"compiler.cstd": v} for v in cstd_possible_values if v != cstd]) + return factors + + +def compatibility(conanfile): + # By default, different compiler.cppstd are compatible + # factors is a list of lists + factors = cppstd_compat(conanfile) + + # MSVC fallback compatibility + compiler = conanfile.settings.get_safe("compiler") + compiler_version = conanfile.settings.get_safe("compiler.version") + if compiler == "msvc": + msvc_fallbacks = { + "195": ["194", "193"], + "194": ["193"], + }.get(compiler_version, []) + + if msvc_fallbacks: + factors.append([{"compiler.version": v} for v in msvc_fallbacks]) + + # macOS / apple-clang: accept any compiler.version >= 13 as compatible + os_ = conanfile.settings.get_safe("os") + if os_ == "Macos" and compiler == "apple-clang" and compiler_version is not None: + try: + current_version = int(str(compiler_version).split(".")[0]) + except ValueError: + current_version = None + if current_version is not None: + min_version = 13 + max_version = 21 # support up to Xcode 27 with apple-clang 21 for now + candidate_versions = [ + str(v) for v in range(min_version, max_version + 1) + if v != current_version + ] + factors.append([{"compiler.version": v} for v in candidate_versions]) + + combinations = _factors_combinations(factors) + return [{"settings": [(k, v) for k, v in comb.items()]} for comb in combinations] + + +def _factors_combinations(factors): + combinations = [] + for factor in factors: + if not combinations: + combinations = list(factor) + continue + new_combinations = [] + for comb in combinations: + for f in factor: + new_comb = comb.copy() + new_comb.update(f) + new_combinations.append(new_comb) + combinations.extend(new_combinations) + return combinations diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1d5f8896a..df87f9a4b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,8 @@ env: -DENABLE_SPLUNK=ON -DENABLE_GCP=ON -DENABLE_OPC=ON -DENABLE_PYTHON_SCRIPTING=ON -DENABLE_LUA_SCRIPTING=ON -DENABLE_KUBERNETES=ON -DENABLE_TEST_PROCESSORS=ON -DENABLE_PROMETHEUS=ON \ -DENABLE_ELASTICSEARCH=ON -DENABLE_GRAFANA_LOKI=ON -DENABLE_COUCHBASE=ON -DENABLE_LLAMACPP=ON -DDOCKER_BUILD_ONLY=ON -DMINIFI_PERFORMANCE_TESTS=ON CCACHE_DIR: ${{ GITHUB.WORKSPACE }}/.ccache + CONAN_LOGIN_USERNAME_NIFI_CONAN: ${{ secrets.CONAN_USERNAME }} + CONAN_PASSWORD_NIFI_CONAN: ${{ secrets.CONAN_ACCESS_TOKEN }} jobs: macos_xcode: name: "macOS 26 aarch64" @@ -63,6 +65,7 @@ jobs: -DSKIP_TESTS=OFF -DUSE_SHARED_LIBS=ON -DMINIFI_PERFORMANCE_TESTS=ON + -DUSE_CONAN=ON steps: - id: checkout uses: actions/checkout@v6 @@ -84,9 +87,17 @@ jobs: echo "PATH=/opt/homebrew/opt/ccache:/opt/homebrew/opt/ccache/bin:/opt/homebrew/opt/ccache/libexec:$PATH" >> $GITHUB_ENV echo "DYLD_LIBRARY_PATH=$(brew --prefix)/lib" >> $GITHUB_ENV echo -e "127.0.0.1\t$HOSTNAME" | sudo tee -a /etc/hosts > /dev/null + mkdir -p ~/.conan2/extensions/plugins/compatibility + cp .github/conan/compatibility.py ~/.conan2/extensions/plugins/compatibility/compatibility.py - name: build run: | - python -m venv venv && source venv/bin/activate && pip install -r requirements.txt && python main.py --noninteractive --skip-compiler-install --cmake-options="-DCMAKE_C_FLAGS=${CPPFLAGS} ${CFLAGS} -DCMAKE_CXX_FLAGS=${CPPFLAGS} ${CXXFLAGS}" --minifi-options="${MACOS_MINIFI_OPTIONS}" + python -m venv venv && source venv/bin/activate && pip install -r requirements.txt && \ + python main.py --noninteractive --skip-compiler-install --cmake-options="-DCMAKE_C_FLAGS=${CPPFLAGS} ${CFLAGS} -DCMAKE_CXX_FLAGS=${CPPFLAGS} ${CXXFLAGS}" --minifi-options="${MACOS_MINIFI_OPTIONS}" + working-directory: bootstrap + - name: Upload conan packages + if: always() && github.event_name == 'push' && github.ref == 'refs/heads/main' + run: | + source venv/bin/activate && conan remote login nifi-conan && conan upload "*" -r nifi-conan --confirm working-directory: bootstrap - name: cache save uses: actions/cache/save@v5 @@ -171,6 +182,7 @@ jobs: -DMINIFI_USE_REAL_ODBC_TEST_DRIVER=ON -DUSE_SHARED_LIBS=OFF -DMINIFI_PERFORMANCE_TESTS=ON + -DUSE_CONAN=ON steps: - name: Support longpaths run: git config --system core.longpaths true @@ -192,14 +204,27 @@ jobs: if ((Get-FileHash 'sqliteodbc_w64.exe').Hash -ne "a4804e4f54f42c721df1323c5fcac101a8c7a577e7f20979227324ceab572d51") {Write "Hash mismatch"; Exit 1} Start-Process -FilePath ".\sqliteodbc_w64.exe" -ArgumentList "/S" -Wait shell: powershell + - name: Copy conan compatibility.py + shell: powershell + run: | + $compatDir = Join-Path $env:USERPROFILE ".conan2\extensions\plugins\compatibility" + New-Item -ItemType Directory -Force -Path $compatDir | Out-Null + Copy-Item ".github\conan\compatibility.py" (Join-Path $compatDir "compatibility.py") - name: Zero sccache stats run: sccache --zero-stats shell: bash - name: build + working-directory: bootstrap run: | - python -m venv venv & venv\Scripts\activate & pip install -r requirements.txt & python main.py --noninteractive --skip-compiler-install --minifi-options="%WINDOWS_MINIFI_OPTIONS%" --cmake-options="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache" + python -m venv venv && venv\Scripts\activate && pip install -r requirements.txt && ^ + python main.py --noninteractive --skip-compiler-install --minifi-options="%WINDOWS_MINIFI_OPTIONS%" --cmake-options="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache" shell: cmd + - name: Upload conan packages + if: always() && github.event_name == 'push' && github.ref == 'refs/heads/main' working-directory: bootstrap + run: | + venv\Scripts\activate && conan remote login nifi-conan && conan upload "*" -r nifi-conan --confirm + shell: cmd - name: Save cache uses: actions/cache/save@v5 if: always() diff --git a/CMakeLists.txt b/CMakeLists.txt index 5af9c071c7..65cfe246cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,8 +87,12 @@ endif() # Use ccache if present find_program(CCACHE_FOUND ccache) if(CCACHE_FOUND) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + if(NOT CMAKE_C_COMPILER_LAUNCHER) + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_FOUND}") + endif() + if(NOT CMAKE_CXX_COMPILER_LAUNCHER) + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_FOUND}") + endif() message("-- Found ccache: ${CCACHE_FOUND}") endif(CCACHE_FOUND) @@ -197,6 +201,7 @@ set(PASSTHROUGH_CMAKE_ARGS -DANDROID_ABI=${ANDROID_ABI} -DANDROID_NDK=${ANDROID_NDK} -DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE} -DCMAKE_POLICY_VERSION_MINIMUM=${CMAKE_POLICY_VERSION_MINIMUM} + -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_C_FLAGS=${PASSTHROUGH_CMAKE_C_FLAGS} -DCMAKE_CXX_FLAGS=${PASSTHROUGH_CMAKE_CXX_FLAGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} @@ -221,12 +226,12 @@ set(MINIFI_CPP_COMPILE_DEFINITIONS "") if(CUSTOM_MALLOC) if (CUSTOM_MALLOC STREQUAL jemalloc) - include(BundledJemalloc) - use_bundled_jemalloc(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) - set(CUSTOM_MALLOC_LIB JeMalloc::JeMalloc) + include(GetJemalloc) + get_jemalloc(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + set(CUSTOM_MALLOC_LIB jemalloc::jemalloc) elseif (CUSTOM_MALLOC STREQUAL mimalloc) - include(MiMalloc) - set(CUSTOM_MALLOC_LIB mimalloc) + include(GetMiMalloc) + set(CUSTOM_MALLOC_LIB mimalloc-static) elseif (CUSTOM_MALLOC STREQUAL rpmalloc) include(RpMalloc) set(CUSTOM_MALLOC_LIB rpmalloc) @@ -243,7 +248,6 @@ include(GetOpenSSL) # BZip2 if (ENABLE_BZIP2 AND (ENABLE_LIBARCHIVE OR (ENABLE_ROCKSDB AND NOT WIN32))) include(GetBZip2) - get_bzip2(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/bzip2/dummy") endif() @@ -259,8 +263,7 @@ if(NOT WIN32) endif() # libsodium -include(BundledLibSodium) -use_bundled_libsodium("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}") +include(GetLibSodium) list(APPEND MINIFI_CPP_COMPILE_DEFINITIONS SODIUM_STATIC=1) list(APPEND MINIFI_CPP_COMPILE_DEFINITIONS "RPM_CONFIG_DIR=\"/${CMAKE_INSTALL_SYSCONFDIR}/${PROJECT_NAME}\"") @@ -270,20 +273,17 @@ list(APPEND MINIFI_CPP_COMPILE_DEFINITIONS "RPM_LIB_DIR=\"/usr/${CMAKE_INSTALL_L # zlib include(GetZLIB) -get_zlib(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/zlib/dummy") # cURL include(GetLibCURL) -get_curl(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/curl/dummy") # spdlog include(GetSpdlog) -get_spdlog() # yaml-cpp -include(YamlCpp) +include(GetYamlCpp) # concurrentqueue add_library(concurrentqueue INTERFACE) @@ -295,7 +295,7 @@ target_include_directories(RapidJSON SYSTEM INTERFACE "${CMAKE_CURRENT_SOURCE_DI target_compile_definitions(RapidJSON INTERFACE RAPIDJSON_HAS_STDSTRING) # gsl-lite -include(GslLite) +include(GetGslLite) # Add necessary definitions based on the value of STRICT_GSL_CHECKS, see gsl-lite README for more details list(APPEND GslDefinitions gsl_CONFIG_DEFAULTS_VERSION=1) @@ -314,13 +314,17 @@ endif() if (STRICT_GSL_CHECKS STREQUAL "DEBUG_ONLY") list(APPEND GslDefinitions $<$>:${GslDefinitionsNonStrict}>) endif() -target_compile_definitions(gsl-lite INTERFACE ${GslDefinitions}) -# date -include(Date) +get_target_property(_gsl_lite_real_target gsl-lite::gsl-lite ALIASED_TARGET) +if (NOT _gsl_lite_real_target) + set(_gsl_lite_real_target gsl-lite::gsl-lite) +endif() +target_compile_definitions(${_gsl_lite_real_target} INTERFACE ${GslDefinitions}) -# magic_enum -include(MagicEnum) +include(Date) +include(GetMagicEnum) +include(GetRangeV3) +include(GetAsio) # Setup warning flags if(MSVC) @@ -364,14 +368,13 @@ add_subdirectory(libminifi) if (ENABLE_ALL OR ENABLE_PROMETHEUS OR ENABLE_GRAFANA_LOKI OR ENABLE_CIVET) include(GetCivetWeb) - get_civetweb() list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/civetweb/dummy") endif() ## Add extensions # PugiXML required for standard processors and WEL extension -include(PugiXml) +include(GetPugiXml) file(GLOB extension-directories "extensions/*") foreach(extension-dir ${extension-directories}) diff --git a/CONAN.md b/CONAN.md index e079e06297..aa2287bf23 100644 --- a/CONAN.md +++ b/CONAN.md @@ -36,7 +36,11 @@ source, it uses CMake to install the third party external libraries that are ena ## Build MiNiFi C++ with Conan -### Install Conan +### Using the bootstrap python script + +The easiest way to build MiNiFi C++ using Conan is by using the the bootstrap script. Run the bootstrap script either with `bootstrap/py_bootstrap.sh` or `bootstrap/py_bootstrap.bat` and the bootstrap installs the conan package manager automatically. In the bootstrap script under Build options menu select the `USE_CONAN` option. Running the one click build with the option selected, it will download the available thirdparty dependencies from the conan repository, otherwise it will build the thirdparty dependency from source (either with the available conan recipe or using the bundled cmake script). + +### Install Conan manually ~~~bash sudo pip install --force-reinstall -v "conan==2.28.1" @@ -45,8 +49,10 @@ sudo pip install --force-reinstall -v "conan==2.28.1" conan profile detect ~~~ -### Create Custom RocksDB Conan Package -The default RocksDB conan package is built with -fno-rtti, which makes it incompatible with MiNiFi. So we need to create a custom RocksDB conan package that is built with -frtti. +### Create Custom Conan Package +Some packages need custom versions built for MiNiFi specifically. This could be due patched source code, different compile options, or different dependency library versions. + +For example the default RocksDB conan package is built with -fno-rtti, which makes it incompatible with MiNiFi. So we need to create a custom RocksDB conan package that is built with -frtti. ~~~bash cd $HOME/nifi-minifi-cpp/thirdparty/rocksdb/all @@ -54,6 +60,18 @@ cd $HOME/nifi-minifi-cpp/thirdparty/rocksdb/all conan create . --user=minifi --channel=develop --test-folder="" --version=11.1.1 --profile=../../../etc/conan/profiles/release-linux ~~~ +If you want to use conan to build these custom libraries as part of the MiNiFi build you only need to export these libraries instead of creating them. + +~~~bash +conan export $HOME/nifi-minifi-cpp/thirdparty/rocksdb/all --version=11.1.1 --user=minifi --channel=develop +~~~ + +You can add the official NiFi remote Conan repository to download the custom Conan packages and recipes manually: + +~~~bash +conan remote add nifi-conan https://apache.jfrog.io/artifactory/api/conan/nifi-conan +~~~ + ### Build MiNiFi ~~~bash @@ -68,6 +86,12 @@ conan install . --build=missing --output-folder=build_conan --profile=etc/conan/ conan build . --output-folder=build_conan --profile=etc/conan/profiles/release-linux ~~~ +After `conan install` command you can also use the conan generated `conan_toolchain.cmake` file with the CMake command to build with Conan packages: + +~~~bash +cmake -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake .. && ninja +~~~ + - **NOTE**: After building MiNiFi, we must have the MINIFI_HOME environment variable created in order to successfully run the minifi binary executable. - **NOTE**: When we install the prebuilt conan package representing the MiNiFi third party libraries, we add the `--build=missing` in case some of the prebuilt missing conan packages are not found from conancenter, jfrog, or one of our conan repositories, then conan will build the conan packages from source. We can upload new prebuilt conan packages by **[conan upload](https://docs.conan.io/2/reference/commands/upload.html)**. diff --git a/LICENSE b/LICENSE index cc46cdf912..ec02cbb4da 100644 --- a/LICENSE +++ b/LICENSE @@ -205,7 +205,6 @@ APACHE NIFI - MINIFI C++ SUBCOMPONENTS: The Apache NiFi - MiNiFi C++ project contains subcomponents licensed under the Apache License, Version 2.0: This product bundles 'Simple-Windows-Posix-Semaphore' which is available under an ALv2 license -This project bundles 'mbedTLS' which is available under an ALv2 license This project bundles 'RocksDB' which is available under an ALv2 license This project bundles 'AWS SDK for C++' which is available under an ALv2 license This project bundles 'C++ Client Libraries for Google Cloud Services' which is available under an ALv2 license @@ -586,40 +585,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -This product bundles 'libuvc' which is available under a BSD license. - -Software License Agreement (BSD License) - -Copyright (C) 2010-2015 Ken Tossell -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - * Neither the name of the author nor other contributors may be - used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - This product bundles 'JsonCpp' which is available under a MIT license. The JsonCpp library's source code, including accompanying documentation, diff --git a/bootstrap/cli.py b/bootstrap/cli.py index bf2f8cb6b0..58518a2c0a 100644 --- a/bootstrap/cli.py +++ b/bootstrap/cli.py @@ -13,9 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. - import os +import platform import inquirer +import yaml +from pathlib import Path from minifi_option import MinifiOptions from package_manager import PackageManager @@ -28,24 +30,88 @@ def install_dependencies(minifi_options: MinifiOptions, package_manager: Package return res +def export_custom_conan_recipes(minifi_options: MinifiOptions, package_manager: PackageManager) -> bool: + thirdparty_dir = minifi_options.source_dir / "thirdparty" + for root, _, files in os.walk(thirdparty_dir): + for file in files: + if file == "conanfile.py": + config_yaml = os.path.join(Path(root).parent, "config.yml") + + with open(config_yaml) as f: + data = yaml.safe_load(f) + + version = next(iter(data["versions"])) + + print(f"Exporting the custom Conan recipe {root} with version {version}") + if not package_manager.run_cmd(f"conan export {root} --version={version} --user=minifi --channel=develop"): + print(f"Exporting the custom Conan recipe {root} failed") + return False + return True + + +def add_conan_options_from_cmake_options(extension_options: list[str], minifi_options: MinifiOptions) -> str: + conan_options = "" + for extension_option in extension_options: + if minifi_options.bool_options[extension_option.upper()].value not in (None, "OFF"): + conan_options += f' -o "&:{extension_option.lower()}=True"' + return conan_options + + +def run_conan_install(minifi_options: MinifiOptions, package_manager: PackageManager) -> bool: + if not minifi_options.use_conan.value == "ON": + 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) + 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}"' + + if not package_manager.run_cmd("conan profile detect --exist-ok"): + print("Conan default profile detection failed") + return False + + if not export_custom_conan_recipes(minifi_options, package_manager): + return False + + compiler_settings = " --settings=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): + print("Adding the nifi-conan remote failed") + return False + build_cmd = f"conan install {minifi_options.source_dir} --output-folder={minifi_options.build_dir} --build=missing {conan_options} " \ + f"--settings=build_type={minifi_options.build_type.value}{generator_setting}{compiler_settings}" + res = package_manager.run_cmd(build_cmd) + print("Conan install was successful" if res else "Conan install was unsuccessful") + return res + + +def _conan_build_env_prefix(minifi_options: MinifiOptions) -> str: + if minifi_options.use_conan.value == "ON" and platform.system() == "Windows": + conanbuild = os.path.join(str(minifi_options.build_dir), "conanbuild.bat") + return f'call "{conanbuild}" && ' + return "" + + def run_cmake(minifi_options: MinifiOptions, package_manager: PackageManager): if not os.path.exists(minifi_options.build_dir): os.mkdir(minifi_options.build_dir) - cmake_cmd = f"cmake {minifi_options.create_cmake_generator_str()} {minifi_options.create_cmake_options_str()} {minifi_options.source_dir} -B {minifi_options.build_dir}" + cmake_cmd = f"{_conan_build_env_prefix(minifi_options)}cmake {minifi_options.create_cmake_generator_str()} {minifi_options.create_cmake_use_conan_str()} " \ + f"{minifi_options.create_cmake_options_str()} {minifi_options.source_dir} -B {minifi_options.build_dir}" res = package_manager.run_cmd(cmake_cmd) print("CMake command run successfully" if res else "CMake command run unsuccessfully") return res def do_build(minifi_options: MinifiOptions, package_manager: PackageManager): - build_cmd = f"cmake --build {str(minifi_options.build_dir)} {minifi_options.create_cmake_build_flags_str()}" + build_cmd = f"{_conan_build_env_prefix(minifi_options)}cmake --build {str(minifi_options.build_dir)} {minifi_options.create_cmake_build_flags_str()}" res = package_manager.run_cmd(build_cmd) print("Build was successful" if res else "Build was unsuccessful") return res def do_package(minifi_options: MinifiOptions, package_manager: PackageManager): - build_cmd = f"cmake --build {str(minifi_options.build_dir)} --target package {minifi_options.create_cmake_build_flags_str()}" + build_cmd = f"{_conan_build_env_prefix(minifi_options)}cmake --build {str(minifi_options.build_dir)} --target package {minifi_options.create_cmake_build_flags_str()}" return package_manager.run_cmd(build_cmd) @@ -56,6 +122,7 @@ def do_docker_build(minifi_options: MinifiOptions, package_manager: PackageManag def do_one_click_build(minifi_options: MinifiOptions, package_manager: PackageManager) -> bool: assert install_dependencies(minifi_options, package_manager) + assert run_conan_install(minifi_options, package_manager) assert run_cmake(minifi_options, package_manager) assert do_build(minifi_options, package_manager) assert do_package(minifi_options, package_manager) @@ -64,6 +131,7 @@ def do_one_click_build(minifi_options: MinifiOptions, package_manager: PackageMa def do_one_click_configuration(minifi_options: MinifiOptions, package_manager: PackageManager) -> bool: assert install_dependencies(minifi_options, package_manager) + assert run_conan_install(minifi_options, package_manager) assert run_cmake(minifi_options, package_manager) return True @@ -75,6 +143,7 @@ def main_menu(minifi_options: MinifiOptions, package_manager: PackageManager): # All menu options' functions return True if the bootstrap should exit after execution f"Build dir: {minifi_options.build_dir}": build_dir_menu, f"Build type: {minifi_options.build_type.value}": build_type_menu, + f"Custom malloc: {minifi_options.custom_malloc.value if minifi_options.custom_malloc is not None else 'N/A'}": custom_malloc_menu, "Build options": build_options_menu, "Extension options": extension_options_menu, "One click build": do_one_click_build, @@ -113,6 +182,25 @@ def build_type_menu(minifi_options: MinifiOptions, _package_manager: PackageMana return False +def custom_malloc_menu(minifi_options: MinifiOptions, _package_manager: PackageManager) -> bool: + if minifi_options.custom_malloc is None: + return False + questions = [ + inquirer.List( + "custom_malloc", + message="Custom malloc implementation (only jemalloc and mimalloc are provided via Conan)", + choices=minifi_options.custom_malloc.possible_values, + ), + ] + + answers = inquirer.prompt(questions) + if answers is None: + return True + minifi_options.custom_malloc.value = answers["custom_malloc"] + minifi_options.save_option_state() + return False + + def build_dir_menu(minifi_options: MinifiOptions, _package_manager: PackageManager) -> bool: questions = [ inquirer.Path('build_dir', @@ -185,6 +273,7 @@ def step_by_step_menu(minifi_options: MinifiOptions, package_manager: PackageMan # All menu options' functions return True if the bootstrap should exit after execution f"Build dir: {minifi_options.build_dir}": build_dir_menu, "Install dependencies": install_dependencies, + "Run conan install": run_conan_install, "Run cmake": run_cmake, "Build": do_build, "Package": do_package, diff --git a/bootstrap/minifi_option.py b/bootstrap/minifi_option.py index 3bfc036f35..ebcdb8e22f 100644 --- a/bootstrap/minifi_option.py +++ b/bootstrap/minifi_option.py @@ -33,19 +33,28 @@ def __init__(self, cache_values: Dict[str, CMakeCacheValue]): self.build_type.possible_values = ["Release", "Debug", "RelWithDebInfo", "MinSizeRel"] additional_build_options = ["DOCKER_BUILD_ONLY", "DOCKER_SKIP_TESTS", "DOCKER_CREATE_RPM", "SKIP_TESTS", "PORTABLE"] self.use_ninja = CMakeCacheValue("Specifies if CMake should use the Ninja generator or the system default", "USE_NINJA", "BOOL", "ON") + self.use_conan = CMakeCacheValue("Specifies if CMake should use Conan package manager", "USE_CONAN", "BOOL", "OFF") + if "USE_NINJA" in cache_values: + self.use_ninja.value = cache_values["USE_NINJA"].value + if "USE_CONAN" in cache_values: + self.use_conan.value = cache_values["USE_CONAN"].value self.bool_options = {name: cache_value for name, cache_value in cache_values.items() if cache_value.value_type == "BOOL" and ("ENABLE" in name or "MINIFI" in name or name in additional_build_options)} self.build_options = {name: cache_value for name, cache_value in self.bool_options.items() if "MINIFI" in name or name in additional_build_options} self.build_options["USE_NINJA"] = self.use_ninja + self.build_options["USE_CONAN"] = self.use_conan self.extension_options = {name: cache_value for name, cache_value in self.bool_options.items() if "ENABLE" in name} self.multi_choice_options = [cache_value for name, cache_value in cache_values.items() if cache_value.value_type == "STRING" and cache_value.possible_values is not None] + self.custom_malloc = cache_values.get("CUSTOM_MALLOC") self.build_dir = pathlib.Path(__file__).parent.parent.resolve() / "build" self.source_dir = pathlib.Path(__file__).parent.parent.resolve() self.no_confirm = False def create_cmake_options_str(self) -> str: cmake_options = [bool_option.create_cmake_option_str() for name, bool_option in self.bool_options.items()] + if self.custom_malloc is not None: + cmake_options.append(self.custom_malloc.create_cmake_option_str()) if self.cmake_override: cmake_options.append(self.cmake_override) cmake_options.append(f'-DCMAKE_BUILD_TYPE={self.build_type.value}') @@ -55,6 +64,9 @@ def create_cmake_options_str(self) -> str: def create_cmake_generator_str(self) -> str: return "-G Ninja" if self.use_ninja.value == "ON" else "" + def create_cmake_use_conan_str(self) -> str: + return "-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake" if self.use_conan.value == "ON" else "" + def create_cmake_build_flags_str(self) -> str: additional_flags = "" if self.use_ninja.value != "ON": @@ -78,7 +90,10 @@ def save_option_state(self): for option_name in self.bool_options: options_dict[option_name] = self.bool_options[option_name].value options_dict[self.use_ninja.name] = self.use_ninja.value + options_dict[self.use_conan.name] = self.use_conan.value options_dict[self.build_type.name] = self.build_type.value + if self.custom_malloc is not None: + options_dict[self.custom_malloc.name] = self.custom_malloc.value options_dict["build_dir"] = str(self.build_dir) with open(pathlib.Path(__file__).parent / "option_state.json", "w") as f: @@ -96,8 +111,12 @@ def load_option_state(self): self.bool_options[option_name].value = options_dict[option_name] if self.use_ninja.name in options_dict: self.use_ninja.value = options_dict[self.use_ninja.name] + if self.use_conan.name in options_dict: + self.use_conan.value = options_dict[self.use_conan.name] if self.build_type.name in options_dict: self.build_type.value = options_dict[self.build_type.name] + if self.custom_malloc is not None and self.custom_malloc.name in options_dict: + self.custom_malloc.value = options_dict[self.custom_malloc.name] if "build_dir" in options_dict: self.build_dir = pathlib.Path(options_dict["build_dir"]) diff --git a/bootstrap/package_manager.py b/bootstrap/package_manager.py index 049697c714..91f3586f24 100644 --- a/bootstrap/package_manager.py +++ b/bootstrap/package_manager.py @@ -241,11 +241,7 @@ def _minifi_setup_env_str(vs_where_location: VsWhereLocation) -> str: set PATH=!PATH:C:\\Strawberry\\c\\bin;=!;C:\\Program Files\\NASM; endlocal & set PATH=%PATH% set build_platform=x64 -IF "%VIRTUALENV%"=="" ( - echo already in venv -) ELSE ( - {_get_activate_venv_path()} -) +call {_get_activate_venv_path()} """ diff --git a/bootstrap/requirements.txt b/bootstrap/requirements.txt index 12c47bcde2..e31f7c3e39 100644 --- a/bootstrap/requirements.txt +++ b/bootstrap/requirements.txt @@ -4,3 +4,5 @@ pathlib==1.0.1 distro==1.8.0 ninja==1.11.1 argparse==1.4.0 +conan==2.30.0 +PyYAML==6.0.3 diff --git a/cmake/Asio.cmake b/cmake/Asio.cmake index 0d03f6e882..9c6c94cd43 100644 --- a/cmake/Asio.cmake +++ b/cmake/Asio.cmake @@ -30,3 +30,7 @@ if(NOT asio_POPULATED) find_package(Threads) target_link_libraries(asio INTERFACE Threads::Threads OpenSSL::SSL OpenSSL::Crypto) endif() + +if (NOT TARGET asio::asio) + add_library(asio::asio ALIAS asio) +endif() diff --git a/cmake/AzureSdkCpp.cmake b/cmake/AzureSdkCpp.cmake index f29855665d..0f1cbdd51f 100644 --- a/cmake/AzureSdkCpp.cmake +++ b/cmake/AzureSdkCpp.cmake @@ -36,7 +36,6 @@ endif() if (NOT WIN32) include(GetLibXml2) - get_libxml2(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/libxml2/dummy") endif() diff --git a/cmake/BuildTests.cmake b/cmake/BuildTests.cmake index 878628230d..b602e7ec18 100644 --- a/cmake/BuildTests.cmake +++ b/cmake/BuildTests.cmake @@ -16,7 +16,6 @@ # under the License. include(GetCatch2) -get_catch2() ### test functions MACRO(GETSOURCEFILES result curdir) @@ -79,7 +78,7 @@ function(createTests testName) target_link_libraries(${testName} ${CMAKE_DL_LIBS}) target_wholearchive_library(${testName} libminifi-unittest) - target_link_libraries(${testName} core-minifi yaml-cpp spdlog Threads::Threads) + target_link_libraries(${testName} core-minifi yaml-cpp::yaml-cpp spdlog Threads::Threads) target_include_directories(${testName} BEFORE PRIVATE "${CMAKE_SOURCE_DIR}/libminifi/test/libtest/") target_compile_definitions(${testName} PRIVATE LOAD_EXTENSIONS) set_target_properties(${testName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") @@ -91,7 +90,7 @@ function(createIntegrationTests testName) target_link_libraries(${testName} ${CMAKE_DL_LIBS}) target_wholearchive_library(${testName} libminifi-integrationtest) - target_link_libraries(${testName} core-minifi yaml-cpp spdlog Threads::Threads) + target_link_libraries(${testName} core-minifi yaml-cpp::yaml-cpp spdlog Threads::Threads) target_include_directories(${testName} BEFORE PRIVATE "${CMAKE_SOURCE_DIR}/libminifi/test/libtest/") target_compile_definitions(${testName} PRIVATE LOAD_EXTENSIONS) set_target_properties(${testName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") diff --git a/cmake/BundledAwsSdkCpp.cmake b/cmake/BundledAwsSdkCpp.cmake index 54e87e9f88..cebffaccce 100644 --- a/cmake/BundledAwsSdkCpp.cmake +++ b/cmake/BundledAwsSdkCpp.cmake @@ -93,12 +93,12 @@ function(use_bundled_libaws SOURCE_DIR BINARY_DIR) "-DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIRS}" "-DZLIB_INCLUDE_DIRS=${ZLIB_INCLUDE_DIRS}" "-DZLIB_LIBRARY=${ZLIB_LIBRARIES}" - -DUSE_OPENSSL=ON - -DBUILD_ONLY=kinesis%s3%s3-crt - -DENABLE_TESTING=OFF - -DBUILD_SHARED_LIBS=OFF - -DENABLE_UNITY_BUILD=${AWS_ENABLE_UNITY_BUILD} - -DUSE_CRT_HTTP_CLIENT=ON) + "-DUSE_OPENSSL=ON" + "-DBUILD_ONLY=kinesis%s3%s3-crt" + "-DENABLE_TESTING=OFF" + "-DBUILD_SHARED_LIBS=OFF" + "-DENABLE_UNITY_BUILD=${AWS_ENABLE_UNITY_BUILD}" + "-DUSE_CRT_HTTP_CLIENT=ON") if(WIN32) list(APPEND AWS_SDK_CPP_CMAKE_ARGS -DFORCE_EXPORT_CORE_API=ON -DFORCE_EXPORT_S3_API=ON -DFORCE_EXPORT_S3_CRT_API=ON -DFORCE_EXPORT_KINESIS_API=ON) diff --git a/cmake/BundledJemalloc.cmake b/cmake/BundledJemalloc.cmake index 6dff753051..bcc6d1ff59 100644 --- a/cmake/BundledJemalloc.cmake +++ b/cmake/BundledJemalloc.cmake @@ -24,8 +24,8 @@ function(use_bundled_jemalloc SOURCE_DIR BINARY_DIR) # Build project ExternalProject_Add( jemalloc-external - URL https://github.com/jemalloc/jemalloc/releases/download/5.1.0/jemalloc-5.1.0.tar.bz2 - URL_HASH "SHA256=5396e61cc6103ac393136c309fae09e44d74743c86f90e266948c50f3dbb7268" + URL https://github.com/jemalloc/jemalloc/archive/refs/tags/5.3.1.tar.gz + URL_HASH "SHA256=7b30f6116f11d736badd48c903cba2b3344a88d62e3a7b892434f870e860b1c0" PREFIX "${BINARY_DIR}/thirdparty/jemalloc" BUILD_IN_SOURCE true SOURCE_DIR "${BINARY_DIR}/thirdparty/jemalloc-src" @@ -49,9 +49,9 @@ function(use_bundled_jemalloc SOURCE_DIR BINARY_DIR) set(JEMALLOC_LIBRARIES "${JEMALLOC_LIBRARY}" CACHE STRING "" FORCE) # Create imported targets - add_library(JeMalloc::JeMalloc STATIC IMPORTED) - set_target_properties(JeMalloc::JeMalloc PROPERTIES IMPORTED_LOCATION "${JEMALLOC_LIBRARY}") - add_dependencies(JeMalloc::JeMalloc jemalloc-external) + add_library(jemalloc::jemalloc STATIC IMPORTED) + set_target_properties(jemalloc::jemalloc PROPERTIES IMPORTED_LOCATION "${JEMALLOC_LIBRARY}") + add_dependencies(jemalloc::jemalloc jemalloc-external) file(MAKE_DIRECTORY ${JEMALLOC_INCLUDE_DIRS}) - set_property(TARGET JeMalloc::JeMalloc APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${JEMALLOC_INCLUDE_DIRS}) + set_property(TARGET jemalloc::jemalloc APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${JEMALLOC_INCLUDE_DIRS}) endfunction(use_bundled_jemalloc) diff --git a/cmake/BundledLibSodium.cmake b/cmake/BundledLibSodium.cmake index b7678aebfb..4232ed3e21 100644 --- a/cmake/BundledLibSodium.cmake +++ b/cmake/BundledLibSodium.cmake @@ -94,8 +94,8 @@ function(use_bundled_libsodium SOURCE_DIR BINARY_DIR) # Create imported targets file(MAKE_DIRECTORY ${LIBSODIUM_INCLUDE_DIRS}) - add_library(libsodium STATIC IMPORTED) - set_target_properties(libsodium PROPERTIES IMPORTED_LOCATION "${LIBSODIUM_LIBRARIES}") - add_dependencies(libsodium libsodium-external) - set_property(TARGET libsodium APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${LIBSODIUM_INCLUDE_DIRS}") + add_library(libsodium::libsodium STATIC IMPORTED) + set_target_properties(libsodium::libsodium PROPERTIES IMPORTED_LOCATION "${LIBSODIUM_LIBRARIES}") + add_dependencies(libsodium::libsodium libsodium-external) + set_property(TARGET libsodium::libsodium APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${LIBSODIUM_INCLUDE_DIRS}") endfunction(use_bundled_libsodium) diff --git a/cmake/BundledOpenSSL.cmake b/cmake/BundledOpenSSL.cmake index 61a6fb9c58..04a215827e 100644 --- a/cmake/BundledOpenSSL.cmake +++ b/cmake/BundledOpenSSL.cmake @@ -38,12 +38,6 @@ function(use_openssl SOURCE_DIR BINARY_DIR) set(BYPRODUCT_SUFFIX ".a" CACHE STRING "" FORCE) endif() - if (WIN32) - set(EXECUTABLE_SUFFIX ".exe" CACHE STRING "" FORCE) - else() - set(EXECUTABLE_SUFFIX "" CACHE STRING "" FORCE) - endif() - set(BYPRODUCTS "${LIBDIR}/${BYPRODUCT_PREFIX}ssl${BYPRODUCT_SUFFIX}" "${LIBDIR}/${BYPRODUCT_PREFIX}crypto${BYPRODUCT_SUFFIX}" @@ -170,96 +164,7 @@ function(use_openssl SOURCE_DIR BINARY_DIR) set_property(TARGET OpenSSL::SSL APPEND PROPERTY INTERFACE_LINK_LIBRARIES crypt32.lib) endif() - if (WIN32) - set(BYPRODUCT_DYN_SUFFIX ".dll" CACHE STRING "" FORCE) - elseif(APPLE) - set(BYPRODUCT_DYN_SUFFIX ".dylib" CACHE STRING "" FORCE) - else() - set(BYPRODUCT_DYN_SUFFIX ".so" CACHE STRING "" FORCE) - endif() - - set(FIPS_BYPRODUCTS - "${LIBDIR}/ossl-modules/fips${BYPRODUCT_DYN_SUFFIX}" - ) - - set(OPENSSL_FIPS_BIN_DIR "${BINARY_DIR}/thirdparty/openssl-fips-install" CACHE STRING "" FORCE) - - FOREACH(BYPRODUCT ${FIPS_BYPRODUCTS}) - LIST(APPEND OPENSSL_FIPS_FILE_LIST "${OPENSSL_FIPS_BIN_DIR}/${BYPRODUCT}") - ENDFOREACH(BYPRODUCT) - - if (MINIFI_PACKAGING_TYPE STREQUAL "RPM") - install(FILES ${OPENSSL_FIPS_FILE_LIST} - DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/fips - COMPONENT bin) - - install(FILES "${OPENSSL_BIN_DIR}/bin/openssl${EXECUTABLE_SUFFIX}" - DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/fips - COMPONENT bin - PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE) - - elseif (MINIFI_PACKAGING_TYPE STREQUAL "TGZ") - install(FILES ${OPENSSL_FIPS_FILE_LIST} - DESTINATION fips - COMPONENT bin) - - install(FILES "${OPENSSL_BIN_DIR}/bin/openssl${EXECUTABLE_SUFFIX}" - DESTINATION fips - COMPONENT bin - PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE) - endif() - - set(OPENSSL_FIPS_EXTRA_FLAGS - no-tests # Disable tests - no-capieng # disable CAPI engine (legacy) - no-legacy # disable legacy modules - no-ssl # disable SSLv3 - no-engine # disable Engine API as it is deprecated since OpenSSL 3.0 and not FIPS compatible - enable-fips) # enable FIPS module - - if (WIN32) - find_program(JOM_EXECUTABLE_PATH - NAMES jom.exe - PATHS ENV PATH - NO_DEFAULT_PATH) - if(JOM_EXECUTABLE_PATH) - include(ProcessorCount) - processorcount(jobs) - set(OPENSSL_BUILD_COMMAND ${JOM_EXECUTABLE_PATH} -j${jobs}) - set(OPENSSL_WINDOWS_COMPILE_FLAGS /FS) - else() - message("Using nmake for OpenSSL build") - set(OPENSSL_BUILD_COMMAND nmake) - set(OPENSSL_WINDOWS_COMPILE_FLAGS "") - endif() - ExternalProject_Add( - openssl-fips-external - URL https://github.com/openssl/openssl/releases/download/openssl-3.1.2/openssl-3.1.2.tar.gz - URL_HASH "SHA256=a0ce69b8b97ea6a35b96875235aa453b966ba3cba8af2de23657d8b6767d6539" - SOURCE_DIR "${BINARY_DIR}/thirdparty/openssl-fips-src" - BUILD_IN_SOURCE true - CONFIGURE_COMMAND perl Configure "CC=${CMAKE_C_COMPILER}" "CXX=${CMAKE_CXX_COMPILER}" "CFLAGS=${OPENSSL_C_FLAGS} ${OPENSSL_WINDOWS_COMPILE_FLAGS}" "CXXFLAGS=${PASSTHROUGH_CMAKE_CXX_FLAGS} ${OPENSSL_WINDOWS_COMPILE_FLAGS}" ${OPENSSL_SHARED_FLAG} ${OPENSSL_FIPS_EXTRA_FLAGS} enable-fips "--prefix=${OPENSSL_FIPS_BIN_DIR}" "--openssldir=${OPENSSL_FIPS_BIN_DIR}" - BUILD_BYPRODUCTS ${OPENSSL_FIPS_FILE_LIST} - EXCLUDE_FROM_ALL TRUE - BUILD_COMMAND ${OPENSSL_BUILD_COMMAND} - INSTALL_COMMAND nmake install_fips - ) - else() - ExternalProject_Add( - openssl-fips-external - URL https://github.com/openssl/openssl/releases/download/openssl-3.1.2/openssl-3.1.2.tar.gz - URL_HASH "SHA256=a0ce69b8b97ea6a35b96875235aa453b966ba3cba8af2de23657d8b6767d6539" - SOURCE_DIR "${BINARY_DIR}/thirdparty/openssl-fips-src" - BUILD_IN_SOURCE true - CONFIGURE_COMMAND ./Configure "CC=${CMAKE_C_COMPILER}" "CXX=${CMAKE_CXX_COMPILER}" "CFLAGS=${OPENSSL_C_FLAGS} -fPIC" "CXXFLAGS=${PASSTHROUGH_CMAKE_CXX_FLAGS} -fPIC" ${OPENSSL_SHARED_FLAG} ${OPENSSL_FIPS_EXTRA_FLAGS} "--prefix=${OPENSSL_FIPS_BIN_DIR}" "--openssldir=${OPENSSL_FIPS_BIN_DIR}" - BUILD_BYPRODUCTS ${OPENSSL_FIPS_FILE_LIST} - EXCLUDE_FROM_ALL TRUE - INSTALL_COMMAND make install_fips - ) - endif() - - add_dependencies(OpenSSL::Crypto openssl-fips-external) - set(OPENSSL_ROOT_DIR "${OPENSSL_BIN_DIR}" CACHE INTERNAL "Strict single source of truth for bundled OpenSSL") + include(BundledOpenSSLFips) set(FIND_OPENSSL_PATH "${CMAKE_SOURCE_DIR}/cmake/ssl/FindOpenSSL.cmake" CACHE INTERNAL "Location of the FindOpenSSL file, for other dependencies") set(FIND_CRYPTO_PATH "${CMAKE_SOURCE_DIR}/cmake/ssl/FindCrypto.cmake" CACHE INTERNAL "Location of the FindCrypto file, for other dependencies") diff --git a/cmake/BundledOpenSSLFips.cmake b/cmake/BundledOpenSSLFips.cmake new file mode 100644 index 0000000000..c8c2738ec9 --- /dev/null +++ b/cmake/BundledOpenSSLFips.cmake @@ -0,0 +1,117 @@ +# 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(APPLE OR WIN32 OR CMAKE_SIZEOF_VOID_P EQUAL 4 OR CMAKE_SYSTEM_PROCESSOR MATCHES "(arm64)|(ARM64)|(aarch64)|(armv8)") + set(LIBDIR "lib") +else() + set(LIBDIR "lib64") +endif() + +if (WIN32) + set(BYPRODUCT_DYN_SUFFIX ".dll" CACHE STRING "" FORCE) +elseif(APPLE) + set(BYPRODUCT_DYN_SUFFIX ".dylib" CACHE STRING "" FORCE) +else() + set(BYPRODUCT_DYN_SUFFIX ".so" CACHE STRING "" FORCE) +endif() + +if (WIN32) + set(EXECUTABLE_SUFFIX ".exe" CACHE STRING "" FORCE) +else() + set(EXECUTABLE_SUFFIX "" CACHE STRING "" FORCE) +endif() + +set(FIPS_BYPRODUCTS "${LIBDIR}/ossl-modules/fips${BYPRODUCT_DYN_SUFFIX}") + +set(OPENSSL_FIPS_BIN_DIR "${CMAKE_BINARY_DIR}/thirdparty/openssl-fips-install" CACHE STRING "" FORCE) + +FOREACH(BYPRODUCT ${FIPS_BYPRODUCTS}) + LIST(APPEND OPENSSL_FIPS_FILE_LIST "${OPENSSL_FIPS_BIN_DIR}/${BYPRODUCT}") +ENDFOREACH(BYPRODUCT) + +if (MINIFI_PACKAGING_TYPE STREQUAL "RPM") + install(FILES ${OPENSSL_FIPS_FILE_LIST} + DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/fips + COMPONENT bin) + + install(FILES "${OPENSSL_BIN_DIR}/bin/openssl${EXECUTABLE_SUFFIX}" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/fips + COMPONENT bin + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE) + +elseif (MINIFI_PACKAGING_TYPE STREQUAL "TGZ") + install(FILES ${OPENSSL_FIPS_FILE_LIST} + DESTINATION fips + COMPONENT bin) + + install(FILES "${OPENSSL_BIN_DIR}/bin/openssl${EXECUTABLE_SUFFIX}" + DESTINATION fips + COMPONENT bin + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE) +endif() + +set(OPENSSL_FIPS_EXTRA_FLAGS + no-tests # Disable tests + no-capieng # disable CAPI engine (legacy) + no-legacy # disable legacy modules + no-ssl # disable SSLv3 + no-engine # disable Engine API as it is deprecated since OpenSSL 3.0 and not FIPS compatible + enable-fips) # enable FIPS module + +if (WIN32) + find_program(JOM_EXECUTABLE_PATH + NAMES jom.exe + PATHS ENV PATH + NO_DEFAULT_PATH) + if(JOM_EXECUTABLE_PATH) + include(ProcessorCount) + processorcount(jobs) + set(OPENSSL_BUILD_COMMAND ${JOM_EXECUTABLE_PATH} -j${jobs}) + set(OPENSSL_WINDOWS_COMPILE_FLAGS /FS) + else() + message("Using nmake for OpenSSL build") + set(OPENSSL_BUILD_COMMAND nmake) + set(OPENSSL_WINDOWS_COMPILE_FLAGS "") + endif() + ExternalProject_Add( + openssl-fips-external + URL https://github.com/openssl/openssl/releases/download/openssl-3.1.2/openssl-3.1.2.tar.gz + URL_HASH "SHA256=a0ce69b8b97ea6a35b96875235aa453b966ba3cba8af2de23657d8b6767d6539" + SOURCE_DIR "${CMAKE_BINARY_DIR}/thirdparty/openssl-fips-src" + BUILD_IN_SOURCE true + CONFIGURE_COMMAND perl Configure "CC=${CMAKE_C_COMPILER}" "CXX=${CMAKE_CXX_COMPILER}" "CFLAGS=${OPENSSL_C_FLAGS} ${OPENSSL_WINDOWS_COMPILE_FLAGS}" "CXXFLAGS=${PASSTHROUGH_CMAKE_CXX_FLAGS} ${OPENSSL_WINDOWS_COMPILE_FLAGS}" ${OPENSSL_SHARED_FLAG} ${OPENSSL_FIPS_EXTRA_FLAGS} enable-fips "--prefix=${OPENSSL_FIPS_BIN_DIR}" "--openssldir=${OPENSSL_FIPS_BIN_DIR}" + BUILD_BYPRODUCTS ${OPENSSL_FIPS_FILE_LIST} + EXCLUDE_FROM_ALL TRUE + BUILD_COMMAND ${OPENSSL_BUILD_COMMAND} + INSTALL_COMMAND nmake install_fips + ) +else() + ExternalProject_Add( + openssl-fips-external + URL https://github.com/openssl/openssl/releases/download/openssl-3.1.2/openssl-3.1.2.tar.gz + URL_HASH "SHA256=a0ce69b8b97ea6a35b96875235aa453b966ba3cba8af2de23657d8b6767d6539" + SOURCE_DIR "${CMAKE_BINARY_DIR}/thirdparty/openssl-fips-src" + BUILD_IN_SOURCE true + CONFIGURE_COMMAND ./Configure "CC=${CMAKE_C_COMPILER}" "CXX=${CMAKE_CXX_COMPILER}" "CFLAGS=${OPENSSL_C_FLAGS} -fPIC" "CXXFLAGS=${PASSTHROUGH_CMAKE_CXX_FLAGS} -fPIC" ${OPENSSL_SHARED_FLAG} ${OPENSSL_FIPS_EXTRA_FLAGS} "--prefix=${OPENSSL_FIPS_BIN_DIR}" "--openssldir=${OPENSSL_FIPS_BIN_DIR}" + BUILD_BYPRODUCTS ${OPENSSL_FIPS_FILE_LIST} + EXCLUDE_FROM_ALL TRUE + INSTALL_COMMAND make install_fips + ) +endif() + +add_dependencies(OpenSSL::Crypto openssl-fips-external) +set(OPENSSL_ROOT_DIR "${OPENSSL_BIN_DIR}" CACHE INTERNAL "Strict single source of truth for bundled OpenSSL") diff --git a/cmake/BundledRocksDB.cmake b/cmake/BundledRocksDB.cmake index c959e04ce7..30474c4deb 100644 --- a/cmake/BundledRocksDB.cmake +++ b/cmake/BundledRocksDB.cmake @@ -43,7 +43,7 @@ function(use_bundled_rocksdb SOURCE_DIR BINARY_DIR) set(ROCKSDB_CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS} "-DCMAKE_INSTALL_PREFIX=${BINARY_DIR}/thirdparty/rocksdb-install" -DWITH_TESTS=OFF - -DWITH_TOOLS=ON + -DWITH_TOOLS=OFF -DWITH_GFLAGS=OFF -DUSE_RTTI=1 -DROCKSDB_BUILD_SHARED=OFF diff --git a/cmake/Bustache.cmake b/cmake/Bustache.cmake index d33796da8c..e4f1b6889c 100644 --- a/cmake/Bustache.cmake +++ b/cmake/Bustache.cmake @@ -18,7 +18,6 @@ # include(FetchContent) include(GetFmt) -get_fmt() set(BUSTACHE_USE_FMT ON CACHE STRING "" FORCE) diff --git a/cmake/CivetWeb.cmake b/cmake/CivetWeb.cmake index 67022f6ef6..81089b8bcd 100644 --- a/cmake/CivetWeb.cmake +++ b/cmake/CivetWeb.cmake @@ -47,8 +47,13 @@ target_link_libraries(civetweb-cpp PUBLIC OpenSSL::SSL OpenSSL::Crypto) target_compile_definitions(civetweb-c-library PRIVATE SOCKET_TIMEOUT_QUANTUM=200) -add_library(civetweb::c-library ALIAS civetweb-c-library) -add_library(civetweb::civetweb-cpp ALIAS civetweb-cpp) +if (NOT TARGET civetweb::c-library) + add_library(civetweb::c-library ALIAS civetweb-c-library) +endif() + +if (NOT TARGET civetweb::civetweb-cpp) + add_library(civetweb::civetweb-cpp ALIAS civetweb-cpp) +endif() set(CIVETWEB_INCLUDE_DIR "${civetweb_SOURCE_DIR}/include") set(CIVETWEB_INCLUDE_DIRS "${CIVETWEB_INCLUDE_DIR}") diff --git a/cmake/Couchbase.cmake b/cmake/Couchbase.cmake index d0c48e538d..41e99ee279 100644 --- a/cmake/Couchbase.cmake +++ b/cmake/Couchbase.cmake @@ -19,7 +19,7 @@ include(FetchContent) include(GetFmt) include(GetSpdlog) -include(Asio) +include(GetAsio) set(COUCHBASE_CXX_CLIENT_BUILD_STATIC ON CACHE BOOL "" FORCE) set(COUCHBASE_CXX_CLIENT_BUILD_SHARED OFF CACHE BOOL "" FORCE) @@ -35,9 +35,9 @@ if(MSVC) add_compile_definitions(ASIO_DISABLE_CONCEPTS) endif() -set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/couchbase/remove-thirdparty.patch") -set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/couchbase/c++23_fixes.patch") -set(PATCH_FILE_3 "${CMAKE_SOURCE_DIR}/thirdparty/couchbase/use_fmt_instead_of_spdlog_fmt.patch") +set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/couchbase/all/patches/remove-thirdparty.patch") +set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/couchbase/all/patches/c++23_fixes.patch") +set(PATCH_FILE_3 "${CMAKE_SOURCE_DIR}/thirdparty/couchbase/all/patches/use_fmt_instead_of_spdlog_fmt.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}\\\") &&\ @@ -52,4 +52,6 @@ FetchContent_Declare(couchbase-cxx-client ) FetchContent_MakeAvailable(couchbase-cxx-client) -set(COUCHBASE_INCLUDE_DIR "${couchbase-cxx-client_SOURCE_DIR}" CACHE STRING "" FORCE) +if (NOT TARGET couchbase_cxx_client::couchbase_cxx_client) + add_library(couchbase_cxx_client::couchbase_cxx_client ALIAS couchbase_cxx_client_static_intermediate) +endif() diff --git a/cmake/Couchbase_1_0_2.cmake b/cmake/Couchbase_1_0_2.cmake deleted file mode 100644 index 655abcd88f..0000000000 --- a/cmake/Couchbase_1_0_2.cmake +++ /dev/null @@ -1,47 +0,0 @@ -# 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. - -include(FetchContent) - -include(fmt_11_0_2) -include(Spdlog) -include(Asio) - -set(COUCHBASE_CXX_CLIENT_BUILD_STATIC ON CACHE BOOL "" FORCE) -set(COUCHBASE_CXX_CLIENT_BUILD_SHARED OFF CACHE BOOL "" FORCE) -set(COUCHBASE_CXX_CLIENT_BUILD_TESTS OFF CACHE BOOL "" FORCE) -set(COUCHBASE_CXX_CLIENT_BUILD_DOCS OFF CACHE BOOL "" FORCE) -set(COUCHBASE_CXX_CLIENT_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) -set(COUCHBASE_CXX_CLIENT_BUILD_TOOLS OFF CACHE BOOL "" FORCE) -set(COUCHBASE_CXX_CLIENT_POST_LINKED_OPENSSL ON CACHE BOOL "" FORCE) -set(COUCHBASE_CXX_CLIENT_INSTALL OFF CACHE BOOL "" FORCE) - -set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/couchbase/remove-thirdparty-1.0.2.patch") -set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/couchbase/remove-debug-symbols.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}\\\")") - -FetchContent_Declare(couchbase-cxx-client - URL https://github.com/couchbase/couchbase-cxx-client/releases/download/1.0.2/couchbase-cxx-client-1.0.2.tar.gz - URL_HASH SHA256=1954e6f5e063d94675428182bc8b1b82fd8e8532c10d1787f157aeb18bb37769 - PATCH_COMMAND "${PC}" -) -FetchContent_MakeAvailable(couchbase-cxx-client) - -set(COUCHBASE_INCLUDE_DIR "${couchbase-cxx-client_SOURCE_DIR}" CACHE STRING "" FORCE) diff --git a/cmake/Crc32c.cmake b/cmake/Crc32c.cmake index 3b4f3edb11..6e408b3b62 100644 --- a/cmake/Crc32c.cmake +++ b/cmake/Crc32c.cmake @@ -28,4 +28,7 @@ FetchContent_Declare( SYSTEM ) FetchContent_MakeAvailable(crc32c) -add_library(Crc32c::crc32c ALIAS crc32c) + +if (NOT TARGET Crc32c::crc32c) + add_library(Crc32c::crc32c ALIAS crc32c) +endif() diff --git a/cmake/FetchLibSSH2.cmake b/cmake/FetchLibSSH2.cmake index 7f70845dcc..7b589cb593 100644 --- a/cmake/FetchLibSSH2.cmake +++ b/cmake/FetchLibSSH2.cmake @@ -50,3 +50,8 @@ set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) FetchContent_MakeAvailable(libssh2) target_link_libraries(libssh2_static PUBLIC OpenSSL::Crypto OpenSSL::SSL ZLIB::ZLIB) + +if (NOT TARGET Libssh2::libssh2) + add_library(Libssh2::libssh2 ALIAS libssh2_static) +endif() + diff --git a/cmake/Fetchlibrdkafka.cmake b/cmake/Fetchlibrdkafka.cmake index b0c32b0923..df072b82a8 100644 --- a/cmake/Fetchlibrdkafka.cmake +++ b/cmake/Fetchlibrdkafka.cmake @@ -37,8 +37,8 @@ set(PC ${Bash_EXECUTABLE} -c "set -x &&\ (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_2}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_2}\\\")") FetchContent_Declare(libkafka - URL https://github.com/confluentinc/librdkafka/archive/refs/tags/v2.14.1.tar.gz - URL_HASH SHA256=bb246e754dee3560e9b42bf4e844dc05de4b146a3cae937e36301ffacdc456e7 + URL https://github.com/confluentinc/librdkafka/archive/refs/tags/v2.14.2.tar.gz + URL_HASH SHA256=d7eec9c31c817fa44402f679c252dfbf97e4c338a849a25c3579a31fd127beb8 PATCH_COMMAND "${PC}" SYSTEM ) @@ -55,3 +55,16 @@ target_include_directories(rdkafka SYSTEM PRIVATE ${ZSTD_INCLUDE_DIRS}) target_include_directories(rdkafka SYSTEM PRIVATE ${LZ4_INCLUDE_DIRS}) target_link_libraries(rdkafka INTERFACE zstd::zstd lz4::lz4) + +if (NOT TARGET RdKafka::rdkafka++) + add_library(RdKafka::rdkafka++ ALIAS rdkafka) +endif() + +set(RDKAFKA_PUBLIC_INCLUDE_DIR "${libkafka_BINARY_DIR}/include") +foreach(RDKAFKA_PUBLIC_HEADER rdkafka.h rdkafka_mock.h) + configure_file( + "${libkafka_SOURCE_DIR}/src/${RDKAFKA_PUBLIC_HEADER}" + "${RDKAFKA_PUBLIC_INCLUDE_DIR}/librdkafka/${RDKAFKA_PUBLIC_HEADER}" + COPYONLY) +endforeach() +target_include_directories(rdkafka SYSTEM INTERFACE "$") diff --git a/cmake/FetchUvc.cmake b/cmake/GetArgparse.cmake similarity index 72% rename from cmake/FetchUvc.cmake rename to cmake/GetArgparse.cmake index 5071531163..d1e0beaa24 100644 --- a/cmake/FetchUvc.cmake +++ b/cmake/GetArgparse.cmake @@ -1,4 +1,3 @@ -# # 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 @@ -15,12 +14,11 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# -include(FetchContent) -FetchContent_Declare(Uvc - URL https://github.com/libuvc/libuvc/archive/refs/tags/v0.0.7.tar.gz - URL_HASH SHA256=7c6ba79723ad5d0ccdfbe6cadcfbd03f9f75b701d7ba96631eb1fd929a86ee72 - OVERRIDE_FIND_PACKAGE - SYSTEM -) -FetchContent_MakeAvailable(Uvc) + +if(MINIFI_ARGPARSE_SOURCE STREQUAL "CONAN") + message("Using Conan to install argparse") + find_package(argparse REQUIRED) +elseif(MINIFI_ARGPARSE_SOURCE STREQUAL "BUILD") + message("Using CMake to build argparse from source") + include(ArgParse) +endif() diff --git a/cmake/mbedtls/dummy/FindMbedTLS.cmake b/cmake/GetAsio.cmake similarity index 61% rename from cmake/mbedtls/dummy/FindMbedTLS.cmake rename to cmake/GetAsio.cmake index 750d465358..2c183f8474 100644 --- a/cmake/mbedtls/dummy/FindMbedTLS.cmake +++ b/cmake/GetAsio.cmake @@ -15,11 +15,10 @@ # specific language governing permissions and limitations # under the License. -if(NOT MBEDTLS_FOUND) - set(MBEDTLS_FOUND "YES" CACHE STRING "" FORCE) - set(MBEDTLS_INCLUDE_DIRS "${EXPORTED_MBEDTLS_INCLUDE_DIRS}" CACHE STRING "" FORCE) - set(MBEDTLS_LIBRARIES ${EXPORTED_MBEDTLS_LIBRARIES} CACHE STRING "" FORCE) - set(MBEDTLS_LIBRARY "${EXPORTED_MBEDTLS_LIBRARY}" CACHE STRING "" FORCE) - set(MBEDX509_LIBRARY "${EXPORTED_MBEDX509_LIBRARY}" CACHE STRING "" FORCE) - set(MBEDCRYPTO_LIBRARY "${EXPORTED_MBEDCRYPTO_LIBRARY}" CACHE STRING "" FORCE) -endif() \ No newline at end of file +if(MINIFI_ASIO_SOURCE STREQUAL "CONAN") + message("Using Conan to install Asio") + find_package(asio REQUIRED) +elseif(MINIFI_ASIO_SOURCE STREQUAL "BUILD") + message("Using CMake to build Asio from source") + include(Asio) +endif() diff --git a/cmake/GetBZip2.cmake b/cmake/GetBZip2.cmake index 2a7d47e9e7..7da1424d35 100644 --- a/cmake/GetBZip2.cmake +++ b/cmake/GetBZip2.cmake @@ -15,13 +15,11 @@ # specific language governing permissions and limitations # under the License. -function(get_bzip2 SOURCE_DIR BINARY_DIR) - if(MINIFI_BZIP2_SOURCE STREQUAL "CONAN") - message("Using Conan to install bzip2") - find_package(BZip2 REQUIRED) - elseif(MINIFI_BZIP2_SOURCE STREQUAL "BUILD") - message("Using CMake to build bzip2 from source") - include(BundledBZip2) - use_bundled_bzip2(${SOURCE_DIR} ${BINARY_DIR}) - endif() -endfunction(get_bzip2) +if(MINIFI_BZIP2_SOURCE STREQUAL "CONAN") + message("Using Conan to install bzip2") + find_package(BZip2 REQUIRED) +elseif(MINIFI_BZIP2_SOURCE STREQUAL "BUILD") + message("Using CMake to build bzip2 from source") + include(BundledBZip2) + use_bundled_bzip2(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) +endif() diff --git a/cmake/GetBenchmark.cmake b/cmake/GetBenchmark.cmake new file mode 100644 index 0000000000..a2d6fd6df0 --- /dev/null +++ b/cmake/GetBenchmark.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_BENCHMARK_SOURCE STREQUAL "CONAN") + message("Using Conan to install benchmark") + find_package(benchmark REQUIRED) +elseif(MINIFI_BENCHMARK_SOURCE STREQUAL "BUILD") + message("Using CMake to build benchmark from source") + include(FetchBenchmark) +endif() diff --git a/cmake/GetCatch2.cmake b/cmake/GetCatch2.cmake index d6c1d6acca..8d4d6c4e00 100644 --- a/cmake/GetCatch2.cmake +++ b/cmake/GetCatch2.cmake @@ -15,13 +15,13 @@ # specific language governing permissions and limitations # under the License. -function(get_catch2) - if(MINIFI_CATCH2_SOURCE STREQUAL "CONAN") - message("Using Conan to install Catch2") - find_package(Catch2 REQUIRED) +if(MINIFI_CATCH2_SOURCE STREQUAL "CONAN") + message("Using Conan to install Catch2") + find_package(Catch2 REQUIRED) + if (NOT TARGET Catch2WithMain) add_library(Catch2WithMain ALIAS Catch2::Catch2WithMain) - elseif(MINIFI_CATCH2_SOURCE STREQUAL "BUILD") - message("Using CMake to build Catch2 from source") - include(Catch2) endif() -endfunction(get_catch2) +elseif(MINIFI_CATCH2_SOURCE STREQUAL "BUILD") + message("Using CMake to build Catch2 from source") + include(Catch2) +endif() diff --git a/cmake/GetCivetWeb.cmake b/cmake/GetCivetWeb.cmake index f30d222897..6604e22cfa 100644 --- a/cmake/GetCivetWeb.cmake +++ b/cmake/GetCivetWeb.cmake @@ -15,12 +15,10 @@ # specific language governing permissions and limitations # under the License. -function(get_civetweb) - if(MINIFI_CIVETWEB_SOURCE STREQUAL "CONAN") - message("Using Conan to install CivetWeb") - find_package(civetweb REQUIRED) - elseif(MINIFI_CIVETWEB_SOURCE STREQUAL "BUILD") - message("Using CMake to build CivetWeb from source") - include(CivetWeb) - endif() -endfunction(get_civetweb) +if(MINIFI_CIVETWEB_SOURCE STREQUAL "CONAN") + message("Using Conan to install CivetWeb") + find_package(civetweb REQUIRED) +elseif(MINIFI_CIVETWEB_SOURCE STREQUAL "BUILD") + message("Using CMake to build CivetWeb from source") + include(CivetWeb) +endif() diff --git a/cmake/GetCouchbase.cmake b/cmake/GetCouchbase.cmake new file mode 100644 index 0000000000..d38163ce6c --- /dev/null +++ b/cmake/GetCouchbase.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_COUCHBASE_SOURCE STREQUAL "CONAN") + message("Using Conan to install Couchbase") + find_package(couchbase_cxx_client REQUIRED) +elseif(MINIFI_COUCHBASE_SOURCE STREQUAL "BUILD") + message("Using CMake to build Couchbase from source") + include(Couchbase) +endif() diff --git a/cmake/GetFmt.cmake b/cmake/GetFmt.cmake index f4f28458db..7a728dc9e2 100644 --- a/cmake/GetFmt.cmake +++ b/cmake/GetFmt.cmake @@ -15,12 +15,10 @@ # specific language governing permissions and limitations # under the License. -function(get_fmt) - if(MINIFI_FMT_SOURCE STREQUAL "CONAN") - message("Using Conan to install Fmt") - find_package(fmt REQUIRED) - elseif(MINIFI_FMT_SOURCE STREQUAL "BUILD") - message("Using CMake to build Fmt from source") - include(fmt) - endif() -endfunction(get_fmt) +if(MINIFI_FMT_SOURCE STREQUAL "CONAN") + message("Using Conan to install Fmt") + find_package(fmt REQUIRED) +elseif(MINIFI_FMT_SOURCE STREQUAL "BUILD") + message("Using CMake to build Fmt from source") + include(fmt) +endif() diff --git a/cmake/GetFmt_11_0_2.cmake b/cmake/GetFmt_11_0_2.cmake index c788dd8ae1..e3ab8a3b5c 100644 --- a/cmake/GetFmt_11_0_2.cmake +++ b/cmake/GetFmt_11_0_2.cmake @@ -15,12 +15,10 @@ # specific language governing permissions and limitations # under the License. -function(get_fmt_11_0_2) - if(MINIFI_FMT_SOURCE STREQUAL "CONAN") - message("Using Conan to install Fmt") - find_package(fmt REQUIRED) - elseif(MINIFI_FMT_SOURCE STREQUAL "BUILD") - message("Using CMake to build Fmt from source (version 11.0.2)") - include(fmt_11_0_2) - endif() -endfunction(get_fmt_11_0_2) +if(MINIFI_FMT_SOURCE STREQUAL "CONAN") + message("Using Conan to install Fmt") + find_package(fmt REQUIRED) +elseif(MINIFI_FMT_SOURCE STREQUAL "BUILD") + message("Using CMake to build Fmt from source (version 11.0.2)") + include(fmt_11_0_2) +endif() diff --git a/cmake/GetGslLite.cmake b/cmake/GetGslLite.cmake new file mode 100644 index 0000000000..9f33041bde --- /dev/null +++ b/cmake/GetGslLite.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_GSL_LITE_SOURCE STREQUAL "CONAN") + message("Using Conan to install gsl-lite") + find_package(gsl-lite REQUIRED) +elseif(MINIFI_GSL_LITE_SOURCE STREQUAL "BUILD") + message("Using CMake to build gsl-lite from source") + include(GslLite) +endif() diff --git a/cmake/GetJemalloc.cmake b/cmake/GetJemalloc.cmake new file mode 100644 index 0000000000..e81f3ac79a --- /dev/null +++ b/cmake/GetJemalloc.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_JEMALLOC_SOURCE STREQUAL "CONAN") + message("Using Conan to install jemalloc") + find_package(jemalloc REQUIRED) +elseif(MINIFI_JEMALLOC_SOURCE STREQUAL "BUILD") + message("Using CMake to build jemalloc from source") + include(BundledJemalloc) + use_bundled_jemalloc(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) +endif() diff --git a/cmake/GetJsonSchemaValidator.cmake b/cmake/GetJsonSchemaValidator.cmake new file mode 100644 index 0000000000..3c32f25651 --- /dev/null +++ b/cmake/GetJsonSchemaValidator.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_JSONSCHEMA_VALIDATOR_SOURCE STREQUAL "CONAN") + message("Using Conan to install json-schema-validator") + find_package(nlohmann_json_schema_validator REQUIRED) +elseif(MINIFI_JSONSCHEMA_VALIDATOR_SOURCE STREQUAL "BUILD") + message("Using CMake to build json-schema-validator from source") + include(JsonSchemaValidator) +endif() diff --git a/cmake/GetJsoncons.cmake b/cmake/GetJsoncons.cmake new file mode 100644 index 0000000000..a8b4a647f0 --- /dev/null +++ b/cmake/GetJsoncons.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_JSONCONS_SOURCE STREQUAL "CONAN") + message("Using Conan to install jsoncons") + find_package(jsoncons REQUIRED) +elseif(MINIFI_JSONCONS_SOURCE STREQUAL "BUILD") + message("Using CMake to build jsoncons from source") + include(Jsoncons) +endif() diff --git a/cmake/GetLibCURL.cmake b/cmake/GetLibCURL.cmake index 72c6a28454..a0654a1072 100644 --- a/cmake/GetLibCURL.cmake +++ b/cmake/GetLibCURL.cmake @@ -15,12 +15,10 @@ # specific language governing permissions and limitations # under the License. -function(get_curl SOURCE_DIR BINARY_DIR) - if(MINIFI_LIBCURL_SOURCE STREQUAL "CONAN") - message("Using Conan to install libcurl") - find_package(CURL REQUIRED) - elseif(MINIFI_LIBCURL_SOURCE STREQUAL "BUILD") - message("Using CMake to build libcurl from source") - include(FetchLibcURL) - endif() -endfunction(get_curl SOURCE_DIR BINARY_DIR) +if(MINIFI_LIBCURL_SOURCE STREQUAL "CONAN") + message("Using Conan to install libcurl") + find_package(CURL REQUIRED) +elseif(MINIFI_LIBCURL_SOURCE STREQUAL "BUILD") + message("Using CMake to build libcurl from source") + include(FetchLibcURL) +endif() diff --git a/cmake/GetLibLZMA.cmake b/cmake/GetLibLZMA.cmake new file mode 100644 index 0000000000..d7f25867ff --- /dev/null +++ b/cmake/GetLibLZMA.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_LIBLZMA_SOURCE STREQUAL "CONAN") + message("Using Conan to install LibLZMA") + find_package(LibLZMA REQUIRED) +elseif(MINIFI_LIBLZMA_SOURCE STREQUAL "BUILD") + message("Using CMake to build LibLZMA from source") + include(LibLZMA) +endif() diff --git a/cmake/GetLibSSH2.cmake b/cmake/GetLibSSH2.cmake new file mode 100644 index 0000000000..5701826303 --- /dev/null +++ b/cmake/GetLibSSH2.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_LIBSSH2_SOURCE STREQUAL "CONAN") + message("Using Conan to install LibSSH2") + find_package(Libssh2 REQUIRED) +elseif(MINIFI_LIBSSH2_SOURCE STREQUAL "BUILD") + message("Using CMake to build LibSSH2 from source") + include(FetchLibSSH2) +endif() diff --git a/cmake/GetLibSodium.cmake b/cmake/GetLibSodium.cmake new file mode 100644 index 0000000000..e448c35b74 --- /dev/null +++ b/cmake/GetLibSodium.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_LIBSODIUM_SOURCE STREQUAL "CONAN") + message("Using Conan to install libsodium") + find_package(LibSodium REQUIRED) +elseif(MINIFI_LIBSODIUM_SOURCE STREQUAL "BUILD") + message("Using CMake to build libsodium from source") + include(BundledLibSodium) + use_bundled_libsodium(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) +endif() diff --git a/cmake/GetLibXml2.cmake b/cmake/GetLibXml2.cmake index 2a6c618f6f..cd73a9511d 100644 --- a/cmake/GetLibXml2.cmake +++ b/cmake/GetLibXml2.cmake @@ -15,12 +15,10 @@ # specific language governing permissions and limitations # under the License. -function(get_libxml2 SOURCE_DIR BINARY_DIR) - if(MINIFI_LIBXML2_SOURCE STREQUAL "CONAN") - message("Using Conan to install libxml2") - find_package(libxml2 REQUIRED) - elseif(MINIFI_LIBXML2_SOURCE STREQUAL "BUILD") - message("Using CMake to build libxml2 from source") - include(LibXml2) - endif() -endfunction(get_libxml2) +if(MINIFI_LIBXML2_SOURCE STREQUAL "CONAN") + message("Using Conan to install libxml2") + find_package(libxml2 REQUIRED) +elseif(MINIFI_LIBXML2_SOURCE STREQUAL "BUILD") + message("Using CMake to build libxml2 from source") + include(LibXml2) +endif() diff --git a/cmake/GetMagicEnum.cmake b/cmake/GetMagicEnum.cmake new file mode 100644 index 0000000000..84f99cd295 --- /dev/null +++ b/cmake/GetMagicEnum.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_MAGIC_ENUM_SOURCE STREQUAL "CONAN") + message("Using Conan to install magic_enum") + find_package(magic_enum REQUIRED) +elseif(MINIFI_MAGIC_ENUM_SOURCE STREQUAL "BUILD") + message("Using CMake to build magic_enum from source") + include(MagicEnum) +endif() diff --git a/cmake/GetMiMalloc.cmake b/cmake/GetMiMalloc.cmake new file mode 100644 index 0000000000..6e923c46f0 --- /dev/null +++ b/cmake/GetMiMalloc.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_MIMALLOC_SOURCE STREQUAL "CONAN") + message("Using Conan to install mimalloc") + find_package(mimalloc REQUIRED) +elseif(MINIFI_MIMALLOC_SOURCE STREQUAL "BUILD") + message("Using CMake to build mimalloc from source") + include(MiMalloc) +endif() diff --git a/cmake/GetOpen62541.cmake b/cmake/GetOpen62541.cmake new file mode 100644 index 0000000000..1a98c309a6 --- /dev/null +++ b/cmake/GetOpen62541.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_OPC_SOURCE STREQUAL "CONAN") + message("Using Conan to install open62541") + find_package(open62541 REQUIRED) +elseif(MINIFI_OPC_SOURCE STREQUAL "BUILD") + message("Using CMake to build open62541 from source") + include(Open62541) +endif() diff --git a/cmake/GetOpenSSL.cmake b/cmake/GetOpenSSL.cmake index 453e1db24a..f1a40ccf4f 100644 --- a/cmake/GetOpenSSL.cmake +++ b/cmake/GetOpenSSL.cmake @@ -20,6 +20,11 @@ if(MINIFI_OPENSSL_SOURCE STREQUAL "CONAN") find_package(OpenSSL REQUIRED) set(FIND_OPENSSL_PATH "${CMAKE_BINARY_DIR}/FindOpenSSL.cmake" CACHE INTERNAL "Location of the FindOpenSSL file, for other dependencies") set(FIND_CRYPTO_PATH "${CMAKE_BINARY_DIR}/FindOpenSSL.cmake" CACHE INTERNAL "Conan's FindOpenSSL finds the Crypto library, too") + + set(OPENSSL_BIN_DIR "${openssl_PACKAGE_FOLDER_RELEASE}" CACHE STRING "" FORCE) + + include(BundledOpenSSLFips) + elseif(MINIFI_OPENSSL_SOURCE STREQUAL "BUILD") message("Using CMake to build OpenSSL from source") include(BundledOpenSSL) diff --git a/cmake/GetPahoMqttC.cmake b/cmake/GetPahoMqttC.cmake new file mode 100644 index 0000000000..734b15a179 --- /dev/null +++ b/cmake/GetPahoMqttC.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_PAHO_MQTT_C_SOURCE STREQUAL "CONAN") + message("Using Conan to install paho-mqtt-c") + find_package(eclipse-paho-mqtt-c REQUIRED) +elseif(MINIFI_PAHO_MQTT_C_SOURCE STREQUAL "BUILD") + message("Using CMake to build paho-mqtt-c from source") + include(PahoMqttC) +endif() diff --git a/cmake/GetPrometheus.cmake b/cmake/GetPrometheus.cmake new file mode 100644 index 0000000000..a2aa09ed98 --- /dev/null +++ b/cmake/GetPrometheus.cmake @@ -0,0 +1,26 @@ +# 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_PROMETHEUS_SOURCE STREQUAL "CONAN") + message("Using Conan to install Prometheus") + find_package(prometheus-cpp REQUIRED) + set(_prometheus_targets prometheus-cpp::prometheus-cpp) +elseif(MINIFI_PROMETHEUS_SOURCE STREQUAL "BUILD") + message("Using CMake to build Prometheus from source") + include(Prometheus) + set(_prometheus_targets prometheus-cpp::core prometheus-cpp::pull) +endif() diff --git a/cmake/GetPugiXml.cmake b/cmake/GetPugiXml.cmake new file mode 100644 index 0000000000..1e784009a0 --- /dev/null +++ b/cmake/GetPugiXml.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_PUGIXML_SOURCE STREQUAL "CONAN") + message("Using Conan to install PugiXML") + find_package(PugiXML REQUIRED) +elseif(MINIFI_PUGIXML_SOURCE STREQUAL "BUILD") + message("Using CMake to build PugiXML from source") + include(PugiXml) +endif() diff --git a/cmake/GetRangeV3.cmake b/cmake/GetRangeV3.cmake new file mode 100644 index 0000000000..f58cb471ce --- /dev/null +++ b/cmake/GetRangeV3.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_RANGEV3_SOURCE STREQUAL "CONAN") + message("Using Conan to install range-v3") + find_package(range-v3 REQUIRED) +elseif(MINIFI_RANGEV3_SOURCE STREQUAL "BUILD") + message("Using CMake to build range-v3 from source") + include(RangeV3) +endif() diff --git a/cmake/GetRocksDB.cmake b/cmake/GetRocksDB.cmake index 0968afc381..78449967f2 100644 --- a/cmake/GetRocksDB.cmake +++ b/cmake/GetRocksDB.cmake @@ -15,20 +15,20 @@ # specific language governing permissions and limitations # under the License. -function(get_rocksdb SOURCE_DIR BINARY_DIR) - if(MINIFI_ROCKSDB_SOURCE STREQUAL "CONAN") - message("Using Conan to install RocksDB") - find_package(RocksDB REQUIRED) +if(MINIFI_ROCKSDB_SOURCE STREQUAL "CONAN") + message("Using Conan to install RocksDB") + find_package(RocksDB REQUIRED) + if (NOT TARGET RocksDB::RocksDB) add_library(RocksDB::RocksDB ALIAS RocksDB::rocksdb) - elseif(MINIFI_ROCKSDB_SOURCE STREQUAL "BUILD") - message("Using CMake to build RocksDB from source") + endif() +elseif(MINIFI_ROCKSDB_SOURCE STREQUAL "BUILD") + message("Using CMake to build RocksDB from source") - if (BUILD_ROCKSDB) - include(BundledRocksDB) - use_bundled_rocksdb(${SOURCE_DIR} ${BINARY_DIR}) - else() - list(APPEND CMAKE_MODULE_PATH "${SOURCE_DIR}/cmake/rocksdb/sys") - find_package(RocksDB REQUIRED) - endif() + if (BUILD_ROCKSDB) + include(BundledRocksDB) + use_bundled_rocksdb(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) + else() + list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/rocksdb/sys") + find_package(RocksDB REQUIRED) endif() -endfunction(get_rocksdb SOURCE_DIR BINARY_DIR) +endif() diff --git a/cmake/GetSpdlog.cmake b/cmake/GetSpdlog.cmake index 9fe3b9c465..3097b41ed9 100644 --- a/cmake/GetSpdlog.cmake +++ b/cmake/GetSpdlog.cmake @@ -15,22 +15,20 @@ # specific language governing permissions and limitations # under the License. -function(get_spdlog) - if (WIN32) - include(GetFmt_11_0_2) - get_fmt_11_0_2() - else() - include(GetFmt) - get_fmt() - endif() +if (WIN32) + include(GetFmt_11_0_2) +else() + include(GetFmt) +endif() - if(MINIFI_SPDLOG_SOURCE STREQUAL "CONAN") - message("Using Conan to install spdlog") - find_package(spdlog REQUIRED) +if(MINIFI_SPDLOG_SOURCE STREQUAL "CONAN") + message("Using Conan to install spdlog") + find_package(spdlog REQUIRED) + if (NOT TARGET spdlog) add_library(spdlog ALIAS spdlog::spdlog) - elseif(MINIFI_SPDLOG_SOURCE STREQUAL "BUILD") - message("Using CMake to build spdlog from source") - include(Spdlog) endif() -endfunction(get_spdlog) +elseif(MINIFI_SPDLOG_SOURCE STREQUAL "BUILD") + message("Using CMake to build spdlog from source") + include(Spdlog) +endif() diff --git a/cmake/GetYamlCpp.cmake b/cmake/GetYamlCpp.cmake new file mode 100644 index 0000000000..bfae7ad040 --- /dev/null +++ b/cmake/GetYamlCpp.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_YAMLCPP_SOURCE STREQUAL "CONAN") + message("Using Conan to install yaml-cpp") + find_package(yaml-cpp REQUIRED) +elseif(MINIFI_YAMLCPP_SOURCE STREQUAL "BUILD") + message("Using CMake to build yaml-cpp from source") + include(YamlCpp) +endif() diff --git a/cmake/GetZLIB.cmake b/cmake/GetZLIB.cmake index 96496ba56e..f8793c9c25 100644 --- a/cmake/GetZLIB.cmake +++ b/cmake/GetZLIB.cmake @@ -15,12 +15,10 @@ # specific language governing permissions and limitations # under the License. -function(get_zlib SOURCE_DIR BINARY_DIR) - if(MINIFI_ZLIB_SOURCE STREQUAL "CONAN") - message("Using Conan to install zlib") - find_package(ZLIB REQUIRED) - elseif(MINIFI_ZLIB_SOURCE STREQUAL "BUILD") - message("Using CMake to build zlib from source") - include(ZLIB) - endif() -endfunction(get_zlib) +if(MINIFI_ZLIB_SOURCE STREQUAL "CONAN") + message("Using Conan to install zlib") + find_package(ZLIB REQUIRED) +elseif(MINIFI_ZLIB_SOURCE STREQUAL "BUILD") + message("Using CMake to build zlib from source") + include(ZLIB) +endif() diff --git a/cmake/Getlibrdkafka.cmake b/cmake/Getlibrdkafka.cmake new file mode 100644 index 0000000000..071b99afc3 --- /dev/null +++ b/cmake/Getlibrdkafka.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_KAFKA_SOURCE STREQUAL "CONAN") + message("Using Conan to install librdkafka") + find_package(RdKafka REQUIRED) +elseif(MINIFI_KAFKA_SOURCE STREQUAL "BUILD") + message("Using CMake to build librdkafka from source") + include(Fetchlibrdkafka) +endif() diff --git a/cmake/Jsoncons.cmake b/cmake/Jsoncons.cmake index 694659c8c3..10a1add426 100644 --- a/cmake/Jsoncons.cmake +++ b/cmake/Jsoncons.cmake @@ -26,3 +26,7 @@ FetchContent_Declare(jsoncons ) FetchContent_MakeAvailable(jsoncons) + +if (NOT TARGET jsoncons::jsoncons) + add_library(jsoncons::jsoncons ALIAS jsoncons) +endif() diff --git a/cmake/LibLZMA.cmake b/cmake/LibLZMA.cmake index 1669368c1a..480a3f5d22 100644 --- a/cmake/LibLZMA.cmake +++ b/cmake/LibLZMA.cmake @@ -31,7 +31,9 @@ FetchContent_Declare(liblzma FetchContent_MakeAvailable(liblzma) -add_library(LibLZMA::LibLZMA ALIAS liblzma) +if (NOT TARGET LibLZMA::LibLZMA) + add_library(LibLZMA::LibLZMA ALIAS liblzma) +endif() # Set exported variables for FindPackage.cmake @@ -44,3 +46,5 @@ else() set(LIBLZMA_LIBRARY "${liblzma_BINARY_DIR}/liblzma.a" CACHE STRING "" FORCE) set(PASSTHROUGH_VARIABLES ${PASSTHROUGH_VARIABLES} "-DEXPORTED_LIBLZMA_LIBRARY=${LIBLZMA_LIBRARY}" CACHE STRING "" FORCE) endif() + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/liblzma/dummy") diff --git a/cmake/MbedTLS.cmake b/cmake/MbedTLS.cmake deleted file mode 100644 index dc00c4dd2a..0000000000 --- a/cmake/MbedTLS.cmake +++ /dev/null @@ -1,61 +0,0 @@ -# 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. - -include(FetchContent) - -set(ENABLE_TESTING OFF CACHE BOOL "" FORCE) -set(ENABLE_PROGRAMS OFF CACHE BOOL "" FORCE) - -FetchContent_Declare( - mbedtls - GIT_REPOSITORY "https://github.com/Mbed-TLS/mbedtls.git" - GIT_TAG "v3.6.6" - GIT_SUBMODULES "framework" - EXCLUDE_FROM_ALL - SYSTEM -) - -FetchContent_MakeAvailable(mbedtls) - -foreach(mbedtls_target mbedtls mbedx509 mbedcrypto everest p256m) - if(TARGET ${mbedtls_target}) - target_compile_options(${mbedtls_target} PRIVATE $<$:-Wno-error>) - endif() -endforeach() - -if (WIN32) - set(MBEDTLS_BYPRODUCT_PREFIX "" CACHE STRING "" FORCE) - set(MBEDTLS_BYPRODUCT_SUFFIX ".lib" CACHE STRING "" FORCE) -else() - set(MBEDTLS_BYPRODUCT_PREFIX "lib" CACHE STRING "" FORCE) - set(MBEDTLS_BYPRODUCT_SUFFIX ".a" CACHE STRING "" FORCE) -endif() - -# Set variables -set(MBEDTLS_FOUND "YES" CACHE STRING "" FORCE) -set(MBEDTLS_INCLUDE_DIRS "${mbedtls_SOURCE_DIR}/include" CACHE STRING "" FORCE) -set(MBEDTLS_LIBRARY "${mbedtls_BINARY_DIR}/library/${MBEDTLS_BYPRODUCT_PREFIX}mbedtls${MBEDTLS_BYPRODUCT_SUFFIX}" CACHE STRING "" FORCE) -set(MBEDX509_LIBRARY "${mbedtls_BINARY_DIR}/library/${MBEDTLS_BYPRODUCT_PREFIX}mbedx509${MBEDTLS_BYPRODUCT_SUFFIX}" CACHE STRING "" FORCE) -set(MBEDCRYPTO_LIBRARY "${mbedtls_BINARY_DIR}/library/${MBEDTLS_BYPRODUCT_PREFIX}mbedcrypto${MBEDTLS_BYPRODUCT_SUFFIX}" CACHE STRING "" FORCE) -set(MBEDTLS_LIBRARIES "${MBEDTLS_LIBRARY};${MBEDX509_LIBRARY};${MBEDCRYPTO_LIBRARY}" CACHE STRING "" FORCE) - -# Set exported variables for FindPackage.cmake -set(PASSTHROUGH_VARIABLES ${PASSTHROUGH_VARIABLES} "-DEXPORTED_MBEDTLS_INCLUDE_DIRS=${MBEDTLS_INCLUDE_DIRS}" CACHE STRING "" FORCE) -set(PASSTHROUGH_VARIABLES ${PASSTHROUGH_VARIABLES} "-DEXPORTED_MBEDTLS_LIBRARIES=${MBEDTLS_LIBRARIES_EXPORT}" CACHE STRING "" FORCE) -set(PASSTHROUGH_VARIABLES ${PASSTHROUGH_VARIABLES} "-DEXPORTED_MBEDTLS_LIBRARY=${MBEDTLS_LIBRARY}" CACHE STRING "" FORCE) -set(PASSTHROUGH_VARIABLES ${PASSTHROUGH_VARIABLES} "-DEXPORTED_MBEDX509_LIBRARY=${MBEDX509_LIBRARY}" CACHE STRING "" FORCE) -set(PASSTHROUGH_VARIABLES ${PASSTHROUGH_VARIABLES} "-DEXPORTED_MBEDCRYPTO_LIBRARY=${MBEDCRYPTO_LIBRARY}" CACHE STRING "" FORCE) diff --git a/cmake/MiNiFiOptions.cmake b/cmake/MiNiFiOptions.cmake index 5c9820d419..f72ae0547d 100644 --- a/cmake/MiNiFiOptions.cmake +++ b/cmake/MiNiFiOptions.cmake @@ -138,23 +138,42 @@ set_property(CACHE STRICT_GSL_CHECKS PROPERTY STRINGS ${STRICT_GSL_CHECKS_Values add_minifi_multi_option(MINIFI_PACKAGING_TYPE "Selects the packaging format for the final artifact." "TGZ;RPM" "TGZ") # BUILD: Fetch and build from source using CMake FetchContent or ExternalProject -# SYSTEM: Use find_package to use the system version # CONAN: Use Conan packages -add_minifi_multi_option(MINIFI_LZ4_SOURCE "Retrieves lz4 from provided source" "BUILD;SYSTEM;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_LIBCURL_SOURCE "Retrieves LibCURL from provided source" "BUILD;SYSTEM;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_OPENSSL_SOURCE "Retrieves OpenSSL from provided source" "BUILD;SYSTEM;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_ZLIB_SOURCE "Retrieves ZLib from provided source" "BUILD;SYSTEM;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_ROCKSDB_SOURCE "Retrieves RocksDB from provided source" "BUILD;SYSTEM;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_ZSTD_SOURCE "Retrieves Zstd from provided source" "BUILD;SYSTEM;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_BZIP2_SOURCE "Retrieves BZip2 from provided source" "BUILD;SYSTEM;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_CIVETWEB_SOURCE "Retrieves CivetWeb from provided source" "BUILD;SYSTEM;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_LIBXML2_SOURCE "Retrieves LibXml2 from provided source" "BUILD;SYSTEM;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_FMT_SOURCE "Retrieves Fmt from provided source" "BUILD;SYSTEM;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_SPDLOG_SOURCE "Retrieves Spdlog from provided source" "BUILD;SYSTEM;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_CATCH2_SOURCE "Retrieves Catch2 from provided source" "BUILD;SYSTEM;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_LIBARCHIVE_SOURCE "Retrieves libarchive from provided source" "BUILD;SYSTEM;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_LUA_SOURCE "Retrieves Lua from provided source" "BUILD;SYSTEM;CONAN" "BUILD") -add_minifi_multi_option(MINIFI_SOL2_SOURCE "Retrieves Sol2 from provided source" "BUILD;SYSTEM;CONAN" "BUILD") +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") # Docker options diff --git a/cmake/Open62541.cmake b/cmake/Open62541.cmake index ba4a1ffbcb..d13b8e04a5 100644 --- a/cmake/Open62541.cmake +++ b/cmake/Open62541.cmake @@ -19,14 +19,13 @@ include(FetchContent) set(OPEN62541_VERSION "v1.5.4" CACHE STRING "" FORCE) set(UA_ENABLE_ENCRYPTION ON CACHE BOOL "" FORCE) +set(UA_ENABLE_ENCRYPTION_OPENSSL ON CACHE BOOL "" FORCE) set(UA_FORCE_WERROR OFF CACHE BOOL "" FORCE) set(UA_ENABLE_DEBUG_SANITIZER OFF CACHE BOOL "" FORCE) -set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/open62541/open62541.patch") -set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/open62541/cflag_fix.patch") +set(PATCH_FILE "${CMAKE_SOURCE_DIR}/thirdparty/open62541/all/patches/open62541.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}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE}\\\")") FetchContent_Declare( open62541 @@ -41,4 +40,9 @@ FetchContent_Declare( FetchContent_MakeAvailable(open62541) -add_dependencies(open62541 mbedtls) +add_dependencies(open62541 OpenSSL::Crypto OpenSSL::SSL) + +if(TARGET openssl-external) + add_dependencies(open62541-object openssl-external) + add_dependencies(open62541-plugins openssl-external) +endif() diff --git a/cmake/PahoMqttC.cmake b/cmake/PahoMqttC.cmake index d34d597dbe..120a836bee 100644 --- a/cmake/PahoMqttC.cmake +++ b/cmake/PahoMqttC.cmake @@ -25,10 +25,8 @@ set(PAHO_WITH_SSL ON CACHE BOOL "" FORCE) set(PAHO_HIGH_PERFORMANCE ON CACHE BOOL "" FORCE) set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/paho-mqtt/cmake-openssl.patch") -set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/paho-mqtt/1576-Changed-bool-typedef-to-bit.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_1}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_1}\\\")") FetchContent_Declare( paho.mqtt.c-external @@ -40,6 +38,4 @@ FetchContent_Declare( FetchContent_MakeAvailable(paho.mqtt.c-external) -# Set dependencies and target to link to -add_library(paho.mqtt.c ALIAS paho-mqtt3as-static) target_link_libraries(common_ssl_obj_static PUBLIC OpenSSL::SSL OpenSSL::Crypto) diff --git a/cmake/PugiXml.cmake b/cmake/PugiXml.cmake index ba5a4df386..1f405cb17e 100644 --- a/cmake/PugiXml.cmake +++ b/cmake/PugiXml.cmake @@ -20,7 +20,7 @@ set(PUGIXML_BUILD_TESTS OFF CACHE BOOL "" FORCE) FetchContent_Declare( pugixml - URL https://github.com/zeux/pugixml/archive/refs/tags/v1.15.tar.gz - URL_HASH SHA256=b39647064d9e28297a34278bfb897092bf33b7c487906ddfc094c9e8868bddcb + URL https://github.com/zeux/pugixml/archive/refs/tags/v1.16.tar.gz + URL_HASH SHA256=357bcab8877dc9943f355d3a72daba1b053238ba955f50fa81586afb65090219 ) FetchContent_MakeAvailable(pugixml) diff --git a/conanfile.py b/conanfile.py index a1047b2f64..ad032bb4b2 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,3 +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. + from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain from conan.tools.files import collect_libs, copy @@ -7,8 +22,9 @@ required_conan_version = ">=2.0" -shared_requires = ("lz4/1.10.0", "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.14.0", "zlib/1.3.2", "zstd/1.5.7", - "bzip2/1.0.8", "rocksdb/11.1.1@minifi/develop", "libarchive/3.8.7", "lua/5.4.6", "sol2/3.5.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_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", @@ -21,15 +37,69 @@ class MiNiFiCppMain(ConanFile): name = "minifi-cpp" version = "1.0.0" license = "Apache-2.0" - requires = shared_requires settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps" - options = {"shared": [True, False], "fPIC": [True, False]} + 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]} - default_options = {"shared": False, "fPIC": True} + 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} exports_sources = shared_sources + def requirements(self): + for req in shared_requires: + self.requires(req) + self.requires("lua/5.4.8", force=True) + self.requires("asio/1.38.0", force=True) + self.requires("lz4/1.10.0", force=True) + 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_mqtt: + self.requires("paho-mqtt-c/1.3.16") + if self.options.enable_all or self.options.enable_couchbase: + self.requires("couchbase_cxx_client/1.3.1@minifi/develop") + self.requires("ms-gsl/4.0.0") + self.requires("snappy/1.2.1") + self.requires("hdrhistogram-c/0.11.8") + self.requires("taocpp-json/1.0.0-beta.14") + self.requires("llhttp/9.3.0") + if self.options.enable_all or self.options.enable_kafka: + 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.custom_malloc == "jemalloc": + self.requires("jemalloc/5.3.1") + elif self.options.custom_malloc == "mimalloc": + self.requires("mimalloc/3.3.2") + + if not self.options.skip_tests: + self.requires("benchmark/1.9.5") + + def configure(self): + self.options["libarchive"].with_openssl = True + 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: + self.options["libarchive"].with_lzma = True + if self.options.enable_all or self.options.enable_kafka: + self.options["librdkafka"].ssl = True + self.options["librdkafka"].sasl = False + self.options["librdkafka"].zstd = True + self.options["librdkafka"].zlib = True + def generate(self): tc = CMakeToolchain(self) @@ -48,7 +118,26 @@ def generate(self): 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.generate() def build(self): diff --git a/controller/CMakeLists.txt b/controller/CMakeLists.txt index 8b72fa9747..f934649aca 100644 --- a/controller/CMakeLists.txt +++ b/controller/CMakeLists.txt @@ -40,8 +40,8 @@ if (WIN32) endif() add_minifi_executable(minifi-controller ${MINIFI_CONTROLLER_SOURCES}) -include(ArgParse) -target_link_libraries(minifi-controller ${LIBMINIFI} argparse Threads::Threads) +include(GetArgparse) +target_link_libraries(minifi-controller ${LIBMINIFI} argparse::argparse Threads::Threads) set_target_properties(minifi-controller PROPERTIES OUTPUT_NAME minifi-controller diff --git a/core-framework/CMakeLists.txt b/core-framework/CMakeLists.txt index 3dc5a77c57..72411fa517 100644 --- a/core-framework/CMakeLists.txt +++ b/core-framework/CMakeLists.txt @@ -15,7 +15,7 @@ file(GLOB SOURCES add_minifi_library(minifi-core-framework STATIC ${SOURCES}) target_include_directories(minifi-core-framework PUBLIC include) -target_link_libraries(minifi-core-framework PUBLIC minifi-api minifi-core-framework-common ZLIB::ZLIB concurrentqueue RapidJSON spdlog Threads::Threads gsl-lite libsodium range-v3 date::date date::tz asio magic_enum OpenSSL::Crypto OpenSSL::SSL CURL::libcurl RapidJSON) +target_link_libraries(minifi-core-framework PUBLIC minifi-api minifi-core-framework-common ZLIB::ZLIB concurrentqueue RapidJSON spdlog Threads::Threads gsl-lite::gsl-lite libsodium::libsodium range-v3::range-v3 date::date date::tz asio::asio magic_enum::magic_enum OpenSSL::Crypto OpenSSL::SSL CURL::libcurl RapidJSON) if(NOT WIN32) target_link_libraries(minifi-core-framework PUBLIC OSSP::libuuid++) endif() diff --git a/core-framework/common/CMakeLists.txt b/core-framework/common/CMakeLists.txt index 45ad126971..65ec1c84a3 100644 --- a/core-framework/common/CMakeLists.txt +++ b/core-framework/common/CMakeLists.txt @@ -13,7 +13,7 @@ file(GLOB SOURCES add_minifi_library(minifi-core-framework-common STATIC ${SOURCES}) target_include_directories(minifi-core-framework-common PUBLIC include) -target_link_libraries(minifi-core-framework-common PUBLIC minifi-api-common ZLIB::ZLIB concurrentqueue RapidJSON spdlog Threads::Threads gsl-lite libsodium range-v3 date::date date::tz asio magic_enum OpenSSL::Crypto OpenSSL::SSL CURL::libcurl RapidJSON) +target_link_libraries(minifi-core-framework-common PUBLIC minifi-api-common ZLIB::ZLIB concurrentqueue RapidJSON spdlog Threads::Threads gsl-lite::gsl-lite libsodium::libsodium range-v3::range-v3 date::date date::tz asio::asio magic_enum::magic_enum OpenSSL::Crypto OpenSSL::SSL CURL::libcurl RapidJSON) if(NOT WIN32) target_link_libraries(minifi-core-framework-common PUBLIC OSSP::libuuid++) endif() diff --git a/encrypt-config/CMakeLists.txt b/encrypt-config/CMakeLists.txt index a6f7281334..0981079696 100644 --- a/encrypt-config/CMakeLists.txt +++ b/encrypt-config/CMakeLists.txt @@ -25,8 +25,8 @@ if (WIN32) endif() add_minifi_executable(minifi-encrypt-config "${ENCRYPT_CONFIG_FILES}") target_include_directories(minifi-encrypt-config PRIVATE ../libminifi/include) -include(ArgParse) -target_link_libraries(minifi-encrypt-config libsodium argparse core-minifi) +include(GetArgparse) +target_link_libraries(minifi-encrypt-config libsodium::libsodium argparse::argparse core-minifi) set_target_properties(minifi-encrypt-config PROPERTIES OUTPUT_NAME minifi-encrypt-config) set_target_properties(minifi-encrypt-config PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") diff --git a/extension-framework/CMakeLists.txt b/extension-framework/CMakeLists.txt index 679f937d9f..bb6707f12d 100644 --- a/extension-framework/CMakeLists.txt +++ b/extension-framework/CMakeLists.txt @@ -15,10 +15,7 @@ add_minifi_library(minifi-extension-framework STATIC ${SOURCES}) target_include_directories(minifi-extension-framework PUBLIC include) target_link_libraries(minifi-extension-framework PUBLIC minifi-api) -include(RangeV3) -include(Asio) -include(MagicEnum) -list(APPEND CORE_LIBRARIES ZLIB::ZLIB concurrentqueue RapidJSON spdlog Threads::Threads gsl-lite range-v3 asio magic_enum OpenSSL::Crypto OpenSSL::SSL CURL::libcurl RapidJSON) +list(APPEND CORE_LIBRARIES ZLIB::ZLIB concurrentqueue RapidJSON spdlog Threads::Threads gsl-lite::gsl-lite range-v3::range-v3 asio::asio magic_enum::magic_enum OpenSSL::Crypto OpenSSL::SSL CURL::libcurl RapidJSON) if(NOT WIN32) list(APPEND CORE_LIBRARIES OSSP::libuuid++) endif() diff --git a/extensions/couchbase/CMakeLists.txt b/extensions/couchbase/CMakeLists.txt index 632c014e3b..8677e74742 100644 --- a/extensions/couchbase/CMakeLists.txt +++ b/extensions/couchbase/CMakeLists.txt @@ -21,7 +21,7 @@ if (NOT (ENABLE_ALL OR ENABLE_COUCHBASE)) return() endif() -include(Couchbase) +include(GetCouchbase) include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) @@ -35,7 +35,6 @@ target_include_directories(minifi-couchbase SYSTEM PRIVATE ${COUCHBASE_INCLUDE_D if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") target_compile_options(minifi-couchbase PRIVATE -Wno-error=cpp) endif() -target_link_libraries(minifi-couchbase ${LIBMINIFI} couchbase_cxx_client::couchbase_cxx_client_static hdr_histogram_static snappy llhttp::llhttp taocpp::json) +target_link_libraries(minifi-couchbase ${LIBMINIFI} couchbase_cxx_client::couchbase_cxx_client hdr_histogram_static snappy llhttp::llhttp taocpp::json) register_extension(minifi-couchbase "COUCHBASE EXTENSIONS" COUCHBASE-EXTENSIONS "This enables Couchbase support" "extensions/couchbase/tests") - diff --git a/extensions/kafka/CMakeLists.txt b/extensions/kafka/CMakeLists.txt index 3e7bfa1e28..8a2a085442 100644 --- a/extensions/kafka/CMakeLists.txt +++ b/extensions/kafka/CMakeLists.txt @@ -21,7 +21,7 @@ if (NOT (ENABLE_ALL OR ENABLE_KAFKA)) return() endif () -include(Fetchlibrdkafka) +include(Getlibrdkafka) include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) @@ -30,10 +30,6 @@ file(GLOB SOURCES "*.cpp") add_minifi_library(minifi-kafka SHARED ${SOURCES}) target_link_libraries(minifi-kafka minifi-cpp-extension-lib Threads::Threads) - -get_target_property(RDKAFKA_INCLUDE_DIRS rdkafka INCLUDE_DIRECTORIES) -target_include_directories(minifi-kafka SYSTEM PUBLIC ${RDKAFKA_INCLUDE_DIRS}) -target_link_libraries(minifi-kafka rdkafka) +target_link_libraries(minifi-kafka RdKafka::rdkafka++) register_c_api_extension(minifi-kafka "RDKAFKA EXTENSIONS" RDKAFKA-EXTENSIONS "This Enables librdkafka functionality including PublishKafka" "extensions/kafka/tests") - diff --git a/extensions/kafka/ConsumeKafka.h b/extensions/kafka/ConsumeKafka.h index ded235f09e..36411be1ad 100644 --- a/extensions/kafka/ConsumeKafka.h +++ b/extensions/kafka/ConsumeKafka.h @@ -28,7 +28,7 @@ #include "core/PropertyDefinitionBuilder.h" #include "minifi-cpp/core/PropertyValidator.h" #include "minifi-cpp/core/RelationshipDefinition.h" -#include "rdkafka.h" +#include "librdkafka/rdkafka.h" #include "rdkafka_utils.h" #include "utils/ArrayUtils.h" #include "api/core/ProcessSession.h" diff --git a/extensions/kafka/KafkaConnection.h b/extensions/kafka/KafkaConnection.h index 2960f0172f..c832c1b7fa 100644 --- a/extensions/kafka/KafkaConnection.h +++ b/extensions/kafka/KafkaConnection.h @@ -25,7 +25,7 @@ #include #include "minifi-cpp/core/logging/Logger.h" -#include "rdkafka.h" +#include "librdkafka/rdkafka.h" #include "KafkaTopic.h" #include "minifi-cpp/utils/gsl.h" diff --git a/extensions/kafka/PublishKafka.h b/extensions/kafka/PublishKafka.h index 682e4218ee..5d82948d9a 100644 --- a/extensions/kafka/PublishKafka.h +++ b/extensions/kafka/PublishKafka.h @@ -35,7 +35,7 @@ #include "minifi-cpp/core/RelationshipDefinition.h" #include "minifi-cpp/core/logging/Logger.h" #include "minifi-cpp/core/PropertyValidator.h" -#include "rdkafka.h" +#include "librdkafka/rdkafka.h" #include "utils/ArrayUtils.h" #include "utils/RegexUtils.h" #include "minifi-cpp/core/Annotation.h" diff --git a/extensions/kafka/rdkafka_utils.h b/extensions/kafka/rdkafka_utils.h index 91f59deb8e..af2d948693 100644 --- a/extensions/kafka/rdkafka_utils.h +++ b/extensions/kafka/rdkafka_utils.h @@ -22,7 +22,7 @@ #include #include -#include "rdkafka.h" +#include "librdkafka/rdkafka.h" #include "api/utils/Ssl.h" #include "minifi-cpp/core/logging/Logger.h" #include "magic_enum/magic_enum.hpp" diff --git a/extensions/libarchive/CMakeLists.txt b/extensions/libarchive/CMakeLists.txt index 70a9520e00..1bdc686035 100644 --- a/extensions/libarchive/CMakeLists.txt +++ b/extensions/libarchive/CMakeLists.txt @@ -22,8 +22,7 @@ if (NOT (ENABLE_ALL OR ENABLE_LIBARCHIVE)) endif() if (ENABLE_LZMA) - include(LibLZMA) - list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/liblzma/dummy") + include(GetLibLZMA) endif() include(GetLibArchive) diff --git a/extensions/mqtt/CMakeLists.txt b/extensions/mqtt/CMakeLists.txt index 3226236646..6a2956b19f 100644 --- a/extensions/mqtt/CMakeLists.txt +++ b/extensions/mqtt/CMakeLists.txt @@ -30,7 +30,7 @@ add_minifi_library(minifi-mqtt-extensions SHARED ${SOURCES}) target_link_libraries(minifi-mqtt-extensions ${LIBMINIFI}) -include(PahoMqttC) -target_link_libraries(minifi-mqtt-extensions paho.mqtt.c) +include(GetPahoMqttC) +target_link_libraries(minifi-mqtt-extensions eclipse-paho-mqtt-c::paho-mqtt3as-static) register_extension(minifi-mqtt-extensions "MQTT EXTENSIONS" MQTT-EXTENSIONS "This Enables MQTT functionality including PublishMQTT/ConsumeMQTT" "${CMAKE_CURRENT_SOURCE_DIR}/tests") diff --git a/extensions/opc/CMakeLists.txt b/extensions/opc/CMakeLists.txt index 19226af704..d12635632f 100644 --- a/extensions/opc/CMakeLists.txt +++ b/extensions/opc/CMakeLists.txt @@ -20,10 +20,7 @@ if (NOT (ENABLE_ALL OR ENABLE_OPC)) return() endif() -include(MbedTLS) -list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/mbedtls/dummy") - -include(Open62541) +include(GetOpen62541) set( CMAKE_VERBOSE_MAKEFILE on ) diff --git a/extensions/prometheus/CMakeLists.txt b/extensions/prometheus/CMakeLists.txt index 047ce4420b..a284657cd9 100644 --- a/extensions/prometheus/CMakeLists.txt +++ b/extensions/prometheus/CMakeLists.txt @@ -21,14 +21,14 @@ if (NOT (ENABLE_PROMETHEUS OR ENABLE_ALL)) return() endif() -include(Prometheus) +include(GetPrometheus) include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) file(GLOB SOURCES "*.cpp") add_minifi_library(minifi-prometheus SHARED ${SOURCES}) -target_link_libraries(minifi-prometheus ${LIBMINIFI} prometheus-cpp::core prometheus-cpp::pull) +target_link_libraries(minifi-prometheus ${LIBMINIFI} ${_prometheus_targets}) target_include_directories(minifi-prometheus PUBLIC ${prometheus-cpp_INCLUDE_DIRS}) register_extension(minifi-prometheus "PROMETHEUS EXTENSIONS" PROMETHEUS-EXTENSIONS "This enables Prometheus support" "extensions/prometheus/tests") diff --git a/extensions/rocksdb-repos/CMakeLists.txt b/extensions/rocksdb-repos/CMakeLists.txt index db6beeed4b..89e809ee4a 100644 --- a/extensions/rocksdb-repos/CMakeLists.txt +++ b/extensions/rocksdb-repos/CMakeLists.txt @@ -22,7 +22,6 @@ if (NOT ENABLE_ROCKSDB) endif() include(GetRocksDB) -get_rocksdb(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) diff --git a/extensions/sftp/CMakeLists.txt b/extensions/sftp/CMakeLists.txt index ab437622b2..366d70aba5 100644 --- a/extensions/sftp/CMakeLists.txt +++ b/extensions/sftp/CMakeLists.txt @@ -21,7 +21,7 @@ if (NOT (ENABLE_ALL OR ENABLE_SFTP)) return() endif() -include(FetchLibSSH2) +include(GetLibSSH2) include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) include_directories(client processors) @@ -32,6 +32,6 @@ add_minifi_library(minifi-sftp SHARED ${SOURCES}) set_target_properties(minifi-sftp PROPERTIES HAS_CUSTOM_INITIALIZER TRUE) target_link_libraries(minifi-sftp ${LIBMINIFI} Threads::Threads) -target_link_libraries(minifi-sftp libssh2 RapidJSON) +target_link_libraries(minifi-sftp Libssh2::libssh2 RapidJSON) register_extension(minifi-sftp "SFTP EXTENSIONS" SFTP "This enables SFTP support" "extensions/sftp/tests") diff --git a/extensions/standard-processors/CMakeLists.txt b/extensions/standard-processors/CMakeLists.txt index bd16be04ff..ecc4b6fe92 100644 --- a/extensions/standard-processors/CMakeLists.txt +++ b/extensions/standard-processors/CMakeLists.txt @@ -25,10 +25,8 @@ file(GLOB SOURCES "processors/*.cpp" "controllers/*.cpp" "utils/*.cpp" "modbus/* add_minifi_library(minifi-standard-processors SHARED ${SOURCES}) target_include_directories(minifi-standard-processors PUBLIC "${CMAKE_SOURCE_DIR}/extensions/standard-processors") -include(RangeV3) -include(Asio) -include(Jsoncons) -target_link_libraries(minifi-standard-processors ${LIBMINIFI} Threads::Threads range-v3 asio pugixml jsoncons) +include(GetJsoncons) +target_link_libraries(minifi-standard-processors ${LIBMINIFI} Threads::Threads range-v3::range-v3 asio::asio pugixml::pugixml jsoncons::jsoncons) register_extension(minifi-standard-processors "STANDARD PROCESSORS" STANDARD-PROCESSORS "Provides standard processors" "extensions/standard-processors/tests/") diff --git a/extensions/standard-processors/controllers/XMLRecordSetWriter.cpp b/extensions/standard-processors/controllers/XMLRecordSetWriter.cpp index 4e283e5531..26cf820054 100644 --- a/extensions/standard-processors/controllers/XMLRecordSetWriter.cpp +++ b/extensions/standard-processors/controllers/XMLRecordSetWriter.cpp @@ -105,7 +105,7 @@ void XMLRecordSetWriter::convertRecordField(const std::string& field_name, const pugi::xml_node field_node = parent_node.append_child(field_name.c_str()); std::visit(utils::overloaded { [&field_node](const std::string& str_val) { - field_node.text().set(str_val); + field_node.text().set(str_val.c_str()); }, [&field_node](int64_t i64_val) { field_node.text().set(std::to_string(i64_val).c_str()); diff --git a/extensions/windows-event-log/CMakeLists.txt b/extensions/windows-event-log/CMakeLists.txt index c10179ee86..e6f8067786 100644 --- a/extensions/windows-event-log/CMakeLists.txt +++ b/extensions/windows-event-log/CMakeLists.txt @@ -28,6 +28,6 @@ file(GLOB SOURCES "*.cpp" "wel/*.cpp") add_minifi_library(minifi-wel SHARED ${SOURCES}) target_link_libraries(minifi-wel ${LIBMINIFI} Threads::Threads) -target_link_libraries(minifi-wel pugixml ZLIB::ZLIB Wevtapi.lib) +target_link_libraries(minifi-wel pugixml::pugixml ZLIB::ZLIB Wevtapi.lib) register_extension(minifi-wel "WEL EXTENSIONS" WEL-EXTENSION "Enables the suite of Windows Event Log extensions." "extensions/windows-event-log/tests") diff --git a/libminifi/CMakeLists.txt b/libminifi/CMakeLists.txt index 3a0e74d2ac..59d0d916c4 100644 --- a/libminifi/CMakeLists.txt +++ b/libminifi/CMakeLists.txt @@ -80,10 +80,7 @@ else() set_target_properties(core-minifi PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") endif() -include(RangeV3) -include(Asio) -include(MagicEnum) -list(APPEND LIBMINIFI_LIBRARIES minifi-core-framework yaml-cpp ZLIB::ZLIB concurrentqueue RapidJSON spdlog::spdlog Threads::Threads gsl-lite libsodium range-v3 asio magic_enum OpenSSL::Crypto OpenSSL::SSL CURL::libcurl RapidJSON fmt::fmt) +list(APPEND LIBMINIFI_LIBRARIES minifi-core-framework yaml-cpp::yaml-cpp ZLIB::ZLIB concurrentqueue RapidJSON spdlog::spdlog Threads::Threads gsl-lite::gsl-lite libsodium::libsodium range-v3::range-v3 asio::asio magic_enum::magic_enum OpenSSL::Crypto OpenSSL::SSL CURL::libcurl RapidJSON fmt::fmt) if(NOT WIN32) list(APPEND LIBMINIFI_LIBRARIES OSSP::libuuid++) endif() diff --git a/libminifi/test/libtest/CMakeLists.txt b/libminifi/test/libtest/CMakeLists.txt index 7d5bc957b1..9e9bb23308 100644 --- a/libminifi/test/libtest/CMakeLists.txt +++ b/libminifi/test/libtest/CMakeLists.txt @@ -18,7 +18,6 @@ # include(GetCivetWeb) -get_civetweb() add_subdirectory(unit) add_subdirectory(integration) diff --git a/libminifi/test/schema-tests/CMakeLists.txt b/libminifi/test/schema-tests/CMakeLists.txt index a5befa0829..1d1b04df2d 100644 --- a/libminifi/test/schema-tests/CMakeLists.txt +++ b/libminifi/test/schema-tests/CMakeLists.txt @@ -17,7 +17,7 @@ # under the License. # -include(JsonSchemaValidator) +include(GetJsonSchemaValidator) file(GLOB SCHEMA_TESTS "*.cpp") SET(SCHEMA_TEST_COUNT 0) diff --git a/libminifi/test/unit/performance/CMakeLists.txt b/libminifi/test/unit/performance/CMakeLists.txt index 49210c5591..0e8ef47db0 100644 --- a/libminifi/test/unit/performance/CMakeLists.txt +++ b/libminifi/test/unit/performance/CMakeLists.txt @@ -21,7 +21,7 @@ if (NOT MINIFI_PERFORMANCE_TESTS) return() endif() -include(FetchBenchmark) +include(GetBenchmark) GETSOURCEFILES(PERF_TESTS "${TEST_DIR}/unit/performance") diff --git a/minifi-api/CMakeLists.txt b/minifi-api/CMakeLists.txt index a242392f48..75f58ab814 100644 --- a/minifi-api/CMakeLists.txt +++ b/minifi-api/CMakeLists.txt @@ -1,6 +1,6 @@ add_library(minifi-api-common INTERFACE) target_include_directories(minifi-api-common INTERFACE common/include) -target_link_libraries(minifi-api-common INTERFACE gsl-lite) +target_link_libraries(minifi-api-common INTERFACE gsl-lite::gsl-lite) target_compile_definitions(minifi-api-common INTERFACE MINIFI_VERSION_STR="${MINIFI_VERSION_STR}") add_library(minifi-api INTERFACE) diff --git a/minifi_main/CMakeLists.txt b/minifi_main/CMakeLists.txt index 77413e1087..dc94bf2208 100644 --- a/minifi_main/CMakeLists.txt +++ b/minifi_main/CMakeLists.txt @@ -52,7 +52,7 @@ if (NOT USE_SHARED_LIBS) endif(NOT USE_SHARED_LIBS) target_link_libraries(minifiexe Threads::Threads) -target_link_libraries(minifiexe yaml-cpp) +target_link_libraries(minifiexe yaml-cpp::yaml-cpp) if(CUSTOM_MALLOC_LIB) message(VERBOSE "Using custom malloc lib ${CUSTOM_MALLOC_LIB} for minifiexe") target_link_libraries(minifiexe ${CUSTOM_MALLOC_LIB}) @@ -64,8 +64,8 @@ if (WIN32) endif() get_property(extensions GLOBAL PROPERTY EXTENSION-OPTIONS) -include(ArgParse) -target_link_libraries(minifiexe spdlog libsodium gsl-lite argparse core-minifi) +include(GetArgparse) +target_link_libraries(minifiexe spdlog libsodium::libsodium gsl-lite::gsl-lite argparse::argparse core-minifi) set_target_properties(minifiexe PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") set_target_properties(minifiexe PROPERTIES OUTPUT_NAME minifi) diff --git a/thirdparty/couchbase/all/ConanThirdPartyDependencies.cmake b/thirdparty/couchbase/all/ConanThirdPartyDependencies.cmake new file mode 100644 index 0000000000..c05c177bcb --- /dev/null +++ b/thirdparty/couchbase/all/ConanThirdPartyDependencies.cmake @@ -0,0 +1,29 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +find_package(spdlog CONFIG QUIET) +find_package(fmt CONFIG QUIET) +find_package(Microsoft.GSL CONFIG QUIET) +find_package(Snappy CONFIG QUIET) +find_package(asio CONFIG QUIET) +find_package(hdr_histogram CONFIG QUIET) +find_package(llhttp CONFIG QUIET) +find_package(taocpp-json CONFIG QUIET) + +include(cmake/OpenSSL.cmake) + +add_library(jsonsl OBJECT ${PROJECT_SOURCE_DIR}/third_party/jsonsl/jsonsl.c) +set_target_properties(jsonsl PROPERTIES C_VISIBILITY_PRESET hidden POSITION_INDEPENDENT_CODE TRUE) +target_include_directories(jsonsl SYSTEM PUBLIC ${PROJECT_SOURCE_DIR}/third_party/jsonsl) diff --git a/thirdparty/couchbase/all/conandata.yml b/thirdparty/couchbase/all/conandata.yml new file mode 100644 index 0000000000..c26ee23e26 --- /dev/null +++ b/thirdparty/couchbase/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.3.1": + url: "https://github.com/couchbase/couchbase-cxx-client/archive/refs/tags/1.3.1.tar.gz" + sha256: "9c497d8ba6f3e4a12376826ae1c172356e16190bb44584f087d7d1a81278dc0f" +patches: + "1.3.1": + - patch_file: "patches/c++23_fixes.patch" + patch_description: "Fix C++23 compatibility issues" + patch_type: "portability" + - patch_file: "patches/use_fmt_instead_of_spdlog_fmt.patch" + patch_description: "Replace spdlog bundle fmt with fmt library" + patch_type: "portability" + - patch_file: "patches/remove-thirdparty.patch" + patch_description: "Remove third-party dependencies from the source tree" + patch_type: "portability" diff --git a/thirdparty/couchbase/all/conanfile.py b/thirdparty/couchbase/all/conanfile.py new file mode 100644 index 0000000000..de0e279773 --- /dev/null +++ b/thirdparty/couchbase/all/conanfile.py @@ -0,0 +1,150 @@ +# 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/couchbase_cxx_client/all/conanfile.py +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 get, copy, rm, rmdir, replace_in_file, export_conandata_patches, apply_conandata_patches + +required_conan_version = ">=2.0.9" + +class CouchbaseCxxClientConan(ConanFile): + name = "couchbase_cxx_client" + description = "Couchbase C++ SDK" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/couchbase/couchbase-cxx-client" + topics = ("couchbase", "database", "nosql", "sdk") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + + options = { + "shared": [True, False], + "fPIC": [True, False], + } + + default_options = { + "shared": False, + "fPIC": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.settings.os == "Windows": + # Only static on Windows + del self.options.shared + self.package_type = "static-library" + if self.options.get_safe("shared"): + self.options.rm_safe("fPIC") + + def requirements(self): + # these should match https://github.com/couchbase/couchbase-cxx-client/blob/main/couchbase-sdk-cxx-black-duck-manifest.yaml + # as best as possible + self.requires("spdlog/[>=1.15 <2]") + self.requires("fmt/[*]") + self.requires("ms-gsl/4.0.0") + self.requires("snappy/[~1.2.1]") + self.requires("asio/1.38.0") + self.requires("hdrhistogram-c/0.11.8") + self.requires("taocpp-json/1.0.0-beta.14") + self.requires("llhttp/[>=9.1.3 <10]") + self.requires("openssl/[>=1.1 <4]") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.19.0]") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + check_min_cppstd(self, 17) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + # Use only the ConanThirdPartyDependencies.cmake module + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "include(cmake/ThirdPartyDependencies.cmake)", + "include(cmake/ConanThirdPartyDependencies.cmake)") + apply_conandata_patches(self) + + def export_sources(self): + export_conandata_patches(self) + copy(self, "ConanThirdPartyDependencies.cmake", self.recipe_folder, + os.path.join(self.export_sources_folder, "src", "cmake")) + + def generate(self): + deps = CMakeDeps(self) + deps.set_property("hdrhistogram-c", "cmake_target_name", "hdr_histogram_static") + deps.set_property("snappy", "cmake_target_name", "snappy") + deps.set_property("asio", "cmake_target_name", "asio") + deps.generate() + + tc = CMakeToolchain(self) + tc.cache_variables["COUCHBASE_CXX_CLIENT_COLUMNAR"] = "OFF" + tc.cache_variables["COUCHBASE_CXX_CLIENT_BUILD_TESTS"] = "OFF" + tc.cache_variables["COUCHBASE_CXX_CLIENT_BUILD_EXAMPLES"] = "OFF" + tc.cache_variables["COUCHBASE_CXX_CLIENT_BUILD_TOOLS"] = "OFF" + tc.cache_variables["COUCHBASE_CXX_CLIENT_BUILD_DOCS"] = "OFF" + tc.cache_variables["COUCHBASE_CXX_CLIENT_INSTALL"] = "ON" + tc.cache_variables["COUCHBASE_CXX_CLIENT_CLANG_TIDY"] = False + if self.options.get_safe("shared"): + tc.cache_variables["COUCHBASE_CXX_CLIENT_BUILD_SHARED"] = "ON" + tc.cache_variables["COUCHBASE_CXX_CLIENT_BUILD_STATIC"] = "OFF" + else: + tc.cache_variables["COUCHBASE_CXX_CLIENT_BUILD_SHARED"] = "OFF" + tc.cache_variables["COUCHBASE_CXX_CLIENT_BUILD_STATIC"] = "ON" + tc.cache_variables["COUCHBASE_CXX_CLIENT_STATIC_BORINGSSL"] = "OFF" + tc.cache_variables["COUCHBASE_CXX_CLIENT_POST_LINKED_OPENSSL"] = "OFF" + tc.cache_variables["COUCHBASE_CXX_CLIENT_USE_HOMEBREW_TO_DETECT_OPENSSL"] = False + tc.cache_variables["COUCHBASE_CXX_CLIENT_USE_SCOOP_TO_DETECT_OPENSSL"] = False + tc.cache_variables["COUCHBASE_CXX_CLIENT_EMBED_MOZILLA_CA_BUNDLE"] = False + tc.cache_variables["COUCHBASE_CXX_CLIENT_STATIC_OPENSSL"] = not bool(self.dependencies["openssl"].options.shared) + tc.cache_variables["OPENSSL_USABLE"] = True + # Force try_compile checks to use the current single-config build type to avoid looking for missing *_DEBUG imported targets + tc.cache_variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = str(self.settings.build_type) + tc.cache_variables["COUCHBASE_CXX_CLIENT_BUILD_OPENTELEMETRY"] = "OFF" + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + for pattern in ("*.hxx", "*.ixx", "*.h"): + copy(self, pattern, src=os.path.join(self.source_folder, "core"), + dst=os.path.join(self.package_folder, "include", "core"), keep_path=True) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.pdb", self.package_folder, recursive=True) + + def package_info(self): + # Provide canonical CMake target name for consumers + self.cpp_info.set_property("cmake_file_name", "couchbase_cxx_client") + self.cpp_info.set_property("cmake_target_name", "couchbase_cxx_client::couchbase_cxx_client") + self.cpp_info.set_property("pkg_config_name", "couchbase_cxx_client") + + # couchbase has different library names for shared vs static builds + self.cpp_info.libs = ["couchbase_cxx_client" if self.options.get_safe("shared") + else "couchbase_cxx_client_static"] diff --git a/thirdparty/couchbase/c++23_fixes.patch b/thirdparty/couchbase/all/patches/c++23_fixes.patch similarity index 100% rename from thirdparty/couchbase/c++23_fixes.patch rename to thirdparty/couchbase/all/patches/c++23_fixes.patch diff --git a/thirdparty/couchbase/remove-thirdparty.patch b/thirdparty/couchbase/all/patches/remove-thirdparty.patch similarity index 100% rename from thirdparty/couchbase/remove-thirdparty.patch rename to thirdparty/couchbase/all/patches/remove-thirdparty.patch diff --git a/thirdparty/couchbase/use_fmt_instead_of_spdlog_fmt.patch b/thirdparty/couchbase/all/patches/use_fmt_instead_of_spdlog_fmt.patch similarity index 100% rename from thirdparty/couchbase/use_fmt_instead_of_spdlog_fmt.patch rename to thirdparty/couchbase/all/patches/use_fmt_instead_of_spdlog_fmt.patch diff --git a/thirdparty/couchbase/config.yml b/thirdparty/couchbase/config.yml new file mode 100644 index 0000000000..3e45dd4779 --- /dev/null +++ b/thirdparty/couchbase/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.3.1": + folder: all diff --git a/thirdparty/magic-enum/all/conandata.yml b/thirdparty/magic-enum/all/conandata.yml new file mode 100644 index 0000000000..96f8c04c75 --- /dev/null +++ b/thirdparty/magic-enum/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.9.8": + url: "https://github.com/Neargye/magic_enum/archive/v0.9.8.tar.gz" + sha256: "1e54959a3f3cb675938d858603ad69d0f3f7c82439fc2bf86d7232daec2bd10e" diff --git a/thirdparty/magic-enum/all/conanfile.py b/thirdparty/magic-enum/all/conanfile.py new file mode 100644 index 0000000000..a85070735f --- /dev/null +++ b/thirdparty/magic-enum/all/conanfile.py @@ -0,0 +1,98 @@ +# 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/magic_enum/all/conanfile.py +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, rmdir +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=2.0" + + +class MagicEnumConan(ConanFile): + name = "magic_enum" + description = ( + "Header-only C++17 library provides static reflection for enums, work " + "with any enum type without any macro or boilerplate code." + ) + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Neargye/magic_enum" + topics = ("cplusplus", "enum-to-string", "string-to-enum", "serialization", + "reflection", "header-only", "compile-time") + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return "17" + + @property + def _compilers_minimum_version(self): + return { + "gcc": "9", + "Visual Studio": "15", + "msvc": "191", + "clang": "5", + "apple-clang": "10", + } + + def layout(self): + cmake_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["MAGIC_ENUM_OPT_BUILD_EXAMPLES"] = False + tc.cache_variables["MAGIC_ENUM_OPT_BUILD_TESTS"] = False + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "magic_enum") + self.cpp_info.set_property("cmake_target_name", "magic_enum::magic_enum") + self.cpp_info.set_property("pkg_config_name", "magic_enum") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/thirdparty/magic-enum/config.yml b/thirdparty/magic-enum/config.yml new file mode 100644 index 0000000000..8f065c77df --- /dev/null +++ b/thirdparty/magic-enum/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.9.8": + folder: all diff --git a/thirdparty/open62541/all/conandata.yml b/thirdparty/open62541/all/conandata.yml new file mode 100644 index 0000000000..9c9370d304 --- /dev/null +++ b/thirdparty/open62541/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.5.4": + url: "https://github.com/open62541/open62541/archive/refs/tags/v1.5.4.tar.gz" + sha256: "fb5aafc19c67a91368d1f71d9ee4acf0f4b47a0d65c66db4ed738691828779c7" +patches: + "1.5.4": + - patch_file: "patches/open62541.patch" + patch_description: "Fix compilation issues with Open62541" + patch_type: "fix" diff --git a/thirdparty/open62541/all/conanfile.py b/thirdparty/open62541/all/conanfile.py new file mode 100644 index 0000000000..f243affd14 --- /dev/null +++ b/thirdparty/open62541/all/conanfile.py @@ -0,0 +1,169 @@ +# 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/open62541/all/conanfile.py +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain, CMakeDeps +from conan.tools.scm import Version +from conan.tools.files import apply_conandata_patches, collect_libs, export_conandata_patches, copy, rm, rmdir, get +from conan.errors import ConanInvalidConfiguration +import glob +import os + +required_conan_version = ">=2.0" + + +class Open62541Conan(ConanFile): + name = "open62541" + description = "open62541 is an open source and free implementation of OPC UA " \ + "(OPC Unified Architecture) written in the common subset of the " \ + "C99 and C++98 languages. The library is usable with all major " \ + "compilers and provides the necessary tools to implement dedicated " \ + "OPC UA clients and servers, or to integrate OPC UA-based communication " \ + "into existing applications. open62541 library is platform independent. " \ + "All platform-specific functionality is implemented via exchangeable " \ + "plugins. Plugin implementations are provided for the major operating systems." + license = ("MPL-2.0", "CC0-1.0") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://open62541.org/" + topics = ( + "opc ua", "sdk", "server/client", "c", "iec-62541", + "industrial automation", "tsn", "time sensitive networks", "publish-subscribe", "pubsub" + ) + + package_type = "library" + settings = "os", "compiler", "build_type", "arch" + options = { + "fPIC": [True, False], + "shared": [True, False], + } + default_options = { + "fPIC": True, + "shared": False, + } + + short_paths = True + + 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 layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("openssl/[>=1.1 <4]") + self.requires("libxml2/[>=2.12.5 <3]") + + def validate(self): + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) == "9": + raise ConanInvalidConfiguration( + f"{self.ref} does not support Clang version {self.settings.compiler.version}") + + if self.settings.compiler == "clang": + if Version(self.settings.compiler.version) < "5": + raise ConanInvalidConfiguration( + "Older clang compiler version than 5.0 are not supported") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + apply_conandata_patches(self) + + def generate(self): + tc = CMakeToolchain(self) + + version = Version(self.version) + tc.variables["OPEN62541_VER_MAJOR"] = version.major + tc.variables["OPEN62541_VER_MINOR"] = version.minor + tc.variables["OPEN62541_VER_PATCH"] = version.patch + tc.variables["UA_ENABLE_ENCRYPTION"] = True + tc.variables["UA_ENABLE_ENCRYPTION_OPENSSL"] = True + + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + @property + def _tools_subfolder(self): + return os.path.join(self.source_folder, "tools") + + @property + def _module_subfolder(self): + return os.path.join("lib", "cmake", "open62541") + + @property + def _module_file_rel_path(self): + return os.path.join(self._module_subfolder, "open62541Macros.cmake") + + def package(self): + licenses_dir = os.path.join(self.package_folder, "licenses") + copy(self, "LICENSE", src=self.source_folder, dst=licenses_dir) + copy(self, "LICENSE-CC0", src=self.source_folder, dst=licenses_dir) + cmake = CMake(self) + cmake.install() + + rm(self, '*.pdb', os.path.join(self.package_folder, "bin")) + rm(self, '*.pdb', os.path.join(self.package_folder, "lib")) + + for cmake_file in glob.glob(os.path.join(self.package_folder, self._module_subfolder, "*")): + if not cmake_file.endswith(self._module_file_rel_path): + os.remove(cmake_file) + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + + tools_dir = os.path.join(self.package_folder, "res", "tools") + copy(self, "generate_*.py", src=self._tools_subfolder, dst=tools_dir) + copy(self, "nodeset_compiler/*", src=self._tools_subfolder, dst=tools_dir) + + @staticmethod + def _chmod_plus_x(filename): + if os.name == 'posix': + os.chmod(filename, os.stat(filename).st_mode | 0o111) + + def package_info(self): + self.cpp_info.libs = collect_libs(self) + self.cpp_info.includedirs = ["include"] + + # required for creating custom servers from ua-nodeset + self.conf_info.define("user.open62541:tools_dir", os.path.join( + self.package_folder, "res", "tools").replace("\\", "/")) + self._chmod_plus_x(os.path.join(self.package_folder, + "res", "tools", "generate_nodeid_header.py")) + + self.cpp_info.includedirs.append( + os.path.join("include", "open62541", "plugin")) + + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("ws2_32") + self.cpp_info.system_libs.append("iphlpapi") + elif self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.system_libs.extend(["pthread", "m", "rt"]) + + self.cpp_info.builddirs.append(self._module_subfolder) + self.cpp_info.set_property("cmake_build_modules", [ + self._module_file_rel_path]) diff --git a/thirdparty/open62541/cflag_fix.patch b/thirdparty/open62541/all/patches/open62541.patch similarity index 56% rename from thirdparty/open62541/cflag_fix.patch rename to thirdparty/open62541/all/patches/open62541.patch index 8aebcf359d..7db9674ca0 100644 --- a/thirdparty/open62541/cflag_fix.patch +++ b/thirdparty/open62541/all/patches/open62541.patch @@ -1,7 +1,16 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 89e7d67ae..8a3c39600 100644 +index 89e7d67ae..ebc16a748 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt +@@ -18,7 +18,7 @@ endif() + + # set(CMAKE_VERBOSE_MAKEFILE ON) + +-set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/cmake") ++list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/cmake") + + find_package(Python3 REQUIRED) + find_package(Git) @@ -588,24 +588,21 @@ endif() # Compiler Settings # ##################### @@ -35,7 +44,25 @@ index 89e7d67ae..8a3c39600 100644 endif() endfunction() -@@ -1438,6 +1435,11 @@ else() +@@ -717,17 +714,6 @@ if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") AND + endif() + endif() + +- # Inter Procedural Optimization / Link Time Optimization (should be same as -flto) +- # IPO requires too much memory for unit tests +- # GCC docu recommends to compile all files with the same options, therefore ignore it completely +- if(NOT UA_BUILD_UNIT_TESTS AND NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION) +- include(CheckIPOSupported) +- check_ipo_supported(RESULT CC_HAS_IPO) +- if(CC_HAS_IPO) +- set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) +- endif() +- endif() +- + # Linker + set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # cmake sets -rdynamic by default + if(APPLE) +@@ -1438,6 +1424,11 @@ else() endif() add_library(open62541 $ $) @@ -47,3 +74,17 @@ index 89e7d67ae..8a3c39600 100644 add_dependencies(open62541-object open62541-code-generation) add_dependencies(open62541-plugins open62541-code-generation) +diff --git a/arch/posix/eventloop_posix.h b/arch/posix/eventloop_posix.h +index ce64f374a..c4b69668c 100644 +--- a/arch/posix/eventloop_posix.h ++++ b/arch/posix/eventloop_posix.h +@@ -277,7 +277,9 @@ typedef int SOCKET; + + #ifndef __ANDROID__ + #ifndef __APPLE__ ++#ifdef __GLIBC__ + #include ++#endif + #endif /* !__APPLE__ */ + #endif /* !__ANDROID__ */ + diff --git a/thirdparty/open62541/config.yml b/thirdparty/open62541/config.yml new file mode 100644 index 0000000000..87e6f8a8cb --- /dev/null +++ b/thirdparty/open62541/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.5.4": + folder: all diff --git a/thirdparty/open62541/open62541.patch b/thirdparty/open62541/open62541.patch deleted file mode 100644 index 75fe9a1dd8..0000000000 --- a/thirdparty/open62541/open62541.patch +++ /dev/null @@ -1,45 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 89e7d67ae..3a09ed900 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -18,7 +18,7 @@ endif() - - # set(CMAKE_VERBOSE_MAKEFILE ON) - --set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/cmake") -+list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/cmake") - - find_package(Python3 REQUIRED) - find_package(Git) -@@ -717,17 +717,6 @@ if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") AND - endif() - endif() - -- # Inter Procedural Optimization / Link Time Optimization (should be same as -flto) -- # IPO requires too much memory for unit tests -- # GCC docu recommends to compile all files with the same options, therefore ignore it completely -- if(NOT UA_BUILD_UNIT_TESTS AND NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION) -- include(CheckIPOSupported) -- check_ipo_supported(RESULT CC_HAS_IPO) -- if(CC_HAS_IPO) -- set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) -- endif() -- endif() -- - # Linker - set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # cmake sets -rdynamic by default - if(APPLE) -diff --git a/arch/posix/eventloop_posix.h b/arch/posix/eventloop_posix.h -index ce64f374a..c4b69668c 100644 ---- a/arch/posix/eventloop_posix.h -+++ b/arch/posix/eventloop_posix.h -@@ -277,7 +277,9 @@ typedef int SOCKET; - - #ifndef __ANDROID__ - #ifndef __APPLE__ -+#ifdef __GLIBC__ - #include -+#endif - #endif /* !__APPLE__ */ - #endif /* !__ANDROID__ */ - diff --git a/thirdparty/paho-mqtt/1576-Changed-bool-typedef-to-bit.patch b/thirdparty/paho-mqtt/1576-Changed-bool-typedef-to-bit.patch deleted file mode 100644 index d3cfa8068d..0000000000 --- a/thirdparty/paho-mqtt/1576-Changed-bool-typedef-to-bit.patch +++ /dev/null @@ -1,96 +0,0 @@ -From e4021c717f7f1623b02788216cc2a07e9556b4d0 Mon Sep 17 00:00:00 2001 -From: fpagliughi -Date: Wed, 14 May 2025 17:56:02 -0400 -Subject: [PATCH] #1576 Changed 'bool' typedef to 'bit' - ---- - src/MQTTPacket.h | 34 +++++++++++++++++----------------- - 1 file changed, 17 insertions(+), 17 deletions(-) - -diff --git a/src/MQTTPacket.h b/src/MQTTPacket.h -index fd384ae..04c217e 100644 ---- a/src/MQTTPacket.h -+++ b/src/MQTTPacket.h -@@ -28,7 +28,7 @@ - #include "LinkedList.h" - #include "Clients.h" - --typedef unsigned int bool; -+typedef unsigned int bit; - typedef void* (*pf)(int, unsigned char, char*, size_t); - - #include "MQTTProperties.h" -@@ -67,16 +67,16 @@ typedef union - struct - { - unsigned int type : 4; /**< message type nibble */ -- bool dup : 1; /**< DUP flag bit */ -+ bit dup : 1; /**< DUP flag bit */ - unsigned int qos : 2; /**< QoS value, 0, 1 or 2 */ -- bool retain : 1; /**< retained flag bit */ -+ bit retain : 1; /**< retained flag bit */ - } bits; - #else - struct - { -- bool retain : 1; /**< retained flag bit */ -+ bit retain : 1; /**< retained flag bit */ - unsigned int qos : 2; /**< QoS value, 0, 1 or 2 */ -- bool dup : 1; /**< DUP flag bit */ -+ bit dup : 1; /**< DUP flag bit */ - unsigned int type : 4; /**< message type nibble */ - } bits; - #endif -@@ -95,24 +95,24 @@ typedef struct - #if defined(REVERSED) - struct - { -- bool username : 1; /**< 3.1 user name */ -- bool password : 1; /**< 3.1 password */ -- bool willRetain : 1; /**< will retain setting */ -+ bit username : 1; /**< 3.1 user name */ -+ bit password : 1; /**< 3.1 password */ -+ bit willRetain : 1; /**< will retain setting */ - unsigned int willQoS : 2; /**< will QoS value */ -- bool will : 1; /**< will flag */ -- bool cleanstart : 1; /**< cleansession flag */ -+ bit will : 1; /**< will flag */ -+ bit cleanstart : 1; /**< cleansession flag */ - int : 1; /**< unused */ - } bits; - #else - struct - { - int : 1; /**< unused */ -- bool cleanstart : 1; /**< cleansession flag */ -- bool will : 1; /**< will flag */ -+ bit cleanstart : 1; /**< cleansession flag */ -+ bit will : 1; /**< will flag */ - unsigned int willQoS : 2; /**< will QoS value */ -- bool willRetain : 1; /**< will retain setting */ -- bool password : 1; /**< 3.1 password */ -- bool username : 1; /**< 3.1 user name */ -+ bit willRetain : 1; /**< will retain setting */ -+ bit password : 1; /**< 3.1 password */ -+ bit username : 1; /**< 3.1 user name */ - } bits; - #endif - } flags; /**< connect flags byte */ -@@ -140,12 +140,12 @@ typedef struct - struct - { - unsigned int reserved : 7; /**< message type nibble */ -- bool sessionPresent : 1; /**< was a session found on the server? */ -+ bit sessionPresent : 1; /**< was a session found on the server? */ - } bits; - #else - struct - { -- bool sessionPresent : 1; /**< was a session found on the server? */ -+ bit sessionPresent : 1; /**< was a session found on the server? */ - unsigned int reserved : 7; /**< message type nibble */ - } bits; - #endif --- -2.39.5 (Apple Git-154) - diff --git a/thirdparty/rocksdb/all/conandata.yml b/thirdparty/rocksdb/all/conandata.yml index de548436b6..d41b13440b 100644 --- a/thirdparty/rocksdb/all/conandata.yml +++ b/thirdparty/rocksdb/all/conandata.yml @@ -1,3 +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. + sources: "11.1.1": url: "https://github.com/facebook/rocksdb/archive/refs/tags/v11.1.1.tar.gz" diff --git a/thirdparty/rocksdb/all/conanfile.py b/thirdparty/rocksdb/all/conanfile.py index 5a0401387e..349f79b9ec 100644 --- a/thirdparty/rocksdb/all/conanfile.py +++ b/thirdparty/rocksdb/all/conanfile.py @@ -1,3 +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. + import os import glob import shutil @@ -131,10 +146,11 @@ def generate(self): tc = CMakeToolchain(self) tc.variables["FAIL_ON_WARNINGS"] = False tc.variables["WITH_TESTS"] = False - tc.variables["WITH_TOOLS"] = True + tc.variables["WITH_TOOLS"] = False tc.variables["WITH_CORE_TOOLS"] = False tc.variables["WITH_BENCHMARK_TOOLS"] = False tc.variables["WITH_FOLLY_DISTRIBUTED_MUTEX"] = False + tc.variables["ROCKSDB_SKIP_THIRDPARTY"] = True if is_msvc(self): tc.variables["WITH_MD_LIBRARY"] = not is_msvc_static_runtime(self) tc.variables["ROCKSDB_INSTALL_ON_WINDOWS"] = self.settings.os == "Windows" diff --git a/thirdparty/rocksdb/config.yml b/thirdparty/rocksdb/config.yml index 21a3c25eab..d538e51f79 100644 --- a/thirdparty/rocksdb/config.yml +++ b/thirdparty/rocksdb/config.yml @@ -1,3 +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: - "8.10.2": + "11.1.1": folder: all