-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
69 lines (57 loc) · 2.4 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
58
59
60
61
62
63
64
65
66
67
68
69
import os
from conans import ConanFile, CMake, tools
class MatchpointConan(ConanFile):
name = "matchpoint"
version = "0.1"
author = "Amir Kalali [email protected]"
url = "https://github.com/akalali/conan-recipes/matchpoint"
description = "MatchPoint is a translational image registration framework written in C++. " \
"It offers a standardized interface to utilize several registration algorithm resources " \
"(like ITK, plastimatch, elastix) easily in a host application."
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
options = {
"shared": [True, False],
"fPIC": [True, False]
}
default_options = {
"shared": True,
"fPIC": True
}
short_paths = True
requires = "itk/4.13.3@dkfz/testing"
_requirement_options = {"itk:shared": True}
default_options.update(_requirement_options)
_build_folder = "build"
_source_folder = "MatchPoint"
# PRIVATE FUNCTIONS
def _configure_cmake(self):
itk_rootpath = self.deps_cpp_info["itk"].rootpath
itk_libpath = os.path.join(itk_rootpath, "lib", "cmake", "ITK-4.13")
cmake = CMake(self)
cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared
cmake.definitions["BUILD_TESTING"] = "ON"
cmake.definitions["CMAKE_PREFIX_PATH"] = itk_libpath
cmake.configure(source_folder = self._source_folder, build_folder = self._build_folder)
return cmake
# PUBLIC FUNCTIONS USED BY CONAN
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def source(self):
self.run("git clone --filter=tree:0 https://github.com/MIC-DKFZ/MatchPoint.git")
self.run("cd MatchPoint && git checkout a47d5558549514a475640b8652a8d337d33d9901")
def build(self):
cmake = self._configure_cmake()
cmake.build()
if tools.get_env("CONAN_RUN_TESTS"):
cmake.test()
def package(self):
self.copy("*.h", dst="include", src="MatchPoint")
self.copy("*.lib", dst="lib", keep_path=False)
self.copy("*.dll", dst="bin", keep_path=False)
self.copy("*.so", dst="lib", keep_path=False)
self.copy("*.dylib", dst="lib", keep_path=False)
self.copy("*.a", dst="lib", keep_path=False)
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)