fgerlits commented on code in PR #2212:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2212#discussion_r3544656333


##########
cmake/GetLibSodium.cmake:
##########
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+function(get_libsodium SOURCE_DIR BINARY_DIR)
+    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(${SOURCE_DIR} ${BINARY_DIR})
+    endif()
+endfunction(get_libsodium)

Review Comment:
   I have seen these function wrappers (probably the scope introduced by them) 
cause problems in some cases. Unless it is needed here, I would remove it, so 
this file works the same as the majority of the `GetX.cmake` files.



##########
conanfile.py:
##########
@@ -21,15 +37,62 @@ 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_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_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_all or 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_all or self.options.enable_bzip2:
+            self.requires("bzip2/1.0.8")
+        if self.options.enable_all or self.options.enable_lzma:
+            self.requires("xz_utils/5.8.3")

Review Comment:
   I don't think `ENABLE_ALL` applies to tools like rocksdb, bzip2 and lzma; it 
only applies to extensions.
   
   (Maybe we should rename it to `ENABLE_ALL_EXTENSIONS`, but not in this pull 
request.)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to