Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Open62541 recipe v1.0.3 and v1.1.3 #3786

Merged
merged 82 commits into from
Dec 14, 2020
Merged
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
a2ac5da
add open62541 recipe for v1.0 and v1.0.1
saukijan May 20, 2020
98a1e39
fix package versioning
saukijan May 20, 2020
29f1e5d
fix fPIC managment for Windows
saukijan May 20, 2020
a369bc6
remove AddSan flags for Debug setup with Clang
saukijan May 20, 2020
402ca72
change integration test to be more generic
saukijan May 20, 2020
de18a1c
remove stringify macro for default config plugin
saukijan May 20, 2020
85ffd21
remove pthread from test_package CMakeLitsts.txt
saukijan May 20, 2020
4e13af7
merge set_static_version v1.0 and v1.0.1 into one patch
saukijan May 20, 2020
e686498
set project version from recipe
saukijan May 22, 2020
54f9f60
rework integration test to use cpp threads
saukijan May 22, 2020
7145978
add cpp11 flag for test_package
saukijan May 22, 2020
648317e
add win32 includes and links
saukijan May 22, 2020
6402633
add copy open62541.dll into lib directory step for windows shared con…
saukijan May 22, 2020
82831a6
fixed cmake install for windows systems
saukijan May 22, 2020
28a7f33
remove license exporting
saukijan Jun 2, 2020
47f830e
revert license removal from package
saukijan Jun 2, 2020
589b881
add loging level selection
saukijan Jun 2, 2020
bc268f5
change .dll packaging location from lib/ to bin/
saukijan Jun 2, 2020
126d2aa
change json_support default value to False
saukijan Jun 2, 2020
50837e8
change namescpae_zero defautl value to FULL
saukijan Jun 2, 2020
30ffa79
fix alogging level typo
saukijan Jun 10, 2020
85d8ba5
add conditional requirement
saukijan Jun 10, 2020
2172859
add shared lib condition to set fPIC option
saukijan Jun 10, 2020
ca5fa53
remove support for static clang configurations
saukijan Jun 10, 2020
4146aa1
remove setting BUILD_SHARED_LIBS and POSITION_INDEPENDENT_CODE cmake …
saukijan Jun 10, 2020
449e575
fix singe_header option
saukijan Jun 12, 2020
fbc0f98
remove multithreading support for v1.0.0
saukijan Jun 12, 2020
fdd029a
change default value for data access to true
saukijan Jun 12, 2020
cbe5809
remove exporting multithreading definition
saukijan Jun 12, 2020
7706bd9
fix option typos
saukijan Jun 22, 2020
befa913
move patching to build method
saukijan Jun 22, 2020
6b676aa
change libs to system_libs for pkg info Windows system dependencies
saukijan Jun 22, 2020
470908e
fix regex typo for namespace, add cmake caching
saukijan Jun 22, 2020
98791c5
change gpl to apache licensing
saukijan Jun 22, 2020
7d086f8
fix KB-H048 hookup error
saukijan Aug 25, 2020
245a09c
Merge branch 'master' of https://github.com/conan-io/conan-center-ind…
saukijan Dec 3, 2020
b2cfc55
refactor patches
saukijan Dec 3, 2020
f4b439e
rework ua-nodeset into a submodule
saukijan Dec 3, 2020
5ce1e45
bump to 1.0.3 add 1.1.3
saukijan Dec 3, 2020
e863226
refactor based on ideas from @syoliver
saukijan Dec 3, 2020
888f248
bump up to 1.0.3 and 1.1.3
saukijan Dec 3, 2020
50919ee
remove leading whitespace
saukijan Dec 3, 2020
d225309
fix archive patter nmissmatch
saukijan Dec 3, 2020
df91149
merge relevant patches into mega patches
saukijan Dec 3, 2020
94cc0dd
remove patch fuzzing
saukijan Dec 3, 2020
0e182d6
refactor conan.model.Version import into tools.Version to fix KB-H053
saukijan Dec 3, 2020
1b3bd4d
fix conflict with KB-H050
saukijan Dec 3, 2020
84302ce
move invalid configutation exceptions to configure()
saukijan Dec 3, 2020
dc44933
rework options to mixed types
saukijan Dec 3, 2020
107c75c
add remove_files_by_mask, exception for multithreading option, change…
saukijan Dec 3, 2020
6106e05
rollback None types to "None" string literals
saukijan Dec 3, 2020
fe925dc
move .dll files to bin, to resolve conflict with KB-H013
saukijan Dec 4, 2020
69d9994
Re-trigger CI-CD Build
saukijan Dec 4, 2020
ce00308
remove .dll files from package source dir after copy
saukijan Dec 4, 2020
3833bd1
fix typos in package()
saukijan Dec 4, 2020
b673d77
fix typo for .dll removal in package()
saukijan Dec 4, 2020
4589df6
Re-trigger CI-CD Build
saukijan Dec 4, 2020
0b9ea87
Re-trigger CI-CD Build
saukijan Dec 4, 2020
586d658
patch out runtime install path to bin
saukijan Dec 7, 2020
599967b
remove .dll handling
saukijan Dec 7, 2020
eeec5e9
remvoe support for older than v4.x clang versions
saukijan Dec 7, 2020
80c0800
fix typo
saukijan Dec 7, 2020
cbaf06d
fix if formating
saukijan Dec 7, 2020
b13fd73
add Clang 9 support, fix mdnsd find package
saukijan Dec 7, 2020
212724e
merge subscription_events option into subscription
saukijan Dec 7, 2020
611c794
fix mdnsd linking
saukijan Dec 7, 2020
30dc27f
merge discovery_multicast option into discovery
saukijan Dec 7, 2020
f3a2f00
remove static lib restriction for clang compiler
saukijan Dec 7, 2020
4727ede
remove discovery_multicast remnants
saukijan Dec 7, 2020
c8ec480
improve clang compiler handling
saukijan Dec 7, 2020
14ece9c
add debugging information for Clang 9 checks
saukijan Dec 7, 2020
303d94d
improve debug informatio nfor 1.0.3
saukijan Dec 7, 2020
6bcef34
remove support for v1.0.3 cpp_compatible option
saukijan Dec 7, 2020
e7a7306
remove clang 9 and later support for v1.0.3
saukijan Dec 7, 2020
b7ecb9f
fix cmake module path, find_package lib names, libwebsockets linking
saukijan Dec 7, 2020
0ef82e4
change "None" options to False, forward encryption option to libwebos…
saukijan Dec 7, 2020
f38dd36
remove -Qunused-arguments compiler argument
saukijan Dec 7, 2020
a7b9cb7
add -Wno-unused-command-line-argument to patch
saukijan Dec 8, 2020
8b2a79c
re-enable clang 9 support for 1.1.3
saukijan Dec 8, 2020
9c5de64
fix comparison operators, use self.recipe_folder instead of os.path.d…
saukijan Dec 10, 2020
8718bc1
reduce integration test from 1 second to 1 milisecond
saukijan Dec 10, 2020
c15446e
remove clang 4 support and fix configuration message
saukijan Dec 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions recipes/open62541/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 2.8.11)
project(cmake_wrapper)

include(conanbuildinfo.cmake)
conan_basic_setup()

add_subdirectory(source_subfolder)
14 changes: 14 additions & 0 deletions recipes/open62541/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sources:
"1.0.3":
url: "https://github.com/open62541/open62541/archive/v1.0.3.tar.gz"
sha256: "3e4c939d702d06d89f32a1cafe2b992c7f3d81c8f8579e093a972d4bc4fb3d50"
"1.1.3":
url: "https://github.com/open62541/open62541/archive/v1.1.3.tar.gz"
sha256: "12770bf9f5d9f44dedce0d1b34066dd14111d24c73a2f0153420e0a750e85d19"
patches:
"1.0.3":
- patch_file: "patches/1_0_3.patch"
base_path: "source_subfolder"
"1.1.3":
- patch_file: "patches/1_1_3.patch"
base_path: "source_subfolder"
307 changes: 307 additions & 0 deletions recipes/open62541/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
import os
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
import shutil
import yaml


class Open62541Conan(ConanFile):
name = "open62541"
license = "MPLv2"
exports_sources = [
"CMakeLists.txt",
"patches/**"
]
exports = "submoduledata.yml"
homepage = "https://open62541.org/"
url = "https://github.com/conan-io/conan-center-index"
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."
topics = (
"OPC UA", "open62541", "sdk", "server/client", "c", "iec-62541",
"industrial automation", "tsn", "time sensetive networks", "publish-subscirbe", "pubsub"
)
settings = "os", "compiler", "build_type", "arch"
options = {
"fPIC": [True, False],
"shared": [True, False],
"historize": [True, False, "Experimental"],
"logging_level": ["Fatal", "Error", "Warning", "Info", "Debug", "Trace"],
"subscription": [True, False, "With Events"],
"methods": [True, False],
"dynamic_nodes": [True, False],
"single_header": [True, False],
"multithreading": ["None", "Threadsafe", "Internal threads"],
"imutable_nodes": [True, False],
"web_socket": [True, False],
"discovery": [True, False, "With Multicast"],
"discovery_semaphore": [True, False],
"query": [True, False],
"encryption": [False, "openssl", "mbedtls-apache", "mbedtls-gpl"],
"json_support": [True, False],
"pub_sub": [False, "Simple", "Ethernet", "Ethernet_XDP"],
"data_access": [True, False],
"compiled_nodeset_descriptions": [True, False],
"namespace_zero": ["MINIMAL", "REDUCED", "FULL"],
"embedded_profile": [True, False],
"typenames": [True, False],
"hardening": [True, False],
"cpp_compatible": [True, False],
"readable_statuscodes": [True, False]
}
default_options = {
"fPIC": True,
"shared": False,
"historize": False,
"logging_level": "Info",
"subscription": True,
"methods": True,
"dynamic_nodes": True,
"single_header": False,
"multithreading": "None",
"imutable_nodes": False,
"web_socket": False,
"discovery": True,
"discovery_semaphore": True,
"query": False,
"encryption": False,
"json_support": False,
"pub_sub": False,
"data_access": True,
"compiled_nodeset_descriptions": True,
"namespace_zero": "FULL",
"embedded_profile": False,
"typenames": True,
"hardening": True,
"cpp_compatible": False,
"readable_statuscodes": True
}
generators = "cmake", "cmake_find_package"

_cmake = None

@property
def _source_subfolder(self):
return "source_subfolder"

def requirements(self):
if tools.Version(self.version) >= "1.1.0":
if self.options.encryption == "mbedtls-apache":
self.requires("mbedtls/2.16.3-apache")
elif self.options.encryption == "mbedtls-gpl":
self.requires("mbedtls/2.16.3-gpl")
elif self.options.encryption == "openssl":
self.requires("openssl/1.1.1g")

if self.options.web_socket:
self.requires("libwebsockets/4.0.15")
else:
if self.options.encryption == "mbedtls-apache":
self.requires("mbedtls/2.16.3-apache")
elif self.options.encryption == "mbedtls-gpl":
self.requires("mbedtls/2.16.3-gpl")

if self.options.discovery == "With Multicast":
self.requires("pro-mdnsd/0.8.4")

def _patch_sources(self):
for patch in self.conan_data["patches"][self.version]:
tools.patch(**patch)

def configure(self):
if not self.options.subscription:
if self.options.subscription_events:
raise ConanInvalidConfiguration(
"Open62541 requires subscription option")

if not self.options.discovery:
if self.options.discovery_semaphore:
raise ConanInvalidConfiguration(
"Open62541 discovery sempahore option requires discovery option to be enabled")

if tools.Version(self.version) < "1.1.0":
if self.options.encryption == "openssl":
raise ConanInvalidConfiguration(
"Lower Open62541 versions than 1.1.0 do not support openssl")

if self.options.multithreading != "None":
raise ConanInvalidConfiguration(
"Lower Open62541 versions than 1.1.0 do not fully support multithreading")

if self.options.web_socket:
raise ConanInvalidConfiguration(
"Lower Open62541 versions than 1.1.0 do not fully support websockets")

if self.options.cpp_compatible:
raise ConanInvalidConfiguration(
"Lower Open62541 versions than 1.1.0 are not cpp compatible due to -fpermisive flags")

if self.settings.compiler == "clang" and tools.Version(self.settings.compiler.version) >= "9":
raise ConanInvalidConfiguration(
"Open62541 does not support Clang 9.x.x and later compiler versions")

if self.settings.compiler == "clang":
if tools.Version(self.settings.compiler.version) < "5":
raise ConanInvalidConfiguration(
"Older clang compiler version than 5.0 are not supported")

if self.options.pub_sub != False and self.settings.os != "Linux":
raise ConanInvalidConfiguration(
"PubSub over Ethernet is not supported for your OS!")

if self.options.web_socket:
self.options["libwebsockets"].with_ssl = self.options.encryption

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

if not self.options.cpp_compatible:
del self.settings.compiler.cppstd
del self.settings.compiler.libcxx

def source(self):
archive_name = self.name + "-" + self.version
tools.get(**self.conan_data["sources"][self.version])
os.rename(archive_name, self._source_subfolder)

submodule_filename = os.path.join(
self.recipe_folder, 'submoduledata.yml')
with open(submodule_filename, 'r') as submodule_stream:
submodules_data = yaml.load(submodule_stream)
for path, submodule in submodules_data["submodules"][self.version].items():
filename = os.path.basename(submodule["url"])
archive_name = submodule["archive_pattern"].format(
version=os.path.splitext(filename.replace('v', ''))[0])

submodule_data = {
"url": submodule["url"],
"sha256": submodule["sha256"]
}

tools.get(**submodule_data)
submodule_source = os.path.join(self._source_subfolder, path)
tools.rmdir(submodule_source)
os.rename(archive_name, submodule_source)

def _get_log_level(self):
return {
"Fatal": "600",
"Error": "500",
"Warning": "400",
"Info": "300",
"Debug": "200",
"Trace": "100",
"PackageOption": "300"
}.get(str(self.options.logging_level), "300")

def _get_multithreading_option(self):
return {
"None": "0",
"Threadsafe": "100",
"Internal threads": "200"
}.get(str(self.options.multithreading), "0")

def _configure_cmake(self):
if self._cmake:
return self._cmake

self._cmake = CMake(self)
self._cmake.verbose = True

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

self._cmake.definitions["UA_LOGLEVEL"] = self._get_log_level()
if self.options.subscription != False:
self._cmake.definitions["UA_ENABLE_SUBSCRIPTIONS"] = True
if self.options.subscription == "With Events":
self._cmake.definitions["UA_ENABLE_SUBSCRIPTIONS_EVENTS"] = 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
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
if self.options.historize != False:
self._cmake.definitions["UA_ENABLE_HISTORIZING"] = True
if self.options.historize == "Experimental":
self._cmake.definitions["UA_ENABLE_EXPERIMENTAL_HISTORIZING"] = True
if self.options.discovery != False:
self._cmake.definitions["UA_ENABLE_DISCOVERY"] = self.options.discovery
if self.options.discovery == "With Multicast":
self._cmake.definitions["UA_ENABLE_DISCOVERY_MULTICAST"] = True
self._cmake.definitions["UA_ENABLE_DISCOVERY_SEMAPHORE"] = self.options.discovery_semaphore
self._cmake.definitions["UA_ENABLE_QUERY"] = self.options.query
if self.options.encryption != False:
self._cmake.definitions["UA_ENABLE_ENCRYPTION"] = True
if self.options.encryption == "openssl":
self._cmake.definitions["UA_ENABLE_ENCRYPTION_OPENSSL"] = True
self._cmake.definitions["UA_ENABLE_JSON_ENCODING"] = self.options.json_support
if self.options.pub_sub != False:
self._cmake.definitions["UA_ENABLE_PUBSUB"] = True
if self.settings.os == "Linux" and self.options.pub_sub == "Ethernet":
self._cmake.definitions["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
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"
else:
self._cmake.definitions["UA_NAMESPACE_ZERO"] = self.options.namespace_zero
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
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

self._cmake.configure(source_dir=self._source_subfolder)
return self._cmake

def build(self):
self._patch_sources()
cmake = self._configure_cmake()
cmake.build()

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()
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')

tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
tools.rmdir(os.path.join(self.package_folder, "share"))
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))

def package_info(self):
self.cpp_info.names["cmake_find_package"] = "open62541"
self.cpp_info.names["cmake_find_package_multi"] = "open62541"
self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.includedirs = [
"include",
os.path.join("include", "plugin")
]

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", "win32"))
else:
self.cpp_info.includedirs.append(os.path.join("include", "posix"))
self.cpp_info.builddirs = [
"lib",
os.path.join("lib", "cmake"),
os.path.join("lib", "cmake", "open62541")
]
Loading