-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit 305246c.
- Loading branch information
1 parent
d28722d
commit bd4dc57
Showing
6 changed files
with
103 additions
and
133 deletions.
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,8 +5,7 @@ | |
|
||
.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,23 +1,26 @@ | ||
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] C++ library's functions. | ||
|
||
This repository contains the OSP C library for co-simulations which wraps and exposes a subset of the [`libcosim`] | ||
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 | ||
[OSP]: https://opensimulationplatform.com/ | ||
[proxy-fmu]: https://github.com/open-simulation-platform/proxy-fmu/ | ||
[Step 2]: https://github.com/open-simulation-platform/libcosim#step-2-prepare-build-system | ||
[`libcosim`]: https://github.com/open-simulation-platform/libcosim |
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,87 +1,47 @@ | ||
import os | ||
|
||
from conan import ConanFile | ||
from conan.tools.cmake import CMake, cmake_layout | ||
from conan.tools.env import VirtualRunEnv | ||
from conan.tools.files import load | ||
from conans import ConanFile, CMake, tools | ||
from os import path | ||
|
||
|
||
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" | ||
description = "A C wrapper for libcosim, a co-simulation library for C++" | ||
|
||
# Binary configuration | ||
package_type = "library" | ||
settings = "os", "compiler", "build_type", "arch" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
} | ||
default_options = { | ||
"shared": True, | ||
"fPIC": True, | ||
exports = "version.txt" | ||
scm = { | ||
"type": "git", | ||
"url": "auto", | ||
"revision": "auto" | ||
} | ||
|
||
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]", | ||
) | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "virtualrunenv" | ||
requires = ( | ||
"libcosim/0.10.3@osp/testing-bugfix_transitive-libs-boost", | ||
) | ||
|
||
# Exports | ||
exports = "version.txt" | ||
exports_sources = "*" | ||
"libcosim/0.10.2@osp/stable" | ||
) | ||
|
||
# Build steps | ||
generators = "CMakeDeps", "CMakeToolchain" | ||
def set_version(self): | ||
self.version = tools.load(path.join(self.recipe_folder, "version.txt")).strip() | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
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) | ||
|
||
def build(self): | ||
def configure_cmake(self): | ||
cmake = CMake(self) | ||
cmake.definitions["LIBCOSIMC_USING_CONAN"] = "ON" | ||
cmake.configure() | ||
return cmake | ||
|
||
def build(self): | ||
cmake = self.configure_cmake() | ||
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 = CMake(self) | ||
cmake = self.configure_cmake() | ||
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.