PengZheng commented on a change in pull request #401: URL: https://github.com/apache/celix/pull/401#discussion_r835882520
########## File path: conanfile.py ########## @@ -0,0 +1,247 @@ +# 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 conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +import os + + +required_conan_version = ">=1.32.0" + + +class CelixConan(ConanFile): + name = "celix" + homepage = "https://celix.apache.org" + url = "https://github.com/apache/celix.git" + topics = ("conan", "celix", "osgi", "embedded", "linux", "C/C++") + exports_sources = "CMakeLists.txt", "bundles*", "cmake*", "!cmake-build*", "examples*", "libs*", "misc*", "LICENSE" + generators = "cmake_paths", "cmake_find_package", "virtualrunenv" + settings = "os", "arch", "compiler", "build_type" + license = " Apache-2.0" + description = "Apache Celix is an implementation of the OSGi specification adapted to C and C++ (C++17). " \ + "It is a framework to develop (dynamic) modular software applications " \ + "using component and/or service-oriented programming." + + tool_requires = "cmake/3.17.5" + + options = { + "enable_testing": [True, False], + "enable_address_sanitizer": [True, False], + "enable_undefined_sanitizer": [True, False], + "enable_thread_sanitizer": [True, False], + "celix_add_openssl_dep": [True, False], + "build_all": [True, False], + "build_deployment_admin": [True, False], + "build_device_access_example": [True, False], + "build_device_access": [True, False], + "build_http_admin": [True, False], + "build_log_service": [True, False], + "build_syslog_writer": [True, False], + "build_pubsub": [True, False], + "build_pubsub_psa_zmq": [True, False], + "build_pubsub_examples": [True, False], + "build_pubsub_integration": [True, False], + "build_pubsub_psa_tcp": [True, False], + "build_pubsub_psa_udp_mc": [True, False], + "build_pubsub_psa_ws": [True, False], + "build_pubsub_discovery_etcd": [True, False], + "build_cxx_remote_service_admin": [True, False], + "build_cxx_rsa_integration": [True, False], + "build_remote_service_admin": [True, False], + "build_rsa_remote_service_admin_dfi": [True, False], + "build_rsa_discovery_configured": [True, False], + "build_rsa_discovery_etcd": [True, False], + "build_shell": [True, False], + "build_remote_shell": [True, False], + "build_shell_bonjour": [True, False], + "build_shell_tui": [True, False], + "build_shell_wui": [True, False], + "build_examples": [True, False], + "build_celix_etcdlib": [True, False], + "build_launcher": [True, False], + "build_promises": [True, False], + "build_pushstreams": [True, False], + "celix_cxx": [True, False], + "celix_install_deprecated_api": [True, False], + "celix_add_deprecated_attributes": [True, False], + } + default_options = { + "enable_testing": False, + "enable_address_sanitizer": False, + "enable_undefined_sanitizer": False, + "enable_thread_sanitizer": False, + "celix_add_openssl_dep": False, + "build_all": False, + "build_deployment_admin": False, + "build_device_access": False, + "build_device_access_example": False, + "build_http_admin": True, + "build_log_service": True, + "build_syslog_writer": True, + "build_pubsub": True, + "build_pubsub_psa_zmq": False, + "build_pubsub_examples": False, + "build_pubsub_integration": False, + "build_pubsub_psa_tcp": False, + "build_pubsub_psa_udp_mc": False, + "build_pubsub_psa_ws": True, + "build_pubsub_discovery_etcd": False, + "build_cxx_remote_service_admin": False, + "build_cxx_rsa_integration": False, + "build_remote_service_admin": True, + "build_rsa_remote_service_admin_dfi": True, + "build_rsa_discovery_configured": True, + "build_rsa_discovery_etcd": False, + "build_shell": True, + "build_remote_shell": False, + "build_shell_bonjour": False, + "build_shell_tui": False, + "build_shell_wui": False, + "build_examples": False, + "build_celix_etcdlib": False, + "build_launcher": False, + "build_promises": False, + "build_pushstreams": False, + "celix_cxx": False, + "celix_install_deprecated_api": False, + "celix_add_deprecated_attributes": True, + } + _cmake = None + + def validate(self): + if self.settings.os != "Linux" and self.settings.os != "Macos": + raise ConanInvalidConfiguration("Celix is only supported for Linux/Macos") + + def package_id(self): + del self.info.options.build_all + del self.info.options.enable_testing + del self.info.options.celix_add_openssl_dep + # the followings are not installed + del self.info.options.build_device_access_example + del self.info.options.build_pubsub_integration + del self.info.options.build_pubsub_examples + del self.info.options.build_cxx_rsa_integration + del self.info.options.build_examples + del self.info.options.build_shell_bonjour + + def build_requirements(self): + if self.options.enable_testing: + self.test_requires("gtest/1.10.0") + self.test_requires("cpputest/4.0") + + def configure(self): + if self.options.build_all: + for opt, val in self.options.values.items(): + if opt.startswith('build_'): + setattr(self.options, opt, True) + if not self.options.celix_cxx: + self.options.build_cxx_remote_service_admin = False + self.options.build_promises = False + self.options.build_pushstreams = False + if not self.options.build_cxx_remote_service_admin: + self.options.build_cxx_rsa_integration = False + if not self.options.enable_testing: + self.options.build_pubsub_integration = False + if not self.options.build_device_access: + self.options.build_device_access_example = False + if not self.options.build_log_service: + self.options.build_syslog_writer = False + if not self.options.build_pubsub: + self.options.build_pubsub_psa_zmq = False + self.options.build_pubsub_examples = False + self.options.build_pubsub_integration = False + self.options.build_pubsub_psa_tcp = False + self.options.build_pubsub_psa_udp_mc = False + self.options.build_pubsub_psa_ws = False + self.options.build_pubsub_discovery_etcd = False + if not self.options.build_remote_service_admin: + self.options.build_rsa_remote_service_admin_dfi = False + self.options.build_rsa_discovery_configured = False + self.options.build_rsa_discovery_etcd = False + if not self.options.build_shell: + self.options.build_remote_shell = False + self.options.build_shell_bonjour = False + self.options.build_shell_tui = False + self.options.build_shell_wui = False + if not self.options.celix_install_deprecated_api: + self.options.build_shell_bonjour = False + + def requirements(self): + self.requires("libffi/[>=3.2.1 <4.0.0]") + self.options['libffi'].shared = True + self.requires("jansson/[>=2.12 <3.0.0]") + self.options['jansson'].shared = True + self.requires("libcurl/[>=7.64.1 <8.0.0]") + self.options['libcurl'].shared = True + self.requires("zlib/[>=1.2.8 <2.0.0]") + self.options['zlib'].shared = True + self.requires("libuuid/1.0.3") + self.options['libuuid'].shared = True + self.requires("libzip/[>=1.7.3 <2.0.0]") + self.options['libzip'].shared = True + self.options['openssl'].shared = True + self.options['libxml2'].shared = True + if self.options.enable_testing: + self.options['gtest'].shared = True + if self.options.enable_address_sanitizer: + self.options["cpputest"].with_leak_detection = False Review comment: Without Leak Detection Plugin, clang address sanitizer now works with cpputest, the following is addressed: https://github.com/apache/celix/blob/9cf8bc39c1a8916fbdda54eac59b24065f0fe3b2/.github/workflows/ubuntu.yml#L16 We cannot modify distribution's cpputest package, but we can easily do so in Conan's virtual environment. -- 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: dev-unsubscr...@celix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org