This repository has been archived by the owner on Oct 31, 2024. It is now read-only.
forked from open-simulation-platform/conan-fmilibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
57 lines (51 loc) · 2.42 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from conans import ConanFile, CMake, tools
class FMILibraryConan(ConanFile):
name = "fmilibrary"
version = "2.4"
license = "https://github.com/modelon-community/fmi-library/blob/master/LICENSE.md"
url = "https://github.com/modelon-community/fmi-library"
description = "An implementation of the FMI standard which enables FMU import in applications"
scm = {
"type": "git",
"url": "https://github.com/modelon-community/fmi-library.git",
"revision": version,
"subfolder": "src"
}
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = "shared=False"
generators = "cmake"
exports_sources = [ "build-static-c99snprintf.patch" ]
def source(self):
tools.patch(base_path="src", patch_file="build-static-c99snprintf.patch")
tools.replace_in_file("src/CMakeLists.txt", "project (FMILibrary)",
'''project (FMILibrary)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()''')
def build(self):
cmake = CMake(self)
cmake.configure(
source_folder="src",
defs={
"FMILIB_BUILD_STATIC_LIB": "OFF" if self.options.shared else "ON",
"FMILIB_BUILD_SHARED_LIB": "ON" if self.options.shared else "OFF",
"FMILIB_BUILD_TESTS": "OFF",
"FMILIB_INSTALL_PREFIX": self.build_folder + "/install",
})
cmake.build()
cmake.install()
def package(self):
fmilib_install_dir = self.build_folder + "/install"
self.copy("*.h", dst="include", src=fmilib_install_dir+"/include")
self.copy("*.dll", dst="bin", src=fmilib_install_dir, keep_path=False)
self.copy("*.so", dst="lib", src=fmilib_install_dir, keep_path=False)
self.copy("*.dylib",dst="lib", src=fmilib_install_dir, keep_path=False)
self.copy("*.lib", dst="lib", src=fmilib_install_dir, keep_path=False)
self.copy("*.a", dst="lib", src=fmilib_install_dir, keep_path=False)
self.copy("LICENSE.md", src="src", dst="licenses", keep_path=False)
self.copy("FMILIB_Acknowledgements.txt", src="src", dst="licenses", keep_path=False)
def package_info(self):
if self.options.shared:
self.cpp_info.libs = ["fmilib_shared"]
else:
self.cpp_info.libs = ["fmilib"]