From 9ff173e4e452a1677dc15e0281d1b3609720e6f0 Mon Sep 17 00:00:00 2001 From: Dovydas Girdvainis Date: Sun, 12 Feb 2023 06:26:21 +0100 Subject: [PATCH] (#14537) Package/open62541: bump to v1.3.4 * remove dead code * add v1.3.4 version * add v1.2.6 version * fix #KB-H041: "NO FINAL ENDLINE" * refactor old test_package into test_v1_package * add test_package for v2 * refactor test_package name to be more consistent with other conan packages * remove wrong executable declaration * include open62541Macros module * fix target name * use CMakeToolchain to set tools and nodeset dirs * include missing threads package * retrigger pipeline * retrigger pipeline * refactor recipe to be compatible with conan v2.x release * use v2 auto include instead of explicit include * use v2 conf_info value for tools_dir * append to builddirs, instead of assigning * remove base_path from patches * fix E9010 error. Old import is deprecated in Conan v2. * retrigger pipeline * add generator specifiers for build_modules field Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> * reuse test_package data for v1 test * remove VirtualBuildEnv * apply code formatting * honor cmake BUILD_SHARED_LIBS policy Signed-off-by: Dovydas Girdvainis * bump dependencies * add open62541 to tools_dir definition for v2 * remove unused mkdir import * remove superfluous new line * add new patch fields * use self.ref instead of explicit calls to self.name and self.version * remove export_sources * split v1_3_x patch into version specific patches, fix OpenSSL variable * add patches for v1.2.6 * fix OpenSSL cmake variable for v1.2.x patch * rollback openssl to v1.1.1* * fix 1_1_x OpenSSL target name * rollback mbedtls to latest supported version * fix MbedTLS target for patch v1_0_x * retriger pipeline * Update recipes/open62541/all/test_package/conanfile.py sanitize open62541_TOOLS_DIR variable path for windows systems Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> * fix E9013 hook error * sanitize open62541_NODESET_DIR variable path * add missing escape char for \ * sanitize conan v1 tools_dir path for windows systems * sanitize conan v2 tools_dir path for windows systems * remove conan v2 open62541:tools_dir path sanitization for windows systems * add explanation for ua-nodeset nodeset_dir path sanitization * retriger pipeline --------- Signed-off-by: Dovydas Girdvainis Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/open62541/all/conandata.yml | 67 +++-- recipes/open62541/all/conanfile.py | 254 ++++++++++-------- .../0001-fix-cmake-find-deps-1_1_x.patch | 43 +-- .../0001-fix-cmake-find-deps-1_2_x.patch | 29 +- ...h => 0001-fix-cmake-find-deps-1_3_1.patch} | 27 +- .../0001-fix-cmake-find-deps-1_3_4.patch | 196 ++++++++++++++ recipes/open62541/all/patches/1_0_x.patch | 34 ++- recipes/open62541/all/submoduledata.yml | 10 + .../open62541/all/test_package/CMakeLists.txt | 16 +- .../open62541/all/test_package/conanfile.py | 33 ++- ...{test_package_nodeset.c => test_package.c} | 0 .../all/test_v1_package/CMakeLists.txt | 36 +++ .../all/test_v1_package/conanfile.py | 24 ++ recipes/open62541/config.yml | 4 + 14 files changed, 598 insertions(+), 175 deletions(-) rename recipes/open62541/all/patches/{0001-fix-cmake-find-deps-1_3_x.patch => 0001-fix-cmake-find-deps-1_3_1.patch} (89%) create mode 100644 recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_4.patch rename recipes/open62541/all/test_package/{test_package_nodeset.c => test_package.c} (100%) create mode 100644 recipes/open62541/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/open62541/all/test_v1_package/conanfile.py diff --git a/recipes/open62541/all/conandata.yml b/recipes/open62541/all/conandata.yml index 6e8ccb43a86584..d458e6add2e688 100644 --- a/recipes/open62541/all/conandata.yml +++ b/recipes/open62541/all/conandata.yml @@ -1,7 +1,13 @@ sources: + "1.3.4": + url: "https://github.com/open62541/open62541/archive/v1.3.4.tar.gz" + sha256: "3489cfa2f98c52df252adc8e641a9e59cb675bdfd5ef413b0d947e667cddd16d" "1.3.1": url: "https://github.com/open62541/open62541/archive/v1.3.1.tar.gz" sha256: "f54d10325fd08fc1505aea37d83daa085912a269521e6d018bfc41a744ba57aa" + "1.2.6": + url: "https://github.com/open62541/open62541/archive/v1.2.6.tar.gz" + sha256: "7470c1e2f97d0e7dad9632ced7b62f0add66a3c689532204ef85b0556d129106" "1.2.4": url: "https://github.com/open62541/open62541/archive/v1.2.4.tar.gz" sha256: "b2d00b91e8315b61efaef6398f0902a0c9a8f357aa6d02f7f000a429048c97ae" @@ -24,41 +30,70 @@ sources: url: "https://github.com/open62541/open62541/archive/v1.0.3.tar.gz" sha256: "3e4c939d702d06d89f32a1cafe2b992c7f3d81c8f8579e093a972d4bc4fb3d50" patches: + "1.3.4": + - patch_file: "patches/0001-fix-cmake-find-deps-1_3_4.patch" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" "1.3.1": - - patch_file: "patches/0001-fix-cmake-find-deps-1_3_x.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-fix-cmake-find-deps-1_3_1.patch" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" + "1.2.6": + - patch_file: "patches/0001-fix-cmake-find-deps-1_2_x.patch" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" + - patch_file: "patches/0003-disable-sanitizers-1_2_x.patch" + patch_description: "Disable static code analysis" + patch_type: "conan" + - patch_file: "patches/0003-fix-use-usr-bin-env-python3.patch" + patch_description: "Use python3 instead of default python interpreter" + patch_type: "conan" "1.2.4": - patch_file: "patches/0001-fix-cmake-find-deps-1_2_x.patch" - base_path: "source_subfolder" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" - patch_file: "patches/0003-disable-sanitizers-1_2_x.patch" - base_path: "source_subfolder" + patch_description: "Disable static code analysis" + patch_type: "conan" - patch_file: "patches/0003-fix-use-usr-bin-env-python3.patch" - base_path: "source_subfolder" + patch_description: "Use python3 instead of default python interpreter" + patch_type: "conan" "1.2.2": - patch_file: "patches/0001-fix-cmake-find-deps-1_2_x.patch" - base_path: "source_subfolder" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" - patch_file: "patches/0003-disable-sanitizers-1_2_x.patch" - base_path: "source_subfolder" + patch_description: "Disable static code analysis" + patch_type: "conan" - patch_file: "patches/0003-fix-use-usr-bin-env-python3.patch" - base_path: "source_subfolder" + patch_description: "Use python3 instead of default python interpreter" + patch_type: "conan" "1.1.6": - patch_file: "patches/0001-fix-cmake-find-deps-1_1_x.patch" - base_path: "source_subfolder" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" - patch_file: "patches/0003-disable-sanitizers-1_1_6.patch" - base_path: "source_subfolder" + patch_description: "Disable static code analysis" + patch_type: "conan" "1.1.5": - patch_file: "patches/0001-fix-cmake-find-deps-1_1_x.patch" - base_path: "source_subfolder" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" - patch_file: "patches/0002-disable-sanitizers-1_1_3-and-1_1_5.patch" - base_path: "source_subfolder" + patch_description: "Disable static code analysis" + patch_type: "conan" "1.1.3": - patch_file: "patches/0001-fix-cmake-find-deps-1_1_x.patch" - base_path: "source_subfolder" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" - patch_file: "patches/0002-disable-sanitizers-1_1_3-and-1_1_5.patch" - base_path: "source_subfolder" + patch_description: "Disable static code analysis" + patch_type: "conan" "1.0.6": - patch_file: "patches/1_0_x.patch" - base_path: "source_subfolder" + patch_description: "Fix CMAKE_MODULE_PATH and PROJECT_VERSION variables, remove -Werror flag, disable static code analysis, use Cmake find_package(*) to resolve external dependencies, fix include paths" + patch_type: "conan" "1.0.3": - patch_file: "patches/1_0_x.patch" - base_path: "source_subfolder" + patch_description: "Fix CMAKE_MODULE_PATH and PROJECT_VERSION variables, remove -Werror flag, disable static code analysis, use Cmake find_package(*) to resolve external dependencies, fix include paths" + patch_type: "conan" diff --git a/recipes/open62541/all/conanfile.py b/recipes/open62541/all/conanfile.py index c1f545696a3c58..25dd98cf850ffc 100644 --- a/recipes/open62541/all/conanfile.py +++ b/recipes/open62541/all/conanfile.py @@ -1,11 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conan.tools.files import rename, get +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, rename, rm, rmdir, get +from conan.errors import ConanInvalidConfiguration import glob import os import yaml -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class Open62541Conan(ConanFile): @@ -136,49 +138,52 @@ class Open62541Conan(ConanFile): "readable_statuscodes": True } - exports_sources = ["CMakeLists.txt", "patches/**"] exports = "submoduledata.yml" - generators = "cmake", "cmake_find_package" - _cmake = None short_paths = True - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if tools.Version(self.version) >= "1.3.1": + + if Version(self.version) >= "1.3.1": del self.options.embedded_profile def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + if not self.options.cpp_compatible: - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") # Due to https://github.com/open62541/open62541/issues/4687 we cannot build with 1.2.2 + Windows + shared - if tools.Version(self.version) >= "1.2.2" and self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("{0} {1} doesn't properly support shared lib on Windows".format(self.name, - self.version)) + if Version(self.version) >= "1.2.2" and self.settings.os == "Windows" and self.options.shared: + raise ConanInvalidConfiguration( + f"{self.ref} doesn't properly support shared lib on Windows") if self.options.subscription == "With Events": - self.output.warning("`{name}:subscription=With Events` is deprecated. Use `{name}:subscription=events` instead".format(name=self.name)) # Deprecated in 1.2.2 + # Deprecated in 1.2.2 + self.output.warning( + f"`{self.ref}:subscription=With Events` is deprecated. Use `{self.ref}:subscription=events` instead") self.options.subscription = "events" if self.options.web_socket: self.options["libwebsockets"].with_ssl = self.options.encryption + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.options.encryption == "mbedtls": self.requires("mbedtls/2.25.0") elif self.options.encryption == "openssl": - self.requires("openssl/1.1.1o") + self.requires("openssl/1.1.1s") if self.options.web_socket: - self.requires("libwebsockets/4.2.0") + self.requires("libwebsockets/4.3.2") if self.options.discovery == "With Multicast" or "multicast" in str(self.options.discovery): self.requires("pro-mdnsd/0.8.4") @@ -192,7 +197,7 @@ def validate(self): raise ConanInvalidConfiguration( "Open62541 discovery sempahore option requires discovery option to be enabled") - if tools.Version(self.version) < "1.1.0": + if Version(self.version) < "1.1.0": if self.options.encryption == "openssl": raise ConanInvalidConfiguration( "Lower Open62541 versions than 1.1.0 do not support openssl") @@ -210,13 +215,14 @@ def validate(self): "Lower Open62541 versions than 1.1.0 are not cpp compatible due to -fpermisive flags") # FIXME: correct clang versions condition - max_clang_version = "8" if tools.Version(self.version) < "1.1.0" else "9" - if self.settings.compiler == "clang" and tools.Version(self.settings.compiler.version) > max_clang_version: + max_clang_version = "8" if Version( + self.version) < "1.1.0" else "9" + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) > max_clang_version: raise ConanInvalidConfiguration( "Open62541 supports Clang up to {} compiler version".format(max_clang_version)) if self.settings.compiler == "clang": - if tools.Version(self.settings.compiler.version) < "5": + if Version(self.settings.compiler.version) < "5": raise ConanInvalidConfiguration( "Older clang compiler version than 5.0 are not supported") @@ -231,7 +237,7 @@ def validate(self): def source(self): get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + destination=self.source_folder, strip_root=True) submodule_filename = os.path.join( self.recipe_folder, 'submoduledata.yml') @@ -248,8 +254,8 @@ def source(self): } get(self, **submodule_data) - submodule_source = os.path.join(self._source_subfolder, path) - tools.rmdir(submodule_source) + submodule_source = os.path.join(self.source_folder, path) + rmdir(self, submodule_source) rename(self, archive_name, submodule_source) def _get_log_level(self): @@ -270,122 +276,142 @@ def _get_multithreading_option(self): "Internal threads": "200" }.get(str(self.options.multithreading), "0") - def _configure_cmake(self): - if self._cmake: - return self._cmake + def generate(self): + tc = CMakeToolchain(self) - self._cmake = CMake(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 - version = tools.Version(self.version) - self._cmake.definitions["OPEN62541_VER_MAJOR"] = version.major - self._cmake.definitions["OPEN62541_VER_MINOR"] = version.minor - self._cmake.definitions["OPEN62541_VER_PATCH"] = version.patch + tc.variables["UA_LOGLEVEL"] = self._get_log_level() + tc.variables["UA_ENABLE_SUBSCRIPTIONS"] = self.options.subscription != False - self._cmake.definitions["UA_LOGLEVEL"] = self._get_log_level() - self._cmake.definitions["UA_ENABLE_SUBSCRIPTIONS"] = self.options.subscription != False if self.options.subscription != False: if "events" in str(self.options.subscription): - self._cmake.definitions["UA_ENABLE_SUBSCRIPTIONS_EVENTS"] = True + tc.variables["UA_ENABLE_SUBSCRIPTIONS_EVENTS"] = True if "alarms" in str(self.options.subscription) and "conditions" in str(self.options.subscription): - self._cmake.definitions["UA_ENABLE_SUBSCRIPTIONS_ALARMS_CONDITIONS"] = True - self._cmake.definitions["UA_ENABLE_METHODCALLS"] = self.options.methods - self._cmake.definitions["UA_ENABLE_NODEMANAGEMENT"] = self.options.dynamic_nodes - self._cmake.definitions["UA_ENABLE_AMALGAMATION"] = self.options.single_header + tc.variables["UA_ENABLE_SUBSCRIPTIONS_ALARMS_CONDITIONS"] = True + + tc.variables["UA_ENABLE_METHODCALLS"] = self.options.methods + tc.variables["UA_ENABLE_NODEMANAGEMENT"] = self.options.dynamic_nodes + tc.variables["UA_ENABLE_AMALGAMATION"] = self.options.single_header + if version >= "1.1.3": - self._cmake.definitions["UA_MULTITHREADING"] = self._get_multithreading_option( - ) - self._cmake.definitions["UA_ENABLE_IMMUTABLE_NODES"] = self.options.imutable_nodes - self._cmake.definitions["UA_ENABLE_WEBSOCKET_SERVER"] = self.options.web_socket - self._cmake.definitions["UA_ENABLE_HISTORIZING"] = self.options.historize != False + tc.variables["UA_MULTITHREADING"] = self._get_multithreading_option() + + tc.variables["UA_ENABLE_IMMUTABLE_NODES"] = self.options.imutable_nodes + tc.variables["UA_ENABLE_WEBSOCKET_SERVER"] = self.options.web_socket + tc.variables["UA_ENABLE_HISTORIZING"] = self.options.historize != False + if self.options.historize != False: if self.options.historize == "Experimental": - self._cmake.definitions["UA_ENABLE_EXPERIMENTAL_HISTORIZING"] = True - self._cmake.definitions["UA_ENABLE_DISCOVERY"] = self.options.discovery != False + tc.variables["UA_ENABLE_EXPERIMENTAL_HISTORIZING"] = True + + tc.variables["UA_ENABLE_DISCOVERY"] = self.options.discovery != False + if self.options.discovery != False: - self._cmake.definitions["UA_ENABLE_DISCOVERY_MULTICAST"] = \ - self.options.discovery == "With Multicast" or "multicast" in str(self.options.discovery) - self._cmake.definitions["UA_ENABLE_DISCOVERY_SEMAPHORE"] = \ - self.options.discovery_semaphore or "semaphore" in str(self.options.discovery) - self._cmake.definitions["UA_ENABLE_QUERY"] = self.options.query - if tools.Version(self.version) >= "1.3.1": + tc.variables["UA_ENABLE_DISCOVERY_MULTICAST"] = \ + self.options.discovery == "With Multicast" or "multicast" in str( + self.options.discovery) + tc.variables["UA_ENABLE_DISCOVERY_SEMAPHORE"] = \ + self.options.discovery_semaphore or "semaphore" in str( + self.options.discovery) + + tc.variables["UA_ENABLE_QUERY"] = self.options.query + + if Version(self.version) >= "1.3.1": if self.options.encryption == "openssl": - self._cmake.definitions["UA_ENABLE_ENCRYPTION"] = "OPENSSL" + tc.variables["UA_ENABLE_ENCRYPTION"] = "OPENSSL" elif self.options.encryption == "mbedtls": - self._cmake.definitions["UA_ENABLE_ENCRYPTION"] = "MBEDTLS" + tc.variables["UA_ENABLE_ENCRYPTION"] = "MBEDTLS" else: - self._cmake.definitions["UA_ENABLE_ENCRYPTION"] = "OFF" + tc.variables["UA_ENABLE_ENCRYPTION"] = "OFF" else: - self._cmake.definitions["UA_ENABLE_ENCRYPTION"] = self.options.encryption != False + tc.variables["UA_ENABLE_ENCRYPTION"] = self.options.encryption != False if self.options.encryption != False: if self.options.encryption == "openssl": - self._cmake.definitions["UA_ENABLE_ENCRYPTION_OPENSSL"] = True - self._cmake.definitions["UA_ENABLE_JSON_ENCODING"] = self.options.json_support - self._cmake.definitions["UA_ENABLE_PUBSUB"] = self.options.pub_sub != False - self._cmake.definitions["UA_ENABLE_PUBSUB_ENCRYPTION"] = self.options.pub_sub_encryption != False + tc.variables["UA_ENABLE_ENCRYPTION_OPENSSL"] = True + + tc.variables["UA_ENABLE_JSON_ENCODING"] = self.options.json_support + tc.variables["UA_ENABLE_PUBSUB"] = self.options.pub_sub != False + tc.variables["UA_ENABLE_PUBSUB_ENCRYPTION"] = self.options.pub_sub_encryption != False + if self.options.pub_sub != False: if self.settings.os == "Linux" and self.options.pub_sub == "Ethernet": - self._cmake.definitions["UA_ENABLE_PUBSUB_ETH_UADP"] = True + tc.variables["UA_ENABLE_PUBSUB_ETH_UADP"] = True elif self.settings.os == "Linux" and self.options.pub_sub == "Ethernet_XDP": - self._cmake.definitions["UA_ENABLE_PUBSUB_ETH_UADP_XDP"] = True - self._cmake.definitions["UA_ENABLE_DA"] = self.options.data_access + tc.variables["UA_ENABLE_PUBSUB_ETH_UADP_XDP"] = True + tc.variables["UA_ENABLE_DA"] = self.options.data_access + if self.options.compiled_nodeset_descriptions == True: - self._cmake.definitions["UA_ENABLE_NODESET_COMPILER_DESCRIPTIONS"] = self.options.compiled_nodeset_descriptions - self._cmake.definitions["UA_NAMESPACE_ZERO"] = "FULL" + tc.variables["UA_ENABLE_NODESET_COMPILER_DESCRIPTIONS"] = self.options.compiled_nodeset_descriptions + tc.variables["UA_NAMESPACE_ZERO"] = "FULL" else: - self._cmake.definitions["UA_NAMESPACE_ZERO"] = self.options.namespace_zero - if tools.Version(self.version) < "1.3.1": - self._cmake.definitions["UA_ENABLE_MICRO_EMB_DEV_PROFILE"] = self.options.embedded_profile - self._cmake.definitions["UA_ENABLE_TYPENAMES"] = self.options.typenames - self._cmake.definitions["UA_ENABLE_STATUSCODE_DESCRIPTIONS"] = self.options.readable_statuscodes - self._cmake.definitions["UA_ENABLE_HARDENING"] = self.options.hardening + tc.variables["UA_NAMESPACE_ZERO"] = self.options.namespace_zero + if Version(self.version) < "1.3.1": + tc.variables["UA_ENABLE_MICRO_EMB_DEV_PROFILE"] = self.options.embedded_profile + + tc.variables["UA_ENABLE_TYPENAMES"] = self.options.typenames + tc.variables["UA_ENABLE_STATUSCODE_DESCRIPTIONS"] = self.options.readable_statuscodes + tc.variables["UA_ENABLE_HARDENING"] = self.options.hardening + if self.settings.compiler == "Visual Studio" and self.options.shared == True: - self._cmake.definitions["UA_MSVC_FORCE_STATIC_CRT"] = True - self._cmake.definitions["UA_COMPILE_AS_CXX"] = self.options.cpp_compatible + tc.variables["UA_MSVC_FORCE_STATIC_CRT"] = True + + tc.variables["UA_COMPILE_AS_CXX"] = self.options.cpp_compatible + + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" - self._cmake.configure(source_dir=self._source_subfolder) - return self._cmake + tc.generate() + tc = CMakeDeps(self) + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if tools.Version(self.version) >= "1.3.1": - os.unlink(os.path.join(self._source_subfolder, "tools", "cmake", "FindPython3.cmake")) + apply_conandata_patches(self) + if Version(self.version) >= "1.3.1": + os.unlink(os.path.join(self.source_folder, + "tools", "cmake", "FindPython3.cmake")) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() @property def _tools_subfolder(self): - return os.path.join(self._source_subfolder, "tools") + 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): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("LICENSE-CC0", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + self.copy("LICENSE", dst="licenses", src=self.source_folder) + self.copy("LICENSE-CC0", dst="licenses", src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.remove_files_by_mask(os.path.join( - self.package_folder, "bin"), '*.pdb') - tools.remove_files_by_mask(os.path.join( - self.package_folder, "lib"), '*.pdb') + 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) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - self.copy("generate_*.py", src=self._tools_subfolder, dst=os.path.join("res", "tools")) - self.copy("nodeset_compiler/*", src=self._tools_subfolder, dst=os.path.join("res", "tools")) - @property - def _module_subfolder(self): - return os.path.join("lib", "cmake", "open62541") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) - @property - def _module_file_rel_path(self): - return os.path.join(self._module_subfolder, "open62541Macros.cmake") + self.copy("generate_*.py", src=self._tools_subfolder, + dst=os.path.join("res", "tools")) + self.copy("nodeset_compiler/*", src=self._tools_subfolder, + dst=os.path.join("res", "tools")) @staticmethod def _chmod_plus_x(filename): @@ -396,24 +422,38 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "open62541" self.cpp_info.names["cmake_find_package_multi"] = "open62541" self.cpp_info.names["pkg_config"] = "open62541" - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) self.cpp_info.includedirs = [ "include", os.path.join("include", "open62541", "plugin") ] # required for creating custom servers from ua-nodeset - self.user_info.tools_dir = os.path.join(self.package_folder, "res", "tools") - self._chmod_plus_x(os.path.join(self.package_folder, "res", "tools", "generate_nodeid_header.py")) + self.conf_info.define("user.open62541:tools_dir", os.path.join( + self.package_folder, "res", "tools").replace("\\", "/")) + # v1 legacy support for tools_dir definition + self.user_info.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")) if self.options.single_header: self.cpp_info.defines.append("UA_ENABLE_AMALGAMATION") if self.settings.os == "Windows": self.cpp_info.system_libs.append("ws2_32") - self.cpp_info.includedirs.append(os.path.join("include", "open62541", "win32")) + self.cpp_info.includedirs.append( + os.path.join("include", "open62541", "win32")) else: - self.cpp_info.includedirs.append(os.path.join("include", "open62541", "posix")) + self.cpp_info.includedirs.append( + os.path.join("include", "open62541", "posix")) if 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.build_modules = [self._module_file_rel_path] + # v1 legacy support for open62541Macros.cmake auto-include + self.cpp_info.build_modules["cmake_find_package"] = [ + self._module_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [ + self._module_file_rel_path] + self.cpp_info.set_property("cmake_build_modules", [ + self._module_file_rel_path]) diff --git a/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_1_x.patch b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_1_x.patch index 62c1ab4b5cd3f4..a90cc17ef17533 100644 --- a/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_1_x.patch +++ b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_1_x.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2fd6ef2..e3bc6a5 100755 +index 2fd6ef29..0aa072b6 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,9 +7,8 @@ endif() @@ -31,7 +31,14 @@ index 2fd6ef2..e3bc6a5 100755 ################# # Build Options # -@@ -462,7 +460,7 @@ if(UA_ENABLE_ENCRYPTION) +@@ -456,13 +454,13 @@ if(UA_ENABLE_ENCRYPTION) + # use the OpenSSL encryption library + # https://cmake.org/cmake/help/v3.0/module/FindOpenSSL.html + find_package(OpenSSL REQUIRED) +- list(APPEND open62541_LIBRARIES ${OPENSSL_LIBRARIES}) ++ list(APPEND open62541_LIBRARIES ${OpenSSL_LIBRARIES}) + else() + # The recommended way is to install mbedtls via the OS package manager. If # that is not possible, manually compile mbedTLS and set the cmake variables # defined in /tools/cmake/FindMbedTLS.cmake. find_package(MbedTLS REQUIRED) @@ -66,7 +73,7 @@ index 2fd6ef2..e3bc6a5 100755 # Use a strict subset of the C and C++ languages check_add_cc_flag("-Wc++-compat") -@@ -632,8 +620,6 @@ if(APPLE) +@@ -632,8 +632,6 @@ if(APPLE) endif() if(MSVC) @@ -75,7 +82,7 @@ index 2fd6ef2..e3bc6a5 100755 if(UA_MSVC_FORCE_STATIC_CRT AND NOT BUILD_SHARED_LIBS) set(CompilerFlags CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE) -@@ -659,8 +645,8 @@ configure_file(include/open62541/config.h.in ${PROJECT_BINARY_DIR}/src_generated +@@ -659,8 +657,8 @@ configure_file(include/open62541/config.h.in ${PROJECT_BINARY_DIR}/src_generated configure_file(open62541.pc.in ${PROJECT_BINARY_DIR}/src_generated/open62541.pc @ONLY) if(UA_ENABLE_DISCOVERY_MULTICAST) @@ -85,7 +92,7 @@ index 2fd6ef2..e3bc6a5 100755 endif() set(exported_headers ${exported_headers} -@@ -946,18 +932,7 @@ if(UA_DEBUG_DUMP_PKGS) +@@ -946,18 +944,7 @@ if(UA_DEBUG_DUMP_PKGS) endif() if(UA_ENABLE_DISCOVERY_MULTICAST) @@ -104,7 +111,7 @@ index 2fd6ef2..e3bc6a5 100755 ${lib_sources}) endif() -@@ -1147,11 +1122,14 @@ if(UA_ENABLE_AMALGAMATION) +@@ -1147,10 +1134,13 @@ if(UA_ENABLE_AMALGAMATION) target_include_directories(open62541-object PRIVATE ${PROJECT_BINARY_DIR}) target_include_directories(open62541-object PRIVATE "${ua_architecture_directories_to_include}") if(UA_ENABLE_ENCRYPTION_MBEDTLS) @@ -112,15 +119,15 @@ index 2fd6ef2..e3bc6a5 100755 + target_include_directories(open62541-object PRIVATE ${MbedTLS_INCLUDE_DIRS}) endif() if(UA_ENABLE_ENCRYPTION_OPENSSL) - target_include_directories(open62541-object PRIVATE ${OPENSSL_INCLUDE_DIR}) - endif() +- target_include_directories(open62541-object PRIVATE ${OPENSSL_INCLUDE_DIR}) ++ target_include_directories(open62541-object PRIVATE ${OpenSSL_INCLUDE_DIR}) ++ endif() + if(UA_ENABLE_WEBSOCKET_SERVER) + target_include_directories(open62541-plugins PRIVATE ${Libwebsockets_INCLUDE_DIR}) -+ endif() + endif() # make sure the open62541_amalgamation target builds before so that amalgamation is finished and it is not executed again for open62541-object - # and thus may overwrite the amalgamation result during multiprocessor compilation -@@ -1186,6 +1164,9 @@ else() +@@ -1186,6 +1176,9 @@ else() ) target_include_directories(open62541-object PRIVATE ${PROJECT_SOURCE_DIR}/src) @@ -130,7 +137,7 @@ index 2fd6ef2..e3bc6a5 100755 add_library(open62541-plugins OBJECT ${default_plugin_sources} ${ua_architecture_sources} ${exported_headers}) add_dependencies(open62541-plugins open62541-generator-types open62541-generator-transport open62541-generator-namespace) -@@ -1194,6 +1175,10 @@ else() +@@ -1194,6 +1187,10 @@ else() target_compile_definitions(open62541-plugins PRIVATE -DUA_DYNAMIC_LINKING_EXPORT) set_target_properties(open62541-plugins PROPERTIES FOLDER "open62541/lib") @@ -141,7 +148,7 @@ index 2fd6ef2..e3bc6a5 100755 if(UA_PACK_DEBIAN) add_library(open62541-static STATIC $ $) set_target_properties(open62541-static PROPERTIES OUTPUT_NAME open62541) -@@ -1232,7 +1217,7 @@ else() +@@ -1232,10 +1229,10 @@ else() include_directories_private("${PROJECT_BINARY_DIR}") if(UA_ENABLE_ENCRYPTION_MBEDTLS) @@ -149,9 +156,13 @@ index 2fd6ef2..e3bc6a5 100755 + include_directories_private(${MbedTLS_INCLUDE_DIRS}) endif() if(UA_ENABLE_ENCRYPTION_OPENSSL) - include_directories_private(${OPENSSL_INCLUDE_DIR}) +- include_directories_private(${OPENSSL_INCLUDE_DIR}) ++ include_directories_private(${OpenSSL_INCLUDE_DIR}) + endif() + + # Option-specific includes diff --git a/src/server/ua_discovery_manager.h b/src/server/ua_discovery_manager.h -index 7787b40..99dc884 100644 +index 7787b40e..99dc884b 100644 --- a/src/server/ua_discovery_manager.h +++ b/src/server/ua_discovery_manager.h @@ -50,7 +50,7 @@ typedef struct periodicServerRegisterCallback_entry { @@ -164,7 +175,7 @@ index 7787b40..99dc884 100644 /** * TXT record: diff --git a/src/server/ua_server_discovery_mdns.c b/src/server/ua_server_discovery_mdns.c -index 6121b8c..e4cae7c 100644 +index 6121b8c3..e4cae7c5 100644 --- a/src/server/ua_server_discovery_mdns.c +++ b/src/server/ua_server_discovery_mdns.c @@ -11,8 +11,8 @@ diff --git a/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_2_x.patch b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_2_x.patch index 1b8a156ff258bb..97765e7ca4ecfb 100644 --- a/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_2_x.patch +++ b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_2_x.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9184b943..8f4b6772 100644 +index ae6405e9..df78f4e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,9 +7,8 @@ endif() @@ -31,7 +31,14 @@ index 9184b943..8f4b6772 100644 ################# # Build Options # -@@ -481,7 +479,7 @@ if(UA_ENABLE_ENCRYPTION) +@@ -475,13 +473,13 @@ if(UA_ENABLE_ENCRYPTION) + # use the OpenSSL encryption library + # https://cmake.org/cmake/help/v3.0/module/FindOpenSSL.html + find_package(OpenSSL REQUIRED) +- list(APPEND open62541_LIBRARIES ${OPENSSL_LIBRARIES}) ++ list(APPEND open62541_LIBRARIES ${OpenSSL_LIBRARIES}) + else() + # The recommended way is to install mbedtls via the OS package manager. If # that is not possible, manually compile mbedTLS and set the cmake variables # defined in /tools/cmake/FindMbedTLS.cmake. find_package(MbedTLS REQUIRED) @@ -116,7 +123,7 @@ index 9184b943..8f4b6772 100644 ${lib_sources}) endif() -@@ -1178,11 +1152,14 @@ if(UA_ENABLE_AMALGAMATION) +@@ -1178,10 +1152,13 @@ if(UA_ENABLE_AMALGAMATION) target_include_directories(open62541-object PRIVATE ${PROJECT_BINARY_DIR}) target_include_directories(open62541-object PRIVATE "${ua_architecture_directories_to_include}") if(UA_ENABLE_ENCRYPTION_MBEDTLS) @@ -124,14 +131,14 @@ index 9184b943..8f4b6772 100644 + target_include_directories(open62541-object PRIVATE ${MbedTLS_INCLUDE_DIRS}) endif() if(UA_ENABLE_ENCRYPTION_OPENSSL) - target_include_directories(open62541-object PRIVATE ${OPENSSL_INCLUDE_DIR}) - endif() +- target_include_directories(open62541-object PRIVATE ${OPENSSL_INCLUDE_DIR}) ++ target_include_directories(open62541-object PRIVATE ${OpenSSL_INCLUDE_DIR}) ++ endif() + if(UA_ENABLE_WEBSOCKET_SERVER) + target_include_directories(open62541-plugins PRIVATE ${Libwebsockets_INCLUDE_DIR}) -+ endif() + endif() # make sure the open62541_amalgamation target builds before so that amalgamation is finished and it is not executed again for open62541-object - # and thus may overwrite the amalgamation result during multiprocessor compilation @@ -1217,6 +1194,12 @@ else() ) @@ -159,7 +166,7 @@ index 9184b943..8f4b6772 100644 if(UA_FORCE_CPP) set_source_files_properties(${lib_sources} PROPERTIES LANGUAGE CXX) -@@ -1263,7 +1253,7 @@ else() +@@ -1263,10 +1253,10 @@ else() include_directories_private("${PROJECT_BINARY_DIR}") if(UA_ENABLE_ENCRYPTION_MBEDTLS) @@ -167,7 +174,11 @@ index 9184b943..8f4b6772 100644 + include_directories_private(${MbedTLS_INCLUDE_DIRS}) endif() if(UA_ENABLE_ENCRYPTION_OPENSSL) - include_directories_private(${OPENSSL_INCLUDE_DIR}) +- include_directories_private(${OPENSSL_INCLUDE_DIR}) ++ include_directories_private(${OpenSSL_INCLUDE_DIR}) + endif() + + # Option-specific includes diff --git a/src/server/ua_discovery_manager.h b/src/server/ua_discovery_manager.h index 38de16e7..16b137af 100644 --- a/src/server/ua_discovery_manager.h diff --git a/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_x.patch b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_1.patch similarity index 89% rename from recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_x.patch rename to recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_1.patch index cdefdfc0dde979..470202a51fce24 100644 --- a/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_x.patch +++ b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_1.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2a140ebd..605aed72 100644 +index 2a140ebd..bbca9b1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ endif() @@ -32,6 +32,15 @@ index 2a140ebd..605aed72 100644 # Examples for the version string are: # v1.2 +@@ -580,7 +577,7 @@ if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL) + # use the OpenSSL encryption library + # https://cmake.org/cmake/help/v3.0/module/FindOpenSSL.html + find_package(OpenSSL REQUIRED) +- list(APPEND open62541_LIBRARIES ${OPENSSL_LIBRARIES}) ++ list(APPEND open62541_LIBRARIES ${OpenSSL_LIBRARIES}) + endif () + + if(UA_ENABLE_ENCRYPTION_LIBRESSL) @@ -598,7 +595,7 @@ if(UA_ENABLE_ENCRYPTION_MBEDTLS OR UA_ENABLE_PUBSUB_ENCRYPTION) # that is not possible, manually compile mbedTLS and set the cmake variables # defined in /tools/cmake/FindMbedTLS.cmake. @@ -108,7 +117,7 @@ index 2a140ebd..605aed72 100644 ${lib_sources}) endif() -@@ -1349,7 +1320,7 @@ if(UA_ENABLE_AMALGAMATION) +@@ -1349,10 +1320,10 @@ if(UA_ENABLE_AMALGAMATION) target_include_directories(open62541-object PRIVATE ${PROJECT_BINARY_DIR}) target_include_directories(open62541-object PRIVATE "${ua_architecture_directories_to_include}") if(UA_ENABLE_ENCRYPTION_MBEDTLS) @@ -116,7 +125,11 @@ index 2a140ebd..605aed72 100644 + target_include_directories(open62541-object PRIVATE ${MbedTLS_INCLUDE_DIRS}) endif() if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL) - target_include_directories(open62541-object PRIVATE ${OPENSSL_INCLUDE_DIR}) +- target_include_directories(open62541-object PRIVATE ${OPENSSL_INCLUDE_DIR}) ++ target_include_directories(open62541-object PRIVATE ${OpenSSL_INCLUDE_DIR}) + endif() + if(UA_ENABLE_ENCRYPTION_LIBRESSL) + target_include_directories(open62541-object PRIVATE ${LIBRESSL_INCLUDE_DIR}) @@ -1391,6 +1362,12 @@ else() ) @@ -144,7 +157,7 @@ index 2a140ebd..605aed72 100644 if(UA_FORCE_CPP) set_source_files_properties(${lib_sources} PROPERTIES LANGUAGE CXX) -@@ -1444,7 +1428,7 @@ else() +@@ -1444,10 +1428,10 @@ else() include_directories_private("${PROJECT_BINARY_DIR}") if(UA_ENABLE_ENCRYPTION_MBEDTLS) @@ -152,7 +165,11 @@ index 2a140ebd..605aed72 100644 + include_directories_private(${MbedTLS_INCLUDE_DIRS}) endif() if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL) - include_directories_private(${OPENSSL_INCLUDE_DIR}) +- include_directories_private(${OPENSSL_INCLUDE_DIR}) ++ include_directories_private(${OpenSSL_INCLUDE_DIR}) + endif() + if(UA_ENABLE_ENCRYPTION_LIBRESSL) + include_directories_private(${LIBRESSL_INCLUDE_DIR}) diff --git a/src/server/ua_discovery_manager.h b/src/server/ua_discovery_manager.h index e0f48c0f..bae9bd65 100644 --- a/src/server/ua_discovery_manager.h diff --git a/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_4.patch b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_4.patch new file mode 100644 index 00000000000000..c1c291956aa8ae --- /dev/null +++ b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_4.patch @@ -0,0 +1,196 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1934374e..199df369 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,7 +11,7 @@ endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_LOWER_CASE) + +-set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/cmake") ++set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PROJECT_SOURCE_DIR};${PROJECT_SOURCE_DIR}/tools/cmake") + find_package(Python3 REQUIRED) + set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) + find_package(Git) +@@ -41,11 +41,11 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + # The current version information. On the master branch, we take the version + # number from the latest release plus the "-undefined" label. Will be + # overwritten with more detailed information if git is available. +-set(OPEN62541_VER_MAJOR 1) +-set(OPEN62541_VER_MINOR 3) +-set(OPEN62541_VER_PATCH 3) +-set(OPEN62541_VER_LABEL "-undefined") # like "-rc1" or "-g4538abcd" or "-g4538abcd-dirty" +-set(OPEN62541_VER_COMMIT "unknown-commit") ++set(OPEN62541_VER_MINOR "0" CACHE STRING "Set the major version. Used by conan") ++set(OPEN62541_VER_MAJOR "0" CACHE STRING "Set the minor version. Used by conan") ++set(OPEN62541_VER_PATCH "0" CACHE STRING "Set the patch version. Used by conan") ++set(OPEN62541_VER_LABEL "") ++set(OPEN62541_VER_COMMIT "${OPEN62541_VER_MAJOR}.${OPEN62541_VER_MINOR}.${OPEN62541_VER_PATCH}") + + # Overwrite the version information based on git if available + include(SetGitBasedVersion) +@@ -601,7 +601,7 @@ if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL) + # use the OpenSSL encryption library + # https://cmake.org/cmake/help/v3.0/module/FindOpenSSL.html + find_package(OpenSSL REQUIRED) +- list(APPEND open62541_LIBRARIES ${OPENSSL_LIBRARIES}) ++ list(APPEND open62541_LIBRARIES ${OpenSSL_LIBRARIES}) + endif () + + if(UA_ENABLE_ENCRYPTION_LIBRESSL) +@@ -619,7 +619,7 @@ if(UA_ENABLE_ENCRYPTION_MBEDTLS OR UA_ENABLE_PUBSUB_ENCRYPTION) + # that is not possible, manually compile mbedTLS and set the cmake variables + # defined in /tools/cmake/FindMbedTLS.cmake. + find_package(MbedTLS REQUIRED) +- list(APPEND open62541_LIBRARIES ${MBEDTLS_LIBRARIES}) ++ list(APPEND open62541_LIBRARIES ${MbedTLS_LIBRARIES}) + endif() + + if(UA_ENABLE_TPM2_SECURITY) +@@ -630,8 +630,10 @@ if(UA_ENABLE_WEBSOCKET_SERVER) + # The recommended way is to install libwebsockets via the OS package manager. If + # that is not possible, manually compile libwebsockets and set the cmake variables + # defined in /tools/cmake/Findlibwebsockets.cmake +- find_package(libwebsockets REQUIRED) +- list(APPEND open62541_LIBRARIES ${LIBWEBSOCKETS_LIBRARIES}) ++ find_package(Libwebsockets REQUIRED) ++ list(APPEND open62541_LIBRARIES ${Libwebsockets_LIBRARIES}) ++ message(STATUS "Libwebsockets library: ${Libwebsockets_LIBRARIES}") ++ message(STATUS "Libwebsockets includes: ${Libwebsockets_INCLUDE_DIRS}") + + set(ua_architecture_directories_to_include ${ua_architecture_directories_to_include} + ${LIBWEBSOCKETS_INCLUDE_DIR}) +@@ -746,7 +748,7 @@ if(NOT UA_FORCE_CPP AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" ST + set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # cmake sets -rdynamic by default + + # Debug +- if(BUILD_TYPE_LOWER_CASE STREQUAL "debug" AND UNIX AND NOT UA_BUILD_OSS_FUZZ AND ++ if(FALSE AND BUILD_TYPE_LOWER_CASE STREQUAL "debug" AND UNIX AND NOT UA_BUILD_OSS_FUZZ AND + "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang" AND NOT UA_ENABLE_UNIT_TESTS_MEMCHECK) + # Add default sanitizer settings when using clang and Debug build. + # This allows e.g. CLion to find memory locations for SegFaults +@@ -832,24 +834,7 @@ configure_file(include/open62541/config.h.in ${PROJECT_BINARY_DIR}/src_generated + configure_file(tools/open62541.pc.in ${PROJECT_BINARY_DIR}/src_generated/open62541.pc @ONLY) + + if(UA_ENABLE_DISCOVERY_MULTICAST) +- include(GenerateExportHeader) +- set(MDNSD_LOGLEVEL 300 CACHE STRING "Level at which logs shall be reported" FORCE) +- # create a "fake" empty library to generate the export header macros +- add_library(libmdnsd ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/mdnsd.h) +- if (UA_FORCE_CPP) +- set_property(TARGET libmdnsd PROPERTY LINKER_LANGUAGE CXX) +- else() +- set_property(TARGET libmdnsd PROPERTY LINKER_LANGUAGE C) +- endif() +- set_property(TARGET libmdnsd PROPERTY DEFINE_SYMBOL "MDNSD_DYNAMIC_LINKING_EXPORT") +- configure_file("deps/mdnsd/libmdnsd/mdnsd_config_extra.in" +- "${PROJECT_BINARY_DIR}/src_generated/mdnsd_config_extra") +- file(READ "${PROJECT_BINARY_DIR}/src_generated/mdnsd_config_extra" MDNSD_CONFIG_EXTRA) +- generate_export_header(libmdnsd +- EXPORT_FILE_NAME "${PROJECT_BINARY_DIR}/src_generated/mdnsd_config.h" +- BASE_NAME MDNSD +- DEFINE_NO_DEPRECATED +- CUSTOM_CONTENT_FROM_VARIABLE MDNSD_CONFIG_EXTRA) ++ find_package(mdnsd) + endif() + + set(exported_headers ${ua_architecture_headers_beginning}) +@@ -1154,18 +1139,7 @@ if(UA_DEBUG_DUMP_PKGS) + endif() + + if(UA_ENABLE_DISCOVERY_MULTICAST) +- # prepend in list, otherwise it complains that winsock2.h has to be included before windows.h +- set(internal_headers ${PROJECT_BINARY_DIR}/src_generated/mdnsd_config.h +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/1035.h +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/xht.h +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/sdtxt.h +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/mdnsd.h +- ${internal_headers} ) + set(lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_server_discovery_mdns.c +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/1035.c +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/xht.c +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/sdtxt.c +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/mdnsd.c + ${lib_sources}) + endif() + +@@ -1370,10 +1344,10 @@ if(UA_ENABLE_AMALGAMATION) + target_include_directories(open62541-object PRIVATE ${PROJECT_BINARY_DIR}) + target_include_directories(open62541-object PRIVATE "${ua_architecture_directories_to_include}") + if(UA_ENABLE_ENCRYPTION_MBEDTLS) +- target_include_directories(open62541-object PRIVATE ${MBEDTLS_INCLUDE_DIRS}) ++ target_include_directories(open62541-object PRIVATE ${MbedTLS_INCLUDE_DIRS}) + endif() + if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL) +- target_include_directories(open62541-object PRIVATE ${OPENSSL_INCLUDE_DIR}) ++ target_include_directories(open62541-object PRIVATE ${OpenSSL_INCLUDE_DIR}) + endif() + if(UA_ENABLE_ENCRYPTION_LIBRESSL) + target_include_directories(open62541-object PRIVATE ${LIBRESSL_INCLUDE_DIR}) +@@ -1412,6 +1386,12 @@ else() + ) + + target_include_directories(open62541-object PRIVATE ${PROJECT_SOURCE_DIR}/src) ++ if(UA_ENABLE_DISCOVERY_MULTICAST) ++ target_include_directories(open62541-object PUBLIC ${mdnsd_INCLUDE_DIRS}) ++ endif() ++ if(UA_ENABLE_WEBSOCKET_SERVER) ++ target_include_directories(open62541-object PUBLIC ${Libwebsockets_INCLUDE_DIRS}) ++ endif() + + add_library(open62541-plugins OBJECT ${default_plugin_sources} ${ua_architecture_sources} ${exported_headers}) + add_dependencies(open62541-plugins open62541-generator-types open62541-generator-transport open62541-generator-namespace) +@@ -1425,6 +1405,13 @@ else() + set_target_properties(open62541-static PROPERTIES OUTPUT_NAME open62541) + endif() + add_library(open62541 $ $) ++ if(UA_ENABLE_DISCOVERY_MULTICAST) ++ list(APPEND open62541_LIBRARIES mdnsd::mdnsd) ++ endif() ++ ++ if(UA_ENABLE_WEBSOCKET_SERVER) ++ list(APPEND open62541_LIBRARIES Libwebsockets::Libwebsockets) ++ endif() + + if(UA_FORCE_CPP) + set_source_files_properties(${lib_sources} PROPERTIES LANGUAGE CXX) +@@ -1465,10 +1452,10 @@ else() + include_directories_private("${PROJECT_BINARY_DIR}") + + if(UA_ENABLE_ENCRYPTION_MBEDTLS) +- include_directories_private(${MBEDTLS_INCLUDE_DIRS}) ++ include_directories_private(${MbedTLS_INCLUDE_DIRS}) + endif() + if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL) +- include_directories_private(${OPENSSL_INCLUDE_DIR}) ++ include_directories_private(${OpenSSL_INCLUDE_DIR}) + endif() + if(UA_ENABLE_ENCRYPTION_LIBRESSL) + include_directories_private(${LIBRESSL_INCLUDE_DIR}) +diff --git a/src/server/ua_discovery_manager.h b/src/server/ua_discovery_manager.h +index e0f48c0f..bae9bd65 100644 +--- a/src/server/ua_discovery_manager.h ++++ b/src/server/ua_discovery_manager.h +@@ -44,7 +44,7 @@ typedef struct periodicServerRegisterCallback_entry { + + #ifdef UA_ENABLE_DISCOVERY_MULTICAST + +-#include "mdnsd/libmdnsd/mdnsd.h" ++#include "libmdnsd/mdnsd.h" + + /** + * TXT record: +diff --git a/src/server/ua_server_discovery_mdns.c b/src/server/ua_server_discovery_mdns.c +index fccb9c73..aa585b8f 100644 +--- a/src/server/ua_server_discovery_mdns.c ++++ b/src/server/ua_server_discovery_mdns.c +@@ -11,8 +11,8 @@ + #ifdef UA_ENABLE_DISCOVERY_MULTICAST + + #ifndef UA_ENABLE_AMALGAMATION +-#include "mdnsd/libmdnsd/xht.h" +-#include "mdnsd/libmdnsd/sdtxt.h" ++#include "libmdnsd/xht.h" ++#include "libmdnsd/sdtxt.h" + #endif + + #ifdef _WIN32 diff --git a/recipes/open62541/all/patches/1_0_x.patch b/recipes/open62541/all/patches/1_0_x.patch index a3095f005e7f22..b6c8ade0e35779 100644 --- a/recipes/open62541/all/patches/1_0_x.patch +++ b/recipes/open62541/all/patches/1_0_x.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 94ceb127..00b7ca1d 100644 +index 94ceb127..3aa9ec26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,9 +7,8 @@ endif() @@ -31,6 +31,15 @@ index 94ceb127..00b7ca1d 100644 ################# # Build Options # +@@ -378,7 +376,7 @@ if(UA_ENABLE_ENCRYPTION) + # that is not possible, manually compile mbedTLS and set the cmake variables + # defined in /tools/cmake/FindMbedTLS.cmake. + find_package(MbedTLS REQUIRED) +- list(APPEND open62541_LIBRARIES ${MBEDTLS_LIBRARIES}) ++ list(APPEND open62541_LIBRARIES ${MbedTLS_LIBRARIES}) + endif() + + ##################### @@ -405,7 +403,6 @@ if(NOT UA_COMPILE_AS_CXX AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID -fno-strict-aliasing # fewer compiler assumptions about pointer types -fexceptions # recommended for multi-threaded C code, also in combination with C++ code @@ -96,6 +105,15 @@ index 94ceb127..00b7ca1d 100644 ${lib_sources}) endif() +@@ -939,7 +911,7 @@ if(UA_ENABLE_AMALGAMATION) + target_include_directories(open62541-object PRIVATE ${PROJECT_BINARY_DIR}) + target_include_directories(open62541-object PRIVATE "${ua_architecture_directories_to_include}") + if(UA_ENABLE_ENCRYPTION) +- target_include_directories(open62541-object PRIVATE ${MBEDTLS_INCLUDE_DIRS}) ++ target_include_directories(open62541-object PRIVATE ${MbedTLS_INCLUDE_DIRS}) + endif() + + # make sure the open62541_amalgamation target builds before so that amalgamation is finished and it is not executed again for open62541-object @@ -972,6 +944,10 @@ else() open62541-generator-namespace ) @@ -107,6 +125,15 @@ index 94ceb127..00b7ca1d 100644 add_library(open62541-plugins OBJECT ${default_plugin_sources} ${ua_architecture_sources} ${exported_headers}) add_dependencies(open62541-plugins open62541-generator-types open62541-generator-transport open62541-generator-namespace) +@@ -1018,7 +994,7 @@ else() + include_directories_private("${PROJECT_BINARY_DIR}") + + if(UA_ENABLE_ENCRYPTION) +- include_directories_private(${MBEDTLS_INCLUDE_DIRS}) ++ include_directories_private(${MbedTLS_INCLUDE_DIRS}) + endif() + + # Option-specific includes @@ -1163,7 +1139,7 @@ install(TARGETS open62541 ${EXTRATARGETS} EXPORT open62541Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -116,6 +143,11 @@ index 94ceb127..00b7ca1d 100644 INCLUDES DESTINATION include) if(UA_ENABLE_AMALGAMATION) +@@ -1296,4 +1272,3 @@ set_target_properties(open62541-generator-namespace PROPERTIES FOLDER "open62541 + set_target_properties(open62541-generator-statuscode PROPERTIES FOLDER "open62541/generators") + set_target_properties(open62541-generator-transport PROPERTIES FOLDER "open62541/generators") + set_target_properties(open62541-generator-types PROPERTIES FOLDER "open62541/generators") +- diff --git a/src/server/ua_discovery_manager.h b/src/server/ua_discovery_manager.h index 3d1ae299..7d5f1051 100644 --- a/src/server/ua_discovery_manager.h diff --git a/recipes/open62541/all/submoduledata.yml b/recipes/open62541/all/submoduledata.yml index 744201d5b92e47..19278804be7058 100644 --- a/recipes/open62541/all/submoduledata.yml +++ b/recipes/open62541/all/submoduledata.yml @@ -34,8 +34,18 @@ submodules: sha256: a2bcc1cda0154091ecbed25b8c40436c5b75d11bb38df28b35a2ceedb331d562 url: https://github.com/OPCFoundation/UA-Nodeset/archive/Errata-1.04.5.zip archive_pattern: "UA-Nodeset-{version}" + "1.2.6": + deps/ua-nodeset: + sha256: a2bcc1cda0154091ecbed25b8c40436c5b75d11bb38df28b35a2ceedb331d562 + url: https://github.com/OPCFoundation/UA-Nodeset/archive/Errata-1.04.5.zip + archive_pattern: "UA-Nodeset-{version}" "1.3.1": deps/ua-nodeset: sha256: a2bcc1cda0154091ecbed25b8c40436c5b75d11bb38df28b35a2ceedb331d562 url: https://github.com/OPCFoundation/UA-Nodeset/archive/Errata-1.04.5.zip archive_pattern: "UA-Nodeset-{version}" + "1.3.4": + deps/ua-nodeset: + sha256: a2bcc1cda0154091ecbed25b8c40436c5b75d11bb38df28b35a2ceedb331d562 + url: https://github.com/OPCFoundation/UA-Nodeset/archive/Errata-1.04.5.zip + archive_pattern: "UA-Nodeset-{version}" diff --git a/recipes/open62541/all/test_package/CMakeLists.txt b/recipes/open62541/all/test_package/CMakeLists.txt index 111c07cd3204c9..553baebf9bc49f 100644 --- a/recipes/open62541/all/test_package/CMakeLists.txt +++ b/recipes/open62541/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ -cmake_minimum_required(VERSION 3.12) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) find_package(open62541 REQUIRED CONFIG) find_package(Threads REQUIRED) @@ -21,17 +18,16 @@ ua_generate_nodeset_and_datatypes( FILE_BSD "${PROJECT_SOURCE_DIR}/FooFlt.Types.bsd" OUTPUT_DIR "${GENERATE_OUTPUT_DIR}" NAMESPACE_IDX 2 # This namespace index must match the order in which you are adding the nodeset in the source code - #NAMESPACE_MAP "2:http://opcfoundation.org/UA/DI/" NAMESPACE_MAP "2:https://new.foo.com/zebra-compression/flattening-and-subspacefolding/UA/" FILE_NS "${PROJECT_SOURCE_DIR}/FooFlt.NodeSet2.xml" INTERNAL ) # Previous macro automatically sets some variables which hold the generated source code files using the provided NAME -add_executable(${PROJECT_NAME}_nodeset +add_executable(${PROJECT_NAME} ${UA_NODESET_FOO_FLT_SOURCES} ${UA_TYPES_FOO_FLT_SOURCES} - test_package_nodeset.c + test_package.c ) # Make sure the nodeset compiler is executed before compiling the main file -add_dependencies(${PROJECT_NAME}_nodeset ${PROJECT_NAME}-ns-foo_flt) -target_link_libraries(${PROJECT_NAME}_nodeset PRIVATE open62541::open62541) +add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}-ns-foo_flt) +target_link_libraries(${PROJECT_NAME} PRIVATE open62541::open62541) diff --git a/recipes/open62541/all/test_package/conanfile.py b/recipes/open62541/all/test_package/conanfile.py index b19700d426fad0..52782cf8480cf5 100644 --- a/recipes/open62541/all/test_package/conanfile.py +++ b/recipes/open62541/all/test_package/conanfile.py @@ -1,25 +1,36 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain import os +# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def requirements(self): + self.requires(self.tested_reference_str) self.requires("ua-nodeset/padim-1.02-2021-07-21") + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["open62541_NODESET_DIR"] = self.deps_user_info["ua-nodeset"].nodeset_dir.replace( + "\\", "/") # ua-nodeset path needs to be sanitized for windows systems + tc.variables["open62541_TOOLS_DIR"] = self.dependencies["open62541"].conf_info.get( + "user.open62541:tools_dir") + tc.generate() + def build(self): cmake = CMake(self) - cmake.definitions["open62541_NODESET_DIR"] = self.deps_user_info["ua-nodeset"].nodeset_dir - cmake.definitions["open62541_TOOLS_DIR"] = self.deps_user_info["open62541"].tools_dir cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - # bin_path = os.path.join("bin", "test_package") - # self.run(bin_path, run_environment=True) - - bin_path = os.path.join("bin", "test_package_nodeset") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/open62541/all/test_package/test_package_nodeset.c b/recipes/open62541/all/test_package/test_package.c similarity index 100% rename from recipes/open62541/all/test_package/test_package_nodeset.c rename to recipes/open62541/all/test_package/test_package.c diff --git a/recipes/open62541/all/test_v1_package/CMakeLists.txt b/recipes/open62541/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..bd17b291f8bc6b --- /dev/null +++ b/recipes/open62541/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(open62541 REQUIRED CONFIG) +find_package(Threads REQUIRED) + +find_package(Python3 REQUIRED) +set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) + +# Output directory for Nodeset Compiler +set(GENERATE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/src_generated/") +file(MAKE_DIRECTORY "${GENERATE_OUTPUT_DIR}") +include_directories("${GENERATE_OUTPUT_DIR}") +ua_generate_nodeset_and_datatypes( + NAME "foo_flt" + TARGET_PREFIX "${PROJECT_NAME}" + FILE_CSV "${PROJECT_SOURCE_DIR}/../test_package/FooFltModel.csv" + FILE_BSD "${PROJECT_SOURCE_DIR}/../test_package/FooFlt.Types.bsd" + OUTPUT_DIR "${GENERATE_OUTPUT_DIR}" + NAMESPACE_IDX 2 # This namespace index must match the order in which you are adding the nodeset in the source code + NAMESPACE_MAP "2:https://new.foo.com/zebra-compression/flattening-and-subspacefolding/UA/" + FILE_NS "${PROJECT_SOURCE_DIR}/../test_package/FooFlt.NodeSet2.xml" + INTERNAL +) +# Previous macro automatically sets some variables which hold the generated source code files using the provided NAME +add_executable(${PROJECT_NAME} + ${UA_NODESET_FOO_FLT_SOURCES} + ${UA_TYPES_FOO_FLT_SOURCES} + ../test_package/test_package.c +) +# Make sure the nodeset compiler is executed before compiling the main file +add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}-ns-foo_flt) +target_link_libraries(${PROJECT_NAME} PRIVATE open62541::open62541) diff --git a/recipes/open62541/all/test_v1_package/conanfile.py b/recipes/open62541/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..95cab84f3695f6 --- /dev/null +++ b/recipes/open62541/all/test_v1_package/conanfile.py @@ -0,0 +1,24 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def requirements(self): + self.requires("ua-nodeset/padim-1.02-2021-07-21") + + def build(self): + cmake = CMake(self) + cmake.definitions["open62541_NODESET_DIR"] = self.deps_user_info["ua-nodeset"].nodeset_dir + cmake.definitions["open62541_TOOLS_DIR"] = self.deps_user_info["open62541"].tools_dir + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/open62541/config.yml b/recipes/open62541/config.yml index eb0be7a7f5d36b..76c77487001109 100644 --- a/recipes/open62541/config.yml +++ b/recipes/open62541/config.yml @@ -1,6 +1,10 @@ versions: + "1.3.4": + folder: all "1.3.1": folder: all + "1.2.6": + folder: all "1.2.4": folder: all "1.2.2":