-
Notifications
You must be signed in to change notification settings - Fork 4
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
Upgrade to Conan 2 #55
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
25fc663
Upgrade to Conan 2
kyllingstad f42943c
Run tests in CI
kyllingstad efc061f
Use libcosim stable, simplify build procedure
kyllingstad 3cc12bc
Drop explicit dependency on Boost
kyllingstad d107ce5
Match error behaviour of old boost::fibers-based code
kyllingstad 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
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 |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
|
||
.idea | ||
cmake-build-*/ | ||
|
||
build/ | ||
CMakeUserPresets.json | ||
|
||
### Vim | ||
*.swp | ||
*.swp |
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
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 |
---|---|---|
@@ -1,26 +1,23 @@ | ||
libcosimc - OSP C co-simulation API | ||
=================================== | ||
![libcosimc CI Conan](https://github.com/open-simulation-platform/libcosimc/workflows/libcosimc%20CI%20Conan/badge.svg) | ||
This repository contains the OSP C library for co-simulations which wraps and exposes a subset of the [`libcosim`] | ||
library's functions. | ||
|
||
This repository contains the [OSP] C library for co-simulations, which wraps and | ||
exposes a subset of the [libcosim] C++ library's functions. | ||
|
||
See [`CONTRIBUTING.md`] for contributor guidelines and [`LICENSE`] for | ||
terms of use. | ||
|
||
|
||
|
||
How to build | ||
------------ | ||
Please read the [libcosim build instructions]. The commands you should run | ||
to build libcosimc are exactly the same, except that the option you need to | ||
add to `conan install` to enable [proxy-fmu] support is | ||
`--options="libcosim/*:proxyfmu=True`. | ||
|
||
`libcosimc` can be built in the same way as libcosim with the following differences in [step 2] | ||
|
||
To include FMU-proxy support use `-o libcosim:'proxyfmu=True'` when installing dependencies in | ||
|
||
conan install .. -o libcosim:'proxyfmu=True' --build=missing | ||
|
||
When running cmake use `-DLIBCOSIMC_USING_CONAN=TRUE` | ||
|
||
[`CONTRIBUTING.md`]: ./CONTRIBUTING.md | ||
[libcosim]: https://github.com/open-simulation-platform/libcosim | ||
[libcosim build instructions]: https://github.com/open-simulation-platform/libcosim#how-to-build | ||
[`LICENSE`]: ./LICENSE | ||
[Step 2]: https://github.com/open-simulation-platform/libcosim#step-2-prepare-build-system | ||
[`libcosim`]: https://github.com/open-simulation-platform/libcosim | ||
[OSP]: https://opensimulationplatform.com/ | ||
[proxy-fmu]: https://github.com/open-simulation-platform/proxy-fmu/ |
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 |
---|---|---|
@@ -1,47 +1,87 @@ | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
from os import path | ||
from conan import ConanFile | ||
from conan.tools.cmake import CMake, cmake_layout | ||
from conan.tools.env import VirtualRunEnv | ||
from conan.tools.files import load | ||
|
||
|
||
class LibCosimCConan(ConanFile): | ||
# Basic package info | ||
name = "libcosimc" | ||
|
||
def set_version(self): | ||
self.version = load(self, os.path.join(self.recipe_folder, "version.txt")).strip() | ||
|
||
# Metadata | ||
license = "MPL-2.0" | ||
author = "osp" | ||
exports = "version.txt" | ||
scm = { | ||
"type": "git", | ||
"url": "auto", | ||
"revision": "auto" | ||
} | ||
description = "A C wrapper for libcosim, a co-simulation library for C++" | ||
|
||
# Binary configuration | ||
package_type = "library" | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "virtualrunenv" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
} | ||
default_options = { | ||
"shared": True, | ||
"fPIC": True, | ||
} | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
self.options.rm_safe("fPIC") | ||
self.options["*"].shared = self.options.shared | ||
|
||
# Dependencies/requirements | ||
tool_requires = ( | ||
"cmake/[>=3.15]", | ||
"doxygen/[>=1.8]", | ||
) | ||
requires = ( | ||
"libcosim/0.10.2@osp/stable" | ||
) | ||
"libcosim/0.10.3@osp/testing-bugfix_transitive-libs-boost", | ||
) | ||
|
||
def set_version(self): | ||
self.version = tools.load(path.join(self.recipe_folder, "version.txt")).strip() | ||
# Exports | ||
exports = "version.txt" | ||
exports_sources = "*" | ||
|
||
def imports(self): | ||
binDir = os.path.join("output", str(self.settings.build_type).lower(), "bin") | ||
self.copy("*.dll", dst=binDir, keep_path=False) | ||
self.copy("*.pdb", dst=binDir, keep_path=False) | ||
# Build steps | ||
generators = "CMakeDeps", "CMakeToolchain" | ||
|
||
def configure_cmake(self): | ||
cmake = CMake(self) | ||
cmake.definitions["LIBCOSIMC_USING_CONAN"] = "ON" | ||
cmake.configure() | ||
return cmake | ||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = self.configure_cmake() | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
cmake.build(target="doc") | ||
if self._is_tests_enabled(): | ||
env = VirtualRunEnv(self).environment() | ||
env.define("CTEST_OUTPUT_ON_FAILURE", "ON") | ||
with env.vars(self).apply(): | ||
cmake.test() | ||
|
||
# Packaging | ||
def package(self): | ||
cmake = self.configure_cmake() | ||
cmake = CMake(self) | ||
cmake.install() | ||
cmake.build(target="install-doc") | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = [ "cosimc" ] | ||
# Ensure that consumers use our CMake package configuration files | ||
# rather than ones generated by Conan. | ||
self.cpp_info.set_property("cmake_find_mode", "none") | ||
self.cpp_info.builddirs.append(".") | ||
|
||
# Helper functions | ||
def _is_tests_enabled(self): | ||
return os.getenv("LIBCOSIMC_RUN_TESTS_ON_CONAN_BUILD", "False").lower() in ("true", "1") |
Oops, something went wrong.
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.
Maybe this have been changed to
libcosim/0.10.3@osp/stable
before merging.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.
Oops! I've pushed a hotfix to
master
now. (Please give it a quick check.)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.
Looks like my hotfix broke master. :( I guess the issue is that the upstream fix in open-simulation-platform/libcosim#753 is in libcosim
master
, but not in any release yet, so it's not in thestable
channel. I don't know what the right way to fix this is. Revert all changes to libcosimcmaster
and reopen this PR again, or make libcosimcmaster
depend on the libcosimtesting
channel which tracks themaster
branch?