-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
inPhraZ
wants to merge
33
commits into
conan-io:master
Choose a base branch
from
inPhraZ:libiec61850
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
libiec61850: new recipe #26096
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 5ed89a6
Remove BUILD_SHARED_LIBS and BUILD_STATIC_LIBS assignments
inPhraZ 4fe2549
Add cache_variables: FIND_PACKAGE_DISABLE_Doxygen
inPhraZ 068fe49
Add attribute: auto_shared_fpic
inPhraZ ff59250
Remove unnecessary copies in package()
inPhraZ 1f38701
Get library version in test_package
inPhraZ 3187730
simpler test_package
inPhraZ b57fac7
add system_libs for linux: rt, pthread
inPhraZ b67964e
Merge branch 'conan-io:master' into libiec61850
inPhraZ 672b42e
build shared/static target and remove redundant package_info
danimtb 772db9b
test_package
danimtb 0e514da
disable mbedtls
danimtb f98af20
package include files, avoid install for lib artifacts, add hal to libs
danimtb b15c78c
only windows build is special
danimtb 7ccd9cb
polish
danimtb c6dca62
fix
danimtb 02b149a
Merge branch 'master' of https://github.com/conan-io/conan-center-ind…
czoido 4b0de03
Update recipes/libiec61850/all/conanfile.py
danimtb 652f76e
Update recipes/libiec61850/all/conanfile.py
danimtb 726baf0
Update recipes/libiec61850/all/conanfile.py
danimtb 72cce70
Merge branch 'libiec61850' of github.com:inPhraZ/conan-center-index i…
czoido 547224e
Apply suggestions from code review
czoido 5d8e605
package correct libs shared-static
danimtb 8bf9c74
simplify
danimtb e8296af
fix import
danimtb 7c8c957
Update recipes/libiec61850/all/conanfile.py
danimtb 6627bd9
use `cache_variables` for single-config varibles: `BUILD_EXAMPLES`, `…
inPhraZ 9665eeb
Merge branch 'libiec61850' of github.com:inPhraZ/conan-center-index i…
czoido 743e995
review
czoido 7fc880e
remove runtime files
czoido 798addb
remove runtime files
czoido 954a578
build only shared or static target
czoido 91a1180
wip
czoido File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
sha256: "a0f396a5e2249398f2432bb9698e3aecdb9de11b28e5af68f7fb8b14bc3b2f44" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"1.5.3": | ||
folder: all |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.