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

feat: add recipe for ua-nodeset #7312

Merged
merged 22 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
26 changes: 24 additions & 2 deletions recipes/open62541/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,18 @@ def _configure_cmake(self):

def build(self):
Mo-Tay marked this conversation as resolved.
Show resolved Hide resolved
for patch in self.conan_data.get("patches", {}).get(self.version, []):
tools.patch(**patch)
tools.patch(**patch)
cmake = self._configure_cmake()
cmake.build()

@property
def _tools_subfolder(self):
return os.path.join(self._source_subfolder, "tools")

# @property
# def _deps_subfolder(self):
# return os.path.join(self._source_subfolder, "deps")

def package(self):
self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
self.copy("LICENSE-CC0", dst="licenses", src=self._source_subfolder)
Expand All @@ -342,7 +350,10 @@ def package(self):
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", dst="share/tools", src=self._tools_subfolder)
self.copy("nodeset_compiler/*", dst="share/tools", src=self._tools_subfolder)
#use local local ua-nodeset instead of the OPC Founation files (NOT RECOMMENDED) Use the UA-Nodeset package instead
#self.copy("ua-nodeset/*", dst="share", src=self._deps_subfolder)
@property
def _module_subfolder(self):
return os.path.join("lib", "cmake", "open62541")
Expand All @@ -351,6 +362,11 @@ def _module_subfolder(self):
def _module_file_rel_path(self):
return os.path.join(self._module_subfolder, "open62541Macros.cmake")

@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.names["cmake_find_package"] = "open62541"
self.cpp_info.names["cmake_find_package_multi"] = "open62541"
Expand All @@ -361,6 +377,12 @@ def package_info(self):
os.path.join("include", "plugin")
]

#required for creating servers from ua nodesets
self.env_info.open62541_TOOLS_DIR = os.path.join(self.package_folder, "share", "tools")
self._chmod_plus_x(os.path.join(self.package_folder, "share", "tools", "generate_nodeid_header.py"))
#use local local ua-nodeset instead of the OPC Founation files (NOT RECOMMENDED) Use the UA-Nodeset package instead
#self.env_info.open62541_NODESET_DIR = os.path.join(self.package_folder, "share", "ua-nodeset")

if self.options.single_header:
self.cpp_info.defines.append("UA_ENABLE_AMALGAMATION")
if self.settings.os == "Windows":
Expand Down
32 changes: 32 additions & 0 deletions recipes/ua-nodeset/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from conans import ConanFile, CMake, tools
import os


class UaNodeSetConan(ConanFile):
Mo-Tay marked this conversation as resolved.
Show resolved Hide resolved
name = "UA-Nodeset"
license = ""
author = 'OPCFoundation'
description = "This repository contains UANodeSets and other normative files which are released with a specification"
Mo-Tay marked this conversation as resolved.
Show resolved Hide resolved
url = 'https://github.com/OPCFoundation/UA-Nodeset'
default_user = "ar"
default_channel = "thirdparty"
generators = "cmake", "virtualenv"
settings = 'os'
Mo-Tay marked this conversation as resolved.
Show resolved Hide resolved


def source(self):
git = tools.Git()
Mo-Tay marked this conversation as resolved.
Show resolved Hide resolved
git.clone(
url="https://github.com/OPCFoundation/UA-Nodeset.git",
branch="v{}".format(self.version))

def build(self):
pass


def package(self):
Mo-Tay marked this conversation as resolved.
Show resolved Hide resolved
Pro marked this conversation as resolved.
Show resolved Hide resolved
self.copy("*", dst="ua-nodeset", src="")
Mo-Tay marked this conversation as resolved.
Show resolved Hide resolved


def package_info(self):
self.env_info.open62541_NODESET_DIR = os.path.join(self.package_folder, "ua-nodeset")
Mo-Tay marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions recipes/ua-nodeset/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
Mo-Tay marked this conversation as resolved.
Show resolved Hide resolved
"1.04":
folder: all