-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
117 lines (107 loc) · 5.05 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
from conans import ConanFile, CMake, tools, AutoToolsBuildEnvironment
import os
class OpenMvgConan(ConanFile):
name = "openmvg"
version = "1.1"
license = "Unlicense"
url = "https://github.com/Brunni/conan-openmvg"
description = "open Multiple View Geometry is a library for computer-vision scientists and especially targeted to the Multiple View Geometry community."
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = "shared=False"
generators = "cmake"
short_paths=True
def config(self):
# if self.scope.dev and self.scope.build_tests:
# self.requires( "gtest/1.8.0@lasote/stable" )
# self.options["gtest"].shared = False
print("Description is: %s" % self.description)
print("default_option is: %s" % self.default_options)
print("shared is: %s" % self.options.shared)
def requirements(self):
print("requires need to be defined correctly")
#self.requires("cereal/1.2-0@TimSimpson/testing")
#self.requires("cereal/1.2.2@Brunni/stable")
#self.requires("GLFW/3.2.1@Brunni/prebuilt")
#self.requires("osi_clp/master@Brunni/testing")
# self.requires("giflib/5.1.3@lasote/stable")
# self.requires("libpng/1.6.21@lasote/stable")
# self.requires("libjpeg-turbo/1.4.2@lasote/stable")
def source(self):
self.run("git clone --depth 1 --recursive https://github.com/openMVG/openMVG.git -b v%s" % self.version)
# step 1 would be to dismiss the --recursive stuff
#self.run("cd openMVG && git submodule update --init --recursive")
#self.run("cd hello && git checkout static_shared")
# This small hack might be useful to guarantee proper /MT /MD linkage in MSVC
# if the packaged project doesn't have variables to set it properly
tools.replace_in_file("openMVG/src/CMakeLists.txt", "project(openMVG C CXX)", '''project(openMVG C CXX)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()''')
#tools.replace_in_file("openMVG/src/CMakeLists.txt", "NOT EXISTS ${PROJECT_SOURCE_DIR}/dependencies/cereal/include", "EXISTS #${PROJECT_SOURCE_DIR}/dependencies/cereal/include")
def build(self):
cmake = CMake(self.settings)
cmake_opts = "-DUSE_CONAN=True "
cmake_opts += "-DOpenMVG_BUILD_TESTS=ON " if self.scope.dev and self.scope.build_tests else "-DOpenMVG_BUILD_TESTS=OFF "
if self.options.shared:
print("Building shared lib only")
cmake_opts += "-DOpenMVG_BUILD_SHARED=ON "
else:
print("Building static lib only")
cmake_opts += "-DOpenMVG_BUILD_SHARED=OFF "
cmake_opts += "-DOpenMVG_BUILD_EXAMPLES=OFF "
cmake_opts += "-DOpenMVG_BUILD_DOC=OFF "
cmake_opts += "-DSCHUR_SPECIALIZATIONS=OFF "
self.run('cmake %s/openMVG/src %s %s' % (self.conanfile_directory, cmake.command_line, cmake_opts))
# We need to prevent to build static library as well when building shared. It might overwrite the lib file!
if self.settings.os == "Windows":
build_opts = ""
else:
build_opts = "-- -j%s" % (tools.cpu_count()+1)
self.output.warn("Build options are: %s" % build_opts)
self.run("cmake --build . %s %s" % (cmake.build_config, build_opts))
def package(self):
self.copy("*.hpp", dst="include/openMVG", src="openMVG/src/openMVG")
self.copy("*.h", dst="include/openMVG", src="openMVG/src/openMVG")
self.copy("*.hpp", dst="include", src="openMVG/src/dependencies/cereal/include") #ceres
self.copy("*.h", dst="include", src="openMVG/src/dependencies/cereal/include") #ceres
self.copy("*.hpp", dst="include", src="openMVG/src/dependencies/osi_clp/CoinUtils/src") #ceres
self.copy("*.h", dst="include", src="openMVG/src/dependencies/osi_clp/CoinUtils/src") #ceres
self.copy("*.hpp", dst="include/third_party/stlplus3", src="openMVG/src/third_party/stlplus3/") #third party stlplus3
self.copy("*.h", dst="include/third_party/stlplus3", src="openMVG/src/third_party/stlplus3") #third party stlplus3
self.copy("*.hpp", dst="include/lemon", src="openMVG/src/third_party/lemon/lemon") #third party lemon
self.copy("*.h", dst="include/lemon", src="openMVG/src/third_party/lemon/lemon") #third party lemon
self.copy("*.hpp", dst="include", src="openMVG/src/third_party/ceres-solver/include") #third party ceres
self.copy("*.h", dst="include", src="openMVG/src/third_party/ceres-solver/include") #third party ceres
self.copy("*.lib", dst="lib", keep_path=False)
self.copy("*.exp", dst="lib", src="Release", keep_path=False)
self.copy("*.dll", dst="bin", src="Release", keep_path=False) #shared lib
self.copy("*.so", dst="lib", src="", keep_path=False)
self.copy("*.a", dst="lib", src="", keep_path=False)
def package_info(self):
self.cpp_info.libs = [
"ceres",
"cxsparse",
"easyexif",
"fast",
"jpeg", # Should be used from conan package like many other libs here.
"lemon",
"lib_clp",
"lib_CoinUtils",
"lib_Osi",
"lib_OsiClpSolver",
"openMVG_features",
"openMVG_image",
"openMVG_kvld",
"openMVG_lInftyComputerVision",
"openMVG_matching",
"openMVG_matching_image_collection",
"openMVG_multiview",
"openMVG_multiview_test_data",
"openMVG_numeric",
"openMVG_sfm",
"openMVG_system",
"png",
"stlplus",
"tiff",
"vlsift",
"zlib"]