Skip to content

Commit

Permalink
(#18400) openmvg: add with_jpeg option
Browse files Browse the repository at this point in the history
* add jpeg option

* fix

* review

* Update recipes/openmvg/all/conanfile.py

Co-authored-by: Martin Valgur <martin.valgur@gmail.com>

* add workaround for build rpath issue on Linux

---------

Co-authored-by: Martin Valgur <martin.valgur@gmail.com>
Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 16, 2023
1 parent 625304d commit d29f906
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions recipes/openmvg/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ class Openmvgconan(ConanFile):
"with_openmp": [True, False],
"with_avx": [False, "avx", "avx2"],
"programs": [True, False],
"with_jpeg": ["libjpeg", "libjpeg-turbo", "mozjpeg"]
}
default_options = {
"shared": False,
"fPIC": True,
"with_openmp": False,
"with_avx": False,
"programs": True,
"with_jpeg": "libjpeg"
}

short_paths = True
Expand Down Expand Up @@ -66,7 +68,12 @@ def requirements(self):
self.requires("coin-utils/2.11.6")
self.requires("eigen/3.4.0", transitive_headers=True)
self.requires("flann/1.9.2", transitive_headers=True, transitive_libs=True)
self.requires("libjpeg/9e")
if self.options.with_jpeg == "libjpeg":
self.requires("libjpeg/9e")
elif self.options.with_jpeg == "libjpeg-turbo":
self.requires("libjpeg-turbo/3.0.0")
elif self.options.with_jpeg == "mozjpeg":
self.requires("mozjpeg/4.1.1")
self.requires("libpng/1.6.40")
self.requires("libtiff/4.5.1")

Expand Down Expand Up @@ -108,6 +115,12 @@ def generate(self):
# see https://github.com/conan-io/conan/issues/10281
if Version(self.dependencies["ceres-solver"].ref.version) >= "2.0.0" and not valid_min_cppstd(self, "14"):
tc.variables["CMAKE_CXX_STANDARD"] = "14"

if self.settings.os == "Linux":
# Workaround for: https://github.com/conan-io/conan/issues/13560
libdirs_host = [l for dependency in self.dependencies.host.values() for l in dependency.cpp_info.aggregated_components().libdirs]
tc.variables["CMAKE_BUILD_RPATH"] = ";".join(libdirs_host)

tc.generate()

deps = CMakeDeps(self)
Expand All @@ -131,6 +144,14 @@ def package(self):

@property
def _openmvg_components(self):
def jpeg():
if self.options.with_jpeg == "libjpeg":
return ["libjpeg::libjpeg"]
elif self.options.with_jpeg == "libjpeg-turbo":
return ["libjpeg-turbo::jpeg"]
elif self.options.with_jpeg == "mozjpeg":
return ["mozjpeg::libjpeg"]

return {
"openmvg_camera": {
"target": "openMVG_camera",
Expand Down Expand Up @@ -162,7 +183,7 @@ def _openmvg_components(self):
"openmvg_image": {
"target": "openMVG_image",
"libs": ["openMVG_image"],
"requires": ["openmvg_numeric", "libjpeg::libjpeg", "libpng::libpng", "libtiff::libtiff"],
"requires": ["openmvg_numeric", "libpng::libpng", "libtiff::libtiff"] + jpeg(),
},
"openmvg_linearprogramming": {
"target": "openMVG_linearProgramming",
Expand Down

0 comments on commit d29f906

Please sign in to comment.