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

libiec61850: new recipe #26096

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d849b04
libiec61850: Add new recipe
inPhraZ Dec 3, 2024
5ed89a6
Remove BUILD_SHARED_LIBS and BUILD_STATIC_LIBS assignments
inPhraZ Dec 3, 2024
4fe2549
Add cache_variables: FIND_PACKAGE_DISABLE_Doxygen
inPhraZ Dec 3, 2024
068fe49
Add attribute: auto_shared_fpic
inPhraZ Dec 3, 2024
ff59250
Remove unnecessary copies in package()
inPhraZ Dec 3, 2024
1f38701
Get library version in test_package
inPhraZ Dec 3, 2024
3187730
simpler test_package
inPhraZ Dec 3, 2024
b57fac7
add system_libs for linux: rt, pthread
inPhraZ Dec 3, 2024
b67964e
Merge branch 'conan-io:master' into libiec61850
inPhraZ Dec 10, 2024
672b42e
build shared/static target and remove redundant package_info
danimtb Dec 12, 2024
772db9b
test_package
danimtb Dec 12, 2024
0e514da
disable mbedtls
danimtb Dec 12, 2024
f98af20
package include files, avoid install for lib artifacts, add hal to libs
danimtb Dec 12, 2024
b15c78c
only windows build is special
danimtb Dec 12, 2024
7ccd9cb
polish
danimtb Dec 12, 2024
c6dca62
fix
danimtb Dec 12, 2024
02b149a
Merge branch 'master' of https://github.com/conan-io/conan-center-ind…
czoido Dec 13, 2024
4b0de03
Update recipes/libiec61850/all/conanfile.py
danimtb Dec 13, 2024
652f76e
Update recipes/libiec61850/all/conanfile.py
danimtb Dec 13, 2024
726baf0
Update recipes/libiec61850/all/conanfile.py
danimtb Dec 13, 2024
72cce70
Merge branch 'libiec61850' of github.com:inPhraZ/conan-center-index i…
czoido Dec 13, 2024
547224e
Apply suggestions from code review
czoido Dec 13, 2024
5d8e605
package correct libs shared-static
danimtb Dec 13, 2024
8bf9c74
simplify
danimtb Dec 13, 2024
e8296af
fix import
danimtb Dec 13, 2024
7c8c957
Update recipes/libiec61850/all/conanfile.py
danimtb Dec 13, 2024
6627bd9
use `cache_variables` for single-config varibles: `BUILD_EXAMPLES`, `…
inPhraZ Dec 13, 2024
9665eeb
Merge branch 'libiec61850' of github.com:inPhraZ/conan-center-index i…
czoido Dec 15, 2024
743e995
review
czoido Dec 15, 2024
7fc880e
remove runtime files
czoido Dec 15, 2024
798addb
remove runtime files
czoido Dec 15, 2024
954a578
build only shared or static target
czoido Dec 16, 2024
91a1180
wip
czoido Dec 16, 2024
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
4 changes: 4 additions & 0 deletions recipes/libiec61850/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"1.5.3":
url: "https://github.com/mz-automation/libiec61850/archive/refs/tags/v1.5.3.tar.gz"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the most recent version available, 1.6.0 seems to have been released a few months ago:
https://github.com/mz-automation/libiec61850/releases/tag/v1.6.0 - any reason why we wouldnt start with the most recent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason why we wouldnt start with the most recent?

Yes, the latest release version (1.6.0) has an issue where one of the required header files is missing from the installation path, causing the test_package to fail. Although this issue has been addressed and fixed in this PR, it has not yet been included in an official release.

sha256: "a0f396a5e2249398f2432bb9698e3aecdb9de11b28e5af68f7fb8b14bc3b2f44"
71 changes: 71 additions & 0 deletions recipes/libiec61850/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import os
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import get, copy, replace_in_file, rmdir, rm

required_conan_version = ">=2.1"

class Libiec61850Conan(ConanFile):
name = "libiec61850"
description = "An open-source library for the IEC 61850 protocols."
license = "LGPL-3.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://libiec61850.com/libiec61850"
topics = ("iec61850", "mms", "goose", "sampled values")

package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}

languages = ["C"]
inPhraZ marked this conversation as resolved.
Show resolved Hide resolved
implements = ["auto_shared_fpic"]

def layout(self):
cmake_layout(self, src_folder="src")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
inPhraZ marked this conversation as resolved.
Show resolved Hide resolved
tc.cache_variables["BUILD_EXAMPLES"] = False
tc.cache_variables["BUILD_TESTS"] = False
tc.cache_variables["FIND_PACKAGE_DISABLE_Doxygen"] = True
tc.generate()

def build(self):
target_type = "-shared" if self.options.get_safe("shared") else ""
replace_in_file(self, os.path.join(self.source_folder, "hal", "CMakeLists.txt"),
"install (TARGETS hal hal-shared", f"install (TARGETS hal{target_type}")
replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"),
"install (TARGETS iec61850 iec61850-shared", f"install (TARGETS iec61850{target_type}")
cmake = CMake(self)
cmake.configure()
target = "iec61850-shared" if self.options.get_safe("shared") else "iec61850"
czoido marked this conversation as resolved.
Show resolved Hide resolved
cmake.build(target=target)

def package(self):
copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()
rmdir(self, os.path.join(self.package_folder, "share"))
for dll_pattern_to_remove in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]:
rm(self, pattern=dll_pattern_to_remove, folder=os.path.join(self.package_folder, "bin"),
recursive=True)

def package_info(self):
self.cpp_info.components["iec61850"].libs = ["iec61850"]
self.cpp_info.components["iec61850"].set_property("cmake_target_name", "iec61850")
self.cpp_info.components["hal"].libs = ["hal-shared"] if self.options.get_safe("shared") else ["hal"]
self.cpp_info.components["iec61850"].requires=["hal"]
self.cpp_info.components["iec61850"].set_property("pkg_config_name", "libiec61850")
if self.settings.os in ["Linux"]:
self.cpp_info.components["iec61850"].system_libs.append("pthread")
self.cpp_info.components["iec61850"].system_libs.append("rt")
7 changes: 7 additions & 0 deletions recipes/libiec61850/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)

find_package(libiec61850)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} iec61850)
25 changes: 25 additions & 0 deletions recipes/libiec61850/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain"

def layout(self):
cmake_layout(self)

def requirements(self):
self.requires(self.tested_reference_str)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
self.run(bin_path, env="conanrun")
10 changes: 10 additions & 0 deletions recipes/libiec61850/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <iostream>
#include <cstdlib>

#include "libiec61850/iec61850_common.h"

int main(int argc, char **argv)
{
std::cout << "libiec61850 v" << LibIEC61850_getVersionString() << std::endl;
return 0;
}
3 changes: 3 additions & 0 deletions recipes/libiec61850/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"1.5.3":
folder: all