Files
vcpkg/ports/openmvg/build_fixes.patch
2025-07-20 22:52:22 -07:00

133 lines
4.9 KiB
Diff

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6879c4c..aa4167a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -324,13 +324,18 @@ else()
if (TARGET flann::flann)
set(FLANN_LIBRARIES "flann::flann;flann::flann_cpp")
else()
- find_package(Flann QUIET)
+ set(FLANN_LIBRARIES "flann::flann_s;flann::flann_cpp_s")
endif()
+ set(FLANN_FOUND TRUE)
endif()
if (NOT FLANN_FOUND OR OpenMVG_USE_INTERNAL_FLANN)
set(FLANN_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/flann/src/cpp)
endif()
+# Used together in openMVG/LinearProgramming
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(OSI_CLP_COIN osi-clp clp osi coinutils REQUIRED)
+if(0)
# ==============================================================================
# CoinUtils
# ==============================================================================
@@ -391,6 +396,7 @@ if (OpenMVG_USE_INTERNAL_OSI AND OpenMVG_USE_INTERNAL_CLP AND OpenMVG_USE_INTERN
set_property(TARGET lib_Osi PROPERTY FOLDER OpenMVG/3rdParty/lib_Osi)
set_property(TARGET lib_OsiClpSolver PROPERTY FOLDER OpenMVG/3rdParty/lib_OsiClpSolver)
endif()
+endif()
# ==============================================================================
# Lemon
@@ -402,7 +408,7 @@ if (NOT DEFINED LEMON_INCLUDE_DIR_HINTS)
set(LEMON_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/lemon)
set(OpenMVG_USE_INTERNAL_LEMON ON)
endif()
-find_package(Lemon QUIET)
+find_package(LEMON REQUIRED)
if (NOT LEMON_FOUND OR OpenMVG_USE_INTERNAL_LEMON)
set(LEMON_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/third_party/lemon
diff --git a/src/cmakeFindModules/OpenMVGConfig.cmake.in b/src/cmakeFindModules/OpenMVGConfig.cmake.in
index 5a788b5..7a0afdb 100644
--- a/src/cmakeFindModules/OpenMVGConfig.cmake.in
+++ b/src/cmakeFindModules/OpenMVGConfig.cmake.in
@@ -61,7 +61,7 @@ set(CMAKE_MODULE_PATH ${CURRENT_CONFIG_INSTALL_DIR})
# Build the absolute root install directory as a relative path
get_filename_component(CURRENT_ROOT_INSTALL_DIR
- ${CMAKE_MODULE_PATH}/../../../ ABSOLUTE)
+ "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
if (NOT EXISTS ${CURRENT_ROOT_INSTALL_DIR})
OPENMVG_REPORT_NOT_FOUND(
"OpenMVG install root: ${CURRENT_ROOT_INSTALL_DIR}, "
@@ -88,11 +88,14 @@ set(OpenMVG_USE_OPENMP "@OpenMVG_USE_OPENMP@")
# Find transitive dependencies if required
include(CMakeFindDependencyMacro)
+find_dependency(flann CONFIG)
+find_dependency(Ceres CONFIG)
+find_dependency(vlfeat CONFIG)
if (OpenMVG_USE_OPENMP)
- find_dependency(OpenMP REQUIRED)
+ find_dependency(OpenMP)
endif()
if (NOT OpenMVG_USE_INTERNAL_CEREAL)
- find_dependency(cereal REQUIRED)
+ find_dependency(cereal CONFIG)
endif()
# Import exported OpenMVG targets
diff --git a/src/nonFree/sift/CMakeLists.txt b/src/nonFree/sift/CMakeLists.txt
index 402a2d8..b2912ea 100644
--- a/src/nonFree/sift/CMakeLists.txt
+++ b/src/nonFree/sift/CMakeLists.txt
@@ -25,7 +25,9 @@ set(FEATS
vl/mathop.c
vl/random.c)
set_source_files_properties(${FEATS} PROPERTIES LANGUAGE C)
-add_library(vlsift ${FEATS})
+find_package(vlfeat CONFIG REQUIRED)
+add_library(vlsift INTERFACE)
+target_link_libraries(vlsift INTERFACE unofficial::vlfeat::vl)
install(TARGETS vlsift DESTINATION lib EXPORT openMVG-targets)
set_property(TARGET vlsift PROPERTY FOLDER OpenMVG/nonFree)
install(
diff --git a/src/nonFree/sift/SIFT_describer.hpp b/src/nonFree/sift/SIFT_describer.hpp
index cd800b0..9586d9b 100644
--- a/src/nonFree/sift/SIFT_describer.hpp
+++ b/src/nonFree/sift/SIFT_describer.hpp
@@ -18,7 +18,7 @@
#include <numeric>
extern "C" {
-#include "nonFree/sift/vl/sift.h"
+#include <vl/sift.h>
}
namespace openMVG {
diff --git a/src/openMVG/exif/sensor_width_database/CMakeLists.txt b/src/openMVG/exif/sensor_width_database/CMakeLists.txt
index 33d9f16..58b4761 100644
--- a/src/openMVG/exif/sensor_width_database/CMakeLists.txt
+++ b/src/openMVG/exif/sensor_width_database/CMakeLists.txt
@@ -2,4 +2,4 @@
UNIT_TEST(openMVG ParseDatabase "openMVG_testing;${STLPLUS_LIBRARY}")
# Installation rules
-install(FILES sensor_width_camera_database.txt DESTINATION ${CMAKE_INSTALL_LIBDIR}/openMVG)
+install(FILES sensor_width_camera_database.txt DESTINATION share/openmvg)
diff --git a/src/openMVG/linearProgramming/CMakeLists.txt b/src/openMVG/linearProgramming/CMakeLists.txt
index 3a8a402..24151e9 100644
--- a/src/openMVG/linearProgramming/CMakeLists.txt
+++ b/src/openMVG/linearProgramming/CMakeLists.txt
@@ -15,16 +15,12 @@ target_link_libraries(openMVG_linearProgramming
PUBLIC
openMVG_numeric
PRIVATE
- ${CLP_LIBRARIES} # clp + solver wrapper
- ${COINUTILS_LIBRARY} # container tools
- ${OSI_LIBRARY} # generic LP
+ ${OSI_CLP_COIN_LINK_LIBRARIES}
)
target_include_directories(openMVG_linearProgramming
PRIVATE
- ${CLP_INCLUDE_DIRS}
- ${COINUTILS_INCLUDE_DIRS}
- ${OSI_INCLUDE_DIRS}
+ ${OSI_CLP_COIN_INCLUDE_DIRS}
PUBLIC
$<INSTALL_INTERFACE:include>
)