From e07737cf300679af6cbcd3b172ecac55598727d9 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 2 Jul 2020 22:59:34 +0200 Subject: [PATCH 01/61] [OpenMVG/OpenMVS] add some features, fix tools --- ports/openmvg/CONTROL | 6 ++- .../{fixcmake.patch => fix-cmake.patch} | 0 ports/openmvg/fix-nullptr.patch | 13 +++++ ports/openmvg/portfile.cmake | 54 +++++++++++++++++-- ports/openmvs/CONTROL | 6 ++- ports/openmvs/portfile.cmake | 20 ++++--- 6 files changed, 86 insertions(+), 13 deletions(-) rename ports/openmvg/{fixcmake.patch => fix-cmake.patch} (100%) create mode 100644 ports/openmvg/fix-nullptr.patch diff --git a/ports/openmvg/CONTROL b/ports/openmvg/CONTROL index dd7dc1e9b261c8..059795bfdccdde 100644 --- a/ports/openmvg/CONTROL +++ b/ports/openmvg/CONTROL @@ -1,5 +1,5 @@ Source: openmvg -Version: 1.5 +Version: 1.5-1 Description: open Multiple View Geometry library. Basis for 3D computer vision and Structure from Motion. Build-Depends: coinutils, clp, osi, liblemon, flann, eigen3, ceres, cereal, libjpeg-turbo, tiff, libpng, zlib, suitesparse @@ -9,3 +9,7 @@ Description: opencv support for openmvg Feature: openmp Description: openmp support for openmvg + +Feature: software +Build-Depends: qt5-base, qt5-svg +Description: build openMVG tools diff --git a/ports/openmvg/fixcmake.patch b/ports/openmvg/fix-cmake.patch similarity index 100% rename from ports/openmvg/fixcmake.patch rename to ports/openmvg/fix-cmake.patch diff --git a/ports/openmvg/fix-nullptr.patch b/ports/openmvg/fix-nullptr.patch new file mode 100644 index 00000000000000..72e61adb3c227a --- /dev/null +++ b/ports/openmvg/fix-nullptr.patch @@ -0,0 +1,13 @@ +diff --git a/src/software/VO/Tracker_opencv_klt.hpp b/src/software/VO/Tracker_opencv_klt.hpp +index aa7dffe..2c4d237 100644 +--- a/src/software/VO/Tracker_opencv_klt.hpp ++++ b/src/software/VO/Tracker_opencv_klt.hpp +@@ -80,7 +80,7 @@ struct Tracker_opencv_KLT : public Abstract_Tracker + std::vector m_nextKeypoints; + + cv::Ptr m_detector = cv::GFTTDetector::create(count); +- if (m_detector == NULL) ++ if (m_detector == nullptr) + return false; + + m_detector->detect(current_img, m_nextKeypoints); diff --git a/ports/openmvg/portfile.cmake b/ports/openmvg/portfile.cmake index c62ceaa4daca89..478e83b68f3458 100644 --- a/ports/openmvg/portfile.cmake +++ b/ports/openmvg/portfile.cmake @@ -9,16 +9,17 @@ vcpkg_from_github( REF 606d1c9e82123dd50de282128151a50bf42262fc # v1.5 SHA512 eddcf4c5f86541112840a6d89bbf360d30b085c2b3ff3e39b357030a465163b465e89d01474f8dbd65b66f8bccfc1f54a58963324f622482e2960f00214b2b75 PATCHES - fixcmake.patch + fix-cmake.patch fix-config-cmake.patch + fix-nullptr.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS openmp OpenMVG_USE_OPENMP - openmp ENABLE_OPENMP opencv OpenMVG_USE_OPENCV opencv OpenMVG_USE_OCVSIFT - opencv ENABLE_OPENCV + software OpenMVG_BUILD_SOFTWARES + software OpenMVG_BUILD_GUI_SOFTWARES ) # remove some deps to prevent conflict @@ -49,8 +50,6 @@ vcpkg_configure_cmake( -DOpenMVG_BUILD_DOC=OFF -DOpenMVG_BUILD_EXAMPLES=OFF -DOpenMVG_BUILD_OPENGL_EXAMPLES=OFF - -DOpenMVG_BUILD_SOFTWARES=OFF - -DOpenMVG_BUILD_GUI_SOFTWARES=OFF -DOpenMVG_BUILD_COVERAGE=OFF -DOpenMVG_USE_INTERNAL_CLP=OFF -DOpenMVG_USE_INTERNAL_COINUTILS=OFF @@ -87,5 +86,50 @@ if(OpenMVG_BUILD_SHARED) endif() vcpkg_copy_pdbs() +vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES + openMVG_main_AlternativeVO + openMVG_main_ChangeLocalOrigin + openMVG_main_ColHarmonize + openMVG_main_ComputeClusters + openMVG_main_ComputeFeatures + openMVG_main_ComputeFeatures_OpenCV + openMVG_main_ComputeMatches + openMVG_main_ComputeSfM_DataColor + openMVG_main_ComputeStructureFromKnownPoses + openMVG_main_ConvertList + openMVG_main_ConvertSfM_DataFormat + openMVG_main_evalQuality + openMVG_main_ExportCameraFrustums + openMVG_main_exportKeypoints + openMVG_main_exportMatches + openMVG_main_exportTracks + openMVG_main_ExportUndistortedImages + openMVG_main_FrustumFiltering + openMVG_main_geodesy_registration_to_gps_position + openMVG_main_GlobalSfM + openMVG_main_IncrementalSfM + openMVG_main_IncrementalSfM2 + openMVG_main_ListMatchingPairs + openMVG_main_MatchesToTracks + openMVG_main_openMVG2Agisoft + openMVG_main_openMVG2CMPMVS + openMVG_main_openMVG2Colmap + openMVG_main_openMVG2MESHLAB + openMVG_main_openMVG2MVE2 + openMVG_main_openMVG2MVSTEXTURING + openMVG_main_openMVG2NVM + openMVG_main_openMVG2openMVS + openMVG_main_openMVG2PMVS + openMVG_main_openMVG2WebGL + openMVG_main_openMVGSpherical2Cubic + openMVG_main_PointsFiltering + openMVG_main_SfMInit_ImageListing + openMVG_main_SfMInit_ImageListingFromKnownPoses + openMVG_main_SfM_Localization + openMVG_main_SplitMatchFileIntoMatchFiles + ui_openMVG_control_points_registration + ui_openMVG_MatchesViewer +) + # Handle copyright file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/openmvs/CONTROL b/ports/openmvs/CONTROL index bc06aef4a50501..2006a514c9e83f 100644 --- a/ports/openmvs/CONTROL +++ b/ports/openmvs/CONTROL @@ -1,5 +1,9 @@ Source: openmvs -Version: 1.1-1 +Version: 1.1-2 Description: OpenMVS: open Multi-View Stereo reconstruction library Homepage: https://cdcseacave.github.io/openMVS Build-Depends: zlib, boost-iostreams, boost-program-options, boost-system, boost-serialization, eigen3, ceres, opencv, cgal[core], glew, glfw3, vcglib + +Feature: cuda +Build-Depends: cuda +Description: cuda support for openmvs diff --git a/ports/openmvs/portfile.cmake b/ports/openmvs/portfile.cmake index e0a771751161b0..653c97ed462521 100644 --- a/ports/openmvs/portfile.cmake +++ b/ports/openmvs/portfile.cmake @@ -8,12 +8,15 @@ vcpkg_from_github( HEAD_REF master ) +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + cuda OpenMVS_USE_CUDA +) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA - OPTIONS + OPTIONS ${FEATURE_OPTIONS} -DOpenMVS_USE_BREAKPAD=OFF - -DOpenMVS_USE_CUDA=OFF -DINSTALL_CMAKE_DIR:STRING=share/openmvs -DINSTALL_BIN_DIR:STRING=bin -DINSTALL_LIB_DIR:STRING=lib @@ -25,9 +28,14 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) vcpkg_fixup_cmake_targets() -file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools) -file(RENAME ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/tools/openmvs) -vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/openmvs) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES + DensifyPointCloud + InterfaceCOLMAP + InterfaceVisualSFM + ReconstructMesh + RefineMesh + TextureMesh + Viewer +) file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) From 35611c2504c1839a9bef7d533a97472278fbdce3 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 3 Jul 2020 12:37:00 +0200 Subject: [PATCH 02/61] [OpenMVG] copy tools only if feature is enabled --- ports/openmvg/fix-tools-config.patch | 57 ++++++++++++++++ ports/openmvg/portfile.cmake | 98 +++++++++++++++------------- 2 files changed, 111 insertions(+), 44 deletions(-) create mode 100644 ports/openmvg/fix-tools-config.patch diff --git a/ports/openmvg/fix-tools-config.patch b/ports/openmvg/fix-tools-config.patch new file mode 100644 index 00000000000000..b476827ca328b7 --- /dev/null +++ b/ports/openmvg/fix-tools-config.patch @@ -0,0 +1,57 @@ +diff --git a/src/software/SfM/SfM_GlobalPipeline.py.in b/src/software/SfM/SfM_GlobalPipeline.py.in +index 42405a4..28b0246 100644 +--- a/src/software/SfM/SfM_GlobalPipeline.py.in ++++ b/src/software/SfM/SfM_GlobalPipeline.py.in +@@ -21,7 +21,7 @@ + OPENMVG_SFM_BIN = "@OPENMVG_SOFTWARE_SFM_BUILD_DIR@" + + # Indicate the openMVG camera sensor width directory +-CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_SOFTWARE_SFM_SRC_DIR@" + "/../../openMVG/exif/sensor_width_database" ++CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_CAMERA_SENSOR_WIDTH_DIRECTORY@" + + import os + import subprocess +@@ -77,5 +77,3 @@ pRecons.wait() + + pRecons = subprocess.Popen( [os.path.join(OPENMVG_SFM_BIN, "openMVG_main_ComputeSfM_DataColor"), "-i", reconstruction_dir+"/robust.bin", "-o", os.path.join(reconstruction_dir,"robust_colorized.ply")] ) + pRecons.wait() +- +- +diff --git a/src/software/SfM/SfM_SequentialPipeline.py.in b/src/software/SfM/SfM_SequentialPipeline.py.in +index 9a5a482..e804a19 100644 +--- a/src/software/SfM/SfM_SequentialPipeline.py.in ++++ b/src/software/SfM/SfM_SequentialPipeline.py.in +@@ -21,7 +21,7 @@ + OPENMVG_SFM_BIN = "@OPENMVG_SOFTWARE_SFM_BUILD_DIR@" + + # Indicate the openMVG camera sensor width directory +-CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_SOFTWARE_SFM_SRC_DIR@" + "/../../openMVG/exif/sensor_width_database" ++CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_CAMERA_SENSOR_WIDTH_DIRECTORY@" + + import os + import subprocess +@@ -77,5 +77,3 @@ pRecons.wait() + + pRecons = subprocess.Popen( [os.path.join(OPENMVG_SFM_BIN, "openMVG_main_ComputeSfM_DataColor"), "-i", reconstruction_dir+"/robust.bin", "-o", os.path.join(reconstruction_dir,"robust_colorized.ply")] ) + pRecons.wait() +- +- +diff --git a/src/software/SfM/tutorial_demo.py.in b/src/software/SfM/tutorial_demo.py.in +index 259e24e..1097062 100644 +--- a/src/software/SfM/tutorial_demo.py.in ++++ b/src/software/SfM/tutorial_demo.py.in +@@ -12,7 +12,7 @@ + OPENMVG_SFM_BIN = "@OPENMVG_SOFTWARE_SFM_BUILD_DIR@" + + # Indicate the openMVG camera sensor width directory +-CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_SOFTWARE_SFM_SRC_DIR@" + "/../../openMVG/exif/sensor_width_database" ++CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_CAMERA_SENSOR_WIDTH_DIRECTORY@" + + import os + import subprocess +@@ -89,5 +89,3 @@ pRecons.wait() + print ("4. Structure from Known Poses (robust triangulation)") + pRecons = subprocess.Popen( [os.path.join(OPENMVG_SFM_BIN, "openMVG_main_ComputeStructureFromKnownPoses"), "-i", reconstruction_dir+"/sfm_data.bin", "-m", matches_dir, "-o", os.path.join(reconstruction_dir,"robust.ply")] ) + pRecons.wait() +- +- diff --git a/ports/openmvg/portfile.cmake b/ports/openmvg/portfile.cmake index 478e83b68f3458..834dc064962374 100644 --- a/ports/openmvg/portfile.cmake +++ b/ports/openmvg/portfile.cmake @@ -12,6 +12,7 @@ vcpkg_from_github( fix-cmake.patch fix-config-cmake.patch fix-nullptr.patch + fix-tools-config.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS @@ -86,50 +87,59 @@ if(OpenMVG_BUILD_SHARED) endif() vcpkg_copy_pdbs() -vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES - openMVG_main_AlternativeVO - openMVG_main_ChangeLocalOrigin - openMVG_main_ColHarmonize - openMVG_main_ComputeClusters - openMVG_main_ComputeFeatures - openMVG_main_ComputeFeatures_OpenCV - openMVG_main_ComputeMatches - openMVG_main_ComputeSfM_DataColor - openMVG_main_ComputeStructureFromKnownPoses - openMVG_main_ConvertList - openMVG_main_ConvertSfM_DataFormat - openMVG_main_evalQuality - openMVG_main_ExportCameraFrustums - openMVG_main_exportKeypoints - openMVG_main_exportMatches - openMVG_main_exportTracks - openMVG_main_ExportUndistortedImages - openMVG_main_FrustumFiltering - openMVG_main_geodesy_registration_to_gps_position - openMVG_main_GlobalSfM - openMVG_main_IncrementalSfM - openMVG_main_IncrementalSfM2 - openMVG_main_ListMatchingPairs - openMVG_main_MatchesToTracks - openMVG_main_openMVG2Agisoft - openMVG_main_openMVG2CMPMVS - openMVG_main_openMVG2Colmap - openMVG_main_openMVG2MESHLAB - openMVG_main_openMVG2MVE2 - openMVG_main_openMVG2MVSTEXTURING - openMVG_main_openMVG2NVM - openMVG_main_openMVG2openMVS - openMVG_main_openMVG2PMVS - openMVG_main_openMVG2WebGL - openMVG_main_openMVGSpherical2Cubic - openMVG_main_PointsFiltering - openMVG_main_SfMInit_ImageListing - openMVG_main_SfMInit_ImageListingFromKnownPoses - openMVG_main_SfM_Localization - openMVG_main_SplitMatchFileIntoMatchFiles - ui_openMVG_control_points_registration - ui_openMVG_MatchesViewer -) +if("software" IN_LIST FEATURES) + vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES + openMVG_main_AlternativeVO + openMVG_main_ChangeLocalOrigin + openMVG_main_ColHarmonize + openMVG_main_ComputeClusters + openMVG_main_ComputeFeatures + openMVG_main_ComputeFeatures_OpenCV + openMVG_main_ComputeMatches + openMVG_main_ComputeSfM_DataColor + openMVG_main_ComputeStructureFromKnownPoses + openMVG_main_ConvertList + openMVG_main_ConvertSfM_DataFormat + openMVG_main_evalQuality + openMVG_main_ExportCameraFrustums + openMVG_main_exportKeypoints + openMVG_main_exportMatches + openMVG_main_exportTracks + openMVG_main_ExportUndistortedImages + openMVG_main_FrustumFiltering + openMVG_main_geodesy_registration_to_gps_position + openMVG_main_GlobalSfM + openMVG_main_IncrementalSfM + openMVG_main_IncrementalSfM2 + openMVG_main_ListMatchingPairs + openMVG_main_MatchesToTracks + openMVG_main_openMVG2Agisoft + openMVG_main_openMVG2CMPMVS + openMVG_main_openMVG2Colmap + openMVG_main_openMVG2MESHLAB + openMVG_main_openMVG2MVE2 + openMVG_main_openMVG2MVSTEXTURING + openMVG_main_openMVG2NVM + openMVG_main_openMVG2openMVS + openMVG_main_openMVG2PMVS + openMVG_main_openMVG2WebGL + openMVG_main_openMVGSpherical2Cubic + openMVG_main_PointsFiltering + openMVG_main_SfMInit_ImageListing + openMVG_main_SfMInit_ImageListingFromKnownPoses + openMVG_main_SfM_Localization + openMVG_main_SplitMatchFileIntoMatchFiles + ui_openMVG_control_points_registration + ui_openMVG_MatchesViewer + ) + + file(COPY ${SOURCE_PATH}/src/openMVG/exif/sensor_width_database/sensor_width_camera_database.txt DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}) + set(OPENMVG_SOFTWARE_SFM_BUILD_DIR ${CURRENT_INSTALLED_DIR}/tools/${PORT}) + set(OPENMVG_CAMERA_SENSOR_WIDTH_DIRECTORY ${CURRENT_INSTALLED_DIR}/tools/${PORT}) + configure_file("${SOURCE_PATH}/src/software/SfM/tutorial_demo.py.in" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/tutorial_demo.py" @ONLY) + configure_file("${SOURCE_PATH}/src/software/SfM/SfM_GlobalPipeline.py.in" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/SfM_GlobalPipeline.py" @ONLY) + configure_file("${SOURCE_PATH}/src/software/SfM/SfM_SequentialPipeline.py.in" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/SfM_SequentialPipeline.py" @ONLY) +endif() # Handle copyright file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) From 557f14532d2609b05bff0e6fd66034627cc905f2 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 3 Jul 2020 15:12:48 +0200 Subject: [PATCH 03/61] [OpenMVG] add a message about graphviz requirement --- ports/openmvg/portfile.cmake | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ports/openmvg/portfile.cmake b/ports/openmvg/portfile.cmake index 834dc064962374..a21cc22f99a1d9 100644 --- a/ports/openmvg/portfile.cmake +++ b/ports/openmvg/portfile.cmake @@ -15,8 +15,16 @@ vcpkg_from_github( fix-tools-config.patch ) +set(OpenMVG_USE_OPENMP OFF) +if("openmp" IN_LIST FEATURES) + if(VCPKG_TARGET_IS_WINDOWS) + message(WARNING "OpenMP feature is broken on Windows, disabled until fixed https://github.com/openMVG/openMVG/issues/1765") + else() + set(OpenMVG_USE_OPENMP ON) + endif() +endif() + vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - openmp OpenMVG_USE_OPENMP opencv OpenMVG_USE_OPENCV opencv OpenMVG_USE_OCVSIFT software OpenMVG_BUILD_SOFTWARES @@ -46,6 +54,7 @@ vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH}/src PREFER_NINJA OPTIONS ${FEATURE_OPTIONS} + -DOpenMVG_USE_OPENMP=${OpenMVG_USE_OPENMP} -DOpenMVG_BUILD_SHARED=OFF -DOpenMVG_BUILD_TESTS=OFF -DOpenMVG_BUILD_DOC=OFF @@ -139,6 +148,7 @@ if("software" IN_LIST FEATURES) configure_file("${SOURCE_PATH}/src/software/SfM/tutorial_demo.py.in" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/tutorial_demo.py" @ONLY) configure_file("${SOURCE_PATH}/src/software/SfM/SfM_GlobalPipeline.py.in" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/SfM_GlobalPipeline.py" @ONLY) configure_file("${SOURCE_PATH}/src/software/SfM/SfM_SequentialPipeline.py.in" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/SfM_SequentialPipeline.py" @ONLY) + message(STATUS "To use tools, you need graphviz installed and manually added to path (to have neato executable)") endif() # Handle copyright From 4ed4059cba41ee857892619908c1a8a82f67b509 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 3 Jul 2020 15:14:10 +0200 Subject: [PATCH 04/61] [OpenMVS] fix tool paths --- ports/openmvs/CONTROL | 2 +- ports/openmvs/fix-tool-paths.patch | 37 ++++++++++++++++++++++++++++++ ports/openmvs/portfile.cmake | 7 ++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 ports/openmvs/fix-tool-paths.patch diff --git a/ports/openmvs/CONTROL b/ports/openmvs/CONTROL index 2006a514c9e83f..368c0b23514c38 100644 --- a/ports/openmvs/CONTROL +++ b/ports/openmvs/CONTROL @@ -2,7 +2,7 @@ Source: openmvs Version: 1.1-2 Description: OpenMVS: open Multi-View Stereo reconstruction library Homepage: https://cdcseacave.github.io/openMVS -Build-Depends: zlib, boost-iostreams, boost-program-options, boost-system, boost-serialization, eigen3, ceres, opencv, cgal[core], glew, glfw3, vcglib +Build-Depends: zlib, boost-iostreams, boost-program-options, boost-system, boost-serialization, eigen3, ceres, opencv, cgal[core], glew, glfw3, vcglib, openmvg[software] Feature: cuda Build-Depends: cuda diff --git a/ports/openmvs/fix-tool-paths.patch b/ports/openmvs/fix-tool-paths.patch new file mode 100644 index 00000000000000..64ff02fe11f425 --- /dev/null +++ b/ports/openmvs/fix-tool-paths.patch @@ -0,0 +1,37 @@ +diff --git a/MvgMvsPipeline.py b/MvgMvsPipeline.py.in +similarity index 97% +rename from MvgMvsPipeline.py +rename to MvgMvsPipeline.py.in +index f4914bf..6ecc060 100644 +--- a/MvgMvsPipeline.py ++++ b/MvgMvsPipeline.py.in +@@ -91,12 +91,12 @@ def find(afile): + return None + + # Try to find openMVG and openMVS binaries in PATH +-OPENMVG_BIN = whereis("openMVG_main_SfMInit_ImageListing") +-OPENMVS_BIN = whereis("ReconstructMesh") ++OPENMVG_BIN = "@OPENMVG_TOOLS_PATH@" ++OPENMVS_BIN = "@OPENMVS_TOOLS_PATH@" + + # Try to find openMVG camera sensor database +-CAMERA_SENSOR_DB_FILE = "sensor_width_camera_database.txt" +-CAMERA_SENSOR_DB_DIRECTORY = find(CAMERA_SENSOR_DB_FILE) ++CAMERA_SENSOR_DB_FILE = "@SENSOR_WIDTH_CAMERA_DATABASE_TXT_PATH@" ++CAMERA_SENSOR_DB_DIRECTORY = "@OPENMVG_TOOLS_PATH@" + + # Ask user for openMVG and openMVS directories if not found + if not OPENMVG_BIN: +@@ -175,10 +175,10 @@ class StepsStore: + ["-i", "%input_dir%", "-o", "%matches_dir%", "-d", "%camera_file_params%"]], + ["Compute features", # 1 + os.path.join(OPENMVG_BIN, "openMVG_main_ComputeFeatures"), +- ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-m", "SIFT", "-n", "4"]], ++ ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-m", "SIFT"]], + ["Compute matches", # 2 + os.path.join(OPENMVG_BIN, "openMVG_main_ComputeMatches"), +- ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-n", "HNSWL2", "-r", ".8"]], ++ ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-n", "AUTO", "-r", ".8"]], + ["Incremental reconstruction", # 3 + os.path.join(OPENMVG_BIN, "openMVG_main_IncrementalSfM"), + ["-i", "%matches_dir%/sfm_data.json", "-m", "%matches_dir%", "-o", "%reconstruction_dir%"]], diff --git a/ports/openmvs/portfile.cmake b/ports/openmvs/portfile.cmake index 653c97ed462521..7f6dc67bd5fd41 100644 --- a/ports/openmvs/portfile.cmake +++ b/ports/openmvs/portfile.cmake @@ -6,6 +6,8 @@ vcpkg_from_github( REF v1.1 SHA512 baa9149853dc08c602deeb1a04cf57643d1cb0733aee2776f4e99b210279aad3b4a1013ab1d790e91a3a95b7c72b9c12c6be25f2c30a76b69b5319b610cb8e7a HEAD_REF master + PATCHES + fix-tool-paths.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS @@ -38,4 +40,9 @@ vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES Viewer ) +set(OPENMVG_TOOLS_PATH "${CURRENT_INSTALLED_DIR}/tools/openmvg") +set(OPENMVS_TOOLS_PATH "${CURRENT_INSTALLED_DIR}/tools/${PORT}") +set(SENSOR_WIDTH_CAMERA_DATABASE_TXT_PATH "${OPENMVG_TOOLS_PATH}/sensor_width_camera_database.txt") +configure_file("${SOURCE_PATH}/MvgMvsPipeline.py.in" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/MvgMvsPipeline.py" @ONLY) + file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) From 25385998e5224167762498a71b533b6ce421552d Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 3 Jul 2020 16:02:18 +0200 Subject: [PATCH 05/61] [OpenMVG] copy OpenCV-enabled tool only if opencv feature is enabled --- ports/openmvg/portfile.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/openmvg/portfile.cmake b/ports/openmvg/portfile.cmake index a21cc22f99a1d9..5ed0d511ea1896 100644 --- a/ports/openmvg/portfile.cmake +++ b/ports/openmvg/portfile.cmake @@ -103,7 +103,6 @@ if("software" IN_LIST FEATURES) openMVG_main_ColHarmonize openMVG_main_ComputeClusters openMVG_main_ComputeFeatures - openMVG_main_ComputeFeatures_OpenCV openMVG_main_ComputeMatches openMVG_main_ComputeSfM_DataColor openMVG_main_ComputeStructureFromKnownPoses @@ -141,6 +140,11 @@ if("software" IN_LIST FEATURES) ui_openMVG_control_points_registration ui_openMVG_MatchesViewer ) + if("opencv" IN_LIST FEATURES) + vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES + openMVG_main_ComputeFeatures_OpenCV + ) + endif() file(COPY ${SOURCE_PATH}/src/openMVG/exif/sensor_width_database/sensor_width_camera_database.txt DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}) set(OPENMVG_SOFTWARE_SFM_BUILD_DIR ${CURRENT_INSTALLED_DIR}/tools/${PORT}) From a087756b1197f7a49e0fb72837c3b8658e43dec4 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Sat, 4 Jul 2020 00:17:32 +0200 Subject: [PATCH 06/61] [OpenMVS] fixes for OSX --- ports/openmvg/portfile.cmake | 17 +++++++++++++++-- ports/openmvs/CONTROL | 3 +++ ports/openmvs/portfile.cmake | 3 ++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ports/openmvg/portfile.cmake b/ports/openmvg/portfile.cmake index 5ed0d511ea1896..d3ca9bc08b66d6 100644 --- a/ports/openmvg/portfile.cmake +++ b/ports/openmvg/portfile.cmake @@ -97,8 +97,22 @@ endif() vcpkg_copy_pdbs() if("software" IN_LIST FEATURES) + if(VCPKG_TARGET_IS_OSX) + vcpkg_copy_tools(TOOL_NAMES + openMVG_main_AlternativeVO.app + ui_openMVG_MatchesViewer.app + ) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/openMVG_main_AlternativeVO.app) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/ui_openMVG_MatchesViewer.app) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin/openMVG_main_AlternativeVO.app) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin/ui_openMVG_MatchesViewer.app) + else() + vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES + openMVG_main_AlternativeVO + ui_openMVG_MatchesViewer + ) + endif() vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES - openMVG_main_AlternativeVO openMVG_main_ChangeLocalOrigin openMVG_main_ColHarmonize openMVG_main_ComputeClusters @@ -138,7 +152,6 @@ if("software" IN_LIST FEATURES) openMVG_main_SfM_Localization openMVG_main_SplitMatchFileIntoMatchFiles ui_openMVG_control_points_registration - ui_openMVG_MatchesViewer ) if("opencv" IN_LIST FEATURES) vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES diff --git a/ports/openmvs/CONTROL b/ports/openmvs/CONTROL index 368c0b23514c38..504f9421e9326f 100644 --- a/ports/openmvs/CONTROL +++ b/ports/openmvs/CONTROL @@ -7,3 +7,6 @@ Build-Depends: zlib, boost-iostreams, boost-program-options, boost-system, boost Feature: cuda Build-Depends: cuda Description: cuda support for openmvs + +Feature: openmp +Description: openmp support for openmvs diff --git a/ports/openmvs/portfile.cmake b/ports/openmvs/portfile.cmake index 7f6dc67bd5fd41..52134e9d43907d 100644 --- a/ports/openmvs/portfile.cmake +++ b/ports/openmvs/portfile.cmake @@ -11,7 +11,8 @@ vcpkg_from_github( ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - cuda OpenMVS_USE_CUDA + cuda OpenMVS_USE_CUDA + openmp OpenMVS_USE_OPENMP ) vcpkg_configure_cmake( From 5c4d2a219fb518e703aed18953e04294978af530 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Sat, 4 Jul 2020 23:10:27 +0200 Subject: [PATCH 07/61] [OpenMVS] improve linux build resiliency --- ports/openmvs/CONTROL | 2 +- ports/openmvs/fix-linux-build.patch | 44 +++++++++++++++++++++++++++++ ports/openmvs/portfile.cmake | 1 + 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 ports/openmvs/fix-linux-build.patch diff --git a/ports/openmvs/CONTROL b/ports/openmvs/CONTROL index 504f9421e9326f..677707b327e14f 100644 --- a/ports/openmvs/CONTROL +++ b/ports/openmvs/CONTROL @@ -2,7 +2,7 @@ Source: openmvs Version: 1.1-2 Description: OpenMVS: open Multi-View Stereo reconstruction library Homepage: https://cdcseacave.github.io/openMVS -Build-Depends: zlib, boost-iostreams, boost-program-options, boost-system, boost-serialization, eigen3, ceres, opencv, cgal[core], glew, glfw3, vcglib, openmvg[software] +Build-Depends: zlib, boost-iostreams, boost-program-options, boost-system, boost-serialization, eigen3, ceres, opencv, cgal[core], glew, glfw3, vcglib, openmvg[software], libpng, tiff Feature: cuda Build-Depends: cuda diff --git a/ports/openmvs/fix-linux-build.patch b/ports/openmvs/fix-linux-build.patch new file mode 100644 index 00000000000000..19460a91cc1ac9 --- /dev/null +++ b/ports/openmvs/fix-linux-build.patch @@ -0,0 +1,44 @@ +diff --git a/apps/Viewer/CMakeLists.txt b/apps/Viewer/CMakeLists.txt +index c519040..934cd50 100644 +--- a/apps/Viewer/CMakeLists.txt ++++ b/apps/Viewer/CMakeLists.txt +@@ -16,18 +16,6 @@ else() + MESSAGE("-- Can't find GLEW. Continuing without it.") + RETURN() + endif() +-if(CMAKE_COMPILER_IS_GNUCXX) +- FIND_PACKAGE(PkgConfig QUIET) +- pkg_search_module(GLFW QUIET glfw3) +- if(GLFW_FOUND) +- INCLUDE_DIRECTORIES(${GLFW_INCLUDE_DIRS}) +- ADD_DEFINITIONS(${GLFW_DEFINITIONS}) +- MESSAGE(STATUS "GLFW3 ${GLFW_VERSION} found (include: ${GLFW_INCLUDE_DIRS})") +- else() +- MESSAGE("-- Can't find GLFW3. Continuing without it.") +- RETURN() +- endif() +-else() + FIND_PACKAGE(glfw3 QUIET) + if(glfw3_FOUND) + INCLUDE_DIRECTORIES(${glfw3_INCLUDE_DIRS}) +@@ -37,7 +25,6 @@ else() + MESSAGE("-- Can't find GLFW3. Continuing without it.") + RETURN() + endif() +-endif() + + # List sources files + FILE(GLOB PCH_C "Common.cpp") +diff --git a/libs/IO/CMakeLists.txt b/libs/IO/CMakeLists.txt +index a354376..d4faf34 100644 +--- a/libs/IO/CMakeLists.txt ++++ b/libs/IO/CMakeLists.txt +@@ -43,7 +43,7 @@ cxx_library_with_type_no_pch(IO "Libs" "STATIC" "${cxx_default}" + set_target_pch(IO Common.h) + + # Link its dependencies +-TARGET_LINK_LIBRARIES(IO Common ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${EXIV2_LIBS}) ++TARGET_LINK_LIBRARIES(IO Common ${TIFF_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${EXIV2_LIBS}) + + # Install + SET_TARGET_PROPERTIES(IO PROPERTIES diff --git a/ports/openmvs/portfile.cmake b/ports/openmvs/portfile.cmake index 52134e9d43907d..316031298cfb3b 100644 --- a/ports/openmvs/portfile.cmake +++ b/ports/openmvs/portfile.cmake @@ -8,6 +8,7 @@ vcpkg_from_github( HEAD_REF master PATCHES fix-tool-paths.patch + fix-linux-build.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS From 3c848595ae7d80a7168a2bc16380b93e10288595 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Mon, 6 Jul 2020 21:54:19 +0200 Subject: [PATCH 08/61] [OpenMVS] fixes when using cmake targets --- ports/openmvs/fix-tool-build.patch | 141 ++++++ ports/openmvs/fix-tool-paths.patch | 761 +++++++++++++++++++++++++++-- ports/openmvs/portfile.cmake | 14 + 3 files changed, 879 insertions(+), 37 deletions(-) create mode 100644 ports/openmvs/fix-tool-build.patch diff --git a/ports/openmvs/fix-tool-build.patch b/ports/openmvs/fix-tool-build.patch new file mode 100644 index 00000000000000..6c8e4123d4ab31 --- /dev/null +++ b/ports/openmvs/fix-tool-build.patch @@ -0,0 +1,141 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7966ed5..b8dfb54 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -63,7 +63,7 @@ INCLUDE_DIRECTORIES("${OpenMVS_SOURCE_DIR}") + SET(OpenMVS_EXTRA_LIBS "") + if(OpenMVS_USE_OPENMP) + SET(OpenMP_LIBS "") +- FIND_PACKAGE(OpenMP) ++ FIND_PACKAGE(OpenMP REQUIRED) + if(OPENMP_FOUND) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + ADD_DEFINITIONS(-D_USE_OPENMP) +@@ -83,7 +83,7 @@ if(OpenMVS_USE_OPENGL) + if(POLICY CMP0072) + cmake_policy(SET CMP0072 NEW) + endif() +- FIND_PACKAGE(OpenGL) ++ FIND_PACKAGE(OpenGL REQUIRED) + if(OPENGL_FOUND) + INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) + ADD_DEFINITIONS(${OpenGL_DEFINITIONS} -D_USE_OPENGL) +@@ -94,7 +94,7 @@ if(OpenMVS_USE_OPENGL) + endif() + + if(OpenMVS_USE_CUDA) +- FIND_PACKAGE(CUDA) ++ FIND_PACKAGE(CUDA REQUIRED) + if(CUDA_FOUND) + INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS}) + ADD_DEFINITIONS(-D_USE_CUDA) +@@ -108,7 +108,7 @@ else() + endif() + + if(OpenMVS_USE_BREAKPAD) +- FIND_PACKAGE(BREAKPAD) ++ FIND_PACKAGE(BREAKPAD REQUIRED) + if(BREAKPAD_FOUND) + INCLUDE_DIRECTORIES(${BREAKPAD_INCLUDE_DIRS}) + ADD_DEFINITIONS(${BREAKPAD_DEFINITIONS} -D_USE_BREAKPAD) +@@ -119,7 +119,7 @@ if(OpenMVS_USE_BREAKPAD) + endif() + endif() + +-FIND_PACKAGE(Boost ${SYSTEM_PACKAGE_REQUIRED} COMPONENTS iostreams program_options system serialization) ++FIND_PACKAGE(Boost COMPONENTS iostreams program_options system serialization REQUIRED) + if(Boost_FOUND) + INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) + ADD_DEFINITIONS(${Boost_DEFINITIONS} -D_USE_BOOST) +@@ -127,14 +127,14 @@ if(Boost_FOUND) + SET(_USE_BOOST TRUE) + endif() + +-FIND_PACKAGE(Eigen ${SYSTEM_PACKAGE_REQUIRED}) +-if(EIGEN_FOUND) +- INCLUDE_DIRECTORIES(${EIGEN_INCLUDE_DIRS}) ++FIND_PACKAGE(Eigen3 REQUIRED) ++if(EIGEN3_FOUND) ++ INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIRS}) + ADD_DEFINITIONS(${EIGEN_DEFINITIONS} -D_USE_EIGEN) + SET(_USE_EIGEN TRUE) + endif() + +-FIND_PACKAGE(OpenCV ${SYSTEM_PACKAGE_REQUIRED}) ++FIND_PACKAGE(OpenCV REQUIRED) + if(OpenCV_FOUND) + INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) + ADD_DEFINITIONS(${OpenCV_DEFINITIONS}) +@@ -170,7 +170,9 @@ ADD_DEFINITIONS(${OpenMVS_DEFINITIONS}) + + # Add modules + ADD_SUBDIRECTORY(libs) ++if(OpenMVS_BUILD_TOOLS) + ADD_SUBDIRECTORY(apps) ++endif() + ADD_SUBDIRECTORY(docs) + + if(OpenMVS_USE_CERES) +@@ -188,7 +190,7 @@ export(TARGETS Common IO Math MVS FILE "${PROJECT_BINARY_DIR}/OpenMVSTargets.cma + # Export the package for use from the build-tree + # (this registers the build-tree with a global CMake-registry) + export(PACKAGE OpenMVS) +- ++ + # Create the OpenMVSConfig.cmake and OpenMVSConfigVersion files + file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}" "${INSTALL_INCLUDE_DIR}") + # ... for the build tree +@@ -199,7 +201,7 @@ set(CONF_INCLUDE_DIRS "${INSTALL_CMAKE_DIR}/${REL_INCLUDE_DIR}") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build/OpenMVSConfig.cmake.in" "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMVSConfig.cmake" @ONLY) + # ... for both + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build/OpenMVSConfigVersion.cmake.in" "${PROJECT_BINARY_DIR}/OpenMVSConfigVersion.cmake" @ONLY) +- ++ + # Install the OpenMVSConfig.cmake and OpenMVSConfigVersion.cmake + install(FILES + "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMVSConfig.cmake" +diff --git a/build/OpenMVSConfig.cmake.in b/build/OpenMVSConfig.cmake.in +index 96b8fe2..4d4d590 100644 +--- a/build/OpenMVSConfig.cmake.in ++++ b/build/OpenMVSConfig.cmake.in +@@ -3,16 +3,37 @@ + # OpenMVS_INCLUDE_DIRS - include directories for OpenMVS + # OpenMVS_LIBRARIES - libraries to link against + # OpenMVS_BINARIES - the binaries +- ++ + # Compute paths + get_filename_component(OpenMVS_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + set(OpenMVS_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@") +- ++include(CMakeFindDependencyMacro) ++ ++if(@OpenMVS_USE_OPENMP@) ++ find_dependency(OpenMP) ++endif() ++ ++if(@OpenMVS_USE_OPENGL@) ++ find_dependency(OpenGL) ++endif() ++ ++if(@OpenMVS_USE_CUDA@) ++ find_dependency(CUDA) ++endif() ++ ++if(@OpenMVS_USE_BREAKPAD@) ++ find_dependency(BREAKPAD) ++endif() ++ ++find_dependency(Boost) ++find_dependency(Eigen3) ++find_dependency(OpenCV) ++ + # Our library dependencies (contains definitions for IMPORTED targets) + if(NOT TARGET MVS AND NOT OpenMVS_BINARY_DIR) + include("${OpenMVS_CMAKE_DIR}/OpenMVSTargets.cmake") + endif() +- ++ + # These are IMPORTED targets created by OpenMVSTargets.cmake + set(OpenMVS_LIBRARIES MVS) + set(OpenMVS_BINARIES InterfaceVisualSFM DensifyPointCloud ReconstructMesh RefineMesh TextureMesh) diff --git a/ports/openmvs/fix-tool-paths.patch b/ports/openmvs/fix-tool-paths.patch index 64ff02fe11f425..6ce862e95f8ee2 100644 --- a/ports/openmvs/fix-tool-paths.patch +++ b/ports/openmvs/fix-tool-paths.patch @@ -1,37 +1,724 @@ -diff --git a/MvgMvsPipeline.py b/MvgMvsPipeline.py.in -similarity index 97% -rename from MvgMvsPipeline.py -rename to MvgMvsPipeline.py.in -index f4914bf..6ecc060 100644 ---- a/MvgMvsPipeline.py -+++ b/MvgMvsPipeline.py.in -@@ -91,12 +91,12 @@ def find(afile): - return None - - # Try to find openMVG and openMVS binaries in PATH --OPENMVG_BIN = whereis("openMVG_main_SfMInit_ImageListing") --OPENMVS_BIN = whereis("ReconstructMesh") -+OPENMVG_BIN = "@OPENMVG_TOOLS_PATH@" -+OPENMVS_BIN = "@OPENMVS_TOOLS_PATH@" - - # Try to find openMVG camera sensor database --CAMERA_SENSOR_DB_FILE = "sensor_width_camera_database.txt" --CAMERA_SENSOR_DB_DIRECTORY = find(CAMERA_SENSOR_DB_FILE) -+CAMERA_SENSOR_DB_FILE = "@SENSOR_WIDTH_CAMERA_DATABASE_TXT_PATH@" -+CAMERA_SENSOR_DB_DIRECTORY = "@OPENMVG_TOOLS_PATH@" - - # Ask user for openMVG and openMVS directories if not found - if not OPENMVG_BIN: -@@ -175,10 +175,10 @@ class StepsStore: - ["-i", "%input_dir%", "-o", "%matches_dir%", "-d", "%camera_file_params%"]], - ["Compute features", # 1 - os.path.join(OPENMVG_BIN, "openMVG_main_ComputeFeatures"), -- ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-m", "SIFT", "-n", "4"]], -+ ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-m", "SIFT"]], - ["Compute matches", # 2 - os.path.join(OPENMVG_BIN, "openMVG_main_ComputeMatches"), -- ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-n", "HNSWL2", "-r", ".8"]], -+ ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-n", "AUTO", "-r", ".8"]], - ["Incremental reconstruction", # 3 - os.path.join(OPENMVG_BIN, "openMVG_main_IncrementalSfM"), - ["-i", "%matches_dir%/sfm_data.json", "-m", "%matches_dir%", "-o", "%reconstruction_dir%"]], +diff --git a/MvgMvsPipeline.py b/MvgMvsPipeline.py.in +similarity index 95% +rename from MvgMvsPipeline.py +rename to MvgMvsPipeline.py.in +index f4914bf..3bd680c 100644 +--- a/MvgMvsPipeline.py ++++ b/MvgMvsPipeline.py.in +@@ -1,358 +1,358 @@ +-#!/usr/bin/python3 +-# -*- encoding: utf-8 -*- +-# +-# Created by @FlachyJoe +-""" +-This script is for an easy use of OpenMVG and OpenMVS +- +-usage: MvgMvs_Pipeline.py [-h] [--steps STEPS [STEPS ...]] [--preset PRESET] +- [--0 0 [0 ...]] [--1 1 [1 ...]] [--2 2 [2 ...]] +- [--3 3 [3 ...]] [--4 4 [4 ...]] [--5 5 [5 ...]] +- [--6 6 [6 ...]] [--7 7 [7 ...]] [--8 8 [8 ...]] +- [--9 9 [9 ...]] [--10 10 [10 ...]] [--11 11 [11 ...]] +- [--12 12 [12 ...]] [--13 13 [13 ...]] +- [--14 14 [14 ...]] [--15 15 [15 ...]] +- input_dir output_dir +- +-Photogrammetry reconstruction with these steps: +- 0. Intrinsics analysis openMVG_main_SfMInit_ImageListing +- 1. Compute features openMVG_main_ComputeFeatures +- 2. Compute matches openMVG_main_ComputeMatches +- 3. Incremental reconstruction openMVG_main_IncrementalSfM +- 4. Global reconstruction openMVG_main_GlobalSfM +- 5. Colorize Structure openMVG_main_ComputeSfM_DataColor +- 6. Structure from Known Poses openMVG_main_ComputeStructureFromKnownPoses +- 7. Colorized robust triangulation openMVG_main_ComputeSfM_DataColor +- 8. Control Points Registration ui_openMVG_control_points_registration +- 9. Export to openMVS openMVG_main_openMVG2openMVS +- 10. Densify point-cloud DensifyPointCloud +- 11. Reconstruct the mesh ReconstructMesh +- 12. Refine the mesh RefineMesh +- 13. Texture the mesh TextureMesh +- 14. Estimate disparity-maps DensifyPointCloud +- 15. Fuse disparity-maps DensifyPointCloud +- +-positional arguments: +- input_dir the directory wich contains the pictures set. +- output_dir the directory wich will contain the resulting files. +- +-optional arguments: +- -h, --help show this help message and exit +- --steps STEPS [STEPS ...] steps to process +- --preset PRESET steps list preset in +- SEQUENTIAL = [0, 1, 2, 3, 9, 10, 11, 12, 13] +- GLOBAL = [0, 1, 2, 4, 9, 10, 11, 12, 13] +- MVG_SEQ = [0, 1, 2, 3, 5, 6, 7] +- MVG_GLOBAL = [0, 1, 2, 4, 5, 6, 7] +- MVS_SGM = [14, 15] +- default : SEQUENTIAL +- +-Passthrough: +- Option to be passed to command lines (remove - in front of option names) +- e.g. --1 p ULTRA to use the ULTRA preset in openMVG_main_ComputeFeatures +-""" +- +-import os +-import subprocess +-import sys +-import argparse +- +-DEBUG = False +- +-# add current directory to PATH +-if sys.platform.startswith('win'): +- path_delim = ';' +-else: +- path_delim = ':' +-os.environ['PATH'] += path_delim + os.getcwd() +- +- +-def whereis(afile): +- """ +- return directory in which afile is, None if not found. Look in PATH +- """ +- if sys.platform.startswith('win'): +- cmd = "where" +- else: +- cmd = "which" +- try: +- ret = subprocess.run([cmd, afile], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True) +- return os.path.split(ret.stdout.decode())[0] +- except subprocess.CalledProcessError: +- return None +- +-def find(afile): +- """ +- As whereis look only for executable on linux, this find look for all file type +- """ +- for d in os.environ['PATH'].split(path_delim): +- if os.path.isfile(os.path.join(d, afile)): +- return d +- return None +- +-# Try to find openMVG and openMVS binaries in PATH +-OPENMVG_BIN = whereis("openMVG_main_SfMInit_ImageListing") +-OPENMVS_BIN = whereis("ReconstructMesh") +- +-# Try to find openMVG camera sensor database +-CAMERA_SENSOR_DB_FILE = "sensor_width_camera_database.txt" +-CAMERA_SENSOR_DB_DIRECTORY = find(CAMERA_SENSOR_DB_FILE) +- +-# Ask user for openMVG and openMVS directories if not found +-if not OPENMVG_BIN: +- OPENMVG_BIN = input("openMVG binary folder?\n") +-if not OPENMVS_BIN: +- OPENMVS_BIN = input("openMVS binary folder?\n") +-if not CAMERA_SENSOR_DB_DIRECTORY: +- CAMERA_SENSOR_DB_DIRECTORY = input("openMVG camera database (%s) folder?\n" % CAMERA_SENSOR_DB_FILE) +- +- +-PRESET = {'SEQUENTIAL': [0, 1, 2, 3, 9, 10, 11, 12, 13], +- 'GLOBAL': [0, 1, 2, 4, 9, 10, 11, 12, 13], +- 'MVG_SEQ': [0, 1, 2, 3, 5, 6, 7], +- 'MVG_GLOBAL': [0, 1, 2, 4, 5, 6, 7], +- 'MVS_SGM': [14, 15]} +- +-PRESET_DEFAULT = 'SEQUENTIAL' +- +- +-# HELPERS for terminal colors +-BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8) +-NO_EFFECT, BOLD, UNDERLINE, BLINK, INVERSE, HIDDEN = (0, 1, 4, 5, 7, 8) +- +-# from Python cookbook, #475186 +-def has_colours(stream): +- ''' +- Return stream colours capability +- ''' +- if not hasattr(stream, "isatty"): +- return False +- if not stream.isatty(): +- return False # auto color only on TTYs +- try: +- import curses +- curses.setupterm() +- return curses.tigetnum("colors") > 2 +- except Exception: +- # guess false in case of error +- return False +- +-HAS_COLOURS = has_colours(sys.stdout) +- +- +-def printout(text, colour=WHITE, background=BLACK, effect=NO_EFFECT): +- """ +- print() with colour +- """ +- if HAS_COLOURS: +- seq = "\x1b[%d;%d;%dm" % (effect, 30+colour, 40+background) + text + "\x1b[0m" +- sys.stdout.write(seq+'\r\n') +- else: +- sys.stdout.write(text+'\r\n') +- +- +-# OBJECTS to store config and data in +-class ConfContainer: +- """ +- Container for all the config variables +- """ +- def __init__(self): +- pass +- +- +-class AStep: +- def __init__(self, info, cmd, opt): +- self.info = info +- self.cmd = cmd +- self.opt = opt +- +- +-class StepsStore: +- def __init__(self): +- self.steps_data = [ +- ["Intrinsics analysis", # 0 +- os.path.join(OPENMVG_BIN, "openMVG_main_SfMInit_ImageListing"), +- ["-i", "%input_dir%", "-o", "%matches_dir%", "-d", "%camera_file_params%"]], +- ["Compute features", # 1 +- os.path.join(OPENMVG_BIN, "openMVG_main_ComputeFeatures"), +- ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-m", "SIFT", "-n", "4"]], +- ["Compute matches", # 2 +- os.path.join(OPENMVG_BIN, "openMVG_main_ComputeMatches"), +- ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-n", "HNSWL2", "-r", ".8"]], +- ["Incremental reconstruction", # 3 +- os.path.join(OPENMVG_BIN, "openMVG_main_IncrementalSfM"), +- ["-i", "%matches_dir%/sfm_data.json", "-m", "%matches_dir%", "-o", "%reconstruction_dir%"]], +- ["Global reconstruction", # 4 +- os.path.join(OPENMVG_BIN, "openMVG_main_GlobalSfM"), +- ["-i", "%matches_dir%/sfm_data.json", "-m", "%matches_dir%", "-o", "%reconstruction_dir%"]], +- ["Colorize Structure", # 5 +- os.path.join(OPENMVG_BIN, "openMVG_main_ComputeSfM_DataColor"), +- ["-i", "%reconstruction_dir%/sfm_data.bin", "-o", "%reconstruction_dir%/colorized.ply"]], +- ["Structure from Known Poses", # 6 +- os.path.join(OPENMVG_BIN, "openMVG_main_ComputeStructureFromKnownPoses"), +- ["-i", "%reconstruction_dir%/sfm_data.bin", "-m", "%matches_dir%", "-f", "%matches_dir%/matches.f.bin", "-o", "%reconstruction_dir%/robust.bin"]], +- ["Colorized robust triangulation", # 7 +- os.path.join(OPENMVG_BIN, "openMVG_main_ComputeSfM_DataColor"), +- ["-i", "%reconstruction_dir%/robust.bin", "-o", "%reconstruction_dir%/robust_colorized.ply"]], +- ["Control Points Registration", # 8 +- os.path.join(OPENMVG_BIN, "ui_openMVG_control_points_registration"), +- ["-i", "%reconstruction_dir%/sfm_data.bin"]], +- ["Export to openMVS", # 9 +- os.path.join(OPENMVG_BIN, "openMVG_main_openMVG2openMVS"), +- ["-i", "%reconstruction_dir%/sfm_data.bin", "-o", "%mvs_dir%/scene.mvs", "-d", "%mvs_dir%/images"]], +- ["Densify point cloud", # 10 +- os.path.join(OPENMVS_BIN, "DensifyPointCloud"), +- ["scene.mvs", "--dense-config-file", "Densify.ini", "--resolution-level", "1", "-w", "%mvs_dir%"]], +- ["Reconstruct the mesh", # 11 +- os.path.join(OPENMVS_BIN, "ReconstructMesh"), +- ["scene_dense.mvs", "-w", "%mvs_dir%"]], +- ["Refine the mesh", # 12 +- os.path.join(OPENMVS_BIN, "RefineMesh"), +- ["scene_dense_mesh.mvs", "--scales", "2", "-w", "%mvs_dir%"]], +- ["Texture the mesh", # 13 +- os.path.join(OPENMVS_BIN, "TextureMesh"), +- ["scene_dense_mesh_refine.mvs", "--decimate", "0.5", "-w", "%mvs_dir%"]], +- ["Estimate disparity-maps", # 14 +- os.path.join(OPENMVS_BIN, "DensifyPointCloud"), +- ["scene.mvs", "--dense-config-file", "Densify.ini", "--fusion-mode", "-1", "-w", "%mvs_dir%"]], +- ["Fuse disparity-maps", # 15 +- os.path.join(OPENMVS_BIN, "DensifyPointCloud"), +- ["scene.mvs", "--dense-config-file", "Densify.ini", "--fusion-mode", "-2", "-w", "%mvs_dir%"]] +- ] +- +- def __getitem__(self, indice): +- return AStep(*self.steps_data[indice]) +- +- def length(self): +- return len(self.steps_data) +- +- def apply_conf(self, conf): +- """ replace each %var% per conf.var value in steps data """ +- for s in self.steps_data: +- o2 = [] +- for o in s[2]: +- co = o.replace("%input_dir%", conf.input_dir) +- co = co.replace("%output_dir%", conf.output_dir) +- co = co.replace("%matches_dir%", conf.matches_dir) +- co = co.replace("%reconstruction_dir%", conf.reconstruction_dir) +- co = co.replace("%mvs_dir%", conf.mvs_dir) +- co = co.replace("%camera_file_params%", conf.camera_file_params) +- o2.append(co) +- s[2] = o2 +- +- +-CONF = ConfContainer() +-STEPS = StepsStore() +- +-# ARGS +-parser = argparse.ArgumentParser( +- formatter_class=argparse.RawTextHelpFormatter, +- description="Photogrammetry reconstruction with these steps: \r\n" + +- "\r\n".join(("\t%i. %s\t %s" % (t, STEPS[t].info, STEPS[t].cmd) for t in range(STEPS.length()))) +- ) +-parser.add_argument('input_dir', +- help="the directory wich contains the pictures set.") +-parser.add_argument('output_dir', +- help="the directory wich will contain the resulting files.") +-parser.add_argument('--steps', +- type=int, +- nargs="+", +- help="steps to process") +-parser.add_argument('--preset', +- help="steps list preset in \r\n" + +- " \r\n".join([k + " = " + str(PRESET[k]) for k in PRESET]) + +- " \r\ndefault : " + PRESET_DEFAULT) +- +-group = parser.add_argument_group('Passthrough', description="Option to be passed to command lines (remove - in front of option names)\r\ne.g. --1 p ULTRA to use the ULTRA preset in openMVG_main_ComputeFeatures") +-for n in range(STEPS.length()): +- group.add_argument('--'+str(n), nargs='+') +- +-parser.parse_args(namespace=CONF) # store args in the ConfContainer +- +-# FOLDERS +- +-def mkdir_ine(dirname): +- """Create the folder if not presents""" +- if not os.path.exists(dirname): +- os.mkdir(dirname) +- +-# Absolute path for input and ouput dirs +-CONF.input_dir = os.path.abspath(CONF.input_dir) +-CONF.output_dir = os.path.abspath(CONF.output_dir) +- +-if not os.path.exists(CONF.input_dir): +- sys.exit("%s: path not found" % CONF.input_dir) +- +-CONF.reconstruction_dir = os.path.join(CONF.output_dir, "sfm") +-CONF.matches_dir = os.path.join(CONF.reconstruction_dir, "matches") +-CONF.mvs_dir = os.path.join(CONF.output_dir, "mvs") +-CONF.camera_file_params = os.path.join(CAMERA_SENSOR_DB_DIRECTORY, CAMERA_SENSOR_DB_FILE) +- +-mkdir_ine(CONF.output_dir) +-mkdir_ine(CONF.reconstruction_dir) +-mkdir_ine(CONF.matches_dir) +-mkdir_ine(CONF.mvs_dir) +- +-# Update directories in steps commandlines +-STEPS.apply_conf(CONF) +- +-# PRESET +-if CONF.steps and CONF.preset: +- sys.exit("Steps and preset arguments can't be set together.") +-elif CONF.preset: +- try: +- CONF.steps = PRESET[CONF.preset] +- except KeyError: +- sys.exit("Unkown preset %s, choose %s" % (CONF.preset, ' or '.join([s for s in PRESET]))) +-elif not CONF.steps: +- CONF.steps = PRESET[PRESET_DEFAULT] +- +-# WALK +-print("# Using input dir: %s" % CONF.input_dir) +-print("# output dir: %s" % CONF.output_dir) +-print("# Steps: %s" % str(CONF.steps)) +- +-if 2 in CONF.steps: # ComputeMatches +- if 4 in CONF.steps: # GlobalReconstruction +- # Set the geometric_model of ComputeMatches to Essential +- STEPS[2].opt.extend(["-g", "e"]) +- +-for cstep in CONF.steps: +- printout("#%i. %s" % (cstep, STEPS[cstep].info), effect=INVERSE) +- +- # Retrieve "passthrough" commandline options +- opt = getattr(CONF, str(cstep)) +- if opt: +- # add - sign to short options and -- to long ones +- for o in range(0, len(opt), 2): +- if len(opt[o]) > 1: +- opt[o] = '-' + opt[o] +- opt[o] = '-' + opt[o] +- else: +- opt = [] +- +- # Remove STEPS[cstep].opt options now defined in opt +- for anOpt in STEPS[cstep].opt: +- if anOpt in opt: +- idx = STEPS[cstep].opt.index(anOpt) +- if DEBUG: +- print('#\tRemove ' + str(anOpt) + ' from defaults options at id ' + str(idx)) +- del STEPS[cstep].opt[idx:idx+2] +- +- # create a commandline for the current step +- cmdline = [STEPS[cstep].cmd] + STEPS[cstep].opt + opt +- print('Cmd: ' + ' '.join(cmdline)) +- +- if not DEBUG: +- # Launch the current step +- try: +- pStep = subprocess.Popen(cmdline) +- pStep.wait() +- if pStep.returncode != 0: +- break +- except KeyboardInterrupt: +- sys.exit('\r\nProcess canceled by user, all files remains') +- else: +- print('\t'.join(cmdline)) +- +-printout("# Pipeline end #", effect=INVERSE) ++#!/usr/bin/python3 ++# -*- encoding: utf-8 -*- ++# ++# Created by @FlachyJoe ++""" ++This script is for an easy use of OpenMVG and OpenMVS ++ ++usage: MvgMvs_Pipeline.py [-h] [--steps STEPS [STEPS ...]] [--preset PRESET] ++ [--0 0 [0 ...]] [--1 1 [1 ...]] [--2 2 [2 ...]] ++ [--3 3 [3 ...]] [--4 4 [4 ...]] [--5 5 [5 ...]] ++ [--6 6 [6 ...]] [--7 7 [7 ...]] [--8 8 [8 ...]] ++ [--9 9 [9 ...]] [--10 10 [10 ...]] [--11 11 [11 ...]] ++ [--12 12 [12 ...]] [--13 13 [13 ...]] ++ [--14 14 [14 ...]] [--15 15 [15 ...]] ++ input_dir output_dir ++ ++Photogrammetry reconstruction with these steps: ++ 0. Intrinsics analysis openMVG_main_SfMInit_ImageListing ++ 1. Compute features openMVG_main_ComputeFeatures ++ 2. Compute matches openMVG_main_ComputeMatches ++ 3. Incremental reconstruction openMVG_main_IncrementalSfM ++ 4. Global reconstruction openMVG_main_GlobalSfM ++ 5. Colorize Structure openMVG_main_ComputeSfM_DataColor ++ 6. Structure from Known Poses openMVG_main_ComputeStructureFromKnownPoses ++ 7. Colorized robust triangulation openMVG_main_ComputeSfM_DataColor ++ 8. Control Points Registration ui_openMVG_control_points_registration ++ 9. Export to openMVS openMVG_main_openMVG2openMVS ++ 10. Densify point-cloud DensifyPointCloud ++ 11. Reconstruct the mesh ReconstructMesh ++ 12. Refine the mesh RefineMesh ++ 13. Texture the mesh TextureMesh ++ 14. Estimate disparity-maps DensifyPointCloud ++ 15. Fuse disparity-maps DensifyPointCloud ++ ++positional arguments: ++ input_dir the directory wich contains the pictures set. ++ output_dir the directory wich will contain the resulting files. ++ ++optional arguments: ++ -h, --help show this help message and exit ++ --steps STEPS [STEPS ...] steps to process ++ --preset PRESET steps list preset in ++ SEQUENTIAL = [0, 1, 2, 3, 9, 10, 11, 12, 13] ++ GLOBAL = [0, 1, 2, 4, 9, 10, 11, 12, 13] ++ MVG_SEQ = [0, 1, 2, 3, 5, 6, 7] ++ MVG_GLOBAL = [0, 1, 2, 4, 5, 6, 7] ++ MVS_SGM = [14, 15] ++ default : SEQUENTIAL ++ ++Passthrough: ++ Option to be passed to command lines (remove - in front of option names) ++ e.g. --1 p ULTRA to use the ULTRA preset in openMVG_main_ComputeFeatures ++""" ++ ++import os ++import subprocess ++import sys ++import argparse ++ ++DEBUG = False ++ ++# add current directory to PATH ++if sys.platform.startswith('win'): ++ path_delim = ';' ++else: ++ path_delim = ':' ++os.environ['PATH'] += path_delim + os.getcwd() ++ ++ ++def whereis(afile): ++ """ ++ return directory in which afile is, None if not found. Look in PATH ++ """ ++ if sys.platform.startswith('win'): ++ cmd = "where" ++ else: ++ cmd = "which" ++ try: ++ ret = subprocess.run([cmd, afile], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True) ++ return os.path.split(ret.stdout.decode())[0] ++ except subprocess.CalledProcessError: ++ return None ++ ++def find(afile): ++ """ ++ As whereis look only for executable on linux, this find look for all file type ++ """ ++ for d in os.environ['PATH'].split(path_delim): ++ if os.path.isfile(os.path.join(d, afile)): ++ return d ++ return None ++ ++# Try to find openMVG and openMVS binaries in PATH ++OPENMVG_BIN = "@OPENMVG_TOOLS_PATH@" ++OPENMVS_BIN = "@OPENMVS_TOOLS_PATH@" ++ ++# Try to find openMVG camera sensor database ++CAMERA_SENSOR_DB_FILE = "@SENSOR_WIDTH_CAMERA_DATABASE_TXT_PATH@" ++CAMERA_SENSOR_DB_DIRECTORY = "@OPENMVG_TOOLS_PATH@" ++ ++# Ask user for openMVG and openMVS directories if not found ++if not OPENMVG_BIN: ++ OPENMVG_BIN = input("openMVG binary folder?\n") ++if not OPENMVS_BIN: ++ OPENMVS_BIN = input("openMVS binary folder?\n") ++if not CAMERA_SENSOR_DB_DIRECTORY: ++ CAMERA_SENSOR_DB_DIRECTORY = input("openMVG camera database (%s) folder?\n" % CAMERA_SENSOR_DB_FILE) ++ ++ ++PRESET = {'SEQUENTIAL': [0, 1, 2, 3, 9, 10, 11, 12, 13], ++ 'GLOBAL': [0, 1, 2, 4, 9, 10, 11, 12, 13], ++ 'MVG_SEQ': [0, 1, 2, 3, 5, 6, 7], ++ 'MVG_GLOBAL': [0, 1, 2, 4, 5, 6, 7], ++ 'MVS_SGM': [14, 15]} ++ ++PRESET_DEFAULT = 'SEQUENTIAL' ++ ++ ++# HELPERS for terminal colors ++BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8) ++NO_EFFECT, BOLD, UNDERLINE, BLINK, INVERSE, HIDDEN = (0, 1, 4, 5, 7, 8) ++ ++# from Python cookbook, #475186 ++def has_colours(stream): ++ ''' ++ Return stream colours capability ++ ''' ++ if not hasattr(stream, "isatty"): ++ return False ++ if not stream.isatty(): ++ return False # auto color only on TTYs ++ try: ++ import curses ++ curses.setupterm() ++ return curses.tigetnum("colors") > 2 ++ except Exception: ++ # guess false in case of error ++ return False ++ ++HAS_COLOURS = has_colours(sys.stdout) ++ ++ ++def printout(text, colour=WHITE, background=BLACK, effect=NO_EFFECT): ++ """ ++ print() with colour ++ """ ++ if HAS_COLOURS: ++ seq = "\x1b[%d;%d;%dm" % (effect, 30+colour, 40+background) + text + "\x1b[0m" ++ sys.stdout.write(seq+'\r\n') ++ else: ++ sys.stdout.write(text+'\r\n') ++ ++ ++# OBJECTS to store config and data in ++class ConfContainer: ++ """ ++ Container for all the config variables ++ """ ++ def __init__(self): ++ pass ++ ++ ++class AStep: ++ def __init__(self, info, cmd, opt): ++ self.info = info ++ self.cmd = cmd ++ self.opt = opt ++ ++ ++class StepsStore: ++ def __init__(self): ++ self.steps_data = [ ++ ["Intrinsics analysis", # 0 ++ os.path.join(OPENMVG_BIN, "openMVG_main_SfMInit_ImageListing"), ++ ["-i", "%input_dir%", "-o", "%matches_dir%", "-d", "%camera_file_params%"]], ++ ["Compute features", # 1 ++ os.path.join(OPENMVG_BIN, "openMVG_main_ComputeFeatures"), ++ ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-m", "SIFT"]], ++ ["Compute matches", # 2 ++ os.path.join(OPENMVG_BIN, "openMVG_main_ComputeMatches"), ++ ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-n", "AUTO", "-r", ".8"]], ++ ["Incremental reconstruction", # 3 ++ os.path.join(OPENMVG_BIN, "openMVG_main_IncrementalSfM"), ++ ["-i", "%matches_dir%/sfm_data.json", "-m", "%matches_dir%", "-o", "%reconstruction_dir%"]], ++ ["Global reconstruction", # 4 ++ os.path.join(OPENMVG_BIN, "openMVG_main_GlobalSfM"), ++ ["-i", "%matches_dir%/sfm_data.json", "-m", "%matches_dir%", "-o", "%reconstruction_dir%"]], ++ ["Colorize Structure", # 5 ++ os.path.join(OPENMVG_BIN, "openMVG_main_ComputeSfM_DataColor"), ++ ["-i", "%reconstruction_dir%/sfm_data.bin", "-o", "%reconstruction_dir%/colorized.ply"]], ++ ["Structure from Known Poses", # 6 ++ os.path.join(OPENMVG_BIN, "openMVG_main_ComputeStructureFromKnownPoses"), ++ ["-i", "%reconstruction_dir%/sfm_data.bin", "-m", "%matches_dir%", "-f", "%matches_dir%/matches.f.bin", "-o", "%reconstruction_dir%/robust.bin"]], ++ ["Colorized robust triangulation", # 7 ++ os.path.join(OPENMVG_BIN, "openMVG_main_ComputeSfM_DataColor"), ++ ["-i", "%reconstruction_dir%/robust.bin", "-o", "%reconstruction_dir%/robust_colorized.ply"]], ++ ["Control Points Registration", # 8 ++ os.path.join(OPENMVG_BIN, "ui_openMVG_control_points_registration"), ++ ["-i", "%reconstruction_dir%/sfm_data.bin"]], ++ ["Export to openMVS", # 9 ++ os.path.join(OPENMVG_BIN, "openMVG_main_openMVG2openMVS"), ++ ["-i", "%reconstruction_dir%/sfm_data.bin", "-o", "%mvs_dir%/scene.mvs", "-d", "%mvs_dir%/images"]], ++ ["Densify point cloud", # 10 ++ os.path.join(OPENMVS_BIN, "DensifyPointCloud"), ++ ["scene.mvs", "--dense-config-file", "Densify.ini", "--resolution-level", "1", "-w", "%mvs_dir%"]], ++ ["Reconstruct the mesh", # 11 ++ os.path.join(OPENMVS_BIN, "ReconstructMesh"), ++ ["scene_dense.mvs", "-w", "%mvs_dir%"]], ++ ["Refine the mesh", # 12 ++ os.path.join(OPENMVS_BIN, "RefineMesh"), ++ ["scene_dense_mesh.mvs", "--scales", "2", "-w", "%mvs_dir%"]], ++ ["Texture the mesh", # 13 ++ os.path.join(OPENMVS_BIN, "TextureMesh"), ++ ["scene_dense_mesh_refine.mvs", "--decimate", "0.5", "-w", "%mvs_dir%"]], ++ ["Estimate disparity-maps", # 14 ++ os.path.join(OPENMVS_BIN, "DensifyPointCloud"), ++ ["scene.mvs", "--dense-config-file", "Densify.ini", "--fusion-mode", "-1", "-w", "%mvs_dir%"]], ++ ["Fuse disparity-maps", # 15 ++ os.path.join(OPENMVS_BIN, "DensifyPointCloud"), ++ ["scene.mvs", "--dense-config-file", "Densify.ini", "--fusion-mode", "-2", "-w", "%mvs_dir%"]] ++ ] ++ ++ def __getitem__(self, indice): ++ return AStep(*self.steps_data[indice]) ++ ++ def length(self): ++ return len(self.steps_data) ++ ++ def apply_conf(self, conf): ++ """ replace each %var% per conf.var value in steps data """ ++ for s in self.steps_data: ++ o2 = [] ++ for o in s[2]: ++ co = o.replace("%input_dir%", conf.input_dir) ++ co = co.replace("%output_dir%", conf.output_dir) ++ co = co.replace("%matches_dir%", conf.matches_dir) ++ co = co.replace("%reconstruction_dir%", conf.reconstruction_dir) ++ co = co.replace("%mvs_dir%", conf.mvs_dir) ++ co = co.replace("%camera_file_params%", conf.camera_file_params) ++ o2.append(co) ++ s[2] = o2 ++ ++ ++CONF = ConfContainer() ++STEPS = StepsStore() ++ ++# ARGS ++parser = argparse.ArgumentParser( ++ formatter_class=argparse.RawTextHelpFormatter, ++ description="Photogrammetry reconstruction with these steps: \r\n" + ++ "\r\n".join(("\t%i. %s\t %s" % (t, STEPS[t].info, STEPS[t].cmd) for t in range(STEPS.length()))) ++ ) ++parser.add_argument('input_dir', ++ help="the directory wich contains the pictures set.") ++parser.add_argument('output_dir', ++ help="the directory wich will contain the resulting files.") ++parser.add_argument('--steps', ++ type=int, ++ nargs="+", ++ help="steps to process") ++parser.add_argument('--preset', ++ help="steps list preset in \r\n" + ++ " \r\n".join([k + " = " + str(PRESET[k]) for k in PRESET]) + ++ " \r\ndefault : " + PRESET_DEFAULT) ++ ++group = parser.add_argument_group('Passthrough', description="Option to be passed to command lines (remove - in front of option names)\r\ne.g. --1 p ULTRA to use the ULTRA preset in openMVG_main_ComputeFeatures") ++for n in range(STEPS.length()): ++ group.add_argument('--'+str(n), nargs='+') ++ ++parser.parse_args(namespace=CONF) # store args in the ConfContainer ++ ++# FOLDERS ++ ++def mkdir_ine(dirname): ++ """Create the folder if not presents""" ++ if not os.path.exists(dirname): ++ os.mkdir(dirname) ++ ++# Absolute path for input and ouput dirs ++CONF.input_dir = os.path.abspath(CONF.input_dir) ++CONF.output_dir = os.path.abspath(CONF.output_dir) ++ ++if not os.path.exists(CONF.input_dir): ++ sys.exit("%s: path not found" % CONF.input_dir) ++ ++CONF.reconstruction_dir = os.path.join(CONF.output_dir, "sfm") ++CONF.matches_dir = os.path.join(CONF.reconstruction_dir, "matches") ++CONF.mvs_dir = os.path.join(CONF.output_dir, "mvs") ++CONF.camera_file_params = os.path.join(CAMERA_SENSOR_DB_DIRECTORY, CAMERA_SENSOR_DB_FILE) ++ ++mkdir_ine(CONF.output_dir) ++mkdir_ine(CONF.reconstruction_dir) ++mkdir_ine(CONF.matches_dir) ++mkdir_ine(CONF.mvs_dir) ++ ++# Update directories in steps commandlines ++STEPS.apply_conf(CONF) ++ ++# PRESET ++if CONF.steps and CONF.preset: ++ sys.exit("Steps and preset arguments can't be set together.") ++elif CONF.preset: ++ try: ++ CONF.steps = PRESET[CONF.preset] ++ except KeyError: ++ sys.exit("Unkown preset %s, choose %s" % (CONF.preset, ' or '.join([s for s in PRESET]))) ++elif not CONF.steps: ++ CONF.steps = PRESET[PRESET_DEFAULT] ++ ++# WALK ++print("# Using input dir: %s" % CONF.input_dir) ++print("# output dir: %s" % CONF.output_dir) ++print("# Steps: %s" % str(CONF.steps)) ++ ++if 2 in CONF.steps: # ComputeMatches ++ if 4 in CONF.steps: # GlobalReconstruction ++ # Set the geometric_model of ComputeMatches to Essential ++ STEPS[2].opt.extend(["-g", "e"]) ++ ++for cstep in CONF.steps: ++ printout("#%i. %s" % (cstep, STEPS[cstep].info), effect=INVERSE) ++ ++ # Retrieve "passthrough" commandline options ++ opt = getattr(CONF, str(cstep)) ++ if opt: ++ # add - sign to short options and -- to long ones ++ for o in range(0, len(opt), 2): ++ if len(opt[o]) > 1: ++ opt[o] = '-' + opt[o] ++ opt[o] = '-' + opt[o] ++ else: ++ opt = [] ++ ++ # Remove STEPS[cstep].opt options now defined in opt ++ for anOpt in STEPS[cstep].opt: ++ if anOpt in opt: ++ idx = STEPS[cstep].opt.index(anOpt) ++ if DEBUG: ++ print('#\tRemove ' + str(anOpt) + ' from defaults options at id ' + str(idx)) ++ del STEPS[cstep].opt[idx:idx+2] ++ ++ # create a commandline for the current step ++ cmdline = [STEPS[cstep].cmd] + STEPS[cstep].opt + opt ++ print('Cmd: ' + ' '.join(cmdline)) ++ ++ if not DEBUG: ++ # Launch the current step ++ try: ++ pStep = subprocess.Popen(cmdline) ++ pStep.wait() ++ if pStep.returncode != 0: ++ break ++ except KeyboardInterrupt: ++ sys.exit('\r\nProcess canceled by user, all files remains') ++ else: ++ print('\t'.join(cmdline)) ++ ++printout("# Pipeline end #", effect=INVERSE) diff --git a/ports/openmvs/portfile.cmake b/ports/openmvs/portfile.cmake index 316031298cfb3b..5118e14482a266 100644 --- a/ports/openmvs/portfile.cmake +++ b/ports/openmvs/portfile.cmake @@ -9,6 +9,7 @@ vcpkg_from_github( PATCHES fix-tool-paths.patch fix-linux-build.patch + fix-tool-build.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS @@ -24,6 +25,10 @@ vcpkg_configure_cmake( -DINSTALL_CMAKE_DIR:STRING=share/openmvs -DINSTALL_BIN_DIR:STRING=bin -DINSTALL_LIB_DIR:STRING=lib + OPTIONS_RELEASE + -DOpenMVS_BUILD_TOOLS=ON + OPTIONS_DEBUG + -DOpenMVS_BUILD_TOOLS=OFF ) vcpkg_install_cmake() @@ -31,6 +36,15 @@ vcpkg_install_cmake() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) vcpkg_fixup_cmake_targets() +file(READ ${CURRENT_PACKAGES_DIR}/share/openmvs/OpenMVSTargets-release.cmake TARGETS_CMAKE) +string(REPLACE "bin/InterfaceCOLMAP.exe" "tools/openmvs/InterfaceCOLMAP.exe" TARGETS_CMAKE "${TARGETS_CMAKE}") +string(REPLACE "bin/InterfaceVisualSFM.exe" "tools/openmvs/InterfaceVisualSFM.exe" TARGETS_CMAKE "${TARGETS_CMAKE}") +string(REPLACE "bin/DensifyPointCloud.exe" "tools/openmvs/DensifyPointCloud.exe" TARGETS_CMAKE "${TARGETS_CMAKE}") +string(REPLACE "bin/ReconstructMesh.exe" "tools/openmvs/ReconstructMesh.exe" TARGETS_CMAKE "${TARGETS_CMAKE}") +string(REPLACE "bin/RefineMesh.exe" "tools/openmvs/RefineMesh.exe" TARGETS_CMAKE "${TARGETS_CMAKE}") +string(REPLACE "bin/TextureMesh.exe" "tools/openmvs/TextureMesh.exe" TARGETS_CMAKE "${TARGETS_CMAKE}") +string(REPLACE "bin/Viewer.exe" "tools/openmvs/Viewer.exe" TARGETS_CMAKE "${TARGETS_CMAKE}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/openmvs/OpenMVSTargets-release.cmake "${TARGETS_CMAKE}") vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES DensifyPointCloud From 5ca639bdf7e4f2cfe71770db7b9653da20dbc8f7 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Tue, 7 Jul 2020 12:28:13 +0200 Subject: [PATCH 09/61] [OpenMVS] improve usage for downstream projects --- ports/openmvs/CONTROL | 2 +- ports/openmvs/fix-tool-build.patch | 158 ++++++++++++++++++++++++++++- ports/openmvs/portfile.cmake | 15 ++- 3 files changed, 169 insertions(+), 6 deletions(-) diff --git a/ports/openmvs/CONTROL b/ports/openmvs/CONTROL index 677707b327e14f..1fd7baea1e52e6 100644 --- a/ports/openmvs/CONTROL +++ b/ports/openmvs/CONTROL @@ -2,7 +2,7 @@ Source: openmvs Version: 1.1-2 Description: OpenMVS: open Multi-View Stereo reconstruction library Homepage: https://cdcseacave.github.io/openMVS -Build-Depends: zlib, boost-iostreams, boost-program-options, boost-system, boost-serialization, eigen3, ceres, opencv, cgal[core], glew, glfw3, vcglib, openmvg[software], libpng, tiff +Build-Depends: zlib, boost-iostreams, boost-program-options, boost-system, boost-serialization, eigen3, opencv, cgal[core], glew, glfw3, vcglib, openmvg[software], libpng, tiff Feature: cuda Build-Depends: cuda diff --git a/ports/openmvs/fix-tool-build.patch b/ports/openmvs/fix-tool-build.patch index 6c8e4123d4ab31..e190042ea049af 100644 --- a/ports/openmvs/fix-tool-build.patch +++ b/ports/openmvs/fix-tool-build.patch @@ -95,10 +95,10 @@ index 7966ed5..b8dfb54 100644 install(FILES "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMVSConfig.cmake" diff --git a/build/OpenMVSConfig.cmake.in b/build/OpenMVSConfig.cmake.in -index 96b8fe2..4d4d590 100644 +index 96b8fe2..2dce8e7 100644 --- a/build/OpenMVSConfig.cmake.in +++ b/build/OpenMVSConfig.cmake.in -@@ -3,16 +3,37 @@ +@@ -3,16 +3,66 @@ # OpenMVS_INCLUDE_DIRS - include directories for OpenMVS # OpenMVS_LIBRARIES - libraries to link against # OpenMVS_BINARIES - the binaries @@ -108,27 +108,56 @@ index 96b8fe2..4d4d590 100644 get_filename_component(OpenMVS_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) set(OpenMVS_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@") - ++list(APPEND CMAKE_MODULE_PATH "${OpenMVS_CMAKE_DIR}") ++ ++if (MSVC) ++ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /GL") ++ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL") ++ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG") ++ set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG") ++endif() ++ +include(CMakeFindDependencyMacro) + +if(@OpenMVS_USE_OPENMP@) + find_dependency(OpenMP) ++ add_definitions(-D_USE_OPENMP) +endif() + +if(@OpenMVS_USE_OPENGL@) + find_dependency(OpenGL) ++ add_definitions(${OpenGL_DEFINITIONS} -D_USE_OPENGL) +endif() + +if(@OpenMVS_USE_CUDA@) + find_dependency(CUDA) ++ add_definitions(-D_USE_CUDA) ++ include_directories(${CUDA_INCLUDE_DIRS}) +endif() + +if(@OpenMVS_USE_BREAKPAD@) + find_dependency(BREAKPAD) ++ add_definitions(${BREAKPAD_DEFINITIONS} -D_USE_BREAKPAD) +endif() + +find_dependency(Boost) ++add_definitions(${Boost_DEFINITIONS} -D_USE_BOOST) +find_dependency(Eigen3) ++add_definitions(${EIGEN_DEFINITIONS} -D_USE_EIGEN) +find_dependency(OpenCV) ++add_definitions(${OpenCV_DEFINITIONS}) ++find_dependency(CGAL) ++add_definitions(${CGAL_DEFINITIONS}) ++ ++find_dependency(VCG REQUIRED) ++add_definitions(${VCG_DEFINITIONS}) ++ ++if(@OpenMVS_USE_CERES@) ++ find_dependency(Ceres) ++ add_definitions(${CERES_DEFINITIONS}) ++endif() ++ ++add_definitions(@OpenMVS_DEFINITIONS@) + # Our library dependencies (contains definitions for IMPORTED targets) if(NOT TARGET MVS AND NOT OpenMVS_BINARY_DIR) @@ -139,3 +168,128 @@ index 96b8fe2..4d4d590 100644 # These are IMPORTED targets created by OpenMVSTargets.cmake set(OpenMVS_LIBRARIES MVS) set(OpenMVS_BINARIES InterfaceVisualSFM DensifyPointCloud ReconstructMesh RefineMesh TextureMesh) +diff --git a/build/Utils.cmake b/build/Utils.cmake +index f41c9d8..b717a1f 100644 +--- a/build/Utils.cmake ++++ b/build/Utils.cmake +@@ -160,7 +160,7 @@ macro(GetOperatingSystemArchitectureBitness) + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES i686.*|i386.*|x86.*) + set(X86 1) + endif() +- ++ + if(NOT ${MY_VAR_PREFIX}_PACKAGE_REQUIRED) + set(${MY_VAR_PREFIX}_PACKAGE_REQUIRED "REQUIRED") + endif() +@@ -173,30 +173,6 @@ macro(ComposePackageLibSuffix) + set(PACKAGE_LIB_SUFFIX "") + set(PACKAGE_LIB_SUFFIX_DBG "") + set(PACKAGE_LIB_SUFFIX_REL "") +- if(MSVC) +- if("${MSVC_VERSION}" STREQUAL "1921") +- set(PACKAGE_LIB_SUFFIX "/vc16") +- elseif("${MSVC_VERSION}" STREQUAL "1916") +- set(PACKAGE_LIB_SUFFIX "/vc15") +- elseif("${MSVC_VERSION}" STREQUAL "1900") +- set(PACKAGE_LIB_SUFFIX "/vc14") +- elseif("${MSVC_VERSION}" STREQUAL "1800") +- set(PACKAGE_LIB_SUFFIX "/vc12") +- elseif("${MSVC_VERSION}" STREQUAL "1700") +- set(PACKAGE_LIB_SUFFIX "/vc11") +- elseif("${MSVC_VERSION}" STREQUAL "1600") +- set(PACKAGE_LIB_SUFFIX "/vc10") +- elseif("${MSVC_VERSION}" STREQUAL "1500") +- set(PACKAGE_LIB_SUFFIX "/vc9") +- endif() +- if("${SYSTEM_BITNESS}" STREQUAL "64") +- set(PACKAGE_LIB_SUFFIX "${PACKAGE_LIB_SUFFIX}/x64") +- else() +- set(PACKAGE_LIB_SUFFIX "${PACKAGE_LIB_SUFFIX}/x86") +- endif() +- set(PACKAGE_LIB_SUFFIX_DBG "${PACKAGE_LIB_SUFFIX}/Debug") +- set(PACKAGE_LIB_SUFFIX_REL "${PACKAGE_LIB_SUFFIX}/Release") +- endif() + endmacro() + + +@@ -511,7 +487,7 @@ macro(optimize_default_compiler_settings) + endif() + add_extra_compiler_option(-fdiagnostics-show-option) + add_extra_compiler_option(-ftemplate-backtrace-limit=0) +- ++ + # The -Wno-long-long is required in 64bit systems when including sytem headers. + if(X86_64) + add_extra_compiler_option(-Wno-long-long) +@@ -817,7 +793,7 @@ macro(ConfigCompilerAndLinker) + else() + set(cxx_rtti_support "${cxx_no_rtti_flags}") + endif() +- ++ + SET(cxx_default "${cxx_exception_support} ${cxx_rtti_support}" CACHE PATH "Common compile CXX flags") + SET(c_default "${CMAKE_C_FLAGS} ${cxx_base_flags}" CACHE PATH "Common compile C flags") + endmacro() +@@ -825,16 +801,12 @@ endmacro() + # Initialize variables needed for a library type project. + macro(ConfigLibrary) + # Offer the user the choice of overriding the installation directories +- set(INSTALL_LIB_DIR "lib/${PROJECT_NAME}" CACHE PATH "Installation directory for libraries") +- set(INSTALL_BIN_DIR "bin/${PROJECT_NAME}" CACHE PATH "Installation directory for executables") ++ set(INSTALL_LIB_DIR "lib" CACHE PATH "Installation directory for libraries") ++ set(INSTALL_BIN_DIR "bin" CACHE PATH "Installation directory for executables") + set(INSTALL_INCLUDE_DIR "include/${PROJECT_NAME}" CACHE PATH "Installation directory for header files") +- if(WIN32 AND NOT CYGWIN) +- set(DEF_INSTALL_CMAKE_DIR "CMake") +- else() +- set(DEF_INSTALL_CMAKE_DIR "lib/CMake/${PROJECT_NAME}") +- endif() ++ set(DEF_INSTALL_CMAKE_DIR "share/${PROJECT_NAME}") + set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files") +- ++ + # Make relative paths absolute (needed later on) + foreach(p LIB BIN INCLUDE CMAKE) + set(var INSTALL_${p}_DIR) +diff --git a/libs/MVS/CMakeLists.txt b/libs/MVS/CMakeLists.txt +index 14be620..0b9a315 100644 +--- a/libs/MVS/CMakeLists.txt ++++ b/libs/MVS/CMakeLists.txt +@@ -1,12 +1,12 @@ + # Find required packages +-FIND_PACKAGE(CGAL ${SYSTEM_PACKAGE_REQUIRED}) ++FIND_PACKAGE(CGAL REQUIRED) + if(CGAL_FOUND) + include_directories(${CGAL_INCLUDE_DIRS}) + add_definitions(${CGAL_DEFINITIONS}) + link_directories(${CGAL_LIBRARY_DIRS}) + endif() + +-FIND_PACKAGE(VCG ${SYSTEM_PACKAGE_REQUIRED}) ++FIND_PACKAGE(VCG REQUIRED) + if(VCG_FOUND) + include_directories(${VCG_INCLUDE_DIRS}) + add_definitions(${VCG_DEFINITIONS}) +@@ -14,12 +14,10 @@ endif() + + set(CERES_LIBS "") + if(OpenMVS_USE_CERES) +- FIND_PACKAGE(CERES) ++ FIND_PACKAGE(Ceres REQUIRED) + if(CERES_FOUND) + include_directories(${CERES_INCLUDE_DIRS}) + add_definitions(${CERES_DEFINITIONS}) +- else() +- set(OpenMVS_USE_CERES OFF) + endif() + endif() + +@@ -42,7 +40,7 @@ cxx_library_with_type_no_pch(MVS "Libs" "" "${cxx_default}" + set_target_pch(MVS Common.h) + + # Link its dependencies +-TARGET_LINK_LIBRARIES(MVS PRIVATE Common Math IO ${CERES_LIBS} ${CGAL_LIBS} ${CUDA_CUDA_LIBRARY}) ++TARGET_LINK_LIBRARIES(MVS PRIVATE Common Math IO ${CERES_LIBS} CGAL::CGAL ${CUDA_CUDA_LIBRARY}) + + # Install + SET_TARGET_PROPERTIES(MVS PROPERTIES diff --git a/ports/openmvs/portfile.cmake b/ports/openmvs/portfile.cmake index 5118e14482a266..38cb144e25cebe 100644 --- a/ports/openmvs/portfile.cmake +++ b/ports/openmvs/portfile.cmake @@ -17,14 +17,22 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS openmp OpenMVS_USE_OPENMP ) +file(REMOVE "${SOURCE_PATH}/build/Modules/FindCERES.cmake") +file(REMOVE "${SOURCE_PATH}/build/Modules/FindCGAL.cmake") +file(REMOVE "${SOURCE_PATH}/build/Modules/FindEIGEN.cmake") + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS ${FEATURE_OPTIONS} + -DOpenMVS_USE_NONFREE=ON + -DOpenMVS_USE_CERES=OFF + -DOpenMVS_USE_FAST_FLOAT2INT=ON + -DOpenMVS_USE_FAST_INVSQRT=OFF + -DOpenMVS_USE_FAST_CBRT=ON + -DOpenMVS_USE_SSE=ON + -DOpenMVS_USE_OPENGL=ON -DOpenMVS_USE_BREAKPAD=OFF - -DINSTALL_CMAKE_DIR:STRING=share/openmvs - -DINSTALL_BIN_DIR:STRING=bin - -DINSTALL_LIB_DIR:STRING=lib OPTIONS_RELEASE -DOpenMVS_BUILD_TOOLS=ON OPTIONS_DEBUG @@ -60,5 +68,6 @@ set(OPENMVG_TOOLS_PATH "${CURRENT_INSTALLED_DIR}/tools/openmvg") set(OPENMVS_TOOLS_PATH "${CURRENT_INSTALLED_DIR}/tools/${PORT}") set(SENSOR_WIDTH_CAMERA_DATABASE_TXT_PATH "${OPENMVG_TOOLS_PATH}/sensor_width_camera_database.txt") configure_file("${SOURCE_PATH}/MvgMvsPipeline.py.in" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/MvgMvsPipeline.py" @ONLY) +file(INSTALL "${SOURCE_PATH}/build/Modules/FindVCG.cmake" DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) From 16aada2ddb10f0c8e96e6ed84def73ff761051a2 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Tue, 7 Jul 2020 14:16:55 +0200 Subject: [PATCH 10/61] [OpenMVG] improve usage for downstream projects --- .../{fix-cmake.patch => build_fixes.patch} | 958 ++++++++++-------- ports/openmvg/fix-config-cmake.patch | 13 - ports/openmvg/fix-nullptr.patch | 13 - ports/openmvg/fix-tools-config.patch | 57 -- ports/openmvg/portfile.cmake | 5 +- 5 files changed, 538 insertions(+), 508 deletions(-) rename ports/openmvg/{fix-cmake.patch => build_fixes.patch} (76%) delete mode 100644 ports/openmvg/fix-config-cmake.patch delete mode 100644 ports/openmvg/fix-nullptr.patch delete mode 100644 ports/openmvg/fix-tools-config.patch diff --git a/ports/openmvg/fix-cmake.patch b/ports/openmvg/build_fixes.patch similarity index 76% rename from ports/openmvg/fix-cmake.patch rename to ports/openmvg/build_fixes.patch index fc84774c4608ff..ff897de9fea2ae 100644 --- a/ports/openmvg/fix-cmake.patch +++ b/ports/openmvg/build_fixes.patch @@ -1,421 +1,537 @@ -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 9cfd06c..a4dea06 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -14,6 +14,7 @@ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) - message(FATAL_ERROR "In-source builds not allowed.") - endif() - -+if(0) - # ============================================================================== - # OpenMVG build options - # ============================================================================== -@@ -31,7 +32,7 @@ option(OpenMVG_USE_OPENMP "Enable OpenMP parallelization" ON) - # and openMVG simultaneously - # ============================================================================== - option(OpenMVG_USE_OPENCV "Build or not opencv+openMVG samples programs" OFF) -- -+endif() - # ============================================================================== - # Since OpenCV 3, SIFT is no longer in the default modules. See - # https://github.com/itseez/opencv_contrib for more informations. -@@ -85,6 +86,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - register_definitions(-DOPENMVG_STD_UNORDERED_MAP) - endif() - -+if(0) - # ============================================================================== - # Check that submodule have been initialized and updated - # ============================================================================== -@@ -93,6 +95,7 @@ if (NOT EXISTS ${PROJECT_SOURCE_DIR}/dependencies/cereal/include) - "\n submodule(s) are missing, please update your repository:\n" - " > git submodule update -i\n") - endif() -+endif() - - # ============================================================================== - # Additional cmake find modules -@@ -128,7 +131,6 @@ if (OpenMVG_USE_OPENMP) - find_package(OpenMP) - if (OPENMP_FOUND) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") -- option(OpenMVG_USE_OPENMP "Use OpenMP for parallelization" ON) - register_definitions(-DOPENMVG_USE_OPENMP) - if (NOT MSVC) - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") -@@ -139,11 +141,6 @@ if (OpenMVG_USE_OPENMP) - endif() - endif (NOT MSVC) - endif (OPENMP_FOUND) --else (OpenMVG_USE_OPENMP) -- option(OpenMVG_USE_OPENMP "Use OpenMP for parallelization" OFF) -- include(UpdateCacheVariable) -- UPDATE_CACHE_VARIABLE(OpenMVG_USE_OPENMP OFF) -- remove_definitions(-DOPENMVG_USE_OPENMP) - endif (OpenMVG_USE_OPENMP) - - # ============================================================================== -@@ -182,6 +179,7 @@ if (OpenMVG_BUILD_OPENGL_EXAMPLES) - set_property(TARGET glfw PROPERTY FOLDER OpenMVG/3rdParty/glfw) - endif (OpenMVG_BUILD_OPENGL_EXAMPLES) - -+if(0) - # Dependencies install rules - install( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/ -@@ -189,7 +187,7 @@ install( - COMPONENT headers - FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h" - ) -- -+endif() - # ============================================================================== - # --END-- SUBMODULE CONFIGURATION - # ============================================================================== -@@ -225,6 +223,7 @@ ENDMACRO(UNIT_TEST) - # - external by default - # - internal if cereal not found - # ============================================================================== -+if(0) - find_package(cereal QUIET CONFIG) - if (NOT TARGET cereal) - add_library(cereal INTERFACE) -@@ -237,6 +236,10 @@ if (NOT TARGET cereal) - - set(OpenMVG_USE_INTERNAL_CEREAL ON) - endif() -+endif() -+ -+find_package(cereal REQUIRED CONFIG) -+get_target_property(CEREAL_INCLUDE_DIRS cereal INTERFACE_INCLUDE_DIRECTORIES) - - # ============================================================================== - # Eigen -@@ -245,6 +248,7 @@ endif() - # - external if EIGEN_INCLUDE_DIR_HINTS is defined - # - internal if Eigen not found - # ============================================================================== -+if(0) - find_package(Eigen3 QUIET) - if (NOT Eigen3_FOUND) - set(EIGEN_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/eigen) -@@ -253,13 +257,17 @@ if (NOT Eigen3_FOUND) - else() - set(EIGEN_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR}) - endif() -+endif() - -+find_package(Eigen3 REQUIRED) -+set(EIGEN_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR}) - # ============================================================================== - # Ceres - # ============================================================================== - # - external by default if CERES_DIR_HINTS or find_package found a valid Ceres - # - internal if ceres not found (ceres-solver+cxsparse+miniglog) - # ============================================================================== -+if(0) - find_package(Ceres QUIET HINTS ${CERES_DIR_HINTS}) - if (NOT Ceres_FOUND) - set(OpenMVG_USE_INTERNAL_CERES ON) -@@ -271,13 +279,16 @@ if (NOT Ceres_FOUND) - STRING(REGEX REPLACE "version ([0-9.]+).*" "\\1" CERES_VERSION ${CERES_CONFIG}) - set(CERES_LIBRARIES openMVG_ceres) - endif() -+endif() - -+find_package(Ceres REQUIRED) - # ============================================================================== - # Flann - # ============================================================================== - # - internal by default (flann), - # - external if FLANN_INCLUDE_DIR_HINTS and a valid Flann setup is found - # ============================================================================== -+if(0) - if (NOT DEFINED FLANN_INCLUDE_DIR_HINTS) - set(FLANN_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/flann/src/cpp) - set(OpenMVG_USE_INTERNAL_FLANN ON) -@@ -286,13 +297,16 @@ find_package(Flann QUIET) - if (NOT FLANN_FOUND OR OpenMVG_USE_INTERNAL_FLANN) - set(FLANN_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/flann/src/cpp) - endif() -+endif() - -+find_package(flann REQUIRED) - # ============================================================================== - # CoinUtils - # ============================================================================== - # - internal by default (CoinUtils), - # - external if COINUTILS_INCLUDE_DIR_HINTS and a valid CoinUtils setup is found - # ============================================================================== -+if(0) - if (NOT DEFINED COINUTILS_INCLUDE_DIR_HINTS) - set(COINUTILS_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/osi_clp/CoinUtils/src/) - set(OpenMVG_USE_INTERNAL_COINUTILS ON) -@@ -302,13 +316,16 @@ if (NOT DEFINED COINUTILS_INCLUDE_DIR_HINTS) - else() - find_package(CoinUtils QUIET) - endif() -+endif() - -+find_package(CoinUtils REQUIRED) - ## ============================================================================== - ## Clp - ## ============================================================================== - ## - internal by default (Clp), - ## - external if CLP_INCLUDE_DIR_HINTS and a valid Clp setup is found - ## ============================================================================== -+if(0) - if (NOT DEFINED CLP_INCLUDE_DIR_HINTS) - set(CLP_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/osi_clp/Clp/src/) - set(OpenMVG_USE_INTERNAL_CLP ON) -@@ -320,6 +337,9 @@ if (NOT DEFINED CLP_INCLUDE_DIR_HINTS) - else() - find_package(Clp QUIET) - endif() -+endif() -+ -+find_package(Clp REQUIRED) - - # ============================================================================== - # Osi -@@ -327,6 +347,7 @@ endif() - # - internal by default (Osi), - # - external if OSI_INCLUDE_DIR_HINTS and a valid Osi setup is found - # ============================================================================== -+if(0) - if (NOT DEFINED OSI_INCLUDE_DIR_HINTS) - set(OSI_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/osi_clp/Osi/src/) - set(OpenMVG_USE_INTERNAL_OSI ON) -@@ -336,6 +357,9 @@ if (NOT DEFINED OSI_INCLUDE_DIR_HINTS) - else() - find_package(Osi QUIET) - endif() -+endif() -+ -+find_package(Osi REQUIRED) - - # ============================================================================== - # Internal CLP/OSI/COINUTILS libraries: -@@ -354,6 +378,7 @@ endif() - # - internal by default (Lemon), - # - external if LEMON_INCLUDE_DIR_HINTS and a valid Lemon setup is found - # ============================================================================== -+if(0) - 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) -@@ -365,6 +390,9 @@ if (NOT LEMON_FOUND OR OpenMVG_USE_INTERNAL_LEMON) - ${PROJECT_BINARY_DIR}/third_party/lemon) - set(LEMON_LIBRARY openMVG_lemon) - endif() -+endif() -+ -+find_package(LEMON REQUIRED) - - # ============================================================================== - # OpenCV -@@ -372,15 +400,13 @@ endif() - # - only external and enabled only if OpenMVG_USE_OPENCV is set to ON - # ============================================================================== - if (OpenMVG_USE_OPENCV) -- find_package( OpenCV QUIET ) -- if (NOT OpenCV_FOUND OR OpenCV_VERSION VERSION_LESS "3.0.0") -- message(STATUS "OpenCV was not found (note that OpenCV version >= 3.0.0 is required). -> Disabling OpenCV support.") -- UPDATE_CACHE_VARIABLE(OpenMVG_USE_OPENCV OFF) -- UPDATE_CACHE_VARIABLE(OpenMVG_USE_OCVSIFT OFF) -- endif() -+ find_package( OpenCV REQUIRED ) - endif() - -- -+# ============================================================================== -+# Suitesparse -+# ============================================================================== -+find_package(suitesparse REQUIRED) - # ============================================================================== - # Third-party libraries: - # ============================================================================== -@@ -472,67 +498,67 @@ message("** Use OpenCV SIFT features: " ${OpenMVG_USE_OCVSIFT}) - - message("\n") - --if (DEFINED OpenMVG_USE_INTERNAL_CEREAL) -+if (OpenMVG_USE_INTERNAL_CEREAL) - message(STATUS "CEREAL: (internal)") - else() - message(STATUS "CEREAL: (external)") - endif() - --if (DEFINED OpenMVG_USE_INTERNAL_EIGEN) -+if (OpenMVG_USE_INTERNAL_EIGEN) - message(STATUS "EIGEN: " ${EIGEN_VERSION} " (internal)") - else() - message(STATUS "EIGEN: " ${EIGEN_VERSION} " (external)") - endif() - --if (DEFINED OpenMVG_USE_INTERNAL_CERES) -+if (OpenMVG_USE_INTERNAL_CERES) - message(STATUS "CERES: " ${CERES_VERSION} " (internal)") - else() - message(STATUS "CERES: " ${CERES_VERSION} " (external)") - endif() - --if (DEFINED OpenMVG_USE_INTERNAL_FLANN) -+if (OpenMVG_USE_INTERNAL_FLANN) - message(STATUS "FLANN: " ${FLANN_VERSION} " (internal)") - else() - message(STATUS "FLANN: " ${FLANN_VERSION} " (external)") - endif() - --if (DEFINED OpenMVG_USE_INTERNAL_TIFF) -+if (OpenMVG_USE_INTERNAL_TIFF) - message(STATUS "LIBTIFF: " ${TIFF_VERSION_STRING} " (internal)") - else() - message(STATUS "LIBTIFF: " ${TIFF_VERSION_STRING} " (external)") - endif() - --if (DEFINED OpenMVG_USE_INTERNAL_PNG) -+if (OpenMVG_USE_INTERNAL_PNG) - message(STATUS "LIBPNG: " ${PNG_VERSION_STRING} " (internal)") - else() - message(STATUS "LIBPNG: " ${PNG_VERSION_STRING} " (external)") - endif() - --if (DEFINED OpenMVG_USE_INTERNAL_JPEG) -+if (OpenMVG_USE_INTERNAL_JPEG) - message(STATUS "LIBJPEG (internal)") - else() - message(STATUS "LIBJPEG (external)") - endif() - --if (DEFINED OpenMVG_USE_INTERNAL_CLP) -+if (OpenMVG_USE_INTERNAL_CLP) - message(STATUS "CLP: " ${CLP_VERSION} " (internal)") - else() - message(STATUS "CLP: " ${CLP_VERSION} " (external)") - endif() - --if (DEFINED OpenMVG_USE_INTERNAL_COINUTILS) -+if (OpenMVG_USE_INTERNAL_COINUTILS) - message(STATUS "COINUTILS: " ${COINUTILS_VERSION} " (internal)") - else() - message(STATUS "COINUTILS: " ${COINUTILS_VERSION} " (external)") - endif() - --if (DEFINED OpenMVG_USE_INTERNAL_OSI) -+if (OpenMVG_USE_INTERNAL_OSI) - message(STATUS "OSI: " ${OSI_VERSION} " (internal)") - else() - message(STATUS "OSI: " ${OSI_VERSION} " (external)") - endif() - --if (DEFINED OpenMVG_USE_INTERNAL_LEMON) -+if (OpenMVG_USE_INTERNAL_LEMON) - message(STATUS "LEMON: " ${LEMON_VERSION} " (internal)") - else() - message(STATUS "LEMON: " ${LEMON_VERSION} " (external)") -diff --git a/src/cmakeFindModules/FindClp.cmake b/src/cmakeFindModules/FindClp.cmake -index 8a69c23..6a81580 100644 ---- a/src/cmakeFindModules/FindClp.cmake -+++ b/src/cmakeFindModules/FindClp.cmake -@@ -51,9 +51,8 @@ IF(EXISTS "${CLP_DIR}" AND NOT "${CLP_DIR}" STREQUAL "") - SET(CLP_INCLUDE_DIR ${CLP_DIR}) - - FIND_LIBRARY(CLP_LIBRARY NAMES Clp) -- FIND_LIBRARY(CLPSOLVER_LIBRARY NAMES ClpSolver) -- FIND_LIBRARY(OSICLP_LIBRARY NAMES OsiClp) -- -+ FIND_LIBRARY(CLPSOLVER_LIBRARY NAMES ClpSolver Clp) -+ FIND_LIBRARY(OSICLP_LIBRARY NAMES OsiClp Clp) - # locate Clp libraries - IF(DEFINED CLP_LIBRARY AND DEFINED CLPSOLVER_LIBRARY AND DEFINED OSICLP_LIBRARY) - SET(CLP_LIBRARIES ${CLP_LIBRARY} ${CLPSOLVER_LIBRARY} ${OSICLP_LIBRARY}) -diff --git a/src/openMVG/linearProgramming/CMakeLists.txt b/src/openMVG/linearProgramming/CMakeLists.txt -index cc5212f..acc57dd 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 -+ Coin::Clp # clp + solver wrapper -+ Coin::CoinUtils # container tools -+ Coin::Osi # generic LP - ) - - target_include_directories(openMVG_linearProgramming -- PRIVATE -- ${CLP_INCLUDE_DIRS} -- ${COINUTILS_INCLUDE_DIRS} -- ${OSI_INCLUDE_DIRS} - PUBLIC - $ - ) -diff --git a/src/openMVG/matching/CMakeLists.txt b/src/openMVG/matching/CMakeLists.txt -index 5fcd972..b21ea7b 100644 ---- a/src/openMVG/matching/CMakeLists.txt -+++ b/src/openMVG/matching/CMakeLists.txt -@@ -18,6 +18,7 @@ list(REMOVE_ITEM matching_files_cpp ${REMOVEFILESUNITTEST}) - - set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) -+find_package(flann REQUIRED) - - set_source_files_properties(${matching_files_cpp} PROPERTIES LANGUAGE CXX) - add_library(openMVG_matching -@@ -39,10 +40,10 @@ target_link_libraries(openMVG_matching - Threads::Threads - cereal - ) --if (NOT DEFINED OpenMVG_USE_INTERNAL_FLANN) -+if (NOT OpenMVG_USE_INTERNAL_FLANN) - target_link_libraries(openMVG_matching - PUBLIC -- ${FLANN_LIBRARIES} -+ flann::flann - ) - endif() - set_target_properties(openMVG_matching PROPERTIES SOVERSION ${OPENMVG_VERSION_MAJOR} VERSION "${OPENMVG_VERSION_MAJOR}.${OPENMVG_VERSION_MINOR}") -diff --git a/src/third_party/CMakeLists.txt b/src/third_party/CMakeLists.txt -index 816a941..f0b7145 100644 ---- a/src/third_party/CMakeLists.txt -+++ b/src/third_party/CMakeLists.txt -@@ -18,7 +18,7 @@ add_subdirectory(stlplus3) - set(STLPLUS_LIBRARY openMVG_stlplus PARENT_SCOPE) - - # Add graph library --if(DEFINED OpenMVG_USE_INTERNAL_LEMON) -+if(OpenMVG_USE_INTERNAL_LEMON) - add_subdirectory(lemon) - set_property(TARGET openMVG_lemon PROPERTY FOLDER OpenMVG/3rdParty/lemon) - set_property(TARGET check PROPERTY FOLDER OpenMVG/3rdParty/lemon) -@@ -68,7 +68,7 @@ endif (NOT TIFF_FOUND) - add_subdirectory(vectorGraphics) - - # Add ceres-solver (A Nonlinear Least Squares Minimizer) --if (DEFINED OpenMVG_USE_INTERNAL_CERES) -+if (OpenMVG_USE_INTERNAL_CERES) - add_subdirectory(cxsparse) - add_subdirectory(ceres-solver) - set_property(TARGET openMVG_cxsparse PROPERTY FOLDER OpenMVG/3rdParty/ceres) -@@ -76,7 +76,7 @@ if (DEFINED OpenMVG_USE_INTERNAL_CERES) - endif() - - # Add an Approximate Nearest Neighbor library --if (DEFINED OpenMVG_USE_INTERNAL_FLANN) -+if (OpenMVG_USE_INTERNAL_FLANN) - set(FLANN_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/openMVG/third_party/flann/src/cpp) - add_subdirectory(flann) - endif() -@@ -90,7 +90,7 @@ add_subdirectory(fast) - ## - # Install Header only libraries if necessary - ## --if (DEFINED OpenMVG_USE_INTERNAL_EIGEN) -+if (OpenMVG_USE_INTERNAL_EIGEN) - #Configure Eigen install - set(EIGEN_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/openMVG/third_party/eigen) - add_subdirectory(eigen) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 9cfd06c..a4dea06 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -14,6 +14,7 @@ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR "In-source builds not allowed.") + endif() + ++if(0) + # ============================================================================== + # OpenMVG build options + # ============================================================================== +@@ -31,7 +32,7 @@ option(OpenMVG_USE_OPENMP "Enable OpenMP parallelization" ON) + # and openMVG simultaneously + # ============================================================================== + option(OpenMVG_USE_OPENCV "Build or not opencv+openMVG samples programs" OFF) +- ++endif() + # ============================================================================== + # Since OpenCV 3, SIFT is no longer in the default modules. See + # https://github.com/itseez/opencv_contrib for more informations. +@@ -85,6 +86,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + register_definitions(-DOPENMVG_STD_UNORDERED_MAP) + endif() + ++if(0) + # ============================================================================== + # Check that submodule have been initialized and updated + # ============================================================================== +@@ -93,6 +95,7 @@ if (NOT EXISTS ${PROJECT_SOURCE_DIR}/dependencies/cereal/include) + "\n submodule(s) are missing, please update your repository:\n" + " > git submodule update -i\n") + endif() ++endif() + + # ============================================================================== + # Additional cmake find modules +@@ -128,7 +131,6 @@ if (OpenMVG_USE_OPENMP) + find_package(OpenMP) + if (OPENMP_FOUND) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") +- option(OpenMVG_USE_OPENMP "Use OpenMP for parallelization" ON) + register_definitions(-DOPENMVG_USE_OPENMP) + if (NOT MSVC) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +@@ -139,11 +141,6 @@ if (OpenMVG_USE_OPENMP) + endif() + endif (NOT MSVC) + endif (OPENMP_FOUND) +-else (OpenMVG_USE_OPENMP) +- option(OpenMVG_USE_OPENMP "Use OpenMP for parallelization" OFF) +- include(UpdateCacheVariable) +- UPDATE_CACHE_VARIABLE(OpenMVG_USE_OPENMP OFF) +- remove_definitions(-DOPENMVG_USE_OPENMP) + endif (OpenMVG_USE_OPENMP) + + # ============================================================================== +@@ -182,6 +179,7 @@ if (OpenMVG_BUILD_OPENGL_EXAMPLES) + set_property(TARGET glfw PROPERTY FOLDER OpenMVG/3rdParty/glfw) + endif (OpenMVG_BUILD_OPENGL_EXAMPLES) + ++if(0) + # Dependencies install rules + install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/ +@@ -189,7 +187,7 @@ install( + COMPONENT headers + FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h" + ) +- ++endif() + # ============================================================================== + # --END-- SUBMODULE CONFIGURATION + # ============================================================================== +@@ -225,6 +223,7 @@ ENDMACRO(UNIT_TEST) + # - external by default + # - internal if cereal not found + # ============================================================================== ++if(0) + find_package(cereal QUIET CONFIG) + if (NOT TARGET cereal) + add_library(cereal INTERFACE) +@@ -237,6 +236,10 @@ if (NOT TARGET cereal) + + set(OpenMVG_USE_INTERNAL_CEREAL ON) + endif() ++endif() ++ ++find_package(cereal REQUIRED CONFIG) ++get_target_property(CEREAL_INCLUDE_DIRS cereal INTERFACE_INCLUDE_DIRECTORIES) + + # ============================================================================== + # Eigen +@@ -245,6 +248,7 @@ endif() + # - external if EIGEN_INCLUDE_DIR_HINTS is defined + # - internal if Eigen not found + # ============================================================================== ++if(0) + find_package(Eigen3 QUIET) + if (NOT Eigen3_FOUND) + set(EIGEN_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/eigen) +@@ -253,13 +257,17 @@ if (NOT Eigen3_FOUND) + else() + set(EIGEN_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR}) + endif() ++endif() + ++find_package(Eigen3 REQUIRED) ++set(EIGEN_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR}) + # ============================================================================== + # Ceres + # ============================================================================== + # - external by default if CERES_DIR_HINTS or find_package found a valid Ceres + # - internal if ceres not found (ceres-solver+cxsparse+miniglog) + # ============================================================================== ++if(0) + find_package(Ceres QUIET HINTS ${CERES_DIR_HINTS}) + if (NOT Ceres_FOUND) + set(OpenMVG_USE_INTERNAL_CERES ON) +@@ -271,13 +279,16 @@ if (NOT Ceres_FOUND) + STRING(REGEX REPLACE "version ([0-9.]+).*" "\\1" CERES_VERSION ${CERES_CONFIG}) + set(CERES_LIBRARIES openMVG_ceres) + endif() ++endif() + ++find_package(Ceres REQUIRED) + # ============================================================================== + # Flann + # ============================================================================== + # - internal by default (flann), + # - external if FLANN_INCLUDE_DIR_HINTS and a valid Flann setup is found + # ============================================================================== ++if(0) + if (NOT DEFINED FLANN_INCLUDE_DIR_HINTS) + set(FLANN_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/flann/src/cpp) + set(OpenMVG_USE_INTERNAL_FLANN ON) +@@ -286,13 +297,16 @@ find_package(Flann QUIET) + if (NOT FLANN_FOUND OR OpenMVG_USE_INTERNAL_FLANN) + set(FLANN_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/flann/src/cpp) + endif() ++endif() + ++find_package(flann REQUIRED) + # ============================================================================== + # CoinUtils + # ============================================================================== + # - internal by default (CoinUtils), + # - external if COINUTILS_INCLUDE_DIR_HINTS and a valid CoinUtils setup is found + # ============================================================================== ++if(0) + if (NOT DEFINED COINUTILS_INCLUDE_DIR_HINTS) + set(COINUTILS_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/osi_clp/CoinUtils/src/) + set(OpenMVG_USE_INTERNAL_COINUTILS ON) +@@ -302,13 +316,16 @@ if (NOT DEFINED COINUTILS_INCLUDE_DIR_HINTS) + else() + find_package(CoinUtils QUIET) + endif() ++endif() + ++find_package(CoinUtils REQUIRED) + ## ============================================================================== + ## Clp + ## ============================================================================== + ## - internal by default (Clp), + ## - external if CLP_INCLUDE_DIR_HINTS and a valid Clp setup is found + ## ============================================================================== ++if(0) + if (NOT DEFINED CLP_INCLUDE_DIR_HINTS) + set(CLP_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/osi_clp/Clp/src/) + set(OpenMVG_USE_INTERNAL_CLP ON) +@@ -320,6 +337,9 @@ if (NOT DEFINED CLP_INCLUDE_DIR_HINTS) + else() + find_package(Clp QUIET) + endif() ++endif() ++ ++find_package(Clp REQUIRED) + + # ============================================================================== + # Osi +@@ -327,6 +347,7 @@ endif() + # - internal by default (Osi), + # - external if OSI_INCLUDE_DIR_HINTS and a valid Osi setup is found + # ============================================================================== ++if(0) + if (NOT DEFINED OSI_INCLUDE_DIR_HINTS) + set(OSI_INCLUDE_DIR_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/osi_clp/Osi/src/) + set(OpenMVG_USE_INTERNAL_OSI ON) +@@ -336,6 +357,9 @@ if (NOT DEFINED OSI_INCLUDE_DIR_HINTS) + else() + find_package(Osi QUIET) + endif() ++endif() ++ ++find_package(Osi REQUIRED) + + # ============================================================================== + # Internal CLP/OSI/COINUTILS libraries: +@@ -354,6 +378,7 @@ endif() + # - internal by default (Lemon), + # - external if LEMON_INCLUDE_DIR_HINTS and a valid Lemon setup is found + # ============================================================================== ++if(0) + 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) +@@ -365,6 +390,9 @@ if (NOT LEMON_FOUND OR OpenMVG_USE_INTERNAL_LEMON) + ${PROJECT_BINARY_DIR}/third_party/lemon) + set(LEMON_LIBRARY openMVG_lemon) + endif() ++endif() ++ ++find_package(LEMON REQUIRED) + + # ============================================================================== + # OpenCV +@@ -372,15 +400,13 @@ endif() + # - only external and enabled only if OpenMVG_USE_OPENCV is set to ON + # ============================================================================== + if (OpenMVG_USE_OPENCV) +- find_package( OpenCV QUIET ) +- if (NOT OpenCV_FOUND OR OpenCV_VERSION VERSION_LESS "3.0.0") +- message(STATUS "OpenCV was not found (note that OpenCV version >= 3.0.0 is required). -> Disabling OpenCV support.") +- UPDATE_CACHE_VARIABLE(OpenMVG_USE_OPENCV OFF) +- UPDATE_CACHE_VARIABLE(OpenMVG_USE_OCVSIFT OFF) +- endif() ++ find_package( OpenCV REQUIRED ) + endif() + +- ++# ============================================================================== ++# Suitesparse ++# ============================================================================== ++find_package(suitesparse REQUIRED) + # ============================================================================== + # Third-party libraries: + # ============================================================================== +@@ -472,67 +498,67 @@ message("** Use OpenCV SIFT features: " ${OpenMVG_USE_OCVSIFT}) + + message("\n") + +-if (DEFINED OpenMVG_USE_INTERNAL_CEREAL) ++if (OpenMVG_USE_INTERNAL_CEREAL) + message(STATUS "CEREAL: (internal)") + else() + message(STATUS "CEREAL: (external)") + endif() + +-if (DEFINED OpenMVG_USE_INTERNAL_EIGEN) ++if (OpenMVG_USE_INTERNAL_EIGEN) + message(STATUS "EIGEN: " ${EIGEN_VERSION} " (internal)") + else() + message(STATUS "EIGEN: " ${EIGEN_VERSION} " (external)") + endif() + +-if (DEFINED OpenMVG_USE_INTERNAL_CERES) ++if (OpenMVG_USE_INTERNAL_CERES) + message(STATUS "CERES: " ${CERES_VERSION} " (internal)") + else() + message(STATUS "CERES: " ${CERES_VERSION} " (external)") + endif() + +-if (DEFINED OpenMVG_USE_INTERNAL_FLANN) ++if (OpenMVG_USE_INTERNAL_FLANN) + message(STATUS "FLANN: " ${FLANN_VERSION} " (internal)") + else() + message(STATUS "FLANN: " ${FLANN_VERSION} " (external)") + endif() + +-if (DEFINED OpenMVG_USE_INTERNAL_TIFF) ++if (OpenMVG_USE_INTERNAL_TIFF) + message(STATUS "LIBTIFF: " ${TIFF_VERSION_STRING} " (internal)") + else() + message(STATUS "LIBTIFF: " ${TIFF_VERSION_STRING} " (external)") + endif() + +-if (DEFINED OpenMVG_USE_INTERNAL_PNG) ++if (OpenMVG_USE_INTERNAL_PNG) + message(STATUS "LIBPNG: " ${PNG_VERSION_STRING} " (internal)") + else() + message(STATUS "LIBPNG: " ${PNG_VERSION_STRING} " (external)") + endif() + +-if (DEFINED OpenMVG_USE_INTERNAL_JPEG) ++if (OpenMVG_USE_INTERNAL_JPEG) + message(STATUS "LIBJPEG (internal)") + else() + message(STATUS "LIBJPEG (external)") + endif() + +-if (DEFINED OpenMVG_USE_INTERNAL_CLP) ++if (OpenMVG_USE_INTERNAL_CLP) + message(STATUS "CLP: " ${CLP_VERSION} " (internal)") + else() + message(STATUS "CLP: " ${CLP_VERSION} " (external)") + endif() + +-if (DEFINED OpenMVG_USE_INTERNAL_COINUTILS) ++if (OpenMVG_USE_INTERNAL_COINUTILS) + message(STATUS "COINUTILS: " ${COINUTILS_VERSION} " (internal)") + else() + message(STATUS "COINUTILS: " ${COINUTILS_VERSION} " (external)") + endif() + +-if (DEFINED OpenMVG_USE_INTERNAL_OSI) ++if (OpenMVG_USE_INTERNAL_OSI) + message(STATUS "OSI: " ${OSI_VERSION} " (internal)") + else() + message(STATUS "OSI: " ${OSI_VERSION} " (external)") + endif() + +-if (DEFINED OpenMVG_USE_INTERNAL_LEMON) ++if (OpenMVG_USE_INTERNAL_LEMON) + message(STATUS "LEMON: " ${LEMON_VERSION} " (internal)") + else() + message(STATUS "LEMON: " ${LEMON_VERSION} " (external)") +diff --git a/src/cmakeFindModules/FindClp.cmake b/src/cmakeFindModules/FindClp.cmake +index 8a69c23..6a81580 100644 +--- a/src/cmakeFindModules/FindClp.cmake ++++ b/src/cmakeFindModules/FindClp.cmake +@@ -51,9 +51,8 @@ IF(EXISTS "${CLP_DIR}" AND NOT "${CLP_DIR}" STREQUAL "") + SET(CLP_INCLUDE_DIR ${CLP_DIR}) + + FIND_LIBRARY(CLP_LIBRARY NAMES Clp) +- FIND_LIBRARY(CLPSOLVER_LIBRARY NAMES ClpSolver) +- FIND_LIBRARY(OSICLP_LIBRARY NAMES OsiClp) +- ++ FIND_LIBRARY(CLPSOLVER_LIBRARY NAMES ClpSolver Clp) ++ FIND_LIBRARY(OSICLP_LIBRARY NAMES OsiClp Clp) + # locate Clp libraries + IF(DEFINED CLP_LIBRARY AND DEFINED CLPSOLVER_LIBRARY AND DEFINED OSICLP_LIBRARY) + SET(CLP_LIBRARIES ${CLP_LIBRARY} ${CLPSOLVER_LIBRARY} ${OSICLP_LIBRARY}) +diff --git a/src/cmakeFindModules/OpenMVGConfig.cmake.in b/src/cmakeFindModules/OpenMVGConfig.cmake.in +index e7dfbfd..31ec90c 100644 +--- a/src/cmakeFindModules/OpenMVGConfig.cmake.in ++++ b/src/cmakeFindModules/OpenMVGConfig.cmake.in +@@ -19,7 +19,7 @@ + # OPENMVG_VERSION: Version of OpenMVG found. + # + +-# Called if we failed to find OpenMVG or any of it's required dependencies, ++# Called if we failed to find OpenMVG or any of its required dependencies, + # unsets all public (designed to be used externally) variables and reports + # error message at priority depending upon [REQUIRED/QUIET/] argument. + macro(OPENMVG_REPORT_NOT_FOUND REASON_MSG) +@@ -59,9 +59,18 @@ set(CALLERS_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) + # script. + set(CMAKE_MODULE_PATH ${CURRENT_CONFIG_INSTALL_DIR}) + ++include(CMakeFindDependencyMacro) ++find_dependency(CoinUtils) ++find_dependency(Clp) ++find_dependency(Osi) ++find_dependency(flann) ++find_dependency(Threads) ++find_dependency(cereal) ++find_dependency(Ceres) ++ + # Build the absolute root install directory as a relative path + get_filename_component(CURRENT_ROOT_INSTALL_DIR +- ${CMAKE_MODULE_PATH}/../../../ ABSOLUTE) ++ ${CMAKE_MODULE_PATH}/../../ ABSOLUTE) + if (NOT EXISTS ${CURRENT_ROOT_INSTALL_DIR}) + OPENMVG_REPORT_NOT_FOUND( + "OpenMVG install root: ${CURRENT_ROOT_INSTALL_DIR}, " +diff --git a/src/openMVG/linearProgramming/CMakeLists.txt b/src/openMVG/linearProgramming/CMakeLists.txt +index cc5212f..acc57dd 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 ++ Coin::Clp # clp + solver wrapper ++ Coin::CoinUtils # container tools ++ Coin::Osi # generic LP + ) + + target_include_directories(openMVG_linearProgramming +- PRIVATE +- ${CLP_INCLUDE_DIRS} +- ${COINUTILS_INCLUDE_DIRS} +- ${OSI_INCLUDE_DIRS} + PUBLIC + $ + ) +diff --git a/src/openMVG/matching/CMakeLists.txt b/src/openMVG/matching/CMakeLists.txt +index 5fcd972..b21ea7b 100644 +--- a/src/openMVG/matching/CMakeLists.txt ++++ b/src/openMVG/matching/CMakeLists.txt +@@ -18,6 +18,7 @@ list(REMOVE_ITEM matching_files_cpp ${REMOVEFILESUNITTEST}) + + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) ++find_package(flann REQUIRED) + + set_source_files_properties(${matching_files_cpp} PROPERTIES LANGUAGE CXX) + add_library(openMVG_matching +@@ -39,10 +40,10 @@ target_link_libraries(openMVG_matching + Threads::Threads + cereal + ) +-if (NOT DEFINED OpenMVG_USE_INTERNAL_FLANN) ++if (NOT OpenMVG_USE_INTERNAL_FLANN) + target_link_libraries(openMVG_matching + PUBLIC +- ${FLANN_LIBRARIES} ++ flann::flann + ) + endif() + set_target_properties(openMVG_matching PROPERTIES SOVERSION ${OPENMVG_VERSION_MAJOR} VERSION "${OPENMVG_VERSION_MAJOR}.${OPENMVG_VERSION_MINOR}") +diff --git a/src/openMVG/numeric/CMakeLists.txt b/src/openMVG/numeric/CMakeLists.txt +index 06baee7..47255be 100644 +--- a/src/openMVG/numeric/CMakeLists.txt ++++ b/src/openMVG/numeric/CMakeLists.txt +@@ -24,7 +24,7 @@ target_include_directories(openMVG_numeric + $ + $ + ) +-if (DEFINED OpenMVG_USE_INTERNAL_EIGEN) ++if (OpenMVG_USE_INTERNAL_EIGEN) + target_include_directories(openMVG_numeric PUBLIC + $) + else() +diff --git a/src/software/SfM/SfM_GlobalPipeline.py.in b/src/software/SfM/SfM_GlobalPipeline.py.in +index 42405a4..28b0246 100644 +--- a/src/software/SfM/SfM_GlobalPipeline.py.in ++++ b/src/software/SfM/SfM_GlobalPipeline.py.in +@@ -21,7 +21,7 @@ + OPENMVG_SFM_BIN = "@OPENMVG_SOFTWARE_SFM_BUILD_DIR@" + + # Indicate the openMVG camera sensor width directory +-CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_SOFTWARE_SFM_SRC_DIR@" + "/../../openMVG/exif/sensor_width_database" ++CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_CAMERA_SENSOR_WIDTH_DIRECTORY@" + + import os + import subprocess +@@ -77,5 +77,3 @@ pRecons.wait() + + pRecons = subprocess.Popen( [os.path.join(OPENMVG_SFM_BIN, "openMVG_main_ComputeSfM_DataColor"), "-i", reconstruction_dir+"/robust.bin", "-o", os.path.join(reconstruction_dir,"robust_colorized.ply")] ) + pRecons.wait() +- +- +diff --git a/src/software/SfM/SfM_SequentialPipeline.py.in b/src/software/SfM/SfM_SequentialPipeline.py.in +index 9a5a482..e804a19 100644 +--- a/src/software/SfM/SfM_SequentialPipeline.py.in ++++ b/src/software/SfM/SfM_SequentialPipeline.py.in +@@ -21,7 +21,7 @@ + OPENMVG_SFM_BIN = "@OPENMVG_SOFTWARE_SFM_BUILD_DIR@" + + # Indicate the openMVG camera sensor width directory +-CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_SOFTWARE_SFM_SRC_DIR@" + "/../../openMVG/exif/sensor_width_database" ++CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_CAMERA_SENSOR_WIDTH_DIRECTORY@" + + import os + import subprocess +@@ -77,5 +77,3 @@ pRecons.wait() + + pRecons = subprocess.Popen( [os.path.join(OPENMVG_SFM_BIN, "openMVG_main_ComputeSfM_DataColor"), "-i", reconstruction_dir+"/robust.bin", "-o", os.path.join(reconstruction_dir,"robust_colorized.ply")] ) + pRecons.wait() +- +- +diff --git a/src/software/SfM/tutorial_demo.py.in b/src/software/SfM/tutorial_demo.py.in +index 259e24e..1097062 100644 +--- a/src/software/SfM/tutorial_demo.py.in ++++ b/src/software/SfM/tutorial_demo.py.in +@@ -12,7 +12,7 @@ + OPENMVG_SFM_BIN = "@OPENMVG_SOFTWARE_SFM_BUILD_DIR@" + + # Indicate the openMVG camera sensor width directory +-CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_SOFTWARE_SFM_SRC_DIR@" + "/../../openMVG/exif/sensor_width_database" ++CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_CAMERA_SENSOR_WIDTH_DIRECTORY@" + + import os + import subprocess +@@ -89,5 +89,3 @@ pRecons.wait() + print ("4. Structure from Known Poses (robust triangulation)") + pRecons = subprocess.Popen( [os.path.join(OPENMVG_SFM_BIN, "openMVG_main_ComputeStructureFromKnownPoses"), "-i", reconstruction_dir+"/sfm_data.bin", "-m", matches_dir, "-o", os.path.join(reconstruction_dir,"robust.ply")] ) + pRecons.wait() +- +- +diff --git a/src/software/VO/Tracker_opencv_klt.hpp b/src/software/VO/Tracker_opencv_klt.hpp +index aa7dffe..2c4d237 100644 +--- a/src/software/VO/Tracker_opencv_klt.hpp ++++ b/src/software/VO/Tracker_opencv_klt.hpp +@@ -80,7 +80,7 @@ struct Tracker_opencv_KLT : public Abstract_Tracker + std::vector m_nextKeypoints; + + cv::Ptr m_detector = cv::GFTTDetector::create(count); +- if (m_detector == NULL) ++ if (m_detector == nullptr) + return false; + + m_detector->detect(current_img, m_nextKeypoints); +diff --git a/src/third_party/CMakeLists.txt b/src/third_party/CMakeLists.txt +index 816a941..f0b7145 100644 +--- a/src/third_party/CMakeLists.txt ++++ b/src/third_party/CMakeLists.txt +@@ -18,7 +18,7 @@ add_subdirectory(stlplus3) + set(STLPLUS_LIBRARY openMVG_stlplus PARENT_SCOPE) + + # Add graph library +-if(DEFINED OpenMVG_USE_INTERNAL_LEMON) ++if(OpenMVG_USE_INTERNAL_LEMON) + add_subdirectory(lemon) + set_property(TARGET openMVG_lemon PROPERTY FOLDER OpenMVG/3rdParty/lemon) + set_property(TARGET check PROPERTY FOLDER OpenMVG/3rdParty/lemon) +@@ -68,7 +68,7 @@ endif (NOT TIFF_FOUND) + add_subdirectory(vectorGraphics) + + # Add ceres-solver (A Nonlinear Least Squares Minimizer) +-if (DEFINED OpenMVG_USE_INTERNAL_CERES) ++if (OpenMVG_USE_INTERNAL_CERES) + add_subdirectory(cxsparse) + add_subdirectory(ceres-solver) + set_property(TARGET openMVG_cxsparse PROPERTY FOLDER OpenMVG/3rdParty/ceres) +@@ -76,7 +76,7 @@ if (DEFINED OpenMVG_USE_INTERNAL_CERES) + endif() + + # Add an Approximate Nearest Neighbor library +-if (DEFINED OpenMVG_USE_INTERNAL_FLANN) ++if (OpenMVG_USE_INTERNAL_FLANN) + set(FLANN_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/openMVG/third_party/flann/src/cpp) + add_subdirectory(flann) + endif() +@@ -90,7 +90,7 @@ add_subdirectory(fast) + ## + # Install Header only libraries if necessary + ## +-if (DEFINED OpenMVG_USE_INTERNAL_EIGEN) ++if (OpenMVG_USE_INTERNAL_EIGEN) + #Configure Eigen install + set(EIGEN_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/openMVG/third_party/eigen) + add_subdirectory(eigen) diff --git a/ports/openmvg/fix-config-cmake.patch b/ports/openmvg/fix-config-cmake.patch deleted file mode 100644 index f229502ce5c2aa..00000000000000 --- a/ports/openmvg/fix-config-cmake.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/cmakeFindModules/OpenMVGConfig.cmake.in b/src/cmakeFindModules/OpenMVGConfig.cmake.in -index e7dfbfd..357a25c 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_MODULE_PATH}/../../ ABSOLUTE) - if (NOT EXISTS ${CURRENT_ROOT_INSTALL_DIR}) - OPENMVG_REPORT_NOT_FOUND( - "OpenMVG install root: ${CURRENT_ROOT_INSTALL_DIR}, " diff --git a/ports/openmvg/fix-nullptr.patch b/ports/openmvg/fix-nullptr.patch deleted file mode 100644 index 72e61adb3c227a..00000000000000 --- a/ports/openmvg/fix-nullptr.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/software/VO/Tracker_opencv_klt.hpp b/src/software/VO/Tracker_opencv_klt.hpp -index aa7dffe..2c4d237 100644 ---- a/src/software/VO/Tracker_opencv_klt.hpp -+++ b/src/software/VO/Tracker_opencv_klt.hpp -@@ -80,7 +80,7 @@ struct Tracker_opencv_KLT : public Abstract_Tracker - std::vector m_nextKeypoints; - - cv::Ptr m_detector = cv::GFTTDetector::create(count); -- if (m_detector == NULL) -+ if (m_detector == nullptr) - return false; - - m_detector->detect(current_img, m_nextKeypoints); diff --git a/ports/openmvg/fix-tools-config.patch b/ports/openmvg/fix-tools-config.patch deleted file mode 100644 index b476827ca328b7..00000000000000 --- a/ports/openmvg/fix-tools-config.patch +++ /dev/null @@ -1,57 +0,0 @@ -diff --git a/src/software/SfM/SfM_GlobalPipeline.py.in b/src/software/SfM/SfM_GlobalPipeline.py.in -index 42405a4..28b0246 100644 ---- a/src/software/SfM/SfM_GlobalPipeline.py.in -+++ b/src/software/SfM/SfM_GlobalPipeline.py.in -@@ -21,7 +21,7 @@ - OPENMVG_SFM_BIN = "@OPENMVG_SOFTWARE_SFM_BUILD_DIR@" - - # Indicate the openMVG camera sensor width directory --CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_SOFTWARE_SFM_SRC_DIR@" + "/../../openMVG/exif/sensor_width_database" -+CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_CAMERA_SENSOR_WIDTH_DIRECTORY@" - - import os - import subprocess -@@ -77,5 +77,3 @@ pRecons.wait() - - pRecons = subprocess.Popen( [os.path.join(OPENMVG_SFM_BIN, "openMVG_main_ComputeSfM_DataColor"), "-i", reconstruction_dir+"/robust.bin", "-o", os.path.join(reconstruction_dir,"robust_colorized.ply")] ) - pRecons.wait() -- -- -diff --git a/src/software/SfM/SfM_SequentialPipeline.py.in b/src/software/SfM/SfM_SequentialPipeline.py.in -index 9a5a482..e804a19 100644 ---- a/src/software/SfM/SfM_SequentialPipeline.py.in -+++ b/src/software/SfM/SfM_SequentialPipeline.py.in -@@ -21,7 +21,7 @@ - OPENMVG_SFM_BIN = "@OPENMVG_SOFTWARE_SFM_BUILD_DIR@" - - # Indicate the openMVG camera sensor width directory --CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_SOFTWARE_SFM_SRC_DIR@" + "/../../openMVG/exif/sensor_width_database" -+CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_CAMERA_SENSOR_WIDTH_DIRECTORY@" - - import os - import subprocess -@@ -77,5 +77,3 @@ pRecons.wait() - - pRecons = subprocess.Popen( [os.path.join(OPENMVG_SFM_BIN, "openMVG_main_ComputeSfM_DataColor"), "-i", reconstruction_dir+"/robust.bin", "-o", os.path.join(reconstruction_dir,"robust_colorized.ply")] ) - pRecons.wait() -- -- -diff --git a/src/software/SfM/tutorial_demo.py.in b/src/software/SfM/tutorial_demo.py.in -index 259e24e..1097062 100644 ---- a/src/software/SfM/tutorial_demo.py.in -+++ b/src/software/SfM/tutorial_demo.py.in -@@ -12,7 +12,7 @@ - OPENMVG_SFM_BIN = "@OPENMVG_SOFTWARE_SFM_BUILD_DIR@" - - # Indicate the openMVG camera sensor width directory --CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_SOFTWARE_SFM_SRC_DIR@" + "/../../openMVG/exif/sensor_width_database" -+CAMERA_SENSOR_WIDTH_DIRECTORY = "@OPENMVG_CAMERA_SENSOR_WIDTH_DIRECTORY@" - - import os - import subprocess -@@ -89,5 +89,3 @@ pRecons.wait() - print ("4. Structure from Known Poses (robust triangulation)") - pRecons = subprocess.Popen( [os.path.join(OPENMVG_SFM_BIN, "openMVG_main_ComputeStructureFromKnownPoses"), "-i", reconstruction_dir+"/sfm_data.bin", "-m", matches_dir, "-o", os.path.join(reconstruction_dir,"robust.ply")] ) - pRecons.wait() -- -- diff --git a/ports/openmvg/portfile.cmake b/ports/openmvg/portfile.cmake index d3ca9bc08b66d6..320efc09390158 100644 --- a/ports/openmvg/portfile.cmake +++ b/ports/openmvg/portfile.cmake @@ -9,10 +9,7 @@ vcpkg_from_github( REF 606d1c9e82123dd50de282128151a50bf42262fc # v1.5 SHA512 eddcf4c5f86541112840a6d89bbf360d30b085c2b3ff3e39b357030a465163b465e89d01474f8dbd65b66f8bccfc1f54a58963324f622482e2960f00214b2b75 PATCHES - fix-cmake.patch - fix-config-cmake.patch - fix-nullptr.patch - fix-tools-config.patch + build_fixes.patch ) set(OpenMVG_USE_OPENMP OFF) From e1908dcb22ead40efa45c3dbf0229472cdb5bf04 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Wed, 8 Jul 2020 12:55:38 +0200 Subject: [PATCH 11/61] [OpenMVS] fix tool names also on macOS/linux --- ports/openmvs/portfile.cmake | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ports/openmvs/portfile.cmake b/ports/openmvs/portfile.cmake index 38cb144e25cebe..774ba73602b0d5 100644 --- a/ports/openmvs/portfile.cmake +++ b/ports/openmvs/portfile.cmake @@ -45,13 +45,13 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) vcpkg_fixup_cmake_targets() file(READ ${CURRENT_PACKAGES_DIR}/share/openmvs/OpenMVSTargets-release.cmake TARGETS_CMAKE) -string(REPLACE "bin/InterfaceCOLMAP.exe" "tools/openmvs/InterfaceCOLMAP.exe" TARGETS_CMAKE "${TARGETS_CMAKE}") -string(REPLACE "bin/InterfaceVisualSFM.exe" "tools/openmvs/InterfaceVisualSFM.exe" TARGETS_CMAKE "${TARGETS_CMAKE}") -string(REPLACE "bin/DensifyPointCloud.exe" "tools/openmvs/DensifyPointCloud.exe" TARGETS_CMAKE "${TARGETS_CMAKE}") -string(REPLACE "bin/ReconstructMesh.exe" "tools/openmvs/ReconstructMesh.exe" TARGETS_CMAKE "${TARGETS_CMAKE}") -string(REPLACE "bin/RefineMesh.exe" "tools/openmvs/RefineMesh.exe" TARGETS_CMAKE "${TARGETS_CMAKE}") -string(REPLACE "bin/TextureMesh.exe" "tools/openmvs/TextureMesh.exe" TARGETS_CMAKE "${TARGETS_CMAKE}") -string(REPLACE "bin/Viewer.exe" "tools/openmvs/Viewer.exe" TARGETS_CMAKE "${TARGETS_CMAKE}") +string(REPLACE "bin/InterfaceCOLMAP" "tools/openmvs/InterfaceCOLMAP" TARGETS_CMAKE "${TARGETS_CMAKE}") +string(REPLACE "bin/InterfaceVisualSFM" "tools/openmvs/InterfaceVisualSFM" TARGETS_CMAKE "${TARGETS_CMAKE}") +string(REPLACE "bin/DensifyPointCloud" "tools/openmvs/DensifyPointCloud" TARGETS_CMAKE "${TARGETS_CMAKE}") +string(REPLACE "bin/ReconstructMesh" "tools/openmvs/ReconstructMesh" TARGETS_CMAKE "${TARGETS_CMAKE}") +string(REPLACE "bin/RefineMesh" "tools/openmvs/RefineMesh" TARGETS_CMAKE "${TARGETS_CMAKE}") +string(REPLACE "bin/TextureMesh" "tools/openmvs/TextureMesh" TARGETS_CMAKE "${TARGETS_CMAKE}") +string(REPLACE "bin/Viewer" "tools/openmvs/Viewer" TARGETS_CMAKE "${TARGETS_CMAKE}") file(WRITE ${CURRENT_PACKAGES_DIR}/share/openmvs/OpenMVSTargets-release.cmake "${TARGETS_CMAKE}") vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES From 1685d9ee2d513e232fb46927af5ef9bab5e17631 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Wed, 8 Jul 2020 16:50:55 +0200 Subject: [PATCH 12/61] rebuild openblas to check binarycaching --- ports/openblas/CONTROL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/openblas/CONTROL b/ports/openblas/CONTROL index 3c2b0b7ebe68d7..0c3168f146a703 100644 --- a/ports/openblas/CONTROL +++ b/ports/openblas/CONTROL @@ -1,5 +1,5 @@ Source: openblas -Version: 0.3.9-1 +Version: 0.3.9-2 Homepage: https://github.com/xianyi/OpenBLAS Build-Depends: pthread (linux) Description: OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. From d4021bfb2f4f4d1c65d6d745e27679d2e520da39 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Wed, 8 Jul 2020 16:56:33 +0200 Subject: [PATCH 13/61] [OpenMVS] simplify patches --- .../{fix-tool-build.patch => fix-build.patch} | 697 ++++++++++------- ports/openmvs/fix-linux-build.patch | 44 -- ports/openmvs/fix-tool-paths.patch | 724 ------------------ ports/openmvs/portfile.cmake | 4 +- 4 files changed, 403 insertions(+), 1066 deletions(-) rename ports/openmvs/{fix-tool-build.patch => fix-build.patch} (67%) delete mode 100644 ports/openmvs/fix-linux-build.patch delete mode 100644 ports/openmvs/fix-tool-paths.patch diff --git a/ports/openmvs/fix-tool-build.patch b/ports/openmvs/fix-build.patch similarity index 67% rename from ports/openmvs/fix-tool-build.patch rename to ports/openmvs/fix-build.patch index e190042ea049af..b96d2375eecf85 100644 --- a/ports/openmvs/fix-tool-build.patch +++ b/ports/openmvs/fix-build.patch @@ -1,295 +1,402 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7966ed5..b8dfb54 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -63,7 +63,7 @@ INCLUDE_DIRECTORIES("${OpenMVS_SOURCE_DIR}") - SET(OpenMVS_EXTRA_LIBS "") - if(OpenMVS_USE_OPENMP) - SET(OpenMP_LIBS "") -- FIND_PACKAGE(OpenMP) -+ FIND_PACKAGE(OpenMP REQUIRED) - if(OPENMP_FOUND) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") - ADD_DEFINITIONS(-D_USE_OPENMP) -@@ -83,7 +83,7 @@ if(OpenMVS_USE_OPENGL) - if(POLICY CMP0072) - cmake_policy(SET CMP0072 NEW) - endif() -- FIND_PACKAGE(OpenGL) -+ FIND_PACKAGE(OpenGL REQUIRED) - if(OPENGL_FOUND) - INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) - ADD_DEFINITIONS(${OpenGL_DEFINITIONS} -D_USE_OPENGL) -@@ -94,7 +94,7 @@ if(OpenMVS_USE_OPENGL) - endif() - - if(OpenMVS_USE_CUDA) -- FIND_PACKAGE(CUDA) -+ FIND_PACKAGE(CUDA REQUIRED) - if(CUDA_FOUND) - INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS}) - ADD_DEFINITIONS(-D_USE_CUDA) -@@ -108,7 +108,7 @@ else() - endif() - - if(OpenMVS_USE_BREAKPAD) -- FIND_PACKAGE(BREAKPAD) -+ FIND_PACKAGE(BREAKPAD REQUIRED) - if(BREAKPAD_FOUND) - INCLUDE_DIRECTORIES(${BREAKPAD_INCLUDE_DIRS}) - ADD_DEFINITIONS(${BREAKPAD_DEFINITIONS} -D_USE_BREAKPAD) -@@ -119,7 +119,7 @@ if(OpenMVS_USE_BREAKPAD) - endif() - endif() - --FIND_PACKAGE(Boost ${SYSTEM_PACKAGE_REQUIRED} COMPONENTS iostreams program_options system serialization) -+FIND_PACKAGE(Boost COMPONENTS iostreams program_options system serialization REQUIRED) - if(Boost_FOUND) - INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) - ADD_DEFINITIONS(${Boost_DEFINITIONS} -D_USE_BOOST) -@@ -127,14 +127,14 @@ if(Boost_FOUND) - SET(_USE_BOOST TRUE) - endif() - --FIND_PACKAGE(Eigen ${SYSTEM_PACKAGE_REQUIRED}) --if(EIGEN_FOUND) -- INCLUDE_DIRECTORIES(${EIGEN_INCLUDE_DIRS}) -+FIND_PACKAGE(Eigen3 REQUIRED) -+if(EIGEN3_FOUND) -+ INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIRS}) - ADD_DEFINITIONS(${EIGEN_DEFINITIONS} -D_USE_EIGEN) - SET(_USE_EIGEN TRUE) - endif() - --FIND_PACKAGE(OpenCV ${SYSTEM_PACKAGE_REQUIRED}) -+FIND_PACKAGE(OpenCV REQUIRED) - if(OpenCV_FOUND) - INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) - ADD_DEFINITIONS(${OpenCV_DEFINITIONS}) -@@ -170,7 +170,9 @@ ADD_DEFINITIONS(${OpenMVS_DEFINITIONS}) - - # Add modules - ADD_SUBDIRECTORY(libs) -+if(OpenMVS_BUILD_TOOLS) - ADD_SUBDIRECTORY(apps) -+endif() - ADD_SUBDIRECTORY(docs) - - if(OpenMVS_USE_CERES) -@@ -188,7 +190,7 @@ export(TARGETS Common IO Math MVS FILE "${PROJECT_BINARY_DIR}/OpenMVSTargets.cma - # Export the package for use from the build-tree - # (this registers the build-tree with a global CMake-registry) - export(PACKAGE OpenMVS) -- -+ - # Create the OpenMVSConfig.cmake and OpenMVSConfigVersion files - file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}" "${INSTALL_INCLUDE_DIR}") - # ... for the build tree -@@ -199,7 +201,7 @@ set(CONF_INCLUDE_DIRS "${INSTALL_CMAKE_DIR}/${REL_INCLUDE_DIR}") - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build/OpenMVSConfig.cmake.in" "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMVSConfig.cmake" @ONLY) - # ... for both - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build/OpenMVSConfigVersion.cmake.in" "${PROJECT_BINARY_DIR}/OpenMVSConfigVersion.cmake" @ONLY) -- -+ - # Install the OpenMVSConfig.cmake and OpenMVSConfigVersion.cmake - install(FILES - "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMVSConfig.cmake" -diff --git a/build/OpenMVSConfig.cmake.in b/build/OpenMVSConfig.cmake.in -index 96b8fe2..2dce8e7 100644 ---- a/build/OpenMVSConfig.cmake.in -+++ b/build/OpenMVSConfig.cmake.in -@@ -3,16 +3,66 @@ - # OpenMVS_INCLUDE_DIRS - include directories for OpenMVS - # OpenMVS_LIBRARIES - libraries to link against - # OpenMVS_BINARIES - the binaries -- -+ - # Compute paths - get_filename_component(OpenMVS_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) - set(OpenMVS_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@") -- -+list(APPEND CMAKE_MODULE_PATH "${OpenMVS_CMAKE_DIR}") -+ -+if (MSVC) -+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /GL") -+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL") -+ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG") -+ set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG") -+endif() -+ -+include(CMakeFindDependencyMacro) -+ -+if(@OpenMVS_USE_OPENMP@) -+ find_dependency(OpenMP) -+ add_definitions(-D_USE_OPENMP) -+endif() -+ -+if(@OpenMVS_USE_OPENGL@) -+ find_dependency(OpenGL) -+ add_definitions(${OpenGL_DEFINITIONS} -D_USE_OPENGL) -+endif() -+ -+if(@OpenMVS_USE_CUDA@) -+ find_dependency(CUDA) -+ add_definitions(-D_USE_CUDA) -+ include_directories(${CUDA_INCLUDE_DIRS}) -+endif() -+ -+if(@OpenMVS_USE_BREAKPAD@) -+ find_dependency(BREAKPAD) -+ add_definitions(${BREAKPAD_DEFINITIONS} -D_USE_BREAKPAD) -+endif() -+ -+find_dependency(Boost) -+add_definitions(${Boost_DEFINITIONS} -D_USE_BOOST) -+find_dependency(Eigen3) -+add_definitions(${EIGEN_DEFINITIONS} -D_USE_EIGEN) -+find_dependency(OpenCV) -+add_definitions(${OpenCV_DEFINITIONS}) -+find_dependency(CGAL) -+add_definitions(${CGAL_DEFINITIONS}) -+ -+find_dependency(VCG REQUIRED) -+add_definitions(${VCG_DEFINITIONS}) -+ -+if(@OpenMVS_USE_CERES@) -+ find_dependency(Ceres) -+ add_definitions(${CERES_DEFINITIONS}) -+endif() -+ -+add_definitions(@OpenMVS_DEFINITIONS@) -+ - # Our library dependencies (contains definitions for IMPORTED targets) - if(NOT TARGET MVS AND NOT OpenMVS_BINARY_DIR) - include("${OpenMVS_CMAKE_DIR}/OpenMVSTargets.cmake") - endif() -- -+ - # These are IMPORTED targets created by OpenMVSTargets.cmake - set(OpenMVS_LIBRARIES MVS) - set(OpenMVS_BINARIES InterfaceVisualSFM DensifyPointCloud ReconstructMesh RefineMesh TextureMesh) -diff --git a/build/Utils.cmake b/build/Utils.cmake -index f41c9d8..b717a1f 100644 ---- a/build/Utils.cmake -+++ b/build/Utils.cmake -@@ -160,7 +160,7 @@ macro(GetOperatingSystemArchitectureBitness) - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES i686.*|i386.*|x86.*) - set(X86 1) - endif() -- -+ - if(NOT ${MY_VAR_PREFIX}_PACKAGE_REQUIRED) - set(${MY_VAR_PREFIX}_PACKAGE_REQUIRED "REQUIRED") - endif() -@@ -173,30 +173,6 @@ macro(ComposePackageLibSuffix) - set(PACKAGE_LIB_SUFFIX "") - set(PACKAGE_LIB_SUFFIX_DBG "") - set(PACKAGE_LIB_SUFFIX_REL "") -- if(MSVC) -- if("${MSVC_VERSION}" STREQUAL "1921") -- set(PACKAGE_LIB_SUFFIX "/vc16") -- elseif("${MSVC_VERSION}" STREQUAL "1916") -- set(PACKAGE_LIB_SUFFIX "/vc15") -- elseif("${MSVC_VERSION}" STREQUAL "1900") -- set(PACKAGE_LIB_SUFFIX "/vc14") -- elseif("${MSVC_VERSION}" STREQUAL "1800") -- set(PACKAGE_LIB_SUFFIX "/vc12") -- elseif("${MSVC_VERSION}" STREQUAL "1700") -- set(PACKAGE_LIB_SUFFIX "/vc11") -- elseif("${MSVC_VERSION}" STREQUAL "1600") -- set(PACKAGE_LIB_SUFFIX "/vc10") -- elseif("${MSVC_VERSION}" STREQUAL "1500") -- set(PACKAGE_LIB_SUFFIX "/vc9") -- endif() -- if("${SYSTEM_BITNESS}" STREQUAL "64") -- set(PACKAGE_LIB_SUFFIX "${PACKAGE_LIB_SUFFIX}/x64") -- else() -- set(PACKAGE_LIB_SUFFIX "${PACKAGE_LIB_SUFFIX}/x86") -- endif() -- set(PACKAGE_LIB_SUFFIX_DBG "${PACKAGE_LIB_SUFFIX}/Debug") -- set(PACKAGE_LIB_SUFFIX_REL "${PACKAGE_LIB_SUFFIX}/Release") -- endif() - endmacro() - - -@@ -511,7 +487,7 @@ macro(optimize_default_compiler_settings) - endif() - add_extra_compiler_option(-fdiagnostics-show-option) - add_extra_compiler_option(-ftemplate-backtrace-limit=0) -- -+ - # The -Wno-long-long is required in 64bit systems when including sytem headers. - if(X86_64) - add_extra_compiler_option(-Wno-long-long) -@@ -817,7 +793,7 @@ macro(ConfigCompilerAndLinker) - else() - set(cxx_rtti_support "${cxx_no_rtti_flags}") - endif() -- -+ - SET(cxx_default "${cxx_exception_support} ${cxx_rtti_support}" CACHE PATH "Common compile CXX flags") - SET(c_default "${CMAKE_C_FLAGS} ${cxx_base_flags}" CACHE PATH "Common compile C flags") - endmacro() -@@ -825,16 +801,12 @@ endmacro() - # Initialize variables needed for a library type project. - macro(ConfigLibrary) - # Offer the user the choice of overriding the installation directories -- set(INSTALL_LIB_DIR "lib/${PROJECT_NAME}" CACHE PATH "Installation directory for libraries") -- set(INSTALL_BIN_DIR "bin/${PROJECT_NAME}" CACHE PATH "Installation directory for executables") -+ set(INSTALL_LIB_DIR "lib" CACHE PATH "Installation directory for libraries") -+ set(INSTALL_BIN_DIR "bin" CACHE PATH "Installation directory for executables") - set(INSTALL_INCLUDE_DIR "include/${PROJECT_NAME}" CACHE PATH "Installation directory for header files") -- if(WIN32 AND NOT CYGWIN) -- set(DEF_INSTALL_CMAKE_DIR "CMake") -- else() -- set(DEF_INSTALL_CMAKE_DIR "lib/CMake/${PROJECT_NAME}") -- endif() -+ set(DEF_INSTALL_CMAKE_DIR "share/${PROJECT_NAME}") - set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files") -- -+ - # Make relative paths absolute (needed later on) - foreach(p LIB BIN INCLUDE CMAKE) - set(var INSTALL_${p}_DIR) -diff --git a/libs/MVS/CMakeLists.txt b/libs/MVS/CMakeLists.txt -index 14be620..0b9a315 100644 ---- a/libs/MVS/CMakeLists.txt -+++ b/libs/MVS/CMakeLists.txt -@@ -1,12 +1,12 @@ - # Find required packages --FIND_PACKAGE(CGAL ${SYSTEM_PACKAGE_REQUIRED}) -+FIND_PACKAGE(CGAL REQUIRED) - if(CGAL_FOUND) - include_directories(${CGAL_INCLUDE_DIRS}) - add_definitions(${CGAL_DEFINITIONS}) - link_directories(${CGAL_LIBRARY_DIRS}) - endif() - --FIND_PACKAGE(VCG ${SYSTEM_PACKAGE_REQUIRED}) -+FIND_PACKAGE(VCG REQUIRED) - if(VCG_FOUND) - include_directories(${VCG_INCLUDE_DIRS}) - add_definitions(${VCG_DEFINITIONS}) -@@ -14,12 +14,10 @@ endif() - - set(CERES_LIBS "") - if(OpenMVS_USE_CERES) -- FIND_PACKAGE(CERES) -+ FIND_PACKAGE(Ceres REQUIRED) - if(CERES_FOUND) - include_directories(${CERES_INCLUDE_DIRS}) - add_definitions(${CERES_DEFINITIONS}) -- else() -- set(OpenMVS_USE_CERES OFF) - endif() - endif() - -@@ -42,7 +40,7 @@ cxx_library_with_type_no_pch(MVS "Libs" "" "${cxx_default}" - set_target_pch(MVS Common.h) - - # Link its dependencies --TARGET_LINK_LIBRARIES(MVS PRIVATE Common Math IO ${CERES_LIBS} ${CGAL_LIBS} ${CUDA_CUDA_LIBRARY}) -+TARGET_LINK_LIBRARIES(MVS PRIVATE Common Math IO ${CERES_LIBS} CGAL::CGAL ${CUDA_CUDA_LIBRARY}) - - # Install - SET_TARGET_PROPERTIES(MVS PROPERTIES +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7966ed5..b8dfb54 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -63,7 +63,7 @@ INCLUDE_DIRECTORIES("${OpenMVS_SOURCE_DIR}") + SET(OpenMVS_EXTRA_LIBS "") + if(OpenMVS_USE_OPENMP) + SET(OpenMP_LIBS "") +- FIND_PACKAGE(OpenMP) ++ FIND_PACKAGE(OpenMP REQUIRED) + if(OPENMP_FOUND) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + ADD_DEFINITIONS(-D_USE_OPENMP) +@@ -83,7 +83,7 @@ if(OpenMVS_USE_OPENGL) + if(POLICY CMP0072) + cmake_policy(SET CMP0072 NEW) + endif() +- FIND_PACKAGE(OpenGL) ++ FIND_PACKAGE(OpenGL REQUIRED) + if(OPENGL_FOUND) + INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) + ADD_DEFINITIONS(${OpenGL_DEFINITIONS} -D_USE_OPENGL) +@@ -94,7 +94,7 @@ if(OpenMVS_USE_OPENGL) + endif() + + if(OpenMVS_USE_CUDA) +- FIND_PACKAGE(CUDA) ++ FIND_PACKAGE(CUDA REQUIRED) + if(CUDA_FOUND) + INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS}) + ADD_DEFINITIONS(-D_USE_CUDA) +@@ -108,7 +108,7 @@ else() + endif() + + if(OpenMVS_USE_BREAKPAD) +- FIND_PACKAGE(BREAKPAD) ++ FIND_PACKAGE(BREAKPAD REQUIRED) + if(BREAKPAD_FOUND) + INCLUDE_DIRECTORIES(${BREAKPAD_INCLUDE_DIRS}) + ADD_DEFINITIONS(${BREAKPAD_DEFINITIONS} -D_USE_BREAKPAD) +@@ -119,7 +119,7 @@ if(OpenMVS_USE_BREAKPAD) + endif() + endif() + +-FIND_PACKAGE(Boost ${SYSTEM_PACKAGE_REQUIRED} COMPONENTS iostreams program_options system serialization) ++FIND_PACKAGE(Boost COMPONENTS iostreams program_options system serialization REQUIRED) + if(Boost_FOUND) + INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) + ADD_DEFINITIONS(${Boost_DEFINITIONS} -D_USE_BOOST) +@@ -127,14 +127,14 @@ if(Boost_FOUND) + SET(_USE_BOOST TRUE) + endif() + +-FIND_PACKAGE(Eigen ${SYSTEM_PACKAGE_REQUIRED}) +-if(EIGEN_FOUND) +- INCLUDE_DIRECTORIES(${EIGEN_INCLUDE_DIRS}) ++FIND_PACKAGE(Eigen3 REQUIRED) ++if(EIGEN3_FOUND) ++ INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIRS}) + ADD_DEFINITIONS(${EIGEN_DEFINITIONS} -D_USE_EIGEN) + SET(_USE_EIGEN TRUE) + endif() + +-FIND_PACKAGE(OpenCV ${SYSTEM_PACKAGE_REQUIRED}) ++FIND_PACKAGE(OpenCV REQUIRED) + if(OpenCV_FOUND) + INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) + ADD_DEFINITIONS(${OpenCV_DEFINITIONS}) +@@ -170,7 +170,9 @@ ADD_DEFINITIONS(${OpenMVS_DEFINITIONS}) + + # Add modules + ADD_SUBDIRECTORY(libs) ++if(OpenMVS_BUILD_TOOLS) + ADD_SUBDIRECTORY(apps) ++endif() + ADD_SUBDIRECTORY(docs) + + if(OpenMVS_USE_CERES) +@@ -188,7 +190,7 @@ export(TARGETS Common IO Math MVS FILE "${PROJECT_BINARY_DIR}/OpenMVSTargets.cma + # Export the package for use from the build-tree + # (this registers the build-tree with a global CMake-registry) + export(PACKAGE OpenMVS) +- ++ + # Create the OpenMVSConfig.cmake and OpenMVSConfigVersion files + file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}" "${INSTALL_INCLUDE_DIR}") + # ... for the build tree +@@ -199,7 +201,7 @@ set(CONF_INCLUDE_DIRS "${INSTALL_CMAKE_DIR}/${REL_INCLUDE_DIR}") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build/OpenMVSConfig.cmake.in" "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMVSConfig.cmake" @ONLY) + # ... for both + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build/OpenMVSConfigVersion.cmake.in" "${PROJECT_BINARY_DIR}/OpenMVSConfigVersion.cmake" @ONLY) +- ++ + # Install the OpenMVSConfig.cmake and OpenMVSConfigVersion.cmake + install(FILES + "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMVSConfig.cmake" +diff --git a/MvgMvsPipeline.py b/MvgMvsPipeline.py.in +similarity index 97% +rename from MvgMvsPipeline.py +rename to MvgMvsPipeline.py.in +index f4914bf..23d03e6 100644 +--- a/MvgMvsPipeline.py ++++ b/MvgMvsPipeline.py.in +@@ -91,12 +91,12 @@ def find(afile): + return None + + # Try to find openMVG and openMVS binaries in PATH +-OPENMVG_BIN = whereis("openMVG_main_SfMInit_ImageListing") +-OPENMVS_BIN = whereis("ReconstructMesh") ++OPENMVG_BIN = "@OPENMVG_TOOLS_PATH@" ++OPENMVS_BIN = "@OPENMVS_TOOLS_PATH@" + + # Try to find openMVG camera sensor database +-CAMERA_SENSOR_DB_FILE = "sensor_width_camera_database.txt" +-CAMERA_SENSOR_DB_DIRECTORY = find(CAMERA_SENSOR_DB_FILE) ++CAMERA_SENSOR_DB_FILE = "@SENSOR_WIDTH_CAMERA_DATABASE_TXT_PATH@" ++CAMERA_SENSOR_DB_DIRECTORY = "@OPENMVG_TOOLS_PATH@" + + # Ask user for openMVG and openMVS directories if not found + if not OPENMVG_BIN: +@@ -175,10 +175,10 @@ class StepsStore: + ["-i", "%input_dir%", "-o", "%matches_dir%", "-d", "%camera_file_params%"]], + ["Compute features", # 1 + os.path.join(OPENMVG_BIN, "openMVG_main_ComputeFeatures"), +- ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-m", "SIFT", "-n", "4"]], ++ ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-m", "SIFT"]], + ["Compute matches", # 2 + os.path.join(OPENMVG_BIN, "openMVG_main_ComputeMatches"), +- ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-n", "HNSWL2", "-r", ".8"]], ++ ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-n", "AUTO", "-r", ".8"]], + ["Incremental reconstruction", # 3 + os.path.join(OPENMVG_BIN, "openMVG_main_IncrementalSfM"), + ["-i", "%matches_dir%/sfm_data.json", "-m", "%matches_dir%", "-o", "%reconstruction_dir%"]], +diff --git a/apps/Viewer/CMakeLists.txt b/apps/Viewer/CMakeLists.txt +index c519040..934cd50 100644 +--- a/apps/Viewer/CMakeLists.txt ++++ b/apps/Viewer/CMakeLists.txt +@@ -16,18 +16,6 @@ else() + MESSAGE("-- Can't find GLEW. Continuing without it.") + RETURN() + endif() +-if(CMAKE_COMPILER_IS_GNUCXX) +- FIND_PACKAGE(PkgConfig QUIET) +- pkg_search_module(GLFW QUIET glfw3) +- if(GLFW_FOUND) +- INCLUDE_DIRECTORIES(${GLFW_INCLUDE_DIRS}) +- ADD_DEFINITIONS(${GLFW_DEFINITIONS}) +- MESSAGE(STATUS "GLFW3 ${GLFW_VERSION} found (include: ${GLFW_INCLUDE_DIRS})") +- else() +- MESSAGE("-- Can't find GLFW3. Continuing without it.") +- RETURN() +- endif() +-else() + FIND_PACKAGE(glfw3 QUIET) + if(glfw3_FOUND) + INCLUDE_DIRECTORIES(${glfw3_INCLUDE_DIRS}) +@@ -37,7 +25,6 @@ else() + MESSAGE("-- Can't find GLFW3. Continuing without it.") + RETURN() + endif() +-endif() + + # List sources files + FILE(GLOB PCH_C "Common.cpp") +diff --git a/build/OpenMVSConfig.cmake.in b/build/OpenMVSConfig.cmake.in +index 96b8fe2..2dce8e7 100644 +--- a/build/OpenMVSConfig.cmake.in ++++ b/build/OpenMVSConfig.cmake.in +@@ -3,16 +3,66 @@ + # OpenMVS_INCLUDE_DIRS - include directories for OpenMVS + # OpenMVS_LIBRARIES - libraries to link against + # OpenMVS_BINARIES - the binaries +- ++ + # Compute paths + get_filename_component(OpenMVS_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + set(OpenMVS_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@") +- ++list(APPEND CMAKE_MODULE_PATH "${OpenMVS_CMAKE_DIR}") ++ ++if (MSVC) ++ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /GL") ++ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL") ++ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG") ++ set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG") ++endif() ++ ++include(CMakeFindDependencyMacro) ++ ++if(@OpenMVS_USE_OPENMP@) ++ find_dependency(OpenMP) ++ add_definitions(-D_USE_OPENMP) ++endif() ++ ++if(@OpenMVS_USE_OPENGL@) ++ find_dependency(OpenGL) ++ add_definitions(${OpenGL_DEFINITIONS} -D_USE_OPENGL) ++endif() ++ ++if(@OpenMVS_USE_CUDA@) ++ find_dependency(CUDA) ++ add_definitions(-D_USE_CUDA) ++ include_directories(${CUDA_INCLUDE_DIRS}) ++endif() ++ ++if(@OpenMVS_USE_BREAKPAD@) ++ find_dependency(BREAKPAD) ++ add_definitions(${BREAKPAD_DEFINITIONS} -D_USE_BREAKPAD) ++endif() ++ ++find_dependency(Boost) ++add_definitions(${Boost_DEFINITIONS} -D_USE_BOOST) ++find_dependency(Eigen3) ++add_definitions(${EIGEN_DEFINITIONS} -D_USE_EIGEN) ++find_dependency(OpenCV) ++add_definitions(${OpenCV_DEFINITIONS}) ++find_dependency(CGAL) ++add_definitions(${CGAL_DEFINITIONS}) ++ ++find_dependency(VCG REQUIRED) ++add_definitions(${VCG_DEFINITIONS}) ++ ++if(@OpenMVS_USE_CERES@) ++ find_dependency(Ceres) ++ add_definitions(${CERES_DEFINITIONS}) ++endif() ++ ++add_definitions(@OpenMVS_DEFINITIONS@) ++ + # Our library dependencies (contains definitions for IMPORTED targets) + if(NOT TARGET MVS AND NOT OpenMVS_BINARY_DIR) + include("${OpenMVS_CMAKE_DIR}/OpenMVSTargets.cmake") + endif() +- ++ + # These are IMPORTED targets created by OpenMVSTargets.cmake + set(OpenMVS_LIBRARIES MVS) + set(OpenMVS_BINARIES InterfaceVisualSFM DensifyPointCloud ReconstructMesh RefineMesh TextureMesh) +diff --git a/build/Utils.cmake b/build/Utils.cmake +index f41c9d8..b717a1f 100644 +--- a/build/Utils.cmake ++++ b/build/Utils.cmake +@@ -160,7 +160,7 @@ macro(GetOperatingSystemArchitectureBitness) + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES i686.*|i386.*|x86.*) + set(X86 1) + endif() +- ++ + if(NOT ${MY_VAR_PREFIX}_PACKAGE_REQUIRED) + set(${MY_VAR_PREFIX}_PACKAGE_REQUIRED "REQUIRED") + endif() +@@ -173,30 +173,6 @@ macro(ComposePackageLibSuffix) + set(PACKAGE_LIB_SUFFIX "") + set(PACKAGE_LIB_SUFFIX_DBG "") + set(PACKAGE_LIB_SUFFIX_REL "") +- if(MSVC) +- if("${MSVC_VERSION}" STREQUAL "1921") +- set(PACKAGE_LIB_SUFFIX "/vc16") +- elseif("${MSVC_VERSION}" STREQUAL "1916") +- set(PACKAGE_LIB_SUFFIX "/vc15") +- elseif("${MSVC_VERSION}" STREQUAL "1900") +- set(PACKAGE_LIB_SUFFIX "/vc14") +- elseif("${MSVC_VERSION}" STREQUAL "1800") +- set(PACKAGE_LIB_SUFFIX "/vc12") +- elseif("${MSVC_VERSION}" STREQUAL "1700") +- set(PACKAGE_LIB_SUFFIX "/vc11") +- elseif("${MSVC_VERSION}" STREQUAL "1600") +- set(PACKAGE_LIB_SUFFIX "/vc10") +- elseif("${MSVC_VERSION}" STREQUAL "1500") +- set(PACKAGE_LIB_SUFFIX "/vc9") +- endif() +- if("${SYSTEM_BITNESS}" STREQUAL "64") +- set(PACKAGE_LIB_SUFFIX "${PACKAGE_LIB_SUFFIX}/x64") +- else() +- set(PACKAGE_LIB_SUFFIX "${PACKAGE_LIB_SUFFIX}/x86") +- endif() +- set(PACKAGE_LIB_SUFFIX_DBG "${PACKAGE_LIB_SUFFIX}/Debug") +- set(PACKAGE_LIB_SUFFIX_REL "${PACKAGE_LIB_SUFFIX}/Release") +- endif() + endmacro() + + +@@ -511,7 +487,7 @@ macro(optimize_default_compiler_settings) + endif() + add_extra_compiler_option(-fdiagnostics-show-option) + add_extra_compiler_option(-ftemplate-backtrace-limit=0) +- ++ + # The -Wno-long-long is required in 64bit systems when including sytem headers. + if(X86_64) + add_extra_compiler_option(-Wno-long-long) +@@ -817,7 +793,7 @@ macro(ConfigCompilerAndLinker) + else() + set(cxx_rtti_support "${cxx_no_rtti_flags}") + endif() +- ++ + SET(cxx_default "${cxx_exception_support} ${cxx_rtti_support}" CACHE PATH "Common compile CXX flags") + SET(c_default "${CMAKE_C_FLAGS} ${cxx_base_flags}" CACHE PATH "Common compile C flags") + endmacro() +@@ -825,16 +801,12 @@ endmacro() + # Initialize variables needed for a library type project. + macro(ConfigLibrary) + # Offer the user the choice of overriding the installation directories +- set(INSTALL_LIB_DIR "lib/${PROJECT_NAME}" CACHE PATH "Installation directory for libraries") +- set(INSTALL_BIN_DIR "bin/${PROJECT_NAME}" CACHE PATH "Installation directory for executables") ++ set(INSTALL_LIB_DIR "lib" CACHE PATH "Installation directory for libraries") ++ set(INSTALL_BIN_DIR "bin" CACHE PATH "Installation directory for executables") + set(INSTALL_INCLUDE_DIR "include/${PROJECT_NAME}" CACHE PATH "Installation directory for header files") +- if(WIN32 AND NOT CYGWIN) +- set(DEF_INSTALL_CMAKE_DIR "CMake") +- else() +- set(DEF_INSTALL_CMAKE_DIR "lib/CMake/${PROJECT_NAME}") +- endif() ++ set(DEF_INSTALL_CMAKE_DIR "share/${PROJECT_NAME}") + set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files") +- ++ + # Make relative paths absolute (needed later on) + foreach(p LIB BIN INCLUDE CMAKE) + set(var INSTALL_${p}_DIR) +diff --git a/libs/Common/CMakeLists.txt b/libs/Common/CMakeLists.txt +index 2e6c1a4..6e1fa95 100644 +--- a/libs/Common/CMakeLists.txt ++++ b/libs/Common/CMakeLists.txt +@@ -18,6 +18,7 @@ set_target_pch(Common Common.h) + + # Link its dependencies + TARGET_LINK_LIBRARIES(Common ${Boost_LIBRARIES} ${OpenCV_LIBS}) ++TARGET_INCLUDE_DIRECTORIES(Common PUBLIC $ $) + + # Install + SET_TARGET_PROPERTIES(Common PROPERTIES +diff --git a/libs/IO/CMakeLists.txt b/libs/IO/CMakeLists.txt +index a354376..4fd478c 100644 +--- a/libs/IO/CMakeLists.txt ++++ b/libs/IO/CMakeLists.txt +@@ -43,7 +43,8 @@ cxx_library_with_type_no_pch(IO "Libs" "STATIC" "${cxx_default}" + set_target_pch(IO Common.h) + + # Link its dependencies +-TARGET_LINK_LIBRARIES(IO Common ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${EXIV2_LIBS}) ++TARGET_LINK_LIBRARIES(IO Common ${TIFF_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${EXIV2_LIBS}) ++TARGET_INCLUDE_DIRECTORIES(IO PUBLIC $ $) + + # Install + SET_TARGET_PROPERTIES(IO PROPERTIES +diff --git a/libs/MVS/CMakeLists.txt b/libs/MVS/CMakeLists.txt +index 14be620..867cfd5 100644 +--- a/libs/MVS/CMakeLists.txt ++++ b/libs/MVS/CMakeLists.txt +@@ -1,12 +1,12 @@ + # Find required packages +-FIND_PACKAGE(CGAL ${SYSTEM_PACKAGE_REQUIRED}) ++FIND_PACKAGE(CGAL REQUIRED) + if(CGAL_FOUND) + include_directories(${CGAL_INCLUDE_DIRS}) + add_definitions(${CGAL_DEFINITIONS}) + link_directories(${CGAL_LIBRARY_DIRS}) + endif() + +-FIND_PACKAGE(VCG ${SYSTEM_PACKAGE_REQUIRED}) ++FIND_PACKAGE(VCG REQUIRED) + if(VCG_FOUND) + include_directories(${VCG_INCLUDE_DIRS}) + add_definitions(${VCG_DEFINITIONS}) +@@ -14,12 +14,10 @@ endif() + + set(CERES_LIBS "") + if(OpenMVS_USE_CERES) +- FIND_PACKAGE(CERES) ++ FIND_PACKAGE(Ceres REQUIRED) + if(CERES_FOUND) + include_directories(${CERES_INCLUDE_DIRS}) + add_definitions(${CERES_DEFINITIONS}) +- else() +- set(OpenMVS_USE_CERES OFF) + endif() + endif() + +@@ -42,7 +40,8 @@ cxx_library_with_type_no_pch(MVS "Libs" "" "${cxx_default}" + set_target_pch(MVS Common.h) + + # Link its dependencies +-TARGET_LINK_LIBRARIES(MVS PRIVATE Common Math IO ${CERES_LIBS} ${CGAL_LIBS} ${CUDA_CUDA_LIBRARY}) ++TARGET_LINK_LIBRARIES(MVS PRIVATE Common Math IO ${CERES_LIBS} CGAL::CGAL ${CUDA_CUDA_LIBRARY}) ++TARGET_INCLUDE_DIRECTORIES(MVS PUBLIC $ $) + + # Install + SET_TARGET_PROPERTIES(MVS PROPERTIES +diff --git a/libs/Math/CMakeLists.txt b/libs/Math/CMakeLists.txt +index d592bd0..f1fe4c6 100644 +--- a/libs/Math/CMakeLists.txt ++++ b/libs/Math/CMakeLists.txt +@@ -35,6 +35,7 @@ set_target_pch(Math Common.h) + + # Link its dependencies + TARGET_LINK_LIBRARIES(Math Common) ++TARGET_INCLUDE_DIRECTORIES(Math PUBLIC $ $) + + # Install + INSTALL(FILES ${LIBRARY_FILES_H} DESTINATION "${INSTALL_INCLUDE_DIR}/Math" COMPONENT dev) diff --git a/ports/openmvs/fix-linux-build.patch b/ports/openmvs/fix-linux-build.patch deleted file mode 100644 index 19460a91cc1ac9..00000000000000 --- a/ports/openmvs/fix-linux-build.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff --git a/apps/Viewer/CMakeLists.txt b/apps/Viewer/CMakeLists.txt -index c519040..934cd50 100644 ---- a/apps/Viewer/CMakeLists.txt -+++ b/apps/Viewer/CMakeLists.txt -@@ -16,18 +16,6 @@ else() - MESSAGE("-- Can't find GLEW. Continuing without it.") - RETURN() - endif() --if(CMAKE_COMPILER_IS_GNUCXX) -- FIND_PACKAGE(PkgConfig QUIET) -- pkg_search_module(GLFW QUIET glfw3) -- if(GLFW_FOUND) -- INCLUDE_DIRECTORIES(${GLFW_INCLUDE_DIRS}) -- ADD_DEFINITIONS(${GLFW_DEFINITIONS}) -- MESSAGE(STATUS "GLFW3 ${GLFW_VERSION} found (include: ${GLFW_INCLUDE_DIRS})") -- else() -- MESSAGE("-- Can't find GLFW3. Continuing without it.") -- RETURN() -- endif() --else() - FIND_PACKAGE(glfw3 QUIET) - if(glfw3_FOUND) - INCLUDE_DIRECTORIES(${glfw3_INCLUDE_DIRS}) -@@ -37,7 +25,6 @@ else() - MESSAGE("-- Can't find GLFW3. Continuing without it.") - RETURN() - endif() --endif() - - # List sources files - FILE(GLOB PCH_C "Common.cpp") -diff --git a/libs/IO/CMakeLists.txt b/libs/IO/CMakeLists.txt -index a354376..d4faf34 100644 ---- a/libs/IO/CMakeLists.txt -+++ b/libs/IO/CMakeLists.txt -@@ -43,7 +43,7 @@ cxx_library_with_type_no_pch(IO "Libs" "STATIC" "${cxx_default}" - set_target_pch(IO Common.h) - - # Link its dependencies --TARGET_LINK_LIBRARIES(IO Common ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${EXIV2_LIBS}) -+TARGET_LINK_LIBRARIES(IO Common ${TIFF_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${EXIV2_LIBS}) - - # Install - SET_TARGET_PROPERTIES(IO PROPERTIES diff --git a/ports/openmvs/fix-tool-paths.patch b/ports/openmvs/fix-tool-paths.patch deleted file mode 100644 index 6ce862e95f8ee2..00000000000000 --- a/ports/openmvs/fix-tool-paths.patch +++ /dev/null @@ -1,724 +0,0 @@ -diff --git a/MvgMvsPipeline.py b/MvgMvsPipeline.py.in -similarity index 95% -rename from MvgMvsPipeline.py -rename to MvgMvsPipeline.py.in -index f4914bf..3bd680c 100644 ---- a/MvgMvsPipeline.py -+++ b/MvgMvsPipeline.py.in -@@ -1,358 +1,358 @@ --#!/usr/bin/python3 --# -*- encoding: utf-8 -*- --# --# Created by @FlachyJoe --""" --This script is for an easy use of OpenMVG and OpenMVS -- --usage: MvgMvs_Pipeline.py [-h] [--steps STEPS [STEPS ...]] [--preset PRESET] -- [--0 0 [0 ...]] [--1 1 [1 ...]] [--2 2 [2 ...]] -- [--3 3 [3 ...]] [--4 4 [4 ...]] [--5 5 [5 ...]] -- [--6 6 [6 ...]] [--7 7 [7 ...]] [--8 8 [8 ...]] -- [--9 9 [9 ...]] [--10 10 [10 ...]] [--11 11 [11 ...]] -- [--12 12 [12 ...]] [--13 13 [13 ...]] -- [--14 14 [14 ...]] [--15 15 [15 ...]] -- input_dir output_dir -- --Photogrammetry reconstruction with these steps: -- 0. Intrinsics analysis openMVG_main_SfMInit_ImageListing -- 1. Compute features openMVG_main_ComputeFeatures -- 2. Compute matches openMVG_main_ComputeMatches -- 3. Incremental reconstruction openMVG_main_IncrementalSfM -- 4. Global reconstruction openMVG_main_GlobalSfM -- 5. Colorize Structure openMVG_main_ComputeSfM_DataColor -- 6. Structure from Known Poses openMVG_main_ComputeStructureFromKnownPoses -- 7. Colorized robust triangulation openMVG_main_ComputeSfM_DataColor -- 8. Control Points Registration ui_openMVG_control_points_registration -- 9. Export to openMVS openMVG_main_openMVG2openMVS -- 10. Densify point-cloud DensifyPointCloud -- 11. Reconstruct the mesh ReconstructMesh -- 12. Refine the mesh RefineMesh -- 13. Texture the mesh TextureMesh -- 14. Estimate disparity-maps DensifyPointCloud -- 15. Fuse disparity-maps DensifyPointCloud -- --positional arguments: -- input_dir the directory wich contains the pictures set. -- output_dir the directory wich will contain the resulting files. -- --optional arguments: -- -h, --help show this help message and exit -- --steps STEPS [STEPS ...] steps to process -- --preset PRESET steps list preset in -- SEQUENTIAL = [0, 1, 2, 3, 9, 10, 11, 12, 13] -- GLOBAL = [0, 1, 2, 4, 9, 10, 11, 12, 13] -- MVG_SEQ = [0, 1, 2, 3, 5, 6, 7] -- MVG_GLOBAL = [0, 1, 2, 4, 5, 6, 7] -- MVS_SGM = [14, 15] -- default : SEQUENTIAL -- --Passthrough: -- Option to be passed to command lines (remove - in front of option names) -- e.g. --1 p ULTRA to use the ULTRA preset in openMVG_main_ComputeFeatures --""" -- --import os --import subprocess --import sys --import argparse -- --DEBUG = False -- --# add current directory to PATH --if sys.platform.startswith('win'): -- path_delim = ';' --else: -- path_delim = ':' --os.environ['PATH'] += path_delim + os.getcwd() -- -- --def whereis(afile): -- """ -- return directory in which afile is, None if not found. Look in PATH -- """ -- if sys.platform.startswith('win'): -- cmd = "where" -- else: -- cmd = "which" -- try: -- ret = subprocess.run([cmd, afile], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True) -- return os.path.split(ret.stdout.decode())[0] -- except subprocess.CalledProcessError: -- return None -- --def find(afile): -- """ -- As whereis look only for executable on linux, this find look for all file type -- """ -- for d in os.environ['PATH'].split(path_delim): -- if os.path.isfile(os.path.join(d, afile)): -- return d -- return None -- --# Try to find openMVG and openMVS binaries in PATH --OPENMVG_BIN = whereis("openMVG_main_SfMInit_ImageListing") --OPENMVS_BIN = whereis("ReconstructMesh") -- --# Try to find openMVG camera sensor database --CAMERA_SENSOR_DB_FILE = "sensor_width_camera_database.txt" --CAMERA_SENSOR_DB_DIRECTORY = find(CAMERA_SENSOR_DB_FILE) -- --# Ask user for openMVG and openMVS directories if not found --if not OPENMVG_BIN: -- OPENMVG_BIN = input("openMVG binary folder?\n") --if not OPENMVS_BIN: -- OPENMVS_BIN = input("openMVS binary folder?\n") --if not CAMERA_SENSOR_DB_DIRECTORY: -- CAMERA_SENSOR_DB_DIRECTORY = input("openMVG camera database (%s) folder?\n" % CAMERA_SENSOR_DB_FILE) -- -- --PRESET = {'SEQUENTIAL': [0, 1, 2, 3, 9, 10, 11, 12, 13], -- 'GLOBAL': [0, 1, 2, 4, 9, 10, 11, 12, 13], -- 'MVG_SEQ': [0, 1, 2, 3, 5, 6, 7], -- 'MVG_GLOBAL': [0, 1, 2, 4, 5, 6, 7], -- 'MVS_SGM': [14, 15]} -- --PRESET_DEFAULT = 'SEQUENTIAL' -- -- --# HELPERS for terminal colors --BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8) --NO_EFFECT, BOLD, UNDERLINE, BLINK, INVERSE, HIDDEN = (0, 1, 4, 5, 7, 8) -- --# from Python cookbook, #475186 --def has_colours(stream): -- ''' -- Return stream colours capability -- ''' -- if not hasattr(stream, "isatty"): -- return False -- if not stream.isatty(): -- return False # auto color only on TTYs -- try: -- import curses -- curses.setupterm() -- return curses.tigetnum("colors") > 2 -- except Exception: -- # guess false in case of error -- return False -- --HAS_COLOURS = has_colours(sys.stdout) -- -- --def printout(text, colour=WHITE, background=BLACK, effect=NO_EFFECT): -- """ -- print() with colour -- """ -- if HAS_COLOURS: -- seq = "\x1b[%d;%d;%dm" % (effect, 30+colour, 40+background) + text + "\x1b[0m" -- sys.stdout.write(seq+'\r\n') -- else: -- sys.stdout.write(text+'\r\n') -- -- --# OBJECTS to store config and data in --class ConfContainer: -- """ -- Container for all the config variables -- """ -- def __init__(self): -- pass -- -- --class AStep: -- def __init__(self, info, cmd, opt): -- self.info = info -- self.cmd = cmd -- self.opt = opt -- -- --class StepsStore: -- def __init__(self): -- self.steps_data = [ -- ["Intrinsics analysis", # 0 -- os.path.join(OPENMVG_BIN, "openMVG_main_SfMInit_ImageListing"), -- ["-i", "%input_dir%", "-o", "%matches_dir%", "-d", "%camera_file_params%"]], -- ["Compute features", # 1 -- os.path.join(OPENMVG_BIN, "openMVG_main_ComputeFeatures"), -- ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-m", "SIFT", "-n", "4"]], -- ["Compute matches", # 2 -- os.path.join(OPENMVG_BIN, "openMVG_main_ComputeMatches"), -- ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-n", "HNSWL2", "-r", ".8"]], -- ["Incremental reconstruction", # 3 -- os.path.join(OPENMVG_BIN, "openMVG_main_IncrementalSfM"), -- ["-i", "%matches_dir%/sfm_data.json", "-m", "%matches_dir%", "-o", "%reconstruction_dir%"]], -- ["Global reconstruction", # 4 -- os.path.join(OPENMVG_BIN, "openMVG_main_GlobalSfM"), -- ["-i", "%matches_dir%/sfm_data.json", "-m", "%matches_dir%", "-o", "%reconstruction_dir%"]], -- ["Colorize Structure", # 5 -- os.path.join(OPENMVG_BIN, "openMVG_main_ComputeSfM_DataColor"), -- ["-i", "%reconstruction_dir%/sfm_data.bin", "-o", "%reconstruction_dir%/colorized.ply"]], -- ["Structure from Known Poses", # 6 -- os.path.join(OPENMVG_BIN, "openMVG_main_ComputeStructureFromKnownPoses"), -- ["-i", "%reconstruction_dir%/sfm_data.bin", "-m", "%matches_dir%", "-f", "%matches_dir%/matches.f.bin", "-o", "%reconstruction_dir%/robust.bin"]], -- ["Colorized robust triangulation", # 7 -- os.path.join(OPENMVG_BIN, "openMVG_main_ComputeSfM_DataColor"), -- ["-i", "%reconstruction_dir%/robust.bin", "-o", "%reconstruction_dir%/robust_colorized.ply"]], -- ["Control Points Registration", # 8 -- os.path.join(OPENMVG_BIN, "ui_openMVG_control_points_registration"), -- ["-i", "%reconstruction_dir%/sfm_data.bin"]], -- ["Export to openMVS", # 9 -- os.path.join(OPENMVG_BIN, "openMVG_main_openMVG2openMVS"), -- ["-i", "%reconstruction_dir%/sfm_data.bin", "-o", "%mvs_dir%/scene.mvs", "-d", "%mvs_dir%/images"]], -- ["Densify point cloud", # 10 -- os.path.join(OPENMVS_BIN, "DensifyPointCloud"), -- ["scene.mvs", "--dense-config-file", "Densify.ini", "--resolution-level", "1", "-w", "%mvs_dir%"]], -- ["Reconstruct the mesh", # 11 -- os.path.join(OPENMVS_BIN, "ReconstructMesh"), -- ["scene_dense.mvs", "-w", "%mvs_dir%"]], -- ["Refine the mesh", # 12 -- os.path.join(OPENMVS_BIN, "RefineMesh"), -- ["scene_dense_mesh.mvs", "--scales", "2", "-w", "%mvs_dir%"]], -- ["Texture the mesh", # 13 -- os.path.join(OPENMVS_BIN, "TextureMesh"), -- ["scene_dense_mesh_refine.mvs", "--decimate", "0.5", "-w", "%mvs_dir%"]], -- ["Estimate disparity-maps", # 14 -- os.path.join(OPENMVS_BIN, "DensifyPointCloud"), -- ["scene.mvs", "--dense-config-file", "Densify.ini", "--fusion-mode", "-1", "-w", "%mvs_dir%"]], -- ["Fuse disparity-maps", # 15 -- os.path.join(OPENMVS_BIN, "DensifyPointCloud"), -- ["scene.mvs", "--dense-config-file", "Densify.ini", "--fusion-mode", "-2", "-w", "%mvs_dir%"]] -- ] -- -- def __getitem__(self, indice): -- return AStep(*self.steps_data[indice]) -- -- def length(self): -- return len(self.steps_data) -- -- def apply_conf(self, conf): -- """ replace each %var% per conf.var value in steps data """ -- for s in self.steps_data: -- o2 = [] -- for o in s[2]: -- co = o.replace("%input_dir%", conf.input_dir) -- co = co.replace("%output_dir%", conf.output_dir) -- co = co.replace("%matches_dir%", conf.matches_dir) -- co = co.replace("%reconstruction_dir%", conf.reconstruction_dir) -- co = co.replace("%mvs_dir%", conf.mvs_dir) -- co = co.replace("%camera_file_params%", conf.camera_file_params) -- o2.append(co) -- s[2] = o2 -- -- --CONF = ConfContainer() --STEPS = StepsStore() -- --# ARGS --parser = argparse.ArgumentParser( -- formatter_class=argparse.RawTextHelpFormatter, -- description="Photogrammetry reconstruction with these steps: \r\n" + -- "\r\n".join(("\t%i. %s\t %s" % (t, STEPS[t].info, STEPS[t].cmd) for t in range(STEPS.length()))) -- ) --parser.add_argument('input_dir', -- help="the directory wich contains the pictures set.") --parser.add_argument('output_dir', -- help="the directory wich will contain the resulting files.") --parser.add_argument('--steps', -- type=int, -- nargs="+", -- help="steps to process") --parser.add_argument('--preset', -- help="steps list preset in \r\n" + -- " \r\n".join([k + " = " + str(PRESET[k]) for k in PRESET]) + -- " \r\ndefault : " + PRESET_DEFAULT) -- --group = parser.add_argument_group('Passthrough', description="Option to be passed to command lines (remove - in front of option names)\r\ne.g. --1 p ULTRA to use the ULTRA preset in openMVG_main_ComputeFeatures") --for n in range(STEPS.length()): -- group.add_argument('--'+str(n), nargs='+') -- --parser.parse_args(namespace=CONF) # store args in the ConfContainer -- --# FOLDERS -- --def mkdir_ine(dirname): -- """Create the folder if not presents""" -- if not os.path.exists(dirname): -- os.mkdir(dirname) -- --# Absolute path for input and ouput dirs --CONF.input_dir = os.path.abspath(CONF.input_dir) --CONF.output_dir = os.path.abspath(CONF.output_dir) -- --if not os.path.exists(CONF.input_dir): -- sys.exit("%s: path not found" % CONF.input_dir) -- --CONF.reconstruction_dir = os.path.join(CONF.output_dir, "sfm") --CONF.matches_dir = os.path.join(CONF.reconstruction_dir, "matches") --CONF.mvs_dir = os.path.join(CONF.output_dir, "mvs") --CONF.camera_file_params = os.path.join(CAMERA_SENSOR_DB_DIRECTORY, CAMERA_SENSOR_DB_FILE) -- --mkdir_ine(CONF.output_dir) --mkdir_ine(CONF.reconstruction_dir) --mkdir_ine(CONF.matches_dir) --mkdir_ine(CONF.mvs_dir) -- --# Update directories in steps commandlines --STEPS.apply_conf(CONF) -- --# PRESET --if CONF.steps and CONF.preset: -- sys.exit("Steps and preset arguments can't be set together.") --elif CONF.preset: -- try: -- CONF.steps = PRESET[CONF.preset] -- except KeyError: -- sys.exit("Unkown preset %s, choose %s" % (CONF.preset, ' or '.join([s for s in PRESET]))) --elif not CONF.steps: -- CONF.steps = PRESET[PRESET_DEFAULT] -- --# WALK --print("# Using input dir: %s" % CONF.input_dir) --print("# output dir: %s" % CONF.output_dir) --print("# Steps: %s" % str(CONF.steps)) -- --if 2 in CONF.steps: # ComputeMatches -- if 4 in CONF.steps: # GlobalReconstruction -- # Set the geometric_model of ComputeMatches to Essential -- STEPS[2].opt.extend(["-g", "e"]) -- --for cstep in CONF.steps: -- printout("#%i. %s" % (cstep, STEPS[cstep].info), effect=INVERSE) -- -- # Retrieve "passthrough" commandline options -- opt = getattr(CONF, str(cstep)) -- if opt: -- # add - sign to short options and -- to long ones -- for o in range(0, len(opt), 2): -- if len(opt[o]) > 1: -- opt[o] = '-' + opt[o] -- opt[o] = '-' + opt[o] -- else: -- opt = [] -- -- # Remove STEPS[cstep].opt options now defined in opt -- for anOpt in STEPS[cstep].opt: -- if anOpt in opt: -- idx = STEPS[cstep].opt.index(anOpt) -- if DEBUG: -- print('#\tRemove ' + str(anOpt) + ' from defaults options at id ' + str(idx)) -- del STEPS[cstep].opt[idx:idx+2] -- -- # create a commandline for the current step -- cmdline = [STEPS[cstep].cmd] + STEPS[cstep].opt + opt -- print('Cmd: ' + ' '.join(cmdline)) -- -- if not DEBUG: -- # Launch the current step -- try: -- pStep = subprocess.Popen(cmdline) -- pStep.wait() -- if pStep.returncode != 0: -- break -- except KeyboardInterrupt: -- sys.exit('\r\nProcess canceled by user, all files remains') -- else: -- print('\t'.join(cmdline)) -- --printout("# Pipeline end #", effect=INVERSE) -+#!/usr/bin/python3 -+# -*- encoding: utf-8 -*- -+# -+# Created by @FlachyJoe -+""" -+This script is for an easy use of OpenMVG and OpenMVS -+ -+usage: MvgMvs_Pipeline.py [-h] [--steps STEPS [STEPS ...]] [--preset PRESET] -+ [--0 0 [0 ...]] [--1 1 [1 ...]] [--2 2 [2 ...]] -+ [--3 3 [3 ...]] [--4 4 [4 ...]] [--5 5 [5 ...]] -+ [--6 6 [6 ...]] [--7 7 [7 ...]] [--8 8 [8 ...]] -+ [--9 9 [9 ...]] [--10 10 [10 ...]] [--11 11 [11 ...]] -+ [--12 12 [12 ...]] [--13 13 [13 ...]] -+ [--14 14 [14 ...]] [--15 15 [15 ...]] -+ input_dir output_dir -+ -+Photogrammetry reconstruction with these steps: -+ 0. Intrinsics analysis openMVG_main_SfMInit_ImageListing -+ 1. Compute features openMVG_main_ComputeFeatures -+ 2. Compute matches openMVG_main_ComputeMatches -+ 3. Incremental reconstruction openMVG_main_IncrementalSfM -+ 4. Global reconstruction openMVG_main_GlobalSfM -+ 5. Colorize Structure openMVG_main_ComputeSfM_DataColor -+ 6. Structure from Known Poses openMVG_main_ComputeStructureFromKnownPoses -+ 7. Colorized robust triangulation openMVG_main_ComputeSfM_DataColor -+ 8. Control Points Registration ui_openMVG_control_points_registration -+ 9. Export to openMVS openMVG_main_openMVG2openMVS -+ 10. Densify point-cloud DensifyPointCloud -+ 11. Reconstruct the mesh ReconstructMesh -+ 12. Refine the mesh RefineMesh -+ 13. Texture the mesh TextureMesh -+ 14. Estimate disparity-maps DensifyPointCloud -+ 15. Fuse disparity-maps DensifyPointCloud -+ -+positional arguments: -+ input_dir the directory wich contains the pictures set. -+ output_dir the directory wich will contain the resulting files. -+ -+optional arguments: -+ -h, --help show this help message and exit -+ --steps STEPS [STEPS ...] steps to process -+ --preset PRESET steps list preset in -+ SEQUENTIAL = [0, 1, 2, 3, 9, 10, 11, 12, 13] -+ GLOBAL = [0, 1, 2, 4, 9, 10, 11, 12, 13] -+ MVG_SEQ = [0, 1, 2, 3, 5, 6, 7] -+ MVG_GLOBAL = [0, 1, 2, 4, 5, 6, 7] -+ MVS_SGM = [14, 15] -+ default : SEQUENTIAL -+ -+Passthrough: -+ Option to be passed to command lines (remove - in front of option names) -+ e.g. --1 p ULTRA to use the ULTRA preset in openMVG_main_ComputeFeatures -+""" -+ -+import os -+import subprocess -+import sys -+import argparse -+ -+DEBUG = False -+ -+# add current directory to PATH -+if sys.platform.startswith('win'): -+ path_delim = ';' -+else: -+ path_delim = ':' -+os.environ['PATH'] += path_delim + os.getcwd() -+ -+ -+def whereis(afile): -+ """ -+ return directory in which afile is, None if not found. Look in PATH -+ """ -+ if sys.platform.startswith('win'): -+ cmd = "where" -+ else: -+ cmd = "which" -+ try: -+ ret = subprocess.run([cmd, afile], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True) -+ return os.path.split(ret.stdout.decode())[0] -+ except subprocess.CalledProcessError: -+ return None -+ -+def find(afile): -+ """ -+ As whereis look only for executable on linux, this find look for all file type -+ """ -+ for d in os.environ['PATH'].split(path_delim): -+ if os.path.isfile(os.path.join(d, afile)): -+ return d -+ return None -+ -+# Try to find openMVG and openMVS binaries in PATH -+OPENMVG_BIN = "@OPENMVG_TOOLS_PATH@" -+OPENMVS_BIN = "@OPENMVS_TOOLS_PATH@" -+ -+# Try to find openMVG camera sensor database -+CAMERA_SENSOR_DB_FILE = "@SENSOR_WIDTH_CAMERA_DATABASE_TXT_PATH@" -+CAMERA_SENSOR_DB_DIRECTORY = "@OPENMVG_TOOLS_PATH@" -+ -+# Ask user for openMVG and openMVS directories if not found -+if not OPENMVG_BIN: -+ OPENMVG_BIN = input("openMVG binary folder?\n") -+if not OPENMVS_BIN: -+ OPENMVS_BIN = input("openMVS binary folder?\n") -+if not CAMERA_SENSOR_DB_DIRECTORY: -+ CAMERA_SENSOR_DB_DIRECTORY = input("openMVG camera database (%s) folder?\n" % CAMERA_SENSOR_DB_FILE) -+ -+ -+PRESET = {'SEQUENTIAL': [0, 1, 2, 3, 9, 10, 11, 12, 13], -+ 'GLOBAL': [0, 1, 2, 4, 9, 10, 11, 12, 13], -+ 'MVG_SEQ': [0, 1, 2, 3, 5, 6, 7], -+ 'MVG_GLOBAL': [0, 1, 2, 4, 5, 6, 7], -+ 'MVS_SGM': [14, 15]} -+ -+PRESET_DEFAULT = 'SEQUENTIAL' -+ -+ -+# HELPERS for terminal colors -+BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8) -+NO_EFFECT, BOLD, UNDERLINE, BLINK, INVERSE, HIDDEN = (0, 1, 4, 5, 7, 8) -+ -+# from Python cookbook, #475186 -+def has_colours(stream): -+ ''' -+ Return stream colours capability -+ ''' -+ if not hasattr(stream, "isatty"): -+ return False -+ if not stream.isatty(): -+ return False # auto color only on TTYs -+ try: -+ import curses -+ curses.setupterm() -+ return curses.tigetnum("colors") > 2 -+ except Exception: -+ # guess false in case of error -+ return False -+ -+HAS_COLOURS = has_colours(sys.stdout) -+ -+ -+def printout(text, colour=WHITE, background=BLACK, effect=NO_EFFECT): -+ """ -+ print() with colour -+ """ -+ if HAS_COLOURS: -+ seq = "\x1b[%d;%d;%dm" % (effect, 30+colour, 40+background) + text + "\x1b[0m" -+ sys.stdout.write(seq+'\r\n') -+ else: -+ sys.stdout.write(text+'\r\n') -+ -+ -+# OBJECTS to store config and data in -+class ConfContainer: -+ """ -+ Container for all the config variables -+ """ -+ def __init__(self): -+ pass -+ -+ -+class AStep: -+ def __init__(self, info, cmd, opt): -+ self.info = info -+ self.cmd = cmd -+ self.opt = opt -+ -+ -+class StepsStore: -+ def __init__(self): -+ self.steps_data = [ -+ ["Intrinsics analysis", # 0 -+ os.path.join(OPENMVG_BIN, "openMVG_main_SfMInit_ImageListing"), -+ ["-i", "%input_dir%", "-o", "%matches_dir%", "-d", "%camera_file_params%"]], -+ ["Compute features", # 1 -+ os.path.join(OPENMVG_BIN, "openMVG_main_ComputeFeatures"), -+ ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-m", "SIFT"]], -+ ["Compute matches", # 2 -+ os.path.join(OPENMVG_BIN, "openMVG_main_ComputeMatches"), -+ ["-i", "%matches_dir%/sfm_data.json", "-o", "%matches_dir%", "-n", "AUTO", "-r", ".8"]], -+ ["Incremental reconstruction", # 3 -+ os.path.join(OPENMVG_BIN, "openMVG_main_IncrementalSfM"), -+ ["-i", "%matches_dir%/sfm_data.json", "-m", "%matches_dir%", "-o", "%reconstruction_dir%"]], -+ ["Global reconstruction", # 4 -+ os.path.join(OPENMVG_BIN, "openMVG_main_GlobalSfM"), -+ ["-i", "%matches_dir%/sfm_data.json", "-m", "%matches_dir%", "-o", "%reconstruction_dir%"]], -+ ["Colorize Structure", # 5 -+ os.path.join(OPENMVG_BIN, "openMVG_main_ComputeSfM_DataColor"), -+ ["-i", "%reconstruction_dir%/sfm_data.bin", "-o", "%reconstruction_dir%/colorized.ply"]], -+ ["Structure from Known Poses", # 6 -+ os.path.join(OPENMVG_BIN, "openMVG_main_ComputeStructureFromKnownPoses"), -+ ["-i", "%reconstruction_dir%/sfm_data.bin", "-m", "%matches_dir%", "-f", "%matches_dir%/matches.f.bin", "-o", "%reconstruction_dir%/robust.bin"]], -+ ["Colorized robust triangulation", # 7 -+ os.path.join(OPENMVG_BIN, "openMVG_main_ComputeSfM_DataColor"), -+ ["-i", "%reconstruction_dir%/robust.bin", "-o", "%reconstruction_dir%/robust_colorized.ply"]], -+ ["Control Points Registration", # 8 -+ os.path.join(OPENMVG_BIN, "ui_openMVG_control_points_registration"), -+ ["-i", "%reconstruction_dir%/sfm_data.bin"]], -+ ["Export to openMVS", # 9 -+ os.path.join(OPENMVG_BIN, "openMVG_main_openMVG2openMVS"), -+ ["-i", "%reconstruction_dir%/sfm_data.bin", "-o", "%mvs_dir%/scene.mvs", "-d", "%mvs_dir%/images"]], -+ ["Densify point cloud", # 10 -+ os.path.join(OPENMVS_BIN, "DensifyPointCloud"), -+ ["scene.mvs", "--dense-config-file", "Densify.ini", "--resolution-level", "1", "-w", "%mvs_dir%"]], -+ ["Reconstruct the mesh", # 11 -+ os.path.join(OPENMVS_BIN, "ReconstructMesh"), -+ ["scene_dense.mvs", "-w", "%mvs_dir%"]], -+ ["Refine the mesh", # 12 -+ os.path.join(OPENMVS_BIN, "RefineMesh"), -+ ["scene_dense_mesh.mvs", "--scales", "2", "-w", "%mvs_dir%"]], -+ ["Texture the mesh", # 13 -+ os.path.join(OPENMVS_BIN, "TextureMesh"), -+ ["scene_dense_mesh_refine.mvs", "--decimate", "0.5", "-w", "%mvs_dir%"]], -+ ["Estimate disparity-maps", # 14 -+ os.path.join(OPENMVS_BIN, "DensifyPointCloud"), -+ ["scene.mvs", "--dense-config-file", "Densify.ini", "--fusion-mode", "-1", "-w", "%mvs_dir%"]], -+ ["Fuse disparity-maps", # 15 -+ os.path.join(OPENMVS_BIN, "DensifyPointCloud"), -+ ["scene.mvs", "--dense-config-file", "Densify.ini", "--fusion-mode", "-2", "-w", "%mvs_dir%"]] -+ ] -+ -+ def __getitem__(self, indice): -+ return AStep(*self.steps_data[indice]) -+ -+ def length(self): -+ return len(self.steps_data) -+ -+ def apply_conf(self, conf): -+ """ replace each %var% per conf.var value in steps data """ -+ for s in self.steps_data: -+ o2 = [] -+ for o in s[2]: -+ co = o.replace("%input_dir%", conf.input_dir) -+ co = co.replace("%output_dir%", conf.output_dir) -+ co = co.replace("%matches_dir%", conf.matches_dir) -+ co = co.replace("%reconstruction_dir%", conf.reconstruction_dir) -+ co = co.replace("%mvs_dir%", conf.mvs_dir) -+ co = co.replace("%camera_file_params%", conf.camera_file_params) -+ o2.append(co) -+ s[2] = o2 -+ -+ -+CONF = ConfContainer() -+STEPS = StepsStore() -+ -+# ARGS -+parser = argparse.ArgumentParser( -+ formatter_class=argparse.RawTextHelpFormatter, -+ description="Photogrammetry reconstruction with these steps: \r\n" + -+ "\r\n".join(("\t%i. %s\t %s" % (t, STEPS[t].info, STEPS[t].cmd) for t in range(STEPS.length()))) -+ ) -+parser.add_argument('input_dir', -+ help="the directory wich contains the pictures set.") -+parser.add_argument('output_dir', -+ help="the directory wich will contain the resulting files.") -+parser.add_argument('--steps', -+ type=int, -+ nargs="+", -+ help="steps to process") -+parser.add_argument('--preset', -+ help="steps list preset in \r\n" + -+ " \r\n".join([k + " = " + str(PRESET[k]) for k in PRESET]) + -+ " \r\ndefault : " + PRESET_DEFAULT) -+ -+group = parser.add_argument_group('Passthrough', description="Option to be passed to command lines (remove - in front of option names)\r\ne.g. --1 p ULTRA to use the ULTRA preset in openMVG_main_ComputeFeatures") -+for n in range(STEPS.length()): -+ group.add_argument('--'+str(n), nargs='+') -+ -+parser.parse_args(namespace=CONF) # store args in the ConfContainer -+ -+# FOLDERS -+ -+def mkdir_ine(dirname): -+ """Create the folder if not presents""" -+ if not os.path.exists(dirname): -+ os.mkdir(dirname) -+ -+# Absolute path for input and ouput dirs -+CONF.input_dir = os.path.abspath(CONF.input_dir) -+CONF.output_dir = os.path.abspath(CONF.output_dir) -+ -+if not os.path.exists(CONF.input_dir): -+ sys.exit("%s: path not found" % CONF.input_dir) -+ -+CONF.reconstruction_dir = os.path.join(CONF.output_dir, "sfm") -+CONF.matches_dir = os.path.join(CONF.reconstruction_dir, "matches") -+CONF.mvs_dir = os.path.join(CONF.output_dir, "mvs") -+CONF.camera_file_params = os.path.join(CAMERA_SENSOR_DB_DIRECTORY, CAMERA_SENSOR_DB_FILE) -+ -+mkdir_ine(CONF.output_dir) -+mkdir_ine(CONF.reconstruction_dir) -+mkdir_ine(CONF.matches_dir) -+mkdir_ine(CONF.mvs_dir) -+ -+# Update directories in steps commandlines -+STEPS.apply_conf(CONF) -+ -+# PRESET -+if CONF.steps and CONF.preset: -+ sys.exit("Steps and preset arguments can't be set together.") -+elif CONF.preset: -+ try: -+ CONF.steps = PRESET[CONF.preset] -+ except KeyError: -+ sys.exit("Unkown preset %s, choose %s" % (CONF.preset, ' or '.join([s for s in PRESET]))) -+elif not CONF.steps: -+ CONF.steps = PRESET[PRESET_DEFAULT] -+ -+# WALK -+print("# Using input dir: %s" % CONF.input_dir) -+print("# output dir: %s" % CONF.output_dir) -+print("# Steps: %s" % str(CONF.steps)) -+ -+if 2 in CONF.steps: # ComputeMatches -+ if 4 in CONF.steps: # GlobalReconstruction -+ # Set the geometric_model of ComputeMatches to Essential -+ STEPS[2].opt.extend(["-g", "e"]) -+ -+for cstep in CONF.steps: -+ printout("#%i. %s" % (cstep, STEPS[cstep].info), effect=INVERSE) -+ -+ # Retrieve "passthrough" commandline options -+ opt = getattr(CONF, str(cstep)) -+ if opt: -+ # add - sign to short options and -- to long ones -+ for o in range(0, len(opt), 2): -+ if len(opt[o]) > 1: -+ opt[o] = '-' + opt[o] -+ opt[o] = '-' + opt[o] -+ else: -+ opt = [] -+ -+ # Remove STEPS[cstep].opt options now defined in opt -+ for anOpt in STEPS[cstep].opt: -+ if anOpt in opt: -+ idx = STEPS[cstep].opt.index(anOpt) -+ if DEBUG: -+ print('#\tRemove ' + str(anOpt) + ' from defaults options at id ' + str(idx)) -+ del STEPS[cstep].opt[idx:idx+2] -+ -+ # create a commandline for the current step -+ cmdline = [STEPS[cstep].cmd] + STEPS[cstep].opt + opt -+ print('Cmd: ' + ' '.join(cmdline)) -+ -+ if not DEBUG: -+ # Launch the current step -+ try: -+ pStep = subprocess.Popen(cmdline) -+ pStep.wait() -+ if pStep.returncode != 0: -+ break -+ except KeyboardInterrupt: -+ sys.exit('\r\nProcess canceled by user, all files remains') -+ else: -+ print('\t'.join(cmdline)) -+ -+printout("# Pipeline end #", effect=INVERSE) diff --git a/ports/openmvs/portfile.cmake b/ports/openmvs/portfile.cmake index 774ba73602b0d5..9ae7790eff829c 100644 --- a/ports/openmvs/portfile.cmake +++ b/ports/openmvs/portfile.cmake @@ -7,9 +7,7 @@ vcpkg_from_github( SHA512 baa9149853dc08c602deeb1a04cf57643d1cb0733aee2776f4e99b210279aad3b4a1013ab1d790e91a3a95b7c72b9c12c6be25f2c30a76b69b5319b610cb8e7a HEAD_REF master PATCHES - fix-tool-paths.patch - fix-linux-build.patch - fix-tool-build.patch + fix-build.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS From 041ccd1beb8ee24be0721d59059981b68238dd55 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Wed, 8 Jul 2020 23:21:18 +0200 Subject: [PATCH 14/61] [OpenMVS] improve behaviour for downstream projects --- ports/openmvs/fix-build.patch | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ports/openmvs/fix-build.patch b/ports/openmvs/fix-build.patch index b96d2375eecf85..13460e83a47132 100644 --- a/ports/openmvs/fix-build.patch +++ b/ports/openmvs/fix-build.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7966ed5..b8dfb54 100644 +index 7966ed5..4e0f673 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,7 @@ INCLUDE_DIRECTORIES("${OpenMVS_SOURCE_DIR}") @@ -54,10 +54,11 @@ index 7966ed5..b8dfb54 100644 -FIND_PACKAGE(Eigen ${SYSTEM_PACKAGE_REQUIRED}) -if(EIGEN_FOUND) - INCLUDE_DIRECTORIES(${EIGEN_INCLUDE_DIRS}) +- ADD_DEFINITIONS(${EIGEN_DEFINITIONS} -D_USE_EIGEN) +FIND_PACKAGE(Eigen3 REQUIRED) +if(EIGEN3_FOUND) + INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIRS}) - ADD_DEFINITIONS(${EIGEN_DEFINITIONS} -D_USE_EIGEN) ++ ADD_DEFINITIONS(${EIGEN3_DEFINITIONS} -D_USE_EIGEN) SET(_USE_EIGEN TRUE) endif() @@ -163,10 +164,10 @@ index c519040..934cd50 100644 # List sources files FILE(GLOB PCH_C "Common.cpp") diff --git a/build/OpenMVSConfig.cmake.in b/build/OpenMVSConfig.cmake.in -index 96b8fe2..2dce8e7 100644 +index 96b8fe2..454e846 100644 --- a/build/OpenMVSConfig.cmake.in +++ b/build/OpenMVSConfig.cmake.in -@@ -3,16 +3,66 @@ +@@ -3,16 +3,70 @@ # OpenMVS_INCLUDE_DIRS - include directories for OpenMVS # OpenMVS_LIBRARIES - libraries to link against # OpenMVS_BINARIES - the binaries @@ -185,6 +186,9 @@ index 96b8fe2..2dce8e7 100644 + set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG") +endif() + ++set(CMAKE_CXX_STANDARD 14) ++set(CMAKE_CXX_STANDARD_REQUIRED ON) ++ +include(CMakeFindDependencyMacro) + +if(@OpenMVS_USE_OPENMP@) @@ -210,8 +214,9 @@ index 96b8fe2..2dce8e7 100644 + +find_dependency(Boost) +add_definitions(${Boost_DEFINITIONS} -D_USE_BOOST) ++include_directories(${Boost_INCLUDE_DIRS}) +find_dependency(Eigen3) -+add_definitions(${EIGEN_DEFINITIONS} -D_USE_EIGEN) ++add_definitions(${EIGEN3_DEFINITIONS} -D_USE_EIGEN) +find_dependency(OpenCV) +add_definitions(${OpenCV_DEFINITIONS}) +find_dependency(CGAL) From f96b4ec4c165ab067c8712c24d08faa70cd76dc1 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 9 Jul 2020 10:40:39 +0200 Subject: [PATCH 15/61] [clapack] bump to retrigger CI build --- ports/clapack/CONTROL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/clapack/CONTROL b/ports/clapack/CONTROL index ce3610044aeff6..ef08ef294f6b01 100644 --- a/ports/clapack/CONTROL +++ b/ports/clapack/CONTROL @@ -1,5 +1,5 @@ Source: clapack -Version: 3.2.1-13 +Version: 3.2.1-14 Homepage: https://www.netlib.org/clapack Description: CLAPACK (f2c'ed version of LAPACK) Build-Depends: openblas (!osx) From 21cc84963353674e1f105098e4fc31a597c43adb Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 9 Jul 2020 17:20:54 +0200 Subject: [PATCH 16/61] [qt5-base] add zstd as dependency --- ports/qt5-base/CONTROL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/qt5-base/CONTROL b/ports/qt5-base/CONTROL index 4788f4b3852d6c..3a70df11999772 100644 --- a/ports/qt5-base/CONTROL +++ b/ports/qt5-base/CONTROL @@ -2,7 +2,7 @@ Source: qt5-base Version: 5.15.0 Homepage: https://www.qt.io/ Description: Qt5 Application Framework Base Module. Includes Core, GUI, Widgets, Networking, SQL, Concurrent and other essential qt components. -Build-Depends: zlib, libjpeg-turbo, libpng, freetype, pcre2, harfbuzz, sqlite3, libpq, double-conversion, openssl, angle (!windows), egl-registry, icu (!uwp), fontconfig (!windows) +Build-Depends: zlib, zstd, libjpeg-turbo, libpng, freetype, pcre2, harfbuzz, sqlite3, libpq, double-conversion, openssl, angle (!windows), egl-registry, icu (!uwp), fontconfig (!windows) Feature: latest Description: Build latest qt version (5.15.0) instead of LTS (latest and LTS are currently the same) From b56afd9ee7b2d91045918986303570c0c0e2f637 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 10 Jul 2020 12:25:23 +0200 Subject: [PATCH 17/61] Update ports/openmvg/CONTROL Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> --- ports/openmvg/CONTROL | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/openmvg/CONTROL b/ports/openmvg/CONTROL index 059795bfdccdde..679d9364266844 100644 --- a/ports/openmvg/CONTROL +++ b/ports/openmvg/CONTROL @@ -1,5 +1,6 @@ Source: openmvg -Version: 1.5-1 +Version: 1.5 +Port-Version: 1 Description: open Multiple View Geometry library. Basis for 3D computer vision and Structure from Motion. Build-Depends: coinutils, clp, osi, liblemon, flann, eigen3, ceres, cereal, libjpeg-turbo, tiff, libpng, zlib, suitesparse From 5b150a4f3158552bdc96d781d8b438d42a1f52d9 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 10 Jul 2020 12:25:34 +0200 Subject: [PATCH 18/61] Update ports/openmvs/CONTROL Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> --- ports/openmvs/CONTROL | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/openmvs/CONTROL b/ports/openmvs/CONTROL index 1fd7baea1e52e6..fc94afde00b19e 100644 --- a/ports/openmvs/CONTROL +++ b/ports/openmvs/CONTROL @@ -1,5 +1,6 @@ Source: openmvs -Version: 1.1-2 +Version: 1.1 +Port-Version: 2 Description: OpenMVS: open Multi-View Stereo reconstruction library Homepage: https://cdcseacave.github.io/openMVS Build-Depends: zlib, boost-iostreams, boost-program-options, boost-system, boost-serialization, eigen3, opencv, cgal[core], glew, glfw3, vcglib, openmvg[software], libpng, tiff From 39caea095b29d2eb23f9b6765e6bfa55fa1892bb Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 10 Jul 2020 12:25:45 +0200 Subject: [PATCH 19/61] Update ports/qt5-base/CONTROL Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> --- ports/qt5-base/CONTROL | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/qt5-base/CONTROL b/ports/qt5-base/CONTROL index 3a70df11999772..e79f75e495d72d 100644 --- a/ports/qt5-base/CONTROL +++ b/ports/qt5-base/CONTROL @@ -1,5 +1,6 @@ Source: qt5-base Version: 5.15.0 +Port-Version: 1 Homepage: https://www.qt.io/ Description: Qt5 Application Framework Base Module. Includes Core, GUI, Widgets, Networking, SQL, Concurrent and other essential qt components. Build-Depends: zlib, zstd, libjpeg-turbo, libpng, freetype, pcre2, harfbuzz, sqlite3, libpq, double-conversion, openssl, angle (!windows), egl-registry, icu (!uwp), fontconfig (!windows) From d1fae659a97ee20360b5903f2e2a54a9dda23a16 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 10 Jul 2020 13:45:37 +0200 Subject: [PATCH 20/61] revert clapack and openblas version bumps --- ports/clapack/CONTROL | 2 +- ports/openblas/CONTROL | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/clapack/CONTROL b/ports/clapack/CONTROL index ef08ef294f6b01..ce3610044aeff6 100644 --- a/ports/clapack/CONTROL +++ b/ports/clapack/CONTROL @@ -1,5 +1,5 @@ Source: clapack -Version: 3.2.1-14 +Version: 3.2.1-13 Homepage: https://www.netlib.org/clapack Description: CLAPACK (f2c'ed version of LAPACK) Build-Depends: openblas (!osx) diff --git a/ports/openblas/CONTROL b/ports/openblas/CONTROL index 0c3168f146a703..3c2b0b7ebe68d7 100644 --- a/ports/openblas/CONTROL +++ b/ports/openblas/CONTROL @@ -1,5 +1,5 @@ Source: openblas -Version: 0.3.9-2 +Version: 0.3.9-1 Homepage: https://github.com/xianyi/OpenBLAS Build-Depends: pthread (linux) Description: OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. From e5e6f1f1d436cf25d3e2fe32afda6ca4b0511d99 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 10 Jul 2020 19:31:20 +0200 Subject: [PATCH 21/61] [vlfeat] add new port and remove it from 3rd party integrated inside openmvg --- ports/openmvg/CONTROL | 2 +- ports/openmvg/build_fixes.patch | 187 +++++++++++++++++++++- ports/vlfeat/CMakeLists.txt | 152 ++++++++++++++++++ ports/vlfeat/CONTROL | 4 + ports/vlfeat/expose_missing_symbols.patch | 79 +++++++++ ports/vlfeat/portfile.cmake | 22 +++ 6 files changed, 442 insertions(+), 4 deletions(-) create mode 100644 ports/vlfeat/CMakeLists.txt create mode 100644 ports/vlfeat/CONTROL create mode 100644 ports/vlfeat/expose_missing_symbols.patch create mode 100644 ports/vlfeat/portfile.cmake diff --git a/ports/openmvg/CONTROL b/ports/openmvg/CONTROL index 679d9364266844..c44a885140ba45 100644 --- a/ports/openmvg/CONTROL +++ b/ports/openmvg/CONTROL @@ -2,7 +2,7 @@ Source: openmvg Version: 1.5 Port-Version: 1 Description: open Multiple View Geometry library. Basis for 3D computer vision and Structure from Motion. -Build-Depends: coinutils, clp, osi, liblemon, flann, eigen3, ceres, cereal, libjpeg-turbo, tiff, libpng, zlib, suitesparse +Build-Depends: coinutils, clp, osi, liblemon, flann, eigen3, ceres, cereal, libjpeg-turbo, tiff, libpng, zlib, suitesparse, vlfeat Feature: opencv Build-Depends: opencv[contrib] diff --git a/ports/openmvg/build_fixes.patch b/ports/openmvg/build_fixes.patch index ff897de9fea2ae..635168cd9de041 100644 --- a/ports/openmvg/build_fixes.patch +++ b/ports/openmvg/build_fixes.patch @@ -1,5 +1,5 @@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 9cfd06c..a4dea06 100644 +index 9cfd06c..45d73a6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,6 +14,7 @@ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) @@ -55,6 +55,21 @@ index 9cfd06c..a4dea06 100644 endif (OpenMVG_USE_OPENMP) # ============================================================================== +@@ -160,10 +157,10 @@ endif() + # ============================================================================== + # IMAGE IO detection + # ============================================================================== +-find_package(JPEG QUIET) +-find_package(PNG QUIET) +-find_package(TIFF QUIET) +- ++find_package(JPEG REQUIRED) ++find_package(PNG REQUIRED) ++find_package(TIFF REQUIRED) ++find_package(vlfeat REQUIRED) + # Folders + set_property(GLOBAL PROPERTY USE_FOLDERS ON) + @@ -182,6 +179,7 @@ if (OpenMVG_BUILD_OPENGL_EXAMPLES) set_property(TARGET glfw PROPERTY FOLDER OpenMVG/3rdParty/glfw) endif (OpenMVG_BUILD_OPENGL_EXAMPLES) @@ -331,7 +346,7 @@ index 8a69c23..6a81580 100644 IF(DEFINED CLP_LIBRARY AND DEFINED CLPSOLVER_LIBRARY AND DEFINED OSICLP_LIBRARY) SET(CLP_LIBRARIES ${CLP_LIBRARY} ${CLPSOLVER_LIBRARY} ${OSICLP_LIBRARY}) diff --git a/src/cmakeFindModules/OpenMVGConfig.cmake.in b/src/cmakeFindModules/OpenMVGConfig.cmake.in -index e7dfbfd..31ec90c 100644 +index e7dfbfd..c01910d 100644 --- a/src/cmakeFindModules/OpenMVGConfig.cmake.in +++ b/src/cmakeFindModules/OpenMVGConfig.cmake.in @@ -19,7 +19,7 @@ @@ -343,7 +358,7 @@ index e7dfbfd..31ec90c 100644 # unsets all public (designed to be used externally) variables and reports # error message at priority depending upon [REQUIRED/QUIET/] argument. macro(OPENMVG_REPORT_NOT_FOUND REASON_MSG) -@@ -59,9 +59,18 @@ set(CALLERS_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) +@@ -59,9 +59,19 @@ set(CALLERS_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) # script. set(CMAKE_MODULE_PATH ${CURRENT_CONFIG_INSTALL_DIR}) @@ -355,6 +370,7 @@ index e7dfbfd..31ec90c 100644 +find_dependency(Threads) +find_dependency(cereal) +find_dependency(Ceres) ++find_dependency(vlfeat) + # Build the absolute root install directory as a relative path get_filename_component(CURRENT_ROOT_INSTALL_DIR @@ -363,6 +379,97 @@ index e7dfbfd..31ec90c 100644 if (NOT EXISTS ${CURRENT_ROOT_INSTALL_DIR}) OPENMVG_REPORT_NOT_FOUND( "OpenMVG install root: ${CURRENT_ROOT_INSTALL_DIR}, " +diff --git a/src/nonFree/sift/CMakeLists.txt b/src/nonFree/sift/CMakeLists.txt +index 402a2d8..a9f2790 100644 +--- a/src/nonFree/sift/CMakeLists.txt ++++ b/src/nonFree/sift/CMakeLists.txt +@@ -1,33 +1,33 @@ + +-# libs should be static +-set(BUILD_SHARED_LIBS OFF) +- +-# use PIC code for link into shared lib +-if(UNIX) +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") +-endif(UNIX) +- +-if(NOT USE_SSE2) +- add_definitions(-DVL_DISABLE_SSE2) +-endif() +- +-add_definitions(-DVL_DISABLE_THREADS) +- +-include_directories(./vl) +-set(FEATS +- vl/generic.c +- vl/imopv_sse2.c +- vl/sift.c +- vl/imopv.c +- vl/mathop_sse2.c +- vl/sift.c +- vl/host.c +- vl/mathop.c +- vl/random.c) +-set_source_files_properties(${FEATS} PROPERTIES LANGUAGE C) +-add_library(vlsift ${FEATS}) +-install(TARGETS vlsift DESTINATION lib EXPORT openMVG-targets) +-set_property(TARGET vlsift PROPERTY FOLDER OpenMVG/nonFree) ++## libs should be static ++#set(BUILD_SHARED_LIBS OFF) ++# ++## use PIC code for link into shared lib ++#if(UNIX) ++# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") ++#endif(UNIX) ++# ++#if(NOT USE_SSE2) ++# add_definitions(-DVL_DISABLE_SSE2) ++#endif() ++# ++#add_definitions(-DVL_DISABLE_THREADS) ++# ++#include_directories(./vl) ++#set(FEATS ++# vl/generic.c ++# vl/imopv_sse2.c ++# vl/sift.c ++# vl/imopv.c ++# vl/mathop_sse2.c ++# vl/sift.c ++# vl/host.c ++# vl/mathop.c ++# vl/random.c) ++#set_source_files_properties(${FEATS} PROPERTIES LANGUAGE C) ++#add_library(vlsift ${FEATS}) ++#install(TARGETS vlsift DESTINATION lib EXPORT openMVG-targets) ++#set_property(TARGET vlsift PROPERTY FOLDER OpenMVG/nonFree) + install( + DIRECTORY . + DESTINATION include/openMVG_dependencies/nonFree/sift +diff --git a/src/nonFree/sift/SIFT_describer.hpp b/src/nonFree/sift/SIFT_describer.hpp +index cd800b0..20e9c8e 100644 +--- a/src/nonFree/sift/SIFT_describer.hpp ++++ b/src/nonFree/sift/SIFT_describer.hpp +@@ -17,9 +17,7 @@ + #include + #include + +-extern "C" { +-#include "nonFree/sift/vl/sift.h" +-} ++#include + + namespace openMVG { + namespace features { +@@ -174,7 +172,7 @@ public: + const int nkeys = vl_sift_get_nkeypoints(filt); + + // Update gradient before launching parallel extraction +- vl_sift_update_gradient(filt); ++ update_gradient(filt); + + #ifdef OPENMVG_USE_OPENMP + #pragma omp parallel for private(descr, descriptor) diff --git a/src/openMVG/linearProgramming/CMakeLists.txt b/src/openMVG/linearProgramming/CMakeLists.txt index cc5212f..acc57dd 100644 --- a/src/openMVG/linearProgramming/CMakeLists.txt @@ -425,6 +532,80 @@ index 06baee7..47255be 100644 target_include_directories(openMVG_numeric PUBLIC $) else() +diff --git a/src/openMVG_Samples/describe_and_match_GUI/CMakeLists.txt b/src/openMVG_Samples/describe_and_match_GUI/CMakeLists.txt +index 862ffc7..326fc9a 100644 +--- a/src/openMVG_Samples/describe_and_match_GUI/CMakeLists.txt ++++ b/src/openMVG_Samples/describe_and_match_GUI/CMakeLists.txt +@@ -18,7 +18,7 @@ if (OpenMVG_BUILD_GUI_SOFTWARES) + add_executable( openMVG_sample_describe_and_match_GUI WIN32 ${FEATURES_PAIR_DEMO_SRCS} ${FEATURES_PAIR_DEMO_HDRS} ) + endif( APPLE ) + +- target_link_libraries( openMVG_sample_describe_and_match_GUI Qt5::Widgets openMVG_features openMVG_image openMVG_matching vlsift ) ++ target_link_libraries( openMVG_sample_describe_and_match_GUI Qt5::Widgets openMVG_features openMVG_image openMVG_matching unofficial::vlfeat::vl ) + + set_target_properties( openMVG_sample_describe_and_match_GUI PROPERTIES CXX_STANDARD 11) + +diff --git a/src/openMVG_Samples/features_image_matching/CMakeLists.txt b/src/openMVG_Samples/features_image_matching/CMakeLists.txt +index 18fb385..d44ffce 100644 +--- a/src/openMVG_Samples/features_image_matching/CMakeLists.txt ++++ b/src/openMVG_Samples/features_image_matching/CMakeLists.txt +@@ -5,7 +5,7 @@ target_link_libraries(openMVG_sample_image_matching + openMVG_features + openMVG_matching + ${STLPLUS_LIBRARY} +- vlsift) ++ unofficial::vlfeat::vl) + target_compile_definitions(openMVG_sample_image_matching + PRIVATE -DTHIS_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}") + +diff --git a/src/openMVG_Samples/features_repeatability/CMakeLists.txt b/src/openMVG_Samples/features_repeatability/CMakeLists.txt +index fd2b7c6..91f2766 100644 +--- a/src/openMVG_Samples/features_repeatability/CMakeLists.txt ++++ b/src/openMVG_Samples/features_repeatability/CMakeLists.txt +@@ -6,7 +6,7 @@ target_link_libraries(openMVG_sample_main_features_repeatability_dataset + openMVG_matching + openMVG_system + openMVG_multiview +- vlsift ++ unofficial::vlfeat::vl + ${STLPLUS_LIBRARY}) + + set_property(TARGET openMVG_sample_main_features_repeatability_dataset PROPERTY FOLDER OpenMVG/Samples) +diff --git a/src/software/Localization/CMakeLists.txt b/src/software/Localization/CMakeLists.txt +index 2f60393..0d57d0a 100644 +--- a/src/software/Localization/CMakeLists.txt ++++ b/src/software/Localization/CMakeLists.txt +@@ -11,7 +11,7 @@ target_link_libraries(openMVG_main_SfM_Localization + openMVG_sfm + openMVG_exif + ${STLPLUS_LIBRARY} +- vlsift ++ unofficial::vlfeat::vl + ) + + # Installation rules +diff --git a/src/software/SfM/CMakeLists.txt b/src/software/SfM/CMakeLists.txt +index 013a6c8..f38daa9 100644 +--- a/src/software/SfM/CMakeLists.txt ++++ b/src/software/SfM/CMakeLists.txt +@@ -44,7 +44,7 @@ target_link_libraries(openMVG_main_ComputeFeatures + openMVG_multiview + openMVG_sfm + ${STLPLUS_LIBRARY} +- vlsift ++ unofficial::vlfeat::vl + ) + if (MSVC) + set_target_properties(openMVG_main_ComputeFeatures PROPERTIES COMPILE_FLAGS "/bigobj") +@@ -235,7 +235,7 @@ if(OpenMVG_USE_OPENCV) + openMVG_multiview + openMVG_sfm + ${STLPLUS_LIBRARY} +- vlsift ++ unofficial::vlfeat::vl + ${OpenCV_LIBS}) + target_include_directories(openMVG_main_ComputeFeatures_OpenCV PRIVATE ${OpenCV_INCLUDE_DIRS}) + diff --git a/src/software/SfM/SfM_GlobalPipeline.py.in b/src/software/SfM/SfM_GlobalPipeline.py.in index 42405a4..28b0246 100644 --- a/src/software/SfM/SfM_GlobalPipeline.py.in diff --git a/ports/vlfeat/CMakeLists.txt b/ports/vlfeat/CMakeLists.txt new file mode 100644 index 00000000000000..9a2b9d740dc2af --- /dev/null +++ b/ports/vlfeat/CMakeLists.txt @@ -0,0 +1,152 @@ +cmake_minimum_required (VERSION 3.10) +project (vlfeat) + +set(INSTALL_BIN_DIR "bin" CACHE PATH "Path where exe and dll will be installed") +set(INSTALL_LIB_DIR "lib" CACHE PATH "Path where lib will be installed") +set(INSTALL_INCLUDE_DIR "include/vlfeat" CACHE PATH "Path where headers will be installed") +set(INSTALL_CMAKE_DIR "share/vlfeat" CACHE PATH "Path where cmake configs will be installed") + +# Make relative paths absolute (needed later on) +set(RELATIVE_INSTALL_INCLUDE_DIR ${INSTALL_INCLUDE_DIR}) +foreach(p LIB BIN INCLUDE CMAKE) + set(var INSTALL_${p}_DIR) + if(NOT IS_ABSOLUTE "${${var}}") + set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}") + endif() +endforeach() + +# make sure that the default is a RELEASE +set(default_build_type "Release") +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to '${default_build_type}' as none was specified.") + set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE + STRING "Choose the type of build." FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + +if(ENABLE_OPENMP) + find_package(OpenMP REQUIRED) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") +endif() + +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D__LITTLE_ENDIAN__) + add_definitions(-D__SSE2__) + add_definitions(/Zp8) + if(CMAKE_C_FLAGS MATCHES "/W[0-4]") + string(REGEX REPLACE "/W[0-4]" "/W1" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + endif() +endif() + +if(CMAKE_COMPILER_IS_GNUCC) + add_definitions(-std=c99) + add_definitions(-Wno-unused-function) + add_definitions(-Wno-long-long) + add_definitions(-Wno-variadic-macros) +endif() + + +set(SSE2_VL_C_FILES "vl/mathop_sse2.c" "vl/imopv_sse2.c") +set(AVX_VL_C_FILES "vl/mathop_avx.c") +set(SSE2_VL_H_FILES "vl/mathop_sse2.h" "vl/imopv_sse2.h") +set(AVX_VL_H_FILES "vl/mathop_avx.h") +add_definitions(-DVL_DISABLE_AVX) + +set (C_SOURCES + vl/aib.c + vl/array.c + vl/covdet.c + vl/dsift.c + vl/fisher.c + vl/generic.c + vl/getopt_long.c + vl/gmm.c + vl/hikmeans.c + vl/hog.c + vl/homkermap.c + vl/host.c + vl/ikmeans.c + vl/imopv.c + vl/kdtree.c + vl/kmeans.c + vl/lbp.c + vl/liop.c + vl/mathop.c + ${AVX_VL_C_FILES} + ${SSE2_VL_C_FILES} + vl/mser.c + vl/pgm.c + vl/quickshift.c + vl/random.c + vl/rodrigues.c + vl/scalespace.c + vl/sift.c + vl/slic.c + vl/stringop.c + vl/svm.c + vl/svmdataset.c + vl/vlad.c +) + +set (H_SOURCES + vl/aib.h + vl/array.h + vl/covdet.h + vl/dsift.h + vl/fisher.h + vl/generic.h + vl/getopt_long.h + vl/gmm.h + vl/heap-def.h + vl/hikmeans.h + vl/hog.h + vl/homkermap.h + vl/host.h + vl/ikmeans.h + vl/imopv.h + vl/kdtree.h + vl/kmeans.h + vl/lbp.h + vl/liop.h + vl/mathop.h + ${AVX_VL_H_FILES} + ${SSE2_VL_H_FILES} + vl/mser.h + vl/pgm.h + vl/qsort-def.h + vl/quickshift.h + vl/random.h + vl/rodrigues.h + vl/scalespace.h + vl/shuffle-def.h + vl/sift.h + vl/slic.h + vl/stringop.h + vl/svm.h + vl/svmdataset.h + vl/vlad.h +) + +add_library(vl ${C_SOURCES} ${H_SOURCES}) +set_property(TARGET vl PROPERTY POSITION_INDEPENDENT_CODE ON) +if(BUILD_SHARED_LIBS) + target_compile_definitions(vl PRIVATE -DVL_BUILD_DLL) +endif() +target_include_directories(vl PUBLIC $ $) +set_target_properties(vl PROPERTIES PUBLIC_HEADER "${H_SOURCES}") + +install(TARGETS vl EXPORT vlfeatTargets + RUNTIME DESTINATION "${INSTALL_BIN_DIR}" + LIBRARY DESTINATION "${INSTALL_LIB_DIR}" + ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" + PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}" + COMPONENT dev +) + +install(EXPORT vlfeatTargets + FILE vlfeatConfig.cmake + NAMESPACE unofficial::vlfeat:: + DESTINATION "${INSTALL_CMAKE_DIR}" +) diff --git a/ports/vlfeat/CONTROL b/ports/vlfeat/CONTROL new file mode 100644 index 00000000000000..d700ed84573f0a --- /dev/null +++ b/ports/vlfeat/CONTROL @@ -0,0 +1,4 @@ +Source: vlfeat +Version: 2020-07-10 +Homepage: https://www.vlfeat.org +Description: An open library of computer vision algorithms diff --git a/ports/vlfeat/expose_missing_symbols.patch b/ports/vlfeat/expose_missing_symbols.patch new file mode 100644 index 00000000000000..02e9ce0a6614c2 --- /dev/null +++ b/ports/vlfeat/expose_missing_symbols.patch @@ -0,0 +1,79 @@ +diff --git a/vl/generic.c b/vl/generic.c +index c6f84a9..8617ed2 100644 +--- a/vl/generic.c ++++ b/vl/generic.c +@@ -1513,13 +1513,13 @@ vl_thread_specific_state_delete (VlThreadState * self) + */ + + #if (defined(VL_OS_LINUX) || defined(VL_OS_MACOSX)) && defined(VL_COMPILER_GNUC) +-static void vl_constructor () __attribute__ ((constructor)) ; +-static void vl_destructor () __attribute__ ((destructor)) ; ++//static void vl_constructor () __attribute__ ((constructor)) ; ++//static void vl_destructor () __attribute__ ((destructor)) ; + #endif + + #if defined(VL_OS_WIN) +-static void vl_constructor () ; +-static void vl_destructor () ; ++//static void vl_constructor () ; ++//static void vl_destructor () ; + + BOOL WINAPI DllMain( + HINSTANCE hinstDLL, // handle to DLL module +@@ -1563,7 +1563,7 @@ BOOL WINAPI DllMain( + /* ---------------------------------------------------------------- */ + + /** @internal @brief Initialize VLFeat state */ +-static void ++void + vl_constructor (void) + { + VlState * state ; +@@ -1637,7 +1637,7 @@ vl_constructor (void) + } + + /** @internal @brief Destruct VLFeat */ +-static void ++void + vl_destructor () + { + VlState * state ; +diff --git a/vl/generic.h b/vl/generic.h +index 4ef87f2..30a974e 100644 +--- a/vl/generic.h ++++ b/vl/generic.h +@@ -206,5 +206,7 @@ VL_EXPORT double vl_toc (void) ; + VL_EXPORT double vl_get_cpu_time (void) ; + /** @} */ + ++VL_EXPORT void vl_constructor(); ++VL_EXPORT void vl_destructor(); + /* VL_GENERIC_H */ + #endif +diff --git a/vl/sift.c b/vl/sift.c +index 03963fe..6477a81 100644 +--- a/vl/sift.c ++++ b/vl/sift.c +@@ -1443,7 +1443,7 @@ vl_sift_detect (VlSiftFilt * f) + ** @remark The minimum octave size is 2x2xS. + **/ + +-static void ++void + update_gradient (VlSiftFilt *f) + { + int s_min = f->s_min ; +diff --git a/vl/sift.h b/vl/sift.h +index 50e03f4..f9558ad 100644 +--- a/vl/sift.h ++++ b/vl/sift.h +@@ -138,7 +138,8 @@ void vl_sift_keypoint_init (VlSiftFilt const *f, + double y, + double sigma) ; + /** @} */ +- ++VL_EXPORT ++void update_gradient(VlSiftFilt* f); + /** @name Retrieve data and parameters + ** @{ + **/ diff --git a/ports/vlfeat/portfile.cmake b/ports/vlfeat/portfile.cmake new file mode 100644 index 00000000000000..e737034b1412af --- /dev/null +++ b/ports/vlfeat/portfile.cmake @@ -0,0 +1,22 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO vlfeat/vlfeat + REF 1b9075fc42fe54b42f0e937f8b9a230d8e2c7701 + SHA512 6d317a1a9496ccac80244553d555fe060b150ccc7ee397a353b64f3a8451f24d1f03d8c00ed04cd9fc2dc066a5c5089b03695c614cb43ffa09be363660278255 + PATCHES + expose_missing_symbols.patch +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) + +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) From 3de57135f388a394be7c94b72db362e514565a46 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 10 Jul 2020 22:53:16 +0200 Subject: [PATCH 22/61] [vlfeat] improve compatibility with arm toolchains --- ports/vlfeat/CMakeLists.txt | 24 +++++++++++++++--------- ports/vlfeat/portfile.cmake | 10 ++++++++++ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/ports/vlfeat/CMakeLists.txt b/ports/vlfeat/CMakeLists.txt index 9a2b9d740dc2af..d48d5c208b5305 100644 --- a/ports/vlfeat/CMakeLists.txt +++ b/ports/vlfeat/CMakeLists.txt @@ -33,7 +33,6 @@ endif() if(MSVC) add_definitions(-D_CRT_SECURE_NO_DEPRECATE) add_definitions(-D__LITTLE_ENDIAN__) - add_definitions(-D__SSE2__) add_definitions(/Zp8) if(CMAKE_C_FLAGS MATCHES "/W[0-4]") string(REGEX REPLACE "/W[0-4]" "/W1" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") @@ -47,12 +46,21 @@ if(CMAKE_COMPILER_IS_GNUCC) add_definitions(-Wno-variadic-macros) endif() +if(USE_SSE) + add_definitions(-D__SSE2__) + set(SSE2_VL_C_FILES "vl/mathop_sse2.c" "vl/imopv_sse2.c") + set(SSE2_VL_H_FILES "vl/mathop_sse2.h" "vl/imopv_sse2.h") +else() + add_definitions(-DVL_DISABLE_SSE2) +endif() + +if(USE_AVX) + set(AVX_VL_C_FILES "vl/mathop_avx.c") + set(AVX_VL_H_FILES "vl/mathop_avx.h") +else() + add_definitions(-DVL_DISABLE_AVX) +endif() -set(SSE2_VL_C_FILES "vl/mathop_sse2.c" "vl/imopv_sse2.c") -set(AVX_VL_C_FILES "vl/mathop_avx.c") -set(SSE2_VL_H_FILES "vl/mathop_sse2.h" "vl/imopv_sse2.h") -set(AVX_VL_H_FILES "vl/mathop_avx.h") -add_definitions(-DVL_DISABLE_AVX) set (C_SOURCES vl/aib.c @@ -131,9 +139,7 @@ set (H_SOURCES add_library(vl ${C_SOURCES} ${H_SOURCES}) set_property(TARGET vl PROPERTY POSITION_INDEPENDENT_CODE ON) -if(BUILD_SHARED_LIBS) - target_compile_definitions(vl PRIVATE -DVL_BUILD_DLL) -endif() +target_compile_definitions(vl PRIVATE -DVL_BUILD_DLL) target_include_directories(vl PUBLIC $ $) set_target_properties(vl PROPERTIES PUBLIC_HEADER "${H_SOURCES}") diff --git a/ports/vlfeat/portfile.cmake b/ports/vlfeat/portfile.cmake index e737034b1412af..501548ac4d8f1f 100644 --- a/ports/vlfeat/portfile.cmake +++ b/ports/vlfeat/portfile.cmake @@ -7,11 +7,21 @@ vcpkg_from_github( expose_missing_symbols.patch ) +set(USE_SSE ON) +set(USE_AVX ON) +if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm") + set(USE_SSE OFF) + set(USE_AVX OFF) +endif() + file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA + OPTIONS + -DUSE_SSE=${USE_SSE} + -DUSE_AVX=${USE_AVX} ) vcpkg_install_cmake() From ba5d6a60175bdc6a70777bd3e8c07d8e3fcee81d Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 10 Jul 2020 22:59:47 +0200 Subject: [PATCH 23/61] [vlfeat] remove avx feature because it's broken --- ports/vlfeat/portfile.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/vlfeat/portfile.cmake b/ports/vlfeat/portfile.cmake index 501548ac4d8f1f..a075bdef7ec25b 100644 --- a/ports/vlfeat/portfile.cmake +++ b/ports/vlfeat/portfile.cmake @@ -8,7 +8,8 @@ vcpkg_from_github( ) set(USE_SSE ON) -set(USE_AVX ON) +set(USE_AVX OFF) # feature is broken, so it's always off anyway + if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm") set(USE_SSE OFF) set(USE_AVX OFF) From 6a50e95c913f13e740aaa2e66b29b184acfe1734 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Sat, 11 Jul 2020 23:22:06 +0200 Subject: [PATCH 24/61] [SuiteSparse] bump to 5.8 trying to fix regressions on linux --- ports/suitesparse/CONTROL | 10 +- .../suitesparse/add-find-package-metis.patch | 46 --- ports/suitesparse/build_fixes.patch | 281 ++++++++++++++++++ ports/suitesparse/portfile.cmake | 45 +-- ports/suitesparse/suitesparse.patch | 151 ---------- 5 files changed, 300 insertions(+), 233 deletions(-) delete mode 100644 ports/suitesparse/add-find-package-metis.patch create mode 100644 ports/suitesparse/build_fixes.patch delete mode 100644 ports/suitesparse/suitesparse.patch diff --git a/ports/suitesparse/CONTROL b/ports/suitesparse/CONTROL index 5481ea4014540a..a71dff77b5facf 100644 --- a/ports/suitesparse/CONTROL +++ b/ports/suitesparse/CONTROL @@ -1,9 +1,5 @@ Source: suitesparse -Version: 5.4.0-6 -Build-Depends: clapack (!osx) -Homepage: http://faculty.cse.tamu.edu/davis/SuiteSparse +Version: 5.8.0 +Build-Depends: clapack (!osx), metis +Homepage: http://suitesparse.com Description: algebra library - -Feature: metis -Build-Depends: metis -Description: Use metis in SuiteSparse diff --git a/ports/suitesparse/add-find-package-metis.patch b/ports/suitesparse/add-find-package-metis.patch deleted file mode 100644 index 297309ea08728a..00000000000000 --- a/ports/suitesparse/add-find-package-metis.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b8c2e63..d443390 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -199,12 +199,15 @@ if(LAPACK_FOUND AND BLAS_FOUND) - endif() # LAPACK is not found - - IF(BUILD_METIS OR USE_VCPKG_METIS) -+ find_package(metis REQUIRED) - set(SuiteSparse_LINKER_METIS_LIBS "metis") - ## namespaced library target for config -- set(SuiteSparse_EXPORTED_METIS_LIBS "SuiteSparse::metis") -+ set(SuiteSparse_EXPORTED_METIS_LIBS "metis") -+ set(SuiteSparse_FIND_PACKAGE_METIS "find_package(metis REQUIRED)") - else() - set(SuiteSparse_LINKER_METIS_LIBS "") - set(SuiteSparse_EXPORTED_METIS_LIBS "") -+ set(SuiteSparse_FIND_PACKAGE_METIS "") - ENDIF() - - add_subdirectory(SuiteSparse) -diff --git a/SuiteSparse/CMakeLists.txt b/SuiteSparse/CMakeLists.txt -index 5ef08a6..6c7abfd 100644 ---- a/SuiteSparse/CMakeLists.txt -+++ b/SuiteSparse/CMakeLists.txt -@@ -13,7 +13,7 @@ ENDIF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_BUILD_TYPE MATCHES "Debug") - - # Global flags: - IF (BUILD_METIS OR USE_VCPKG_METIS) -- INCLUDE_DIRECTORIES("${METIS_SOURCE_DIR}/include") -+ #INCLUDE_DIRECTORIES("${METIS_SOURCE_DIR}/include") - ELSE () - ADD_DEFINITIONS(-DNPARTITION) - ENDIF () -diff --git a/cmake/SuiteSparse-config-install.cmake.in b/cmake/SuiteSparse-config-install.cmake.in -index 49387b8..553d9c7 100644 ---- a/cmake/SuiteSparse-config-install.cmake.in -+++ b/cmake/SuiteSparse-config-install.cmake.in -@@ -5,6 +5,7 @@ get_filename_component(_SuiteSparse_PREFIX "${_SuiteSparse_PREFIX}" PATH) - get_filename_component(_SuiteSparse_PREFIX "${_SuiteSparse_PREFIX}" PATH) - - find_package(LAPACK REQUIRED) -+@SuiteSparse_FIND_PACKAGE_METIS@ - - # Load targets from the install tree. - include(${_SuiteSparse_SELF_DIR}/suitesparse-targets.cmake) diff --git a/ports/suitesparse/build_fixes.patch b/ports/suitesparse/build_fixes.patch new file mode 100644 index 00000000000000..8cdad27d6b1979 --- /dev/null +++ b/ports/suitesparse/build_fixes.patch @@ -0,0 +1,281 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9602cce..dafb434 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,14 +5,6 @@ + # Updated by jesnault (jerome.esnault@inria.fr) 2014-01-21 + # ----------------------------------------------------------------- + +-option(HUNTER_ENABLED "Enable Hunter package manager support" OFF) +-include(cmake/HunterGate.cmake) +- +-HunterGate( +- URL "https://github.com/ruslo/hunter/archive/v0.23.214.tar.gz" +- SHA1 "e14bc153a7f16d6a5eeec845fb0283c8fad8c358" +-) +- + PROJECT(SuiteSparseProject) + + cmake_minimum_required(VERSION 3.1) +@@ -47,29 +39,9 @@ else() + message(STATUS "Using user defined CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") + endif() + +-# Fix GKlib path: +-IF(NOT WIN32) +- SET(GKLIB_PATH "${${PROJECT_NAME}_SOURCE_DIR}/SuiteSparse/metis-5.1.0/GKlib" CACHE INTERNAL "Path to GKlib (for METIS)" FORCE) +-ENDIF() +- +-# allow creating DLLs in Windows without touching the source code: +-IF(NOT ${CMAKE_VERSION} VERSION_LESS "3.4.0" AND WIN32) +- set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +-ENDIF() +- + ## get CMAKE_INSTALL_BINDIR and CMAKE_INSTALL_LIBDIR + include(GNUInstallDirs) + +-if(CMAKE_SIZEOF_VOID_P MATCHES "8") +- set(SUITESPARSE_LIB_POSTFIX "64") +-else() +- set(SUITESPARSE_LIB_POSTFIX "") +-endif() +- +-## get POSTFIX for lib install dir +-set(LIB_POSTFIX "${SUITESPARSE_LIB_POSTFIX}" CACHE STRING "suffix for 32/64 inst dir placement") +-mark_as_advanced(LIB_POSTFIX) +- + # We want libraries to be named "libXXX" and "libXXXd" in all compilers: + # ------------------------------------------------------------------------ + set(CMAKE_DEBUG_POSTFIX "d") +@@ -77,59 +49,6 @@ IF(MSVC) + set(SP_LIB_PREFIX "lib") # Libs are: "libXXX" + ENDIF(MSVC) + +-## check if we can build metis +-SET(BUILD_METIS_DEFAULT ON) +-if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/SuiteSparse/metis-5.1.0/CMakeLists.txt") +- SET(BUILD_METIS_DEFAULT OFF) +-endif() +- +-SET(WITH_CUDA OFF CACHE BOOL "Build with CUDA support") +- +-SET(BUILD_METIS ${BUILD_METIS_DEFAULT} CACHE BOOL "Build METIS for partitioning?") +-SET(METIS_DIR ${${PROJECT_NAME}_SOURCE_DIR}/SuiteSparse/metis-5.1.0 CACHE PATH "Source directory of METIS") +- +-if(BUILD_METIS) +- ## prepare the installation : +- ## using metis target here is not possible because this target is added in another branch of the CMake structure +- ## TRICK: need to dynamically modify the metis CMakeLists.txt file before it going to parsed... +- ## (very ugly/poor for a metis project get from SCM (git/svn/cvs) but it's works ;) and it doesn't matter if metis was get from .zip) +- if(EXISTS "${METIS_DIR}/libmetis/CMakeLists.txt") +- file(READ "${METIS_DIR}/libmetis/CMakeLists.txt" contentFile) +- string(REGEX MATCH "EXPORT SuiteSparseTargets" alreadyModified ${contentFile}) ## use a string pattern to check if we have to do the modif +- if(NOT alreadyModified) +- file(APPEND "${METIS_DIR}/libmetis/CMakeLists.txt" +- " +- set_target_properties(metis PROPERTIES PUBLIC_HEADER \"../include/metis.h\") +- install(TARGETS metis ## this line is also the string pattern to check if the modification had already done +- EXPORT SuiteSparseTargets +- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +- PUBLIC_HEADER DESTINATION include +- ) +- " +- ) +- endif() +- endif() +- add_subdirectory(SuiteSparse/metis-5.1.0) ## important part for building metis from its src files +-endif(BUILD_METIS) +- +- +-## For EXPORT only : +-## Previous version of cmake (>2.8.12) doesn't auto take into account external lib (here I mean blas and lapack) we need to link to for our current target we want to export. +-## Or at least we need to investigate how to do with previous version. +-## This may cause some trouble in case you want to build in static mode and then use it into another custom project. +-## You will need to manually link your target into your custom project to the correct dependencies link interfaces. +-if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" GREATER 2.8.11) ## (policies introduced both in 2.8.12) +- set(EXPORT_USE_INTERFACE_LINK_LIBRARIES ON CACHE BOOL "") +- mark_as_advanced(EXPORT_USE_INTERFACE_LINK_LIBRARIES) +- if(EXPORT_USE_INTERFACE_LINK_LIBRARIES) +- cmake_policy(SET CMP0023 NEW) ## just for respecting the new target_link_libraries(...) signature procedure +- cmake_policy(SET CMP0022 NEW) ## use INTERFACE_LINK_LIBRARIES property for in-build targets and ignore old properties (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_)? +- ## Here, next version of cmake 2.8.12 auto take into account the link interface dependencies (see generated cmake/SuiteSparse-config*.cmake into your install dir) +- endif() +-endif() +- + ## install_suitesparse_project(targetName headersList) + ## factorise the way we will install all projects (part of the suitesparse project) + ## is the target of the current project you build +@@ -176,16 +95,16 @@ macro(declare_suitesparse_library targetName srcsList headersList) + set(dsl_TARGET_PUBLIC_LINK "") + endif() + if(WITH_CUDA) +- find_package(CUDA) ++ find_package(CUDA REQUIRED) + endif() +- IF(${CUDA_FOUND}) ++ IF(CUDA_FOUND) + INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS}) + INCLUDE_DIRECTORIES(${SuiteSparse_GPUQREngine_INCLUDE}) + INCLUDE_DIRECTORIES(${SuiteSparse_GPURuntime_INCLUDE}) + CUDA_ADD_LIBRARY(${targetName} ${srcsList} ${headersList}) +- ELSE(${CUDA_FOUND}) ++ ELSE() + ADD_LIBRARY(${targetName} ${srcsList} ${headersList}) +- ENDIF(${CUDA_FOUND}) ++ ENDIF() + SET_TARGET_PROPERTIES(${targetName} PROPERTIES + OUTPUT_NAME ${SP_LIB_PREFIX}${targetName} + ) +@@ -211,44 +130,30 @@ MACRO(REMOVE_MATCHING_FILES_FROM_LIST match_expr lst_files) + ENDMACRO(REMOVE_MATCHING_FILES_FROM_LIST) + + if(WITH_CUDA) +- FIND_PACKAGE(cuda) +- IF(${CUDA_FOUND}) ++ FIND_PACKAGE(CUDA REQUIRED) ++ IF(CUDA_FOUND) + ADD_DEFINITIONS(-DGPU_BLAS) +- ENDIF(${CUDA_FOUND}) ++ ENDIF() + endif() + +-hunter_add_package(LAPACK) # only in effect if HUNTER_ENABLED is set +-# prefer LAPACK config file +-find_package(LAPACK CONFIG) +-if (LAPACK_FOUND AND TARGET blas AND TARGET lapack) +- message(STATUS "found lapack and blas config file. Linking targets lapack and blas") +- message(STATUS "- LAPACK_CONFIG: ${LAPACK_CONFIG}") +- set(SuiteSparse_LINKER_LAPACK_BLAS_LIBS lapack blas) +- # for suitesparse-config file set method used to find LAPACK (and BLAS) +- set(SuiteSparse_LAPACK_used_CONFIG YES) +-else() +- # missing config file or targets, try BLAS and LAPACK +- find_package(BLAS) +- find_package(LAPACK) +- if (BLAS_FOUND AND LAPACK_FOUND) ++ find_package(BLAS REQUIRED) ++ find_package(LAPACK REQUIRED) + message(STATUS "found lapack and blas config file. Linking targets lapack and blas") + message(STATUS "- LAPACK_LIBRARIES: ${LAPACK_LIBRARIES}") + message(STATUS "- BLAS_LIBRARIES: ${BLAS_LIBRARIES}") + set(SuiteSparse_LINKER_LAPACK_BLAS_LIBS ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}) + # for suitesparse-config file set method used to find LAPACK (and BLAS) + set(SuiteSparse_LAPACK_used_CONFIG NO) +- else () # LAPACK is not found +- message(FATAL_ERROR "lapack not found") +- endif() +-endif() + +-IF(BUILD_METIS) ++IF(USE_VCPKG_METIS) ++ find_package(metis REQUIRED) + set(SuiteSparse_LINKER_METIS_LIBS "metis") +- ## namespaced library target for config +- set(SuiteSparse_EXPORTED_METIS_LIBS "SuiteSparse::metis") ++ set(SuiteSparse_EXPORTED_METIS_LIBS "metis") ++ set(SuiteSparse_FIND_DEPENDENCY_METIS "find_dependency(metis REQUIRED)") + else() + set(SuiteSparse_LINKER_METIS_LIBS "") + set(SuiteSparse_EXPORTED_METIS_LIBS "") ++ set(SuiteSparse_FIND_PACKAGE_METIS "") + ENDIF() + + add_subdirectory(SuiteSparse) +@@ -287,7 +192,7 @@ endmacro() + # get SuiteSparse version + get_SuiteSparse_Version() + +-set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/suitesparse-${SuiteSparse_VERSION}) ++set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/suitesparse) + ## create targets file + export(EXPORT SuiteSparseTargets + FILE "${CMAKE_CURRENT_BINARY_DIR}/suitesparse/suitesparse-targets.cmake" +@@ -301,7 +206,7 @@ configure_file(cmake/SuiteSparse-config-install.cmake.in + ## do the EXPORT for allowing other project to easily use suitesparse with cmake + install(EXPORT SuiteSparseTargets + FILE +- SuiteSparse-targets.cmake ++ suitesparse-targets.cmake + NAMESPACE + SuiteSparse:: + DESTINATION +diff --git a/SuiteSparse/CMakeLists.txt b/SuiteSparse/CMakeLists.txt +index c6e2834..6fdfb01 100644 +--- a/SuiteSparse/CMakeLists.txt ++++ b/SuiteSparse/CMakeLists.txt +@@ -1,23 +1,5 @@ + PROJECT(SuiteSparse) + +-# Set optimized building: +-IF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_BUILD_TYPE MATCHES "Debug") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3") +- # only optimize for native processer when NOT cross compiling +- if(NOT CMAKE_CROSSCOMPILING) +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=native") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mtune=native") +- endif(NOT CMAKE_CROSSCOMPILING) +-ENDIF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_BUILD_TYPE MATCHES "Debug") +- +-# Global flags: +-IF (BUILD_METIS) +- INCLUDE_DIRECTORIES("${METIS_SOURCE_DIR}/include") +-ELSE (BUILD_METIS) +- ADD_DEFINITIONS(-DNPARTITION) +-ENDIF ( BUILD_METIS) +- + # Disable COMPLEX numbers: disable it by default, since it causes problems in some platforms. + SET(HAVE_COMPLEX OFF CACHE BOOL "Enables building SuiteSparse with complex numbers (disabled by default to avoid problems in some platforms)") + IF (NOT HAVE_COMPLEX) +@@ -38,12 +20,12 @@ if(WITH_CUDA) + set(SUBPROJECTS_TO_ADD + ${SUBPROJECTS_TO_ADD} + SuiteSparse_GPURuntime +- GPUQREngine ++ GPUQREngine + ) + endif() + + set(SUBPROJECTS_TO_ADD +- ${SUBPROJECTS_TO_ADD} ++ ${SUBPROJECTS_TO_ADD} + SuiteSparse_config + AMD + BTF +diff --git a/cmake/SuiteSparse-config-install.cmake.in b/cmake/SuiteSparse-config-install.cmake.in +index 1e587d1..fd8f3a7 100644 +--- a/cmake/SuiteSparse-config-install.cmake.in ++++ b/cmake/SuiteSparse-config-install.cmake.in +@@ -2,20 +2,14 @@ + get_filename_component(_SuiteSparse_SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + get_filename_component(_SuiteSparse_PREFIX "${_SuiteSparse_SELF_DIR}" PATH) + get_filename_component(_SuiteSparse_PREFIX "${_SuiteSparse_PREFIX}" PATH) +-get_filename_component(_SuiteSparse_PREFIX "${_SuiteSparse_PREFIX}" PATH) + + include(CMakeFindDependencyMacro) +-if (@SuiteSparse_LAPACK_used_CONFIG@) # SuiteSparse_LAPACK_used_CONFIG +- # use config file which provides LAPACK (and BLAS) for us +- find_dependency(LAPACK CONFIG) +-else() +- # try to find BLAS and LAPACK with modules + find_dependency(BLAS) + find_dependency(LAPACK) +-endif () ++ @SuiteSparse_FIND_PACKAGE_METIS@ + + # Load targets from the install tree. +-include(${_SuiteSparse_SELF_DIR}/SuiteSparse-targets.cmake) ++include(${_SuiteSparse_SELF_DIR}/suitesparse-targets.cmake) + + # Report SuiteSparse header search locations. + set(SuiteSparse_INCLUDE_DIRS ${_SuiteSparse_PREFIX}/include) +@@ -39,3 +33,7 @@ set(SuiteSparse_LIBRARIES + + unset(_SuiteSparse_PREFIX) + unset(_SuiteSparse_SELF_DIR) ++set(SUITESPARSE_FOUND TRUE) ++set(SuiteSparse_FOUND TRUE) ++set(SUITESPARSE_LIBRARIES ${SuiteSparse_LIBRARIES}) ++set(SUITESPARSE_INCLUDE_DIRS ${SuiteSparse_INCLUDE_DIRS}) diff --git a/ports/suitesparse/portfile.cmake b/ports/suitesparse/portfile.cmake index d5568812126969..5d93550c930635 100644 --- a/ports/suitesparse/portfile.cmake +++ b/ports/suitesparse/portfile.cmake @@ -1,54 +1,41 @@ -set(SUITESPARSE_VER 5.4.0) -set(SUITESPARSEWIN_VER 1.4.0) - -vcpkg_download_distfile(SUITESPARSE - URLS "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-${SUITESPARSE_VER}.tar.gz" - FILENAME "SuiteSparse-${SUITESPARSE_VER}.tar.gz" - SHA512 8328bcc2ef5eb03febf91b9c71159f091ff405c1ba7522e53714120fcf857ceab2d2ecf8bf9a2e1fc45e1a934665a341e3a47f954f87b59934f4fce6164775d6 -) - -vcpkg_extract_source_archive_ex( +vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH - ARCHIVE ${SUITESPARSE} + REPO DrTimothyAldenDavis/SuiteSparse + REF 71e330ca2bc0a2f12f416c461d23dbca21db4d8f + SHA512 06c75927c924cfd5511b07504e826714f504586243d6f3449d67408a33f3ecea824a7f2de7a165171791b9bda4fc09c0d7093125970895c2ed8d4d37ca1d5a3d + HEAD_REF master ) vcpkg_from_github( OUT_SOURCE_PATH SUITESPARSEWIN_SOURCE_PATH REPO jlblancoc/suitesparse-metis-for-windows - REF v${SUITESPARSEWIN_VER} - SHA512 35a2563d6e33ebe8157f8d023167abd8d2512e2a627b8dbea798c59afefc56b8f01c7d10553529b03a7b4759e200ca82bb26ebce5cefce6983ffb057a8622162 + REF c11e8dd7a2ef7d0d93af4c16f75374dd8ca029e2 + SHA512 fbd2a9e6f7df47eeb5d890c7b286bef7fc4c8bcb22783ce800723bacaf2cfe902177828ce5b9e1c2ed9fb5c54591c5fb046a8667e7d354d452a4baac693e47d2 HEAD_REF master PATCHES - suitesparse.patch - add-find-package-metis.patch + build_fixes.patch ) # Copy suitesparse sources. -message(STATUS "Copying SuiteSparse source files...") +message(STATUS "Overwriting SuiteSparseWin source files with SuiteSparse source files...") # Should probably remove everything but CMakeLists.txt files? file(GLOB SUITESPARSE_SOURCE_FILES ${SOURCE_PATH}/*) foreach(SOURCE_FILE ${SUITESPARSE_SOURCE_FILES}) file(COPY ${SOURCE_FILE} DESTINATION "${SUITESPARSEWIN_SOURCE_PATH}/SuiteSparse") endforeach() -message(STATUS "Copying SuiteSparse source files... done") -message(STATUS "Removing integrated lapack and metis libs...") +message(STATUS "Overwriting SuiteSparseWin source files with SuiteSparse source files... done") +message(STATUS "Removing integrated lapack and metis lib...") file(REMOVE_RECURSE ${SUITESPARSEWIN_SOURCE_PATH}/lapack_windows) -file(REMOVE_RECURSE ${SUITESPARSEWIN_SOURCE_PATH}/metis) -message(STATUS "Removing integrated lapack and metis libs... done") - -set(USE_VCPKG_METIS OFF) -if("metis" IN_LIST FEATURES) - set(USE_VCPKG_METIS ON) - set(ADDITIONAL_BUILD_OPTIONS "-DMETIS_SOURCE_DIR=${CURRENT_INSTALLED_DIR}") -endif() +file(REMOVE_RECURSE ${SUITESPARSEWIN_SOURCE_PATH}/SuiteSparse/metis-5.1.0) +message(STATUS "Removing integrated lapack and metis lib... done") vcpkg_configure_cmake( SOURCE_PATH ${SUITESPARSEWIN_SOURCE_PATH} PREFER_NINJA OPTIONS -DBUILD_METIS=OFF - -DUSE_VCPKG_METIS=${USE_VCPKG_METIS} - ${ADDITIONAL_BUILD_OPTIONS} + -DUSE_VCPKG_METIS=ON + "-DMETIS_SOURCE_DIR=${CURRENT_INSTALLED_DIR}" OPTIONS_DEBUG -DSUITESPARSE_INSTALL_PREFIX="${CURRENT_PACKAGES_DIR}/debug" OPTIONS_RELEASE @@ -57,7 +44,7 @@ vcpkg_configure_cmake( vcpkg_install_cmake() -vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/suitesparse-${SUITESPARSE_VER}) +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/suitesparse) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/suitesparse/suitesparse.patch b/ports/suitesparse/suitesparse.patch deleted file mode 100644 index 2255565ac173b1..00000000000000 --- a/ports/suitesparse/suitesparse.patch +++ /dev/null @@ -1,151 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3486f05..b8c2e63 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -191,68 +191,14 @@ if(WITH_CUDA) - ENDIF(${CUDA_FOUND}) - endif() - --find_package(BLAS) --find_package(LAPACK) --if (LAPACK_FOUND AND BLAS_FOUND) -+find_package(BLAS REQUIRED) -+find_package(LAPACK REQUIRED) -+if(LAPACK_FOUND AND BLAS_FOUND) - message(STATUS "found lapack and blas config file. Linking targets lapack and blas") - set(SuiteSparse_LINKER_LAPACK_BLAS_LIBS ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}) --else () # LAPACK is not found -- --## Need to use SuiteSparse_LINKER_LAPACK_BLAS_LIBS in our subproject in case of SHARED flag is set to ON --SET(SUITESPARSE_USE_CUSTOM_BLAS_LAPACK_LIBS OFF CACHE BOOL "Check if you have custom LAPACK/BLAS libraries (AMD,...)") --IF (SUITESPARSE_USE_CUSTOM_BLAS_LAPACK_LIBS) -- SET(SUITESPARSE_CUSTOM_BLAS_LIB "" CACHE FILE "Path to custom library file for BLAS") -- SET(SUITESPARSE_CUSTOM_LAPACK_LIB "" CACHE FILE "Path to custom library file for LAPACK") -- IF (NOT EXISTS "${SUITESPARSE_CUSTOM_BLAS_LIB}" OR NOT EXISTS "${SUITESPARSE_CUSTOM_LAPACK_LIB}") -- MESSAGE("*Error*: Correctly set SUITESPARSE_CUSTOM_BLAS_LIB and SUITESPARSE_CUSTOM_LAPACK_LIB or uncheck SUITESPARSE_USE_CUSTOM_BLAS_LAPACK_LIBS") -- ELSE() -- SET(SuiteSparse_LINKER_LAPACK_BLAS_LIBS ${SUITESPARSE_CUSTOM_BLAS_LIB} ${SUITESPARSE_CUSTOM_LAPACK_LIB}) -- ENDIF() --ELSE() -- IF (UNIX) -- SET(SuiteSparse_LINKER_LAPACK_BLAS_LIBS lapack blas rt) -- ELSE() -- IF(CMAKE_SIZEOF_VOID_P EQUAL 8) # Size in bytes! -- set(PATH_WORD_SIZE "x64") -- ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) # Size in bytes! -- set(PATH_WORD_SIZE "x32") -- ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) -- -- add_library(blas SHARED IMPORTED) -- set_property(TARGET blas PROPERTY IMPORTED_LOCATION ${SuiteSparseProject_SOURCE_DIR}/lapack_windows/${PATH_WORD_SIZE}/libblas.dll) -- set_property(TARGET blas PROPERTY IMPORTED_IMPLIB ${SuiteSparseProject_SOURCE_DIR}/lapack_windows/${PATH_WORD_SIZE}/libblas.lib) -- -- add_library(lapack SHARED IMPORTED) -- set_property(TARGET lapack PROPERTY IMPORTED_LOCATION ${SuiteSparseProject_SOURCE_DIR}/lapack_windows/${PATH_WORD_SIZE}/liblapack.dll) -- set_property(TARGET lapack PROPERTY IMPORTED_IMPLIB ${SuiteSparseProject_SOURCE_DIR}/lapack_windows/${PATH_WORD_SIZE}/liblapack.lib) -- -- SET(SuiteSparse_LINKER_LAPACK_BLAS_LIBS blas lapack) -- -- ## install lapack and blas dependencies -- file(GLOB lapack_blas_windows_libs "${CMAKE_SOURCE_DIR}/lapack_windows/${PATH_WORD_SIZE}/*.lib") -- file(GLOB lapack_blas_windows_dll "${CMAKE_SOURCE_DIR}/lapack_windows/${PATH_WORD_SIZE}/*.dll") -- if(lapack_blas_windows_dll AND lapack_blas_windows_libs) -- set(SuiteSparse_LAPACK_BLAS_LIB_DIR "lib${LIB_POSTFIX}/lapack_blas_windows") -- install(FILES ${lapack_blas_windows_libs} -- ${lapack_blas_windows_dll} -- DESTINATION ${SuiteSparse_LAPACK_BLAS_LIB_DIR} -- ) -- endif() -- ENDIF() --ENDIF() --ENDIF() # LAPACK found -- --if(SuiteSparse_LAPACK_BLAS_LIB_DIR) # "Export" the imported targets in config.cmake manually -- set(ExternConfig "add_library(blas SHARED IMPORTED) -- set_property(TARGET blas PROPERTY IMPORTED_LOCATION \${_SuiteSparse_PREFIX}/${SuiteSparse_LAPACK_BLAS_LIB_DIR}/libblas.dll) -- set_property(TARGET blas PROPERTY IMPORTED_IMPLIB \${_SuiteSparse_PREFIX}/${SuiteSparse_LAPACK_BLAS_LIB_DIR}/libblas.lib) -- -- add_library(lapack SHARED IMPORTED) -- set_property(TARGET lapack PROPERTY IMPORTED_LOCATION \${_SuiteSparse_PREFIX}/${SuiteSparse_LAPACK_BLAS_LIB_DIR}/liblapack.dll) -- set_property(TARGET lapack PROPERTY IMPORTED_IMPLIB \${_SuiteSparse_PREFIX}/${SuiteSparse_LAPACK_BLAS_LIB_DIR}/liblapack.lib)") --endif() -+endif() # LAPACK is not found - --IF(BUILD_METIS) -+IF(BUILD_METIS OR USE_VCPKG_METIS) - set(SuiteSparse_LINKER_METIS_LIBS "metis") - ## namespaced library target for config - set(SuiteSparse_EXPORTED_METIS_LIBS "SuiteSparse::metis") -@@ -311,7 +257,7 @@ configure_file(cmake/SuiteSparse-config-install.cmake.in - ## do the EXPORT for allowing other project to easily use suitesparse with cmake - install(EXPORT SuiteSparseTargets - FILE -- SuiteSparse-targets.cmake -+ suitesparse-targets.cmake - NAMESPACE - SuiteSparse:: - DESTINATION -diff --git a/SuiteSparse/CHOLMOD/Include/cholmod_blas.h b/SuiteSparse/CHOLMOD/Include/cholmod_blas.h -index aef3e63..907512b 100644 ---- a/SuiteSparse/CHOLMOD/Include/cholmod_blas.h -+++ b/SuiteSparse/CHOLMOD/Include/cholmod_blas.h -@@ -27,6 +27,7 @@ - #elif defined (__linux) || defined (MGLNX86) || defined (ARCH_GLNX86) - #define CHOLMOD_LINUX - #define CHOLMOD_ARCHITECTURE "Linux" -+#define BLAS_NO_UNDERSCORE - - #elif defined (__APPLE__) - #define CHOLMOD_MAC -diff --git a/SuiteSparse/CMakeLists.txt b/SuiteSparse/CMakeLists.txt -index c6e2834..5ef08a6 100644 ---- a/SuiteSparse/CMakeLists.txt -+++ b/SuiteSparse/CMakeLists.txt -@@ -12,11 +12,11 @@ IF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_BUILD_TYPE MATCHES "Debug") - ENDIF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_BUILD_TYPE MATCHES "Debug") - - # Global flags: --IF (BUILD_METIS) -+IF (BUILD_METIS OR USE_VCPKG_METIS) - INCLUDE_DIRECTORIES("${METIS_SOURCE_DIR}/include") --ELSE (BUILD_METIS) -+ELSE () - ADD_DEFINITIONS(-DNPARTITION) --ENDIF ( BUILD_METIS) -+ENDIF () - - # Disable COMPLEX numbers: disable it by default, since it causes problems in some platforms. - SET(HAVE_COMPLEX OFF CACHE BOOL "Enables building SuiteSparse with complex numbers (disabled by default to avoid problems in some platforms)") -diff --git a/cmake/SuiteSparse-config-install.cmake.in b/cmake/SuiteSparse-config-install.cmake.in -index cb1f51f..12f654c 100644 ---- a/cmake/SuiteSparse-config-install.cmake.in -+++ b/cmake/SuiteSparse-config-install.cmake.in -@@ -2,15 +2,11 @@ - get_filename_component(_SuiteSparse_SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) - get_filename_component(_SuiteSparse_PREFIX "${_SuiteSparse_SELF_DIR}" PATH) - get_filename_component(_SuiteSparse_PREFIX "${_SuiteSparse_PREFIX}" PATH) --get_filename_component(_SuiteSparse_PREFIX "${_SuiteSparse_PREFIX}" PATH) - --find_package(LAPACK CONFIG) --if (NOT LAPACK_FOUND) # Load the LAPACK package with which we were built. -- @ExternConfig@ --endif () -+find_package(LAPACK REQUIRED) - - # Load targets from the install tree. --include(${_SuiteSparse_SELF_DIR}/SuiteSparse-targets.cmake) -+include(${_SuiteSparse_SELF_DIR}/suitesparse-targets.cmake) - - # Report SuiteSparse header search locations. - set(SuiteSparse_INCLUDE_DIRS ${_SuiteSparse_PREFIX}/include) -@@ -31,6 +27,10 @@ set(SuiteSparse_LIBRARIES - SuiteSparse::spqr - @SuiteSparse_EXPORTED_METIS_LIBS@ - ) -+set(SUITESPARSE_LIBRARIES ${SuiteSparse_LIBRARIES}) - - unset(_SuiteSparse_PREFIX) - unset(_SuiteSparse_SELF_DIR) -+ -+set(SUITESPARSE_FOUND TRUE) -+set(SuiteSparse_FOUND TRUE) From 8f849f788b496e4f8576bc1df7e5dbd63f8c976e Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Sat, 11 Jul 2020 23:22:30 +0200 Subject: [PATCH 25/61] [OpenMVG] fully remove integrated vlfeat --- ports/openmvg/CONTROL | 2 +- ports/openmvg/build_fixes.patch | 23 ++++++++++++++--------- ports/openmvg/portfile.cmake | 10 +++------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/ports/openmvg/CONTROL b/ports/openmvg/CONTROL index c44a885140ba45..288d530acd1515 100644 --- a/ports/openmvg/CONTROL +++ b/ports/openmvg/CONTROL @@ -2,7 +2,7 @@ Source: openmvg Version: 1.5 Port-Version: 1 Description: open Multiple View Geometry library. Basis for 3D computer vision and Structure from Motion. -Build-Depends: coinutils, clp, osi, liblemon, flann, eigen3, ceres, cereal, libjpeg-turbo, tiff, libpng, zlib, suitesparse, vlfeat +Build-Depends: coinutils, clp, osi, liblemon, flann, eigen3, ceres[suitesparse,cxsparse], cereal, libjpeg-turbo, tiff, libpng, zlib, vlfeat Feature: opencv Build-Depends: opencv[contrib] diff --git a/ports/openmvg/build_fixes.patch b/ports/openmvg/build_fixes.patch index 635168cd9de041..fff8846d28e9e2 100644 --- a/ports/openmvg/build_fixes.patch +++ b/ports/openmvg/build_fixes.patch @@ -1,5 +1,5 @@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 9cfd06c..45d73a6 100644 +index 9cfd06c..8859469 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,6 +14,7 @@ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) @@ -229,7 +229,7 @@ index 9cfd06c..45d73a6 100644 # ============================================================================== # OpenCV -@@ -372,15 +400,13 @@ endif() +@@ -372,20 +400,13 @@ endif() # - only external and enabled only if OpenMVG_USE_OPENCV is set to ON # ============================================================================== if (OpenMVG_USE_OPENCV) @@ -243,14 +243,15 @@ index 9cfd06c..45d73a6 100644 endif() - -+# ============================================================================== -+# Suitesparse -+# ============================================================================== -+find_package(suitesparse REQUIRED) # ============================================================================== # Third-party libraries: # ============================================================================== -@@ -472,67 +498,67 @@ message("** Use OpenCV SIFT features: " ${OpenMVG_USE_OCVSIFT}) + add_subdirectory(third_party) +-add_subdirectory(testing) + + # ============================================================================== + # openMVG modules +@@ -472,67 +493,67 @@ message("** Use OpenCV SIFT features: " ${OpenMVG_USE_OCVSIFT}) message("\n") @@ -380,10 +381,10 @@ index e7dfbfd..c01910d 100644 OPENMVG_REPORT_NOT_FOUND( "OpenMVG install root: ${CURRENT_ROOT_INSTALL_DIR}, " diff --git a/src/nonFree/sift/CMakeLists.txt b/src/nonFree/sift/CMakeLists.txt -index 402a2d8..a9f2790 100644 +index 402a2d8..60ddc11 100644 --- a/src/nonFree/sift/CMakeLists.txt +++ b/src/nonFree/sift/CMakeLists.txt -@@ -1,33 +1,33 @@ +@@ -1,36 +1,36 @@ -# libs should be static -set(BUILD_SHARED_LIBS OFF) @@ -446,6 +447,10 @@ index 402a2d8..a9f2790 100644 install( DIRECTORY . DESTINATION include/openMVG_dependencies/nonFree/sift + COMPONENT headers +- FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h" ++ FILES_MATCHING PATTERN "*.hpp" + ) diff --git a/src/nonFree/sift/SIFT_describer.hpp b/src/nonFree/sift/SIFT_describer.hpp index cd800b0..20e9c8e 100644 --- a/src/nonFree/sift/SIFT_describer.hpp diff --git a/ports/openmvg/portfile.cmake b/ports/openmvg/portfile.cmake index 320efc09390158..236d94d31a89f9 100644 --- a/ports/openmvg/portfile.cmake +++ b/ports/openmvg/portfile.cmake @@ -70,16 +70,12 @@ vcpkg_configure_cmake( vcpkg_install_cmake() vcpkg_fixup_cmake_targets(CONFIG_PATH share/openMVG/cmake) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) -#remove extra deprecated cmake target files left in unappropriate folders -file(GLOB REMOVE_CMAKE ${CURRENT_PACKAGES_DIR}/lib/*.cmake) -file(REMOVE_RECURSE ${REMOVE_CMAKE}) -file(GLOB REMOVE_CMAKE ${CURRENT_PACKAGES_DIR}/debug/lib/*.cmake) -file(REMOVE_RECURSE ${REMOVE_CMAKE}) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/openMVG/image/image_test - ${CURRENT_PACKAGES_DIR}/include/openMVG/exif/image_data) + ${CURRENT_PACKAGES_DIR}/include/openMVG/exif/image_data + ${CURRENT_PACKAGES_DIR}/include/openMVG_dependencies/nonFree/sift/vl) if(OpenMVG_BUILD_SHARED) # release From c20fe88ad2cb4a4ba1569c4602b1d94034dbc375 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Sun, 12 Jul 2020 00:02:23 +0200 Subject: [PATCH 26/61] [eigen3] properly handle cmake targets --- ports/eigen3/CONTROL | 3 ++- ports/eigen3/portfile.cmake | 18 +++--------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/ports/eigen3/CONTROL b/ports/eigen3/CONTROL index f769005179e6c5..9a60167d29af70 100644 --- a/ports/eigen3/CONTROL +++ b/ports/eigen3/CONTROL @@ -1,4 +1,5 @@ Source: eigen3 -Version: 3.3.7-5 +Version: 3.3.7 +Port-Version: 6 Homepage: http://eigen.tuxfamily.org Description: C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms. diff --git a/ports/eigen3/portfile.cmake b/ports/eigen3/portfile.cmake index 85b4295589fcfc..7d2d5e2bf2506f 100644 --- a/ports/eigen3/portfile.cmake +++ b/ports/eigen3/portfile.cmake @@ -1,5 +1,3 @@ -include(vcpkg_common_functions) - vcpkg_buildpath_length_warning(37) vcpkg_from_gitlab( @@ -26,19 +24,9 @@ vcpkg_configure_cmake( ) vcpkg_install_cmake() - -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) - -file(READ "${CURRENT_PACKAGES_DIR}/share/eigen3/Eigen3Targets.cmake" EIGEN_TARGETS) -string(REPLACE "set(_IMPORT_PREFIX " "get_filename_component(_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_DIR}/../..\" ABSOLUTE) #" EIGEN_TARGETS "${EIGEN_TARGETS}") -file(WRITE "${CURRENT_PACKAGES_DIR}/share/eigen3/Eigen3Targets.cmake" "${EIGEN_TARGETS}") - +vcpkg_fixup_cmake_targets() vcpkg_fixup_pkgconfig() -file(GLOB INCLUDES ${CURRENT_PACKAGES_DIR}/include/eigen3/*) -# Copy the eigen header files to conventional location for user-wide MSBuild integration -file(COPY ${INCLUDES} DESTINATION ${CURRENT_PACKAGES_DIR}/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) -# Put the licence file where vcpkg expects it -file(COPY ${SOURCE_PATH}/COPYING.README DESTINATION ${CURRENT_PACKAGES_DIR}/share/eigen3) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/eigen3/COPYING.README ${CURRENT_PACKAGES_DIR}/share/eigen3/copyright) +file(INSTALL ${SOURCE_PATH}/COPYING.README DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) From 076e96dd8bfeb75e98d3a481f6cbd97d2244527b Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Mon, 13 Jul 2020 12:01:35 +0200 Subject: [PATCH 27/61] [suitesparse] add cxsparse cmake module handling --- ports/suitesparse/FindCXSparse.cmake | 75 +++++++++++++++++++ ports/suitesparse/portfile.cmake | 4 + .../vcpkg-cmake-wrapper_cxsparse.cmake | 10 +++ 3 files changed, 89 insertions(+) create mode 100644 ports/suitesparse/FindCXSparse.cmake create mode 100644 ports/suitesparse/vcpkg-cmake-wrapper_cxsparse.cmake diff --git a/ports/suitesparse/FindCXSparse.cmake b/ports/suitesparse/FindCXSparse.cmake new file mode 100644 index 00000000000000..94ba41e045f786 --- /dev/null +++ b/ports/suitesparse/FindCXSparse.cmake @@ -0,0 +1,75 @@ +# Distributed under the OSI-approved BSD 3-Clause License. +# +#.rst: +# FindCXSparse +# -------- +# +# Find the CXSparse library +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# The following variables will be defined: +# +# ``CXSparse_FOUND`` +# True if CXSparse found on the local system +# +# ``CXSPARSE_FOUND`` +# True if CXSparse found on the local system +# +# ``CXSparse_INCLUDE_DIRS`` +# Location of CXSparse header files +# +# ``CXSPARSE_INCLUDE_DIRS`` +# Location of CXSparse header files +# +# ``CXSparse_LIBRARIES`` +# List of the CXSparse libraries found +# +# ``CXSPARSE_LIBRARIES`` +# List of the CXSparse libraries found +# +# + +include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) +include(${CMAKE_ROOT}/Modules/CMakeFindDependencyMacro.cmake) + +find_path(CXSPARSE_INCLUDE_DIR NAMES cs.h) + +find_library(CXSPARSE_LIBRARY_RELEASE NAMES cxsparse libcxsparse) +find_library(CXSPARSE_LIBRARY_DEBUG NAMES cxsparsed libcxsparsed) +select_library_configurations(CXSPARSE) + +if(CXSPARSE_INCLUDE_DIR) + set(CXSPARSE_VERSION_FILE ${CXSPARSE_INCLUDE_DIR}/cs.h) + file(READ ${CXSPARSE_INCLUDE_DIR}/cs.h CXSPARSE_VERSION_FILE_CONTENTS) + + string(REGEX MATCH "#define CS_VER [0-9]+" + CXSPARSE_MAIN_VERSION "${CXSPARSE_VERSION_FILE_CONTENTS}") + string(REGEX REPLACE "#define CS_VER ([0-9]+)" "\\1" + CXSPARSE_MAIN_VERSION "${CXSPARSE_MAIN_VERSION}") + + string(REGEX MATCH "#define CS_SUBVER [0-9]+" + CXSPARSE_SUB_VERSION "${CXSPARSE_VERSION_FILE_CONTENTS}") + string(REGEX REPLACE "#define CS_SUBVER ([0-9]+)" "\\1" + CXSPARSE_SUB_VERSION "${CXSPARSE_SUB_VERSION}") + + string(REGEX MATCH "#define CS_SUBSUB [0-9]+" + CXSPARSE_SUBSUB_VERSION "${CXSPARSE_VERSION_FILE_CONTENTS}") + string(REGEX REPLACE "#define CS_SUBSUB ([0-9]+)" "\\1" + CXSPARSE_SUBSUB_VERSION "${CXSPARSE_SUBSUB_VERSION}") + + set(CXSPARSE_VERSION "${CXSPARSE_MAIN_VERSION}.${CXSPARSE_SUB_VERSION}.${CXSPARSE_SUBSUB_VERSION}") +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(CXSparse + REQUIRED_VARS CXSPARSE_INCLUDE_DIRS CXSPARSE_LIBRARIES + VERSION_VAR CXSPARSE_VERSION) + +set(CXSPARSE_FOUND ${CXSparse_FOUND}) +set(CXSPARSE_INCLUDE_DIRS ${CXSPARSE_INCLUDE_DIR}) +set(CXSPARSE_LIBRARIES ${CXSPARSE_LIBRARY}) +set(CXSparse_INCLUDE_DIRS ${CXSPARSE_INCLUDE_DIR}) +set(CXSparse_LIBRARIES ${CXSPARSE_LIBRARY}) diff --git a/ports/suitesparse/portfile.cmake b/ports/suitesparse/portfile.cmake index 5d93550c930635..44dfa8c36234b4 100644 --- a/ports/suitesparse/portfile.cmake +++ b/ports/suitesparse/portfile.cmake @@ -50,3 +50,7 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) file(INSTALL ${SUITESPARSEWIN_SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright_suitesparse-metis-for-windows) + +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/cxsparse) +file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper_cxsparse.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/cxsparse RENAME vcpkg-cmake-wrapper.cmake) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindCXSparse.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/cxsparse) diff --git a/ports/suitesparse/vcpkg-cmake-wrapper_cxsparse.cmake b/ports/suitesparse/vcpkg-cmake-wrapper_cxsparse.cmake new file mode 100644 index 00000000000000..67d87e8b69055b --- /dev/null +++ b/ports/suitesparse/vcpkg-cmake-wrapper_cxsparse.cmake @@ -0,0 +1,10 @@ +set(CXSPARSE_PREV_MODULE_PATH ${CMAKE_MODULE_PATH}) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +list(REMOVE_ITEM ARGS "NO_MODULE") +list(REMOVE_ITEM ARGS "CONFIG") +list(REMOVE_ITEM ARGS "MODULE") + +_find_package(${ARGS}) + +set(CMAKE_MODULE_PATH ${CXSPARSE_PREV_MODULE_PATH}) From 1a98de6905bac9155d2336f7d30e83784021e796 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Mon, 13 Jul 2020 12:03:27 +0200 Subject: [PATCH 28/61] [nanogui] properly handle eigen3 --- ports/nanogui/CONTROL | 3 ++- ports/nanogui/portfile.cmake | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ports/nanogui/CONTROL b/ports/nanogui/CONTROL index 63b70db69f0055..f2a160bca1e9a8 100644 --- a/ports/nanogui/CONTROL +++ b/ports/nanogui/CONTROL @@ -1,5 +1,6 @@ Source: nanogui Version: 2019-09-23 +Port-Version: 1 Homepage: https://github.com/wjakob/nanogui Description: NanoGUI is a minimalistic cross-platform widget library for OpenGL 3.x or higher. -Build-Depends: glfw3, nanovg, eigen3 \ No newline at end of file +Build-Depends: glfw3, nanovg, eigen3 diff --git a/ports/nanogui/portfile.cmake b/ports/nanogui/portfile.cmake index bc868e5498210a..165dda119462ea 100644 --- a/ports/nanogui/portfile.cmake +++ b/ports/nanogui/portfile.cmake @@ -7,7 +7,7 @@ endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO wjakob/nanogui - REF e9ec8a1a9861cf578d9c6e85a6420080aa715c03 #Commits on Sep 23, 2019 + REF e9ec8a1a9861cf578d9c6e85a6420080aa715c03 #Commits on Sep 23, 2019 SHA512 36c93bf977862ced2df4030211e2b83625e60a11fc9fdb6c1f2996bb234758331d3f41a7fbafd25a5bca0239ed9bac9c93446a4a7fac4c5e6d7943af2be3e14a HEAD_REF master PATCHES @@ -16,6 +16,9 @@ vcpkg_from_github( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DNANOGUI_EIGEN_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include/eigen3 + -DEIGEN_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include/eigen3 ) vcpkg_install_cmake() @@ -23,4 +26,4 @@ vcpkg_copy_pdbs() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) # Handle copyright -file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file +file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) From c0554c9ec9b606bcc971007342bd666c85e5ce83 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Mon, 13 Jul 2020 12:04:00 +0200 Subject: [PATCH 29/61] [ceres] properly handle eigen3 --- ports/ceres/0001_cmakelists_fixes.patch | 13 +- ports/ceres/0004_fix_find_eigen.patch | 67 ++++++ ...ux_fix.patch => 0005_blas_linux_fix.patch} | 0 ports/ceres/CONTROL | 3 +- ports/ceres/build_fixes.patch | 198 ++++++++++++++++++ ports/ceres/portfile.cmake | 11 +- 6 files changed, 274 insertions(+), 18 deletions(-) create mode 100644 ports/ceres/0004_fix_find_eigen.patch rename ports/ceres/{0004_blas_linux_fix.patch => 0005_blas_linux_fix.patch} (100%) create mode 100644 ports/ceres/build_fixes.patch diff --git a/ports/ceres/0001_cmakelists_fixes.patch b/ports/ceres/0001_cmakelists_fixes.patch index f269f05eefd852..87a3785d5fe2b1 100644 --- a/ports/ceres/0001_cmakelists_fixes.patch +++ b/ports/ceres/0001_cmakelists_fixes.patch @@ -31,19 +31,10 @@ index 02c72b5..62d8c59 100644 endif (MINIGLOG) if (NOT SCHUR_SPECIALIZATIONS) -@@ -582,7 +562,7 @@ include_directories( - # Note that this is *not* propagated to clients, ie CERES_INCLUDE_DIRS - # used by clients after find_package(Ceres) does not identify Eigen as - # as system headers. --include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS}) -+include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS}/Eigen) - - if (SUITESPARSE) - include_directories(${SUITESPARSE_INCLUDE_DIRS}) -@@ -917,8 +897,6 @@ install(FILES "${Ceres_BINARY_DIR}/CeresConfig-install.cmake" +@@ -917,8 +897,5 @@ install(FILES "${Ceres_BINARY_DIR}/CeresConfig-install.cmake" DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR}) install(FILES "${Ceres_BINARY_DIR}/CeresConfigVersion.cmake" - "${Ceres_SOURCE_DIR}/cmake/FindEigen.cmake" +- "${Ceres_SOURCE_DIR}/cmake/FindEigen.cmake" - "${Ceres_SOURCE_DIR}/cmake/FindGlog.cmake" - "${Ceres_SOURCE_DIR}/cmake/FindGflags.cmake" DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR}) diff --git a/ports/ceres/0004_fix_find_eigen.patch b/ports/ceres/0004_fix_find_eigen.patch new file mode 100644 index 00000000000000..6996e0808b5c8f --- /dev/null +++ b/ports/ceres/0004_fix_find_eigen.patch @@ -0,0 +1,67 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7033de0..5235baa 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -209,40 +209,40 @@ endif (IOS) + unset(CERES_COMPILE_OPTIONS) + + # Eigen. +-find_package(Eigen REQUIRED) +-if (EIGEN_FOUND) +- message("-- Found Eigen version ${EIGEN_VERSION}: ${EIGEN_INCLUDE_DIRS}") +- if (EIGEN_VERSION VERSION_LESS 3.1.0) ++find_package(Eigen3 REQUIRED) ++if (EIGEN3_FOUND) ++ message(STATUS "Found Eigen version ${EIGEN3_VERSION_STRING}: ${EIGEN3_INCLUDE_DIRS}") ++ if (EIGEN3_VERSION_STRING VERSION_LESS 3.1.0) + message(FATAL_ERROR "-- Ceres requires Eigen version >= 3.1.0 in order " + "that Eigen/SparseCore be available, detected version of Eigen is: " +- "${EIGEN_VERSION}") +- endif (EIGEN_VERSION VERSION_LESS 3.1.0) ++ "${EIGEN3_VERSION_STRING}") ++ endif (EIGEN3_VERSION_STRING VERSION_LESS 3.1.0) + + if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)" AND +- EIGEN_VERSION VERSION_LESS 3.3.4) ++ EIGEN3_VERSION_STRING VERSION_LESS 3.3.4) + # As per issue #289: https://github.com/ceres-solver/ceres-solver/issues/289 + # the bundle_adjustment_test will fail for Eigen < 3.3.4 on aarch64. + message(FATAL_ERROR "-- Ceres requires Eigen version >= 3.3.4 on aarch64. " +- "Detected version of Eigen is: ${EIGEN_VERSION}.") ++ "Detected version of Eigen is: ${EIGEN3_VERSION_STRING}.") + endif() + + if (EIGENSPARSE) +- message("-- Enabling use of Eigen as a sparse linear algebra library.") ++ message(STATUS "Enabling use of Eigen as a sparse linear algebra library.") + list(APPEND CERES_COMPILE_OPTIONS CERES_USE_EIGEN_SPARSE) +- if (EIGEN_VERSION VERSION_LESS 3.2.2) ++ if (EIGEN3_VERSION_STRING VERSION_LESS 3.2.2) + message(" WARNING:") + message("") +- message(" Your version of Eigen (${EIGEN_VERSION}) is older than ") ++ message(" Your version of Eigen (${EIGEN3_VERSION_STRING}) is older than ") + message(" version 3.2.2. The performance of SPARSE_NORMAL_CHOLESKY ") + message(" and SPARSE_SCHUR linear solvers will suffer.") +- endif (EIGEN_VERSION VERSION_LESS 3.2.2) ++ endif (EIGEN3_VERSION_STRING VERSION_LESS 3.2.2) + else (EIGENSPARSE) + message("-- Disabling use of Eigen as a sparse linear algebra library.") + message(" This does not affect the covariance estimation algorithm ") + message(" which can still use the EIGEN_SPARSE_QR algorithm.") + add_definitions(-DEIGEN_MPL2_ONLY) + endif (EIGENSPARSE) +-endif (EIGEN_FOUND) ++endif (EIGEN3_FOUND) + + if (LAPACK) + find_package(LAPACK QUIET) +@@ -562,7 +562,7 @@ include_directories( + # Note that this is *not* propagated to clients, ie CERES_INCLUDE_DIRS + # used by clients after find_package(Ceres) does not identify Eigen as + # as system headers. +-include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS}) ++include_directories(${EIGEN3_INCLUDE_DIRS}) + + if (SUITESPARSE) + include_directories(${SUITESPARSE_INCLUDE_DIRS}) diff --git a/ports/ceres/0004_blas_linux_fix.patch b/ports/ceres/0005_blas_linux_fix.patch similarity index 100% rename from ports/ceres/0004_blas_linux_fix.patch rename to ports/ceres/0005_blas_linux_fix.patch diff --git a/ports/ceres/CONTROL b/ports/ceres/CONTROL index a0a7a72e02faf8..9b7d183b2c0a97 100644 --- a/ports/ceres/CONTROL +++ b/ports/ceres/CONTROL @@ -1,5 +1,6 @@ Source: ceres -Version: 1.14.0-7 +Version: 1.14.0 +Port-Version: 8 Build-Depends: glog, eigen3 Homepage: https://github.com/ceres-solver/ceres-solver Description: non-linear optimization package diff --git a/ports/ceres/build_fixes.patch b/ports/ceres/build_fixes.patch new file mode 100644 index 00000000000000..fcbd0061305eef --- /dev/null +++ b/ports/ceres/build_fixes.patch @@ -0,0 +1,198 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 02c72b5..1c066bb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -209,9 +209,9 @@ endif (IOS) + unset(CERES_COMPILE_OPTIONS) + + # Eigen. +-find_package(Eigen REQUIRED) ++find_package(Eigen3 REQUIRED) + if (EIGEN_FOUND) +- message("-- Found Eigen version ${EIGEN_VERSION}: ${EIGEN_INCLUDE_DIRS}") ++ message("-- Found Eigen version ${EIGEN3_VERSION}: ${EIGEN3_INCLUDE_DIRS}") + if (EIGEN_VERSION VERSION_LESS 3.1.0) + message(FATAL_ERROR "-- Ceres requires Eigen version >= 3.1.0 in order " + "that Eigen/SparseCore be available, detected version of Eigen is: " +@@ -374,27 +374,7 @@ if (MINIGLOG) + GLOG_LIBRARY) + else (MINIGLOG) + unset(MINIGLOG_MAX_LOG_LEVEL CACHE) +- # Don't search with REQUIRED so that configuration continues if not found and +- # we can output an error messages explaining MINIGLOG option. +- find_package(Glog) +- if (NOT GLOG_FOUND) +- message(FATAL_ERROR "Can't find Google Log (glog). Please set either: " +- "glog_DIR (newer CMake built versions of glog) or GLOG_INCLUDE_DIR & " +- "GLOG_LIBRARY or enable MINIGLOG option to use minimal glog " +- "implementation.") +- endif(NOT GLOG_FOUND) +- # By default, assume gflags was found, updating the message if it was not. +- set(GLOG_GFLAGS_DEPENDENCY_MESSAGE +- " Assuming glog was built with gflags support as gflags was found. " +- "This will make gflags a public dependency of Ceres.") +- if (NOT GFLAGS_FOUND) +- set(GLOG_GFLAGS_DEPENDENCY_MESSAGE +- " Assuming glog was NOT built with gflags support as gflags was " +- "not found. If glog was built with gflags, please set the " +- "gflags search locations such that it can be found by Ceres. " +- "Otherwise, Ceres may fail to link due to missing gflags symbols.") +- endif(NOT GFLAGS_FOUND) +- message("-- Found Google Log (glog)." ${GLOG_GFLAGS_DEPENDENCY_MESSAGE}) ++ find_package(Glog REQUIRED) + endif (MINIGLOG) + + if (NOT SCHUR_SPECIALIZATIONS) +@@ -916,9 +896,6 @@ install(FILES "${Ceres_BINARY_DIR}/CeresConfig-install.cmake" + RENAME CeresConfig.cmake + DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR}) + install(FILES "${Ceres_BINARY_DIR}/CeresConfigVersion.cmake" +- "${Ceres_SOURCE_DIR}/cmake/FindEigen.cmake" +- "${Ceres_SOURCE_DIR}/cmake/FindGlog.cmake" +- "${Ceres_SOURCE_DIR}/cmake/FindGflags.cmake" + DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR}) + + # Create an uninstall target to remove all installed files. +diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in +index d0380de..c4ed71f 100644 +--- a/cmake/CeresConfig.cmake.in ++++ b/cmake/CeresConfig.cmake.in +@@ -237,85 +237,13 @@ endif (EIGEN_FOUND) + list(APPEND CERES_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS}) + + # Glog. +-# Flag set during configuration and build of Ceres. +-set(CERES_USES_MINIGLOG @MINIGLOG@) +-set(CERES_USES_GFLAGS @GFLAGS@) +-if (CERES_USES_MINIGLOG) +- set(MINIGLOG_INCLUDE_DIR ${CERES_INCLUDE_DIR}/ceres/internal/miniglog) +- if (NOT CERES_WAS_INSTALLED) +- # When Ceres was exported from the build tree, the miniglog headers +- # will be in Ceres internal source directory, not in the public headers +- # directory (they are copied with the public headers when installed). +- set(MINIGLOG_INCLUDE_DIR +- ${CERES_EXPORTED_SOURCE_DIR}/internal/ceres/miniglog) +- endif() +- if (NOT EXISTS ${MINIGLOG_INCLUDE_DIR}) +- ceres_report_not_found( +- "Failed to find miniglog headers in expected include directory: " +- "${MINIGLOG_INCLUDE_DIR}, but Ceres was compiled with MINIGLOG enabled " +- "(in place of glog).") +- endif (NOT EXISTS ${MINIGLOG_INCLUDE_DIR}) +- list(APPEND CERES_INCLUDE_DIRS ${MINIGLOG_INCLUDE_DIR}) +- # Output message at standard log level (not the lower STATUS) so that +- # the message is output in GUI during configuration to warn user. +- message("-- Found Ceres compiled with miniglog substitute " +- "for glog, beware this will likely cause problems if glog is later linked.") +-else (CERES_USES_MINIGLOG) +- # Append the locations of glog when Ceres was built to the search path hints. +- set(GLOG_WAS_BUILT_WITH_CMAKE @FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION@) +- if (GLOG_WAS_BUILT_WITH_CMAKE) +- set(glog_DIR @glog_DIR@) +- set(GLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION TRUE) +- else() +- list(APPEND GLOG_INCLUDE_DIR_HINTS @GLOG_INCLUDE_DIR@) +- get_filename_component(CERES_BUILD_GLOG_LIBRARY_DIR @GLOG_LIBRARY@ PATH) +- list(APPEND GLOG_LIBRARY_DIR_HINTS ${CERES_BUILD_GLOG_LIBRARY_DIR}) +- endif() +- +- # Search quietly s/t we control the timing of the error message if not found. +- find_package(Glog QUIET) +- if (GLOG_FOUND) +- message(STATUS "Found required Ceres dependency: glog") +- else (GLOG_FOUND) +- ceres_report_not_found("Missing required Ceres " +- "dependency: glog. Searched using GLOG_INCLUDE_DIR_HINTS: " +- "${GLOG_INCLUDE_DIR_HINTS} and glog_DIR: ${glog_DIR}.") +- endif (GLOG_FOUND) +- list(APPEND CERES_INCLUDE_DIRS ${GLOG_INCLUDE_DIRS}) ++include (CMakeFindDependencyMacro) ++find_dependency (glog NO_MODULE) + +- # gflags is only a public dependency of Ceres via glog, thus is not required +- # if Ceres was built with MINIGLOG. +- if (CERES_USES_GFLAGS) +- # If gflags was found as an imported CMake target, we need to call +- # find_packge(Gflags) again here, as imported CMake targets are not +- # re-exported. Without this, the 'gflags-shared' target name which is +- # present in CERES_LIBRARIES in this case would not be defined, and so +- # CMake will assume it is a library name (which it is not) and fail to link. +- # +- # Append the locations of gflags when Ceres was built to the search path +- # hints. +- set(GFLAGS_WAS_BUILT_WITH_CMAKE @FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION@) +- if (GFLAGS_WAS_BUILT_WITH_CMAKE) +- set(gflags_DIR @gflags_DIR@) +- set(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION TRUE) +- else() +- list(APPEND GFLAGS_INCLUDE_DIR_HINTS @GFLAGS_INCLUDE_DIR@) +- get_filename_component(CERES_BUILD_GFLAGS_LIBRARY_DIR @GFLAGS_LIBRARY@ PATH) +- list(APPEND GFLAGS_LIBRARY_DIR_HINTS ${CERES_BUILD_GFLAGS_LIBRARY_DIR}) +- endif() +- +- # Search quietly s/t we control the timing of the error message if not found. +- find_package(Gflags QUIET) +- if (GFLAGS_FOUND) +- message(STATUS "Found required Ceres dependency: gflags") +- else() +- ceres_report_not_found("Missing required Ceres " +- "dependency: gflags. Searched using GFLAGS_INCLUDE_DIR_HINTS: " +- "${GFLAGS_INCLUDE_DIR_HINTS} and gflags_DIR: ${gflags_DIR}.") +- endif() +- list(APPEND CERES_INCLUDE_DIRS ${GFLAGS_INCLUDE_DIR_HINTS}) +- endif() +-endif (CERES_USES_MINIGLOG) ++#SuiteSparse ++if (@SUITESPARSE@) ++ find_dependency(suitesparse CONFIG REQUIRED) ++endif() + + # Import exported Ceres targets, if they have not already been imported. + if (NOT TARGET ceres AND NOT Ceres_BINARY_DIR) +diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt +index cc43fec..18b415b 100644 +--- a/internal/ceres/CMakeLists.txt ++++ b/internal/ceres/CMakeLists.txt +@@ -152,17 +152,9 @@ else (SCHUR_SPECIALIZATIONS) + endif (SCHUR_SPECIALIZATIONS) + + # Build the list of dependencies for Ceres based on the current configuration. +-if (NOT MINIGLOG AND GLOG_FOUND) +- list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES ${GLOG_LIBRARIES}) +- if (GFLAGS_FOUND) +- # If glog & gflags are both found, we assume that glog was built with +- # gflags, as it is awkward to perform a try_compile() to verify this +- # when gflags is an imported target (as it is in newer versions). +- # As glog #includes gflags/gflags.h in glog/logging.h if compiled with +- # gflags, it is thus a public dependency for Ceres in this case. +- list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES ${GFLAGS_LIBRARIES}) +- endif() +-endif (NOT MINIGLOG AND GLOG_FOUND) ++if (NOT MINIGLOG) ++ list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES glog::glog) ++endif (NOT MINIGLOG) + + if (SUITESPARSE AND SUITESPARSE_FOUND) + # Define version information for use in Solver::FullReport. +diff --git a/internal/ceres/blas.cc b/internal/ceres/blas.cc +index 3ba63bb..071a26e 100644 +--- a/internal/ceres/blas.cc ++++ b/internal/ceres/blas.cc +@@ -33,7 +33,7 @@ + #include "glog/logging.h" + + #ifndef CERES_NO_LAPACK +-extern "C" void dsyrk_(char* uplo, ++extern "C" void dsyrk(char* uplo, + char* trans, + int* n, + int* k, +@@ -64,7 +64,7 @@ void BLAS::SymmetricRankKUpdate(int num_rows, + int k = transpose ? num_rows : num_cols; + int lda = k; + int ldc = n; +- dsyrk_(&uplo, ++ dsyrk(&uplo, + &trans, + &n, + &k, diff --git a/ports/ceres/portfile.cmake b/ports/ceres/portfile.cmake index d2d781b594341b..2f11ba1cd55bb3 100644 --- a/ports/ceres/portfile.cmake +++ b/ports/ceres/portfile.cmake @@ -7,7 +7,7 @@ if(VCPKG_CRT_LINKAGE STREQUAL "static") endif() if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(ADDITIONAL_PATCH "0004_blas_linux_fix.patch") + set(ADDITIONAL_PATCH "0005_blas_linux_fix.patch") endif() vcpkg_from_github( @@ -20,14 +20,15 @@ vcpkg_from_github( 0001_cmakelists_fixes.patch 0002_use_glog_target.patch 0003_fix_exported_ceres_config.patch + 0004_fix_find_eigen.patch ${ADDITIONAL_PATCH} ) +file(REMOVE ${SOURCE_PATH}/cmake/FindCXSparse.cmake) file(REMOVE ${SOURCE_PATH}/cmake/FindGflags.cmake) file(REMOVE ${SOURCE_PATH}/cmake/FindGlog.cmake) -#file(REMOVE ${SOURCE_PATH}/cmake/FindEigen.cmake) +file(REMOVE ${SOURCE_PATH}/cmake/FindEigen.cmake) file(REMOVE ${SOURCE_PATH}/cmake/FindSuiteSparse.cmake) -#file(REMOVE ${SOURCE_PATH}/cmake/FindTBB.cmake) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS @@ -77,6 +78,4 @@ endif() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) -# Handle copyright of suitesparse and metis -file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/ceres) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/ceres/LICENSE ${CURRENT_PACKAGES_DIR}/share/ceres/copyright) +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) From 412cff1cc82a86693dca543b6831b51f9e7994f4 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Mon, 13 Jul 2020 12:40:55 +0200 Subject: [PATCH 30/61] [qt5] fixes #12387 --- ports/freetype/CONTROL | 4 +- ports/qt5-base/portfile.cmake | 73 +++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 35 deletions(-) diff --git a/ports/freetype/CONTROL b/ports/freetype/CONTROL index 7ba2032bf3107f..fb3b734ba42d2e 100644 --- a/ports/freetype/CONTROL +++ b/ports/freetype/CONTROL @@ -1,7 +1,7 @@ Source: freetype Version: 2.10.2 -Port-Version: 1 -Build-Depends: zlib +Port-Version: 2 +Build-Depends: zlib, woff2 Homepage: https://www.freetype.org/ Description: A library to render fonts. Default-Features: bzip2, png diff --git a/ports/qt5-base/portfile.cmake b/ports/qt5-base/portfile.cmake index f989926730ef66..65eb94ab1b6c56 100644 --- a/ports/qt5-base/portfile.cmake +++ b/ports/qt5-base/portfile.cmake @@ -17,13 +17,13 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake) if("latest" IN_LIST FEATURES) # latest = core currently set(QT_BUILD_LATEST ON) - set(PATCHES + set(PATCHES patches/Qt5BasicConfig.patch patches/Qt5PluginTarget.patch patches/create_cmake.patch ) else() - set(PATCHES + set(PATCHES patches/Qt5BasicConfig.patch patches/Qt5PluginTarget.patch patches/create_cmake.patch @@ -54,15 +54,15 @@ qt_download_submodule( OUT_SOURCE_PATH SOURCE_PATH PATCHES patches/winmain_pro.patch #Moves qtmain to manual-link patches/windows_prf.patch #fixes the qtmain dependency due to the above move - patches/qt_app.patch #Moves the target location of qt5 host apps to always install into the host dir. + patches/qt_app.patch #Moves the target location of qt5 host apps to always install into the host dir. patches/gui_configure.patch #Patches the gui configure.json to break freetype/fontconfig autodetection because it does not include its dependencies. patches/icu.patch #Help configure find static icu builds in vcpkg on windows patches/xlib.patch #Patches Xlib check to actually use Pkgconfig instead of makeSpec only - patches/egl.patch #Fix egl detection logic. - patches/8c44d70.diff #Upstream fix for MSVC 16.6.2. static init of std::atomic. - #patches/static_opengl.patch #Use this patch if you really want to statically link angle on windows (e.g. using -opengl es2 and -static). - #Be carefull since it requires definining _GDI32_ for all dependent projects due to redefinition errors in the - #the windows supplied gl.h header and the angle gl.h otherwise. + patches/egl.patch #Fix egl detection logic. + patches/8c44d70.diff #Upstream fix for MSVC 16.6.2. static init of std::atomic. + #patches/static_opengl.patch #Use this patch if you really want to statically link angle on windows (e.g. using -opengl es2 and -static). + #Be carefull since it requires definining _GDI32_ for all dependent projects due to redefinition errors in the + #the windows supplied gl.h header and the angle gl.h otherwise. #CMake fixes ${PATCHES} patches/Qt5GuiConfigExtras.patch # Patches the library search behavior for EGL since angle is not build with Qt @@ -87,7 +87,7 @@ set(CORE_OPTIONS -opensource #-simulator_and_device #-ltcg - #-combined-angle-lib + #-combined-angle-lib # ENV ANGLE_DIR to external angle source dir. (Will always be compiled with Qt) #-optimized-tools #-force-debug-info @@ -123,9 +123,9 @@ find_library(PCRE2_RELEASE NAMES pcre2-16 PATHS "${CURRENT_INSTALLED_DIR}/lib" N find_library(PCRE2_DEBUG NAMES pcre2-16 pcre2-16d PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) find_library(FREETYPE_RELEASE NAMES freetype PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) #zlib, bzip2, libpng find_library(FREETYPE_DEBUG NAMES freetype freetyped PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) -find_library(DOUBLECONVERSION_RELEASE NAMES double-conversion PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) +find_library(DOUBLECONVERSION_RELEASE NAMES double-conversion PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) find_library(DOUBLECONVERSION_DEBUG NAMES double-conversion PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) -find_library(HARFBUZZ_RELEASE NAMES harfbuzz PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) +find_library(HARFBUZZ_RELEASE NAMES harfbuzz PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) find_library(HARFBUZZ_DEBUG NAMES harfbuzz PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) find_library(SQLITE_RELEASE NAMES sqlite3 PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) # Depends on openssl and zlib(linux) find_library(SQLITE_DEBUG NAMES sqlite3 sqlite3d PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) @@ -166,8 +166,15 @@ find_library(SSL_DEBUG ssl ssleay32 ssld ssleay32d PATHS "${CURRENT_INSTALLED_DI find_library(EAY_RELEASE libeay32 crypto libcrypto PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) find_library(EAY_DEBUG libeay32 crypto libcrypto libeay32d cryptod libcryptod PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) -set(FREETYPE_RELEASE_ALL "${FREETYPE_RELEASE} ${BZ2_RELEASE} ${LIBPNG_RELEASE} ${ZLIB_RELEASE}") -set(FREETYPE_DEBUG_ALL "${FREETYPE_DEBUG} ${BZ2_DEBUG} ${LIBPNG_DEBUG} ${ZLIB_DEBUG}") +find_library(BROTLY_COMMON_RELEASE brotlicommon brotlicommon-static PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) +find_library(BROTLY_COMMON_DEBUG brotlicommon brotlicommon-static PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) +find_library(BROTLY_DECODER_RELEASE brotlidec brotlidec-static PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) +find_library(BROTLY_DECODER_DEBUG brotlidec brotlidec-static PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) +find_library(BROTLY_ENCODER_RELEASE brotlienc brotlienc-static PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) +find_library(BROTLY_ENCODER_DEBUG brotlienc brotlienc-static PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) + +set(FREETYPE_RELEASE_ALL "${FREETYPE_RELEASE} ${BROTLY_COMMON_RELEASE} ${BROTLY_DECODER_RELEASE} ${BROTLY_ENCODER_RELEASE} ${BZ2_RELEASE} ${LIBPNG_RELEASE} ${ZLIB_RELEASE}") +set(FREETYPE_DEBUG_ALL "${FREETYPE_DEBUG} ${BROTLY_COMMON_DEBUG} ${BROTLY_DECODER_DEBUG} ${BROTLY_ENCODER_DEBUG} ${BZ2_DEBUG} ${LIBPNG_DEBUG} ${ZLIB_DEBUG}") # If HarfBuzz is built with GLib enabled, it must be statically link set(GLIB_LIB_VERSION 2.0) @@ -186,7 +193,7 @@ set(RELEASE_OPTIONS "FREETYPE_LIBS=${FREETYPE_RELEASE_ALL}" "ICU_LIBS=${ICU_RELEASE}" "QMAKE_LIBS_PRIVATE+=${BZ2_RELEASE}" - "QMAKE_LIBS_PRIVATE+=${LIBPNG_RELEASE}" + "QMAKE_LIBS_PRIVATE+=${LIBPNG_RELEASE}" ) set(DEBUG_OPTIONS "LIBJPEG_LIBS=${JPEG_DEBUG}" @@ -207,7 +214,7 @@ if(VCPKG_TARGET_IS_WINDOWS) if(NOT ${VCPKG_LIBRARY_LINKAGE} STREQUAL "static") list(APPEND CORE_OPTIONS -opengl dynamic) # other options are "-no-opengl", "-opengl angle", and "-opengl desktop" and "-opengel es2" else() - list(APPEND CORE_OPTIONS -opengl dynamic) # other possible option without moving angle dlls: "-opengl desktop". "-opengel es2" only works with commented patch + list(APPEND CORE_OPTIONS -opengl dynamic) # other possible option without moving angle dlls: "-opengl desktop". "-opengel es2" only works with commented patch endif() list(APPEND RELEASE_OPTIONS "PSQL_LIBS=${PSQL_RELEASE} ${SSL_RELEASE} ${EAY_RELEASE} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib" @@ -215,7 +222,7 @@ if(VCPKG_TARGET_IS_WINDOWS) "HARFBUZZ_LIBS=${HARFBUZZ_RELEASE} ${FREETYPE_RELEASE_ALL}" "OPENSSL_LIBS=${SSL_RELEASE} ${EAY_RELEASE} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib" ) - + list(APPEND DEBUG_OPTIONS "PSQL_LIBS=${PSQL_DEBUG} ${SSL_DEBUG} ${EAY_DEBUG} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib" "SQLITE_LIBS=${SQLITE_DEBUG}" @@ -261,7 +268,7 @@ elseif(VCPKG_TARGET_IS_OSX) set(ENV{QMAKE_MACOSX_DEPLOYMENT_TARGET} ${VCPKG_OSX_DEPLOYMENT_TARGET}) message(STATUS "Enviromnent OSX SDK Version: $ENV{QMAKE_MACOSX_DEPLOYMENT_TARGET}") FILE(READ "${SOURCE_PATH}/mkspecs/common/macx.conf" _tmp_contents) - string(REPLACE "QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.12" "QMAKE_MACOSX_DEPLOYMENT_TARGET = ${VCPKG_OSX_DEPLOYMENT_TARGET}" _tmp_contents ${_tmp_contents}) + string(REPLACE "QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.13" "QMAKE_MACOSX_DEPLOYMENT_TARGET = ${VCPKG_OSX_DEPLOYMENT_TARGET}" _tmp_contents ${_tmp_contents}) FILE(WRITE "${SOURCE_PATH}/mkspecs/common/macx.conf" ${_tmp_contents}) endif() #list(APPEND QT_PLATFORM_CONFIGURE_OPTIONS HOST_PLATFORM ${TARGET_MKSPEC}) @@ -301,7 +308,7 @@ else() ######################### #TODO: Make this a function since it is also done by modular scripts! # e.g. by patching mkspecs/features/qt_tools.prf somehow - file(GLOB_RECURSE PRL_FILES "${CURRENT_PACKAGES_DIR}/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/mkspecs/*.pri" + file(GLOB_RECURSE PRL_FILES "${CURRENT_PACKAGES_DIR}/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/mkspecs/*.pri" "${CURRENT_PACKAGES_DIR}/debug/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/debug/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/debug/mkspecs/*.pri") file(TO_CMAKE_PATH "${CURRENT_INSTALLED_DIR}/include" CMAKE_INCLUDE_PATH) @@ -318,10 +325,10 @@ else() file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share) file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake ${CURRENT_PACKAGES_DIR}/share/cmake) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) # TODO: check if important debug information for cmake is lost + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) # TODO: check if important debug information for cmake is lost - #This needs a new VCPKG policy or a static angle build (ANGLE needs to be fixed in VCPKG!) - if(VCPKG_TARGET_IS_WINDOWS AND ${VCPKG_LIBRARY_LINKAGE} MATCHES "static") # Move angle dll libraries + #This needs a new VCPKG policy or a static angle build (ANGLE needs to be fixed in VCPKG!) + if(VCPKG_TARGET_IS_WINDOWS AND ${VCPKG_LIBRARY_LINKAGE} MATCHES "static") # Move angle dll libraries if(EXISTS "${CURRENT_PACKAGES_DIR}/bin") message(STATUS "Moving ANGLE dlls from /bin to /tools/qt5-angle/bin. In static builds dlls are not allowed in /bin") file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/qt5-angle) @@ -338,32 +345,32 @@ else() file(READ "${cmakefile}" _contents) if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_BUILD_TYPE) string(REPLACE "set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)" "set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)" _contents "${_contents}") - string(REPLACE - [[set(imported_location "${_qt5Core_install_prefix}/lib/qtmain.lib")]] + string(REPLACE + [[set(imported_location "${_qt5Core_install_prefix}/lib/qtmain.lib")]] [[set(imported_location_release "${_qt5Core_install_prefix}/lib/manual-link/qtmain.lib") - set(imported_location_debug "${_qt5Core_install_prefix}/debug/lib/manual-link/qtmaind.lib")]] + set(imported_location_debug "${_qt5Core_install_prefix}/debug/lib/manual-link/qtmaind.lib")]] _contents "${_contents}") - string(REPLACE + string(REPLACE [[ set_target_properties(Qt5::WinMain PROPERTIES IMPORTED_LOCATION_RELEASE ${imported_location} - )]] + )]] [[ set_target_properties(Qt5::WinMain PROPERTIES IMPORTED_LOCATION_RELEASE ${imported_location_release} IMPORTED_LOCATION_DEBUG ${imported_location_debug} - )]] + )]] _contents "${_contents}") else() # Single configuration build (either debug or release) # Release case - string(REPLACE + string(REPLACE [[set(imported_location "${_qt5Core_install_prefix}/lib/qtmain.lib")]] [[set(imported_location "${_qt5Core_install_prefix}/lib/manual-link/qtmain.lib")]] _contents "${_contents}") # Debug case (whichever will match) - string(REPLACE + string(REPLACE [[set(imported_location "${_qt5Core_install_prefix}/lib/qtmaind.lib")]] [[set(imported_location "${_qt5Core_install_prefix}/debug/lib/manual-link/qtmaind.lib")]] _contents "${_contents}") - string(REPLACE + string(REPLACE [[set(imported_location "${_qt5Core_install_prefix}/debug/lib/qtmaind.lib")]] [[set(imported_location "${_qt5Core_install_prefix}/debug/lib/manual-link/qtmaind.lib")]] _contents "${_contents}") @@ -380,7 +387,7 @@ else() file(COPY ${CURRENT_PACKAGES_DIR}/tools/qt5/bin DESTINATION ${CURRENT_PACKAGES_DIR}/tools/qt5/debug) vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/qt5/debug/bin) endif() - + if(EXISTS ${CURRENT_PACKAGES_DIR}/tools/qt5/bin/qt.conf) file(REMOVE "${CURRENT_PACKAGES_DIR}/tools/qt5/bin/qt.conf") endif() @@ -388,7 +395,7 @@ else() set(CURRENT_INSTALLED_DIR "./../../.." ) # Making the qt.conf relative and not absolute configure_file(${CURRENT_PACKAGES_DIR}/tools/qt5/qt_release.conf ${CURRENT_PACKAGES_DIR}/tools/qt5/bin/qt.conf) # This makes the tools at least useable for release set(CURRENT_INSTALLED_DIR "${CURRENT_INSTALLED_DIR_BACKUP}") - + qt_install_copyright(${SOURCE_PATH}) endif() #install scripts for other qt ports @@ -422,7 +429,7 @@ if(QT_BUILD_LATEST) ) endif() -# #Code to get generated CMake files from CI +# #Code to get generated CMake files from CI # file(RENAME "${CURRENT_PACKAGES_DIR}/share/cmake/Qt5Core/Qt5CoreConfig.cmake" "${CURRENT_BUILDTREES_DIR}/Qt5CoreConfig.cmake.log") # file(GLOB_RECURSE CMAKE_GUI_FILES "${CURRENT_PACKAGES_DIR}/share/cmake/Qt5Gui/*.cmake" ) # foreach(cmake_file ${CMAKE_GUI_FILES}) From 4a1775ef92cf9e4da4199da55c480678f6aa3485 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Mon, 13 Jul 2020 15:22:14 +0200 Subject: [PATCH 31/61] [ceres] improve handling Eigen3 --- ports/ceres/0004_fix_find_eigen.patch | 64 +++++++++++++++++++++++++++ ports/suitesparse/build_fixes.patch | 2 +- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/ports/ceres/0004_fix_find_eigen.patch b/ports/ceres/0004_fix_find_eigen.patch index 6996e0808b5c8f..ed5d5b8e96a910 100644 --- a/ports/ceres/0004_fix_find_eigen.patch +++ b/ports/ceres/0004_fix_find_eigen.patch @@ -65,3 +65,67 @@ index 7033de0..5235baa 100644 if (SUITESPARSE) include_directories(${SUITESPARSE_INCLUDE_DIRS}) +diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in +index c4ed71f..b3d6a17 100644 +--- a/cmake/CeresConfig.cmake.in ++++ b/cmake/CeresConfig.cmake.in +@@ -70,7 +70,7 @@ + # unsets all public (designed to be used externally) variables and reports + # error message at priority depending upon [REQUIRED/QUIET/] argument. + macro(CERES_REPORT_NOT_FOUND REASON_MSG) +- # FindPackage() only references Ceres_FOUND, and requires it to be ++# FindPackage() only references Ceres_FOUND, and requires it to be + # explicitly set FALSE to denote not found (not merely undefined). + set(Ceres_FOUND FALSE) + set(CERES_FOUND FALSE) +@@ -202,39 +202,39 @@ set(CERES_VERSION @CERES_VERSION@ ) + + # Eigen. + # Flag set during configuration and build of Ceres. +-set(CERES_EIGEN_VERSION @EIGEN_VERSION@) ++set(CERES_EIGEN_VERSION @EIGEN3_VERSION_STRING@) + set(EIGEN_WAS_BUILT_WITH_CMAKE @FOUND_INSTALLED_EIGEN_CMAKE_CONFIGURATION@) + # Append the locations of Eigen when Ceres was built to the search path hints. + if (EIGEN_WAS_BUILT_WITH_CMAKE) + set(Eigen3_DIR @Eigen3_DIR@) + set(EIGEN_PREFER_EXPORTED_EIGEN_CMAKE_CONFIGURATION TRUE) + else() +- list(APPEND EIGEN_INCLUDE_DIR_HINTS @EIGEN_INCLUDE_DIR@) ++ list(APPEND EIGEN_INCLUDE_DIR_HINTS @EIGEN3_INCLUDE_DIR@) + endif() + # Search quietly to control the timing of the error message if not found. The + # search should be for an exact match, but for usability reasons do a soft + # match and reject with an explanation below. +-find_package(Eigen ${CERES_EIGEN_VERSION} QUIET) +-if (EIGEN_FOUND) +- if (NOT EIGEN_VERSION VERSION_EQUAL CERES_EIGEN_VERSION) ++find_package(Eigen3 ${CERES_EIGEN_VERSION} QUIET) ++if (EIGEN3_FOUND) ++ if (NOT EIGEN3_VERSION_STRING VERSION_EQUAL CERES_EIGEN_VERSION) + # CMake's VERSION check in FIND_PACKAGE() will accept any version >= the + # specified version. However, only version = is supported. Improve + # usability by explaining why we don't accept non-exact version matching. + ceres_report_not_found("Found Eigen dependency, but the version of Eigen " +- "found (${EIGEN_VERSION}) does not exactly match the version of Eigen " ++ "found (${EIGEN3_VERSION_STRING}) does not exactly match the version of Eigen " + "Ceres was compiled with (${CERES_EIGEN_VERSION}). This can cause subtle " + "bugs by triggering violations of the One Definition Rule. See the " + "Wikipedia article http://en.wikipedia.org/wiki/One_Definition_Rule " + "for more details") + endif () + message(STATUS "Found required Ceres dependency: " +- "Eigen version ${CERES_EIGEN_VERSION} in ${EIGEN_INCLUDE_DIRS}") +-else (EIGEN_FOUND) ++ "Eigen version ${CERES_EIGEN_VERSION} in ${EIGEN3_INCLUDE_DIRS}") ++else (EIGEN3_FOUND) + ceres_report_not_found("Missing required Ceres " + "dependency: Eigen version ${CERES_EIGEN_VERSION}, please set " +- "EIGEN_INCLUDE_DIR.") +-endif (EIGEN_FOUND) +-list(APPEND CERES_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS}) ++ "EIGEN3_INCLUDE_DIR.") ++endif (EIGEN3_FOUND) ++list(APPEND CERES_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIRS}) + + # Glog. + include (CMakeFindDependencyMacro) diff --git a/ports/suitesparse/build_fixes.patch b/ports/suitesparse/build_fixes.patch index 8cdad27d6b1979..2734bb02cef03f 100644 --- a/ports/suitesparse/build_fixes.patch +++ b/ports/suitesparse/build_fixes.patch @@ -263,7 +263,7 @@ index 1e587d1..fd8f3a7 100644 find_dependency(BLAS) find_dependency(LAPACK) -endif () -+ @SuiteSparse_FIND_PACKAGE_METIS@ ++ @SuiteSparse_FIND_DEPENDENCY_METIS@ # Load targets from the install tree. -include(${_SuiteSparse_SELF_DIR}/SuiteSparse-targets.cmake) From 98bb209f08bb70fee7f24f6b08830bcc3665c74d Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Mon, 13 Jul 2020 15:48:09 +0200 Subject: [PATCH 32/61] [vlfeat] trying to fix uwp builds --- ports/vlfeat/CMakeLists.txt | 1 + scripts/ci.baseline.txt | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ports/vlfeat/CMakeLists.txt b/ports/vlfeat/CMakeLists.txt index d48d5c208b5305..39ecfbc6be59f3 100644 --- a/ports/vlfeat/CMakeLists.txt +++ b/ports/vlfeat/CMakeLists.txt @@ -34,6 +34,7 @@ if(MSVC) add_definitions(-D_CRT_SECURE_NO_DEPRECATE) add_definitions(-D__LITTLE_ENDIAN__) add_definitions(/Zp8) + add_definitions(/wd4146) if(CMAKE_C_FLAGS MATCHES "/W[0-4]") string(REGEX REPLACE "/W[0-4]" "/W1" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") endif() diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index ddf34f5c6fb297..702a95068b0c6a 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -629,9 +629,9 @@ jinja2cpplight:arm-uwp=fail jinja2cpplight:x64-uwp=fail keystone:arm-uwp=fail keystone:x64-uwp=fail -kfr:arm64-windows=fail +kfr:arm64-windows=fail kfr:arm-uwp=fail -kfr:x64-linux=fail +kfr:x64-linux=fail kinectsdk1:arm64-windows=fail kinectsdk1:arm-uwp=fail kinectsdk1:x64-linux=fail @@ -1427,7 +1427,7 @@ qpid-proton:x64-uwp=fail qpid-proton:x64-windows-static=fail qt5-activeqt:x64-linux=fail qt5-activeqt:x64-osx=fail -# Skip deprecated Qt module +# Skip deprecated Qt module # (remnove after 1 year or longer due to vcpkg upgrade not handling removed ports correctly) qt5-canvas3d:x64-linux=skip qt5-canvas3d:x64-osx=skip @@ -1940,4 +1940,4 @@ ctp:x64-windows=skip ctp:x64-windows-static=skip ctp:x86-windows=skip protozero:arm-uwp=fail -protozero:x64-uwp=fail \ No newline at end of file +protozero:x64-uwp=fail From 0370ea3fab987b579b3028e72fd6af100b8c0736 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Mon, 13 Jul 2020 21:33:46 +0200 Subject: [PATCH 33/61] fix openblas/lapack, again, like one year ago --- ports/ceres/build_fixes.patch | 198 ----- ports/clapack/CONTROL | 3 +- ports/clapack/FindLAPACK.cmake | 705 +++++---------- ports/clapack/vcpkg-cmake-wrapper.cmake | 10 +- ports/openblas/CONTROL | 3 +- ports/openblas/FindBLAS.cmake | 816 ------------------ ports/openblas/portfile.cmake | 11 +- ports/openblas/vcpkg-cmake-wrapper.cmake | 2 - .../linux_blas_no_underscore.patch | 13 + ports/suitesparse/portfile.cmake | 2 + ports/theia/CONTROL | 3 +- ports/theia/fix-external-dependencies.patch | 57 +- ports/theia/portfile.cmake | 1 + 13 files changed, 325 insertions(+), 1499 deletions(-) delete mode 100644 ports/ceres/build_fixes.patch delete mode 100644 ports/openblas/FindBLAS.cmake delete mode 100644 ports/openblas/vcpkg-cmake-wrapper.cmake create mode 100644 ports/suitesparse/linux_blas_no_underscore.patch diff --git a/ports/ceres/build_fixes.patch b/ports/ceres/build_fixes.patch deleted file mode 100644 index fcbd0061305eef..00000000000000 --- a/ports/ceres/build_fixes.patch +++ /dev/null @@ -1,198 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 02c72b5..1c066bb 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -209,9 +209,9 @@ endif (IOS) - unset(CERES_COMPILE_OPTIONS) - - # Eigen. --find_package(Eigen REQUIRED) -+find_package(Eigen3 REQUIRED) - if (EIGEN_FOUND) -- message("-- Found Eigen version ${EIGEN_VERSION}: ${EIGEN_INCLUDE_DIRS}") -+ message("-- Found Eigen version ${EIGEN3_VERSION}: ${EIGEN3_INCLUDE_DIRS}") - if (EIGEN_VERSION VERSION_LESS 3.1.0) - message(FATAL_ERROR "-- Ceres requires Eigen version >= 3.1.0 in order " - "that Eigen/SparseCore be available, detected version of Eigen is: " -@@ -374,27 +374,7 @@ if (MINIGLOG) - GLOG_LIBRARY) - else (MINIGLOG) - unset(MINIGLOG_MAX_LOG_LEVEL CACHE) -- # Don't search with REQUIRED so that configuration continues if not found and -- # we can output an error messages explaining MINIGLOG option. -- find_package(Glog) -- if (NOT GLOG_FOUND) -- message(FATAL_ERROR "Can't find Google Log (glog). Please set either: " -- "glog_DIR (newer CMake built versions of glog) or GLOG_INCLUDE_DIR & " -- "GLOG_LIBRARY or enable MINIGLOG option to use minimal glog " -- "implementation.") -- endif(NOT GLOG_FOUND) -- # By default, assume gflags was found, updating the message if it was not. -- set(GLOG_GFLAGS_DEPENDENCY_MESSAGE -- " Assuming glog was built with gflags support as gflags was found. " -- "This will make gflags a public dependency of Ceres.") -- if (NOT GFLAGS_FOUND) -- set(GLOG_GFLAGS_DEPENDENCY_MESSAGE -- " Assuming glog was NOT built with gflags support as gflags was " -- "not found. If glog was built with gflags, please set the " -- "gflags search locations such that it can be found by Ceres. " -- "Otherwise, Ceres may fail to link due to missing gflags symbols.") -- endif(NOT GFLAGS_FOUND) -- message("-- Found Google Log (glog)." ${GLOG_GFLAGS_DEPENDENCY_MESSAGE}) -+ find_package(Glog REQUIRED) - endif (MINIGLOG) - - if (NOT SCHUR_SPECIALIZATIONS) -@@ -916,9 +896,6 @@ install(FILES "${Ceres_BINARY_DIR}/CeresConfig-install.cmake" - RENAME CeresConfig.cmake - DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR}) - install(FILES "${Ceres_BINARY_DIR}/CeresConfigVersion.cmake" -- "${Ceres_SOURCE_DIR}/cmake/FindEigen.cmake" -- "${Ceres_SOURCE_DIR}/cmake/FindGlog.cmake" -- "${Ceres_SOURCE_DIR}/cmake/FindGflags.cmake" - DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR}) - - # Create an uninstall target to remove all installed files. -diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in -index d0380de..c4ed71f 100644 ---- a/cmake/CeresConfig.cmake.in -+++ b/cmake/CeresConfig.cmake.in -@@ -237,85 +237,13 @@ endif (EIGEN_FOUND) - list(APPEND CERES_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS}) - - # Glog. --# Flag set during configuration and build of Ceres. --set(CERES_USES_MINIGLOG @MINIGLOG@) --set(CERES_USES_GFLAGS @GFLAGS@) --if (CERES_USES_MINIGLOG) -- set(MINIGLOG_INCLUDE_DIR ${CERES_INCLUDE_DIR}/ceres/internal/miniglog) -- if (NOT CERES_WAS_INSTALLED) -- # When Ceres was exported from the build tree, the miniglog headers -- # will be in Ceres internal source directory, not in the public headers -- # directory (they are copied with the public headers when installed). -- set(MINIGLOG_INCLUDE_DIR -- ${CERES_EXPORTED_SOURCE_DIR}/internal/ceres/miniglog) -- endif() -- if (NOT EXISTS ${MINIGLOG_INCLUDE_DIR}) -- ceres_report_not_found( -- "Failed to find miniglog headers in expected include directory: " -- "${MINIGLOG_INCLUDE_DIR}, but Ceres was compiled with MINIGLOG enabled " -- "(in place of glog).") -- endif (NOT EXISTS ${MINIGLOG_INCLUDE_DIR}) -- list(APPEND CERES_INCLUDE_DIRS ${MINIGLOG_INCLUDE_DIR}) -- # Output message at standard log level (not the lower STATUS) so that -- # the message is output in GUI during configuration to warn user. -- message("-- Found Ceres compiled with miniglog substitute " -- "for glog, beware this will likely cause problems if glog is later linked.") --else (CERES_USES_MINIGLOG) -- # Append the locations of glog when Ceres was built to the search path hints. -- set(GLOG_WAS_BUILT_WITH_CMAKE @FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION@) -- if (GLOG_WAS_BUILT_WITH_CMAKE) -- set(glog_DIR @glog_DIR@) -- set(GLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION TRUE) -- else() -- list(APPEND GLOG_INCLUDE_DIR_HINTS @GLOG_INCLUDE_DIR@) -- get_filename_component(CERES_BUILD_GLOG_LIBRARY_DIR @GLOG_LIBRARY@ PATH) -- list(APPEND GLOG_LIBRARY_DIR_HINTS ${CERES_BUILD_GLOG_LIBRARY_DIR}) -- endif() -- -- # Search quietly s/t we control the timing of the error message if not found. -- find_package(Glog QUIET) -- if (GLOG_FOUND) -- message(STATUS "Found required Ceres dependency: glog") -- else (GLOG_FOUND) -- ceres_report_not_found("Missing required Ceres " -- "dependency: glog. Searched using GLOG_INCLUDE_DIR_HINTS: " -- "${GLOG_INCLUDE_DIR_HINTS} and glog_DIR: ${glog_DIR}.") -- endif (GLOG_FOUND) -- list(APPEND CERES_INCLUDE_DIRS ${GLOG_INCLUDE_DIRS}) -+include (CMakeFindDependencyMacro) -+find_dependency (glog NO_MODULE) - -- # gflags is only a public dependency of Ceres via glog, thus is not required -- # if Ceres was built with MINIGLOG. -- if (CERES_USES_GFLAGS) -- # If gflags was found as an imported CMake target, we need to call -- # find_packge(Gflags) again here, as imported CMake targets are not -- # re-exported. Without this, the 'gflags-shared' target name which is -- # present in CERES_LIBRARIES in this case would not be defined, and so -- # CMake will assume it is a library name (which it is not) and fail to link. -- # -- # Append the locations of gflags when Ceres was built to the search path -- # hints. -- set(GFLAGS_WAS_BUILT_WITH_CMAKE @FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION@) -- if (GFLAGS_WAS_BUILT_WITH_CMAKE) -- set(gflags_DIR @gflags_DIR@) -- set(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION TRUE) -- else() -- list(APPEND GFLAGS_INCLUDE_DIR_HINTS @GFLAGS_INCLUDE_DIR@) -- get_filename_component(CERES_BUILD_GFLAGS_LIBRARY_DIR @GFLAGS_LIBRARY@ PATH) -- list(APPEND GFLAGS_LIBRARY_DIR_HINTS ${CERES_BUILD_GFLAGS_LIBRARY_DIR}) -- endif() -- -- # Search quietly s/t we control the timing of the error message if not found. -- find_package(Gflags QUIET) -- if (GFLAGS_FOUND) -- message(STATUS "Found required Ceres dependency: gflags") -- else() -- ceres_report_not_found("Missing required Ceres " -- "dependency: gflags. Searched using GFLAGS_INCLUDE_DIR_HINTS: " -- "${GFLAGS_INCLUDE_DIR_HINTS} and gflags_DIR: ${gflags_DIR}.") -- endif() -- list(APPEND CERES_INCLUDE_DIRS ${GFLAGS_INCLUDE_DIR_HINTS}) -- endif() --endif (CERES_USES_MINIGLOG) -+#SuiteSparse -+if (@SUITESPARSE@) -+ find_dependency(suitesparse CONFIG REQUIRED) -+endif() - - # Import exported Ceres targets, if they have not already been imported. - if (NOT TARGET ceres AND NOT Ceres_BINARY_DIR) -diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt -index cc43fec..18b415b 100644 ---- a/internal/ceres/CMakeLists.txt -+++ b/internal/ceres/CMakeLists.txt -@@ -152,17 +152,9 @@ else (SCHUR_SPECIALIZATIONS) - endif (SCHUR_SPECIALIZATIONS) - - # Build the list of dependencies for Ceres based on the current configuration. --if (NOT MINIGLOG AND GLOG_FOUND) -- list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES ${GLOG_LIBRARIES}) -- if (GFLAGS_FOUND) -- # If glog & gflags are both found, we assume that glog was built with -- # gflags, as it is awkward to perform a try_compile() to verify this -- # when gflags is an imported target (as it is in newer versions). -- # As glog #includes gflags/gflags.h in glog/logging.h if compiled with -- # gflags, it is thus a public dependency for Ceres in this case. -- list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES ${GFLAGS_LIBRARIES}) -- endif() --endif (NOT MINIGLOG AND GLOG_FOUND) -+if (NOT MINIGLOG) -+ list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES glog::glog) -+endif (NOT MINIGLOG) - - if (SUITESPARSE AND SUITESPARSE_FOUND) - # Define version information for use in Solver::FullReport. -diff --git a/internal/ceres/blas.cc b/internal/ceres/blas.cc -index 3ba63bb..071a26e 100644 ---- a/internal/ceres/blas.cc -+++ b/internal/ceres/blas.cc -@@ -33,7 +33,7 @@ - #include "glog/logging.h" - - #ifndef CERES_NO_LAPACK --extern "C" void dsyrk_(char* uplo, -+extern "C" void dsyrk(char* uplo, - char* trans, - int* n, - int* k, -@@ -64,7 +64,7 @@ void BLAS::SymmetricRankKUpdate(int num_rows, - int k = transpose ? num_rows : num_cols; - int lda = k; - int ldc = n; -- dsyrk_(&uplo, -+ dsyrk(&uplo, - &trans, - &n, - &k, diff --git a/ports/clapack/CONTROL b/ports/clapack/CONTROL index ce3610044aeff6..bbabc6ad89f306 100644 --- a/ports/clapack/CONTROL +++ b/ports/clapack/CONTROL @@ -1,5 +1,6 @@ Source: clapack -Version: 3.2.1-13 +Version: 3.2.1 +Port-Version: 14 Homepage: https://www.netlib.org/clapack Description: CLAPACK (f2c'ed version of LAPACK) Build-Depends: openblas (!osx) diff --git a/ports/clapack/FindLAPACK.cmake b/ports/clapack/FindLAPACK.cmake index 0b5924ff4a4280..da0aca9b7b85e3 100644 --- a/ports/clapack/FindLAPACK.cmake +++ b/ports/clapack/FindLAPACK.cmake @@ -1,468 +1,237 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindLAPACK ----------- - -Find LAPACK library - -This module finds an installed fortran library that implements the -LAPACK linear-algebra interface (see http://www.netlib.org/lapack/). - -The approach follows that taken for the autoconf macro file, -acx_lapack.m4 (distributed at -http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html). - -Input Variables -^^^^^^^^^^^^^^^ - -The following variables may be set to influence this module's behavior: - -``BLA_STATIC`` - if ``ON`` use static linkage - -``BLA_VENDOR`` - If set, checks only the specified vendor, if not set checks all the - possibilities. List of vendors valid in this module: - - * ``Intel10_32`` (intel mkl v10 32 bit) - * ``Intel10_64lp`` (intel mkl v10+ 64 bit, threaded code, lp64 model) - * ``Intel10_64lp_seq`` (intel mkl v10+ 64 bit, sequential code, lp64 model) - * ``Intel10_64ilp`` (intel mkl v10+ 64 bit, threaded code, ilp64 model) - * ``Intel10_64ilp_seq`` (intel mkl v10+ 64 bit, sequential code, ilp64 model) - * ``Intel`` (obsolete versions of mkl 32 and 64 bit) - * ``OpenBLAS`` - * ``FLAME`` - * ``ACML`` - * ``Apple`` - * ``NAS`` - * ``Generic`` - -``BLA_F95`` - if ``ON`` tries to find BLAS95/LAPACK95 - -Result Variables -^^^^^^^^^^^^^^^^ - -This module defines the following variables: - -``LAPACK_FOUND`` - library implementing the LAPACK interface is found -``LAPACK_LINKER_FLAGS`` - uncached list of required linker flags (excluding -l and -L). -``LAPACK_LIBRARIES`` - uncached list of libraries (using full path name) to link against - to use LAPACK -``LAPACK95_LIBRARIES`` - uncached list of libraries (using full path name) to link against - to use LAPACK95 -``LAPACK95_FOUND`` - library implementing the LAPACK95 interface is found - -.. note:: - - C or CXX must be enabled to use Intel MKL - - For example, to use Intel MKL libraries and/or Intel compiler: - - .. code-block:: cmake - - set(BLA_VENDOR Intel10_64lp) - find_package(LAPACK) -#]=======================================================================] - -set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - -# Check the language being used -if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED) ) - if(LAPACK_FIND_REQUIRED) - message(FATAL_ERROR "FindLAPACK requires Fortran, C, or C++ to be enabled.") - else() - message(STATUS "Looking for LAPACK... - NOT found (Unsupported languages)") - return() - endif() -endif() - -if (CMAKE_Fortran_COMPILER_LOADED) -include(${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake) -else () -include(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) -endif () -include(${CMAKE_ROOT}/Modules/CMakePushCheckState.cmake) -include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) - -cmake_push_check_state() -set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY}) - -set(LAPACK_FOUND FALSE) -set(LAPACK95_FOUND FALSE) - -# TODO: move this stuff to separate module - -macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads) -# This macro checks for the existence of the combination of fortran libraries -# given by _list. If the combination is found, this macro checks (using the -# Check_Fortran_Function_Exists macro) whether can link against that library -# combination using the name of a routine given by _name using the linker -# flags given by _flags. If the combination of libraries is found and passes -# the link test, LIBRARIES is set to the list of complete library paths that -# have been found. Otherwise, LIBRARIES is set to FALSE. - -# N.B. _prefix is the prefix applied to the names of all cached variables that -# are generated internally and marked advanced by this macro. - -set(_libraries_work TRUE) -set(${LIBRARIES}) -set(${LIBRARIES}_RELEASE) -set(_combined_name) -if (NOT _libdir) - if (WIN32) - set(_libdir ENV LIB) - elseif (APPLE) - set(_libdir ENV DYLD_LIBRARY_PATH) - else () - set(_libdir ENV LD_LIBRARY_PATH) - endif () -endif () - -list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - -foreach(_library ${_list}) - set(_combined_name ${_combined_name}_${_library}) - - if(_libraries_work) - if (BLA_STATIC) - if (WIN32) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif () - if (APPLE) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else () - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif () - else () - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - # for ubuntu's libblas3gf and liblapack3gf packages - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) - endif () - endif () - find_library(${_prefix}_${_library}_LIBRARY_RELEASE - NAMES ${_library} - PATHS ${_libdir} - ) - mark_as_advanced(${_prefix}_${_library}_LIBRARY_RELEASE) - find_library(${_prefix}_${_library}_LIBRARY_DEBUG - NAMES ${_library}d - PATHS ${_libdir} - ) - mark_as_advanced(${_prefix}_${_library}_LIBRARY_DEBUG) - select_library_configurations(${_prefix}_${_library}) - if(NOT ${_prefix}_${_library}_LIBRARY_RELEASE MATCHES "NOTFOUND") - set(${LIBRARIES}_RELEASE ${${LIBRARIES}_RELEASE} ${${_prefix}_${_library}_LIBRARY_RELEASE}) - endif() - set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) - set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) - endif() -endforeach() - -if(_libraries_work) - # Test this combination of libraries. - if(NOT "${_blas}" STREQUAL "") - string(GENEX_STRIP "${_blas}" _test_blas) - endif() - if(UNIX AND BLA_STATIC) - set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group" ${${LIBRARIES}_RELEASE} ${_test_blas} "-Wl,--end-group" ${_threads}) - else() - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}_RELEASE} ${_test_blas} ${_threads}) - endif() - #message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") - #message("DEBUG: _test_blas = ${_test_blas} former ${_blas}") - if (NOT CMAKE_Fortran_COMPILER_LOADED) - check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) - else () - check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) - endif () - set(CMAKE_REQUIRED_LIBRARIES) - set(_test_blas) - set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) -# message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") -endif() - - if(_libraries_work) - set(${LIBRARIES} ${${LIBRARIES}} "${_blas}" ${_threads}) - else() - set(${LIBRARIES} FALSE) - endif() - -endmacro() - - -set(LAPACK_LINKER_FLAGS) -set(LAPACK_LIBRARIES) -set(LAPACK95_LIBRARIES) - - -if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - find_package(BLAS) -else() - find_package(BLAS REQUIRED) -endif() - - -if(BLAS_FOUND) - set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) - if (NOT $ENV{BLA_VENDOR} STREQUAL "") - set(BLA_VENDOR $ENV{BLA_VENDOR}) - else () - if(NOT BLA_VENDOR) - set(BLA_VENDOR "All") - endif() - endif () - -#intel lapack -if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") - if (NOT WIN32) - set(LAPACK_mkl_LM "-lm") - set(LAPACK_mkl_LDL "-ldl") - endif () - if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED) - if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - find_PACKAGE(Threads) - else() - find_package(Threads REQUIRED) - endif() - - if (BLA_VENDOR MATCHES "_64ilp") - set(LAPACK_mkl_ILP_MODE "ilp64") - else () - set(LAPACK_mkl_ILP_MODE "lp64") - endif () - - set(LAPACK_SEARCH_LIBS "") - - if (BLA_F95) - set(LAPACK_mkl_SEARCH_SYMBOL "cheev_f95") - set(_LIBRARIES LAPACK95_LIBRARIES) - set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES}) - - # old - list(APPEND LAPACK_SEARCH_LIBS - "mkl_lapack95") - # new >= 10.3 - list(APPEND LAPACK_SEARCH_LIBS - "mkl_intel_c") - list(APPEND LAPACK_SEARCH_LIBS - "mkl_lapack95_${LAPACK_mkl_ILP_MODE}") - else() - set(LAPACK_mkl_SEARCH_SYMBOL "cheev") - set(_LIBRARIES LAPACK_LIBRARIES) - set(_BLAS_LIBRARIES ${BLAS_LIBRARIES}) - - # old - list(APPEND LAPACK_SEARCH_LIBS - "mkl_lapack") - endif() - - # First try empty lapack libs - if (NOT ${_LIBRARIES}) - check_lapack_libraries( - ${_LIBRARIES} - LAPACK - ${LAPACK_mkl_SEARCH_SYMBOL} - "" - "" - "${_BLAS_LIBRARIES}" - "" - ) - endif () - # Then try the search libs - foreach (IT ${LAPACK_SEARCH_LIBS}) - if (NOT ${_LIBRARIES}) - check_lapack_libraries( - ${_LIBRARIES} - LAPACK - ${LAPACK_mkl_SEARCH_SYMBOL} - "" - "${IT}" - "${_BLAS_LIBRARIES}" - "${CMAKE_THREAD_LIBS_INIT};${LAPACK_mkl_LM};${LAPACK_mkl_LDL}" - ) - endif () - endforeach () - - unset(LAPACK_mkl_ILP_MODE) - unset(LAPACK_mkl_SEARCH_SYMBOL) - unset(LAPACK_mkl_LM) - unset(LAPACK_mkl_LDL) - endif () -endif() - -if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "goto2" - "${BLAS_LIBRARIES}" - "" - ) - endif() -endif () - -if (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "openblas" - "${BLAS_LIBRARIES}" - "" - ) - endif() -endif () - -if (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "flame" - "${BLAS_LIBRARIES}" - "" - ) - endif() -endif () - -#acml lapack - if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") - if (BLAS_LIBRARIES MATCHES ".+acml.+") - set (LAPACK_LIBRARIES ${BLAS_LIBRARIES}) - endif () - endif () - -# Apple LAPACK library? -if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "Accelerate" - "${BLAS_LIBRARIES}" - "" - ) - endif() -endif () -if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") - if ( NOT LAPACK_LIBRARIES ) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "vecLib" - "${BLAS_LIBRARIES}" - "" - ) - endif () -endif () -# Generic LAPACK library? -if (BLA_VENDOR STREQUAL "Generic" OR - BLA_VENDOR STREQUAL "ATLAS" OR - BLA_VENDOR STREQUAL "All") - if ( NOT LAPACK_LIBRARIES ) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "lapack" - "${BLAS_LIBRARIES}" - "" - ) - endif () - if ( NOT LAPACK_LIBRARIES ) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "lapack;libf2c" - "${BLAS_LIBRARIES}" - "" - ) - endif () - if ( NOT LAPACK_LIBRARIES ) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "lapack;f2c" - "${BLAS_LIBRARIES}" - "" - ) - endif () -endif () - -else() - message(STATUS "LAPACK requires BLAS") -endif() - -if(BLA_F95) - if(LAPACK95_LIBRARIES) - set(LAPACK95_FOUND TRUE) - else() - set(LAPACK95_FOUND FALSE) - endif() - if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK95_FOUND) - message(STATUS "A library with LAPACK95 API found.") - else() - if(LAPACK_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with LAPACK95 API not found. Please specify library location." - ) - else() - message(STATUS - "A library with LAPACK95 API not found. Please specify library location." - ) - endif() - endif() - endif() - set(LAPACK_FOUND "${LAPACK95_FOUND}") - set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}") -else() - if(LAPACK_LIBRARIES) - set(LAPACK_FOUND TRUE) - else() - set(LAPACK_FOUND FALSE) - endif() - - if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK_FOUND) - message(STATUS "A library with LAPACK API found.") - else() - if(LAPACK_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with LAPACK API not found. Please specify library location." - ) - else() - message(STATUS - "A library with LAPACK API not found. Please specify library location." - ) - endif() - endif() - endif() -endif() - -cmake_pop_check_state() -set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) +#.rst: +# clapack config for vcpkg +# ------------ +# +# Find the clapack includes and library. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This script defines the following variables: +# +# ``CLAPACK_FOUND`` +# True if clapack library found +# +# ``CLAPACK_VERSION`` +# Containing the clapack version tag (manually defined) +# +# ``CLAPACK_INCLUDE_DIR`` +# Location of clapack headers +# +# ``CLAPACK_LIBRARY`` +# List of libraries to link with when using clapack +# +# Result Targets +# ^^^^^^^^^^^^^^ +# +# This script defines the following targets: +# +# ``clapack::clapack`` +# Target to use clapack +# +# Compatibility Variables +# ^^^^^^^^^^^^^^^^^^^^^^^ +# +# This script defines the following variables for compatibility reasons: +# +# ``F2C_FOUND`` +# True if f2c (fortran-to-c wrap layer) library found +# +# ``F2C_INCLUDE_DIR`` +# Location of clapack headers +# +# ``F2C_LIBRARY`` +# Library containing the fortran-to-c wrap layer, necessary for clapack and automatically included when used +# +# ``LAPACK_FOUND`` +# True if clapack library found +# +# ``LAPACK_VERSION`` +# Containing the clapack version tag (manually defined) +# +# ``LAPACK_INCLUDE_DIR`` +# Location of clapack headers +# +# ``LAPACK_LIBRARY`` +# List of libraries to link with when using clapack +# +# Compatibility Targets +# ^^^^^^^^^^^^^^ +# +# This script defines the following targets for compatibility reasons: +# +# ``lapack`` +# Target to use lapack + +include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) +include(${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake) +include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_ROOT}/Modules/CMakeFindDependencyMacro.cmake) + +set(CLAPACK_VERSION "3.2.1") + +set(CMAKE_THREAD_PREFER_PTHREAD TRUE) +find_dependency(Threads) + +if(UNIX) + find_library(ADDITIONAL_LAPACK_LIBRARY m) + set(PTHREAD_LINK_NAME "-pthread") +endif() + +if(NOT F2C_LIBRARY) + find_library(F2C_LIBRARY_RELEASE NAMES f2c libf2c) + find_library(F2C_LIBRARY_DEBUG NAMES f2cd libf2cd) + select_library_configurations(F2C) + + #keep a list of "pure" f2c libs, without dependencies + set(oF2C_LIBRARY_RELEASE ${F2C_LIBRARY_RELEASE}) + set(oF2C_LIBRARY_DEBUG ${F2C_LIBRARY_DEBUG}) + set(oF2C_LIBRARY ${F2C_LIBRARY}) + + list(APPEND F2C_LIBRARY ${ADDITIONAL_LAPACK_LIBRARY}) +endif() + +if(NOT LAPACK_LIBRARY) + find_library(LAPACK_LIBRARY_RELEASE NAMES lapack) + find_library(LAPACK_LIBRARY_DEBUG NAMES lapackd) + + #keep a list of "pure" lapack libs, without dependencies + set(oLAPACK_LIBRARY_RELEASE ${LAPACK_LIBRARY_RELEASE}) + set(oLAPACK_LIBRARY_DEBUG ${LAPACK_LIBRARY_DEBUG}) + select_library_configurations(oLAPACK) + + list(APPEND LAPACK_LIBRARY_RELEASE ${F2C_LIBRARY_RELEASE}) + list(APPEND LAPACK_LIBRARY_DEBUG ${F2C_LIBRARY_DEBUG}) + + find_dependency(OpenBLAS) + get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY IMPORTED_IMPLIB_RELEASE) + if(NOT _loc) + get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY LOCATION_RELEASE) + endif() + set(LAPACK_BLAS_LIBRARY_RELEASE ${_loc}) + get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY IMPORTED_IMPLIB_DEBUG) + if(NOT _loc) + get_property(_loc TARGET OpenBLAS::OpenBLAS PROPERTY LOCATION_DEBUG) + endif() + set(LAPACK_BLAS_LIBRARY_DEBUG ${_loc}) + select_library_configurations(LAPACK_BLAS) + list(APPEND LAPACK_LIBRARY_RELEASE ${LAPACK_BLAS_LIBRARY_RELEASE}) + list(APPEND LAPACK_LIBRARY_DEBUG ${LAPACK_BLAS_LIBRARY_DEBUG}) + + select_library_configurations(LAPACK) + list(APPEND LAPACK_LIBRARY Threads::Threads) +endif() + +if(NOT F2C_INCLUDE_DIR) + find_path(F2C_INCLUDE_DIR NAMES f2c.h) +endif() + +if(NOT LAPACK_INCLUDE_DIR) + find_path(LAPACK_INCLUDE_DIR NAMES clapack.h) +endif() + +list(APPEND LAPACK_INCLUDE_DIR ${F2C_INCLUDE_DIR}) +set(LAPACK_INCLUDE_DIR "${LAPACK_INCLUDE_DIR}" CACHE PATH "" FORCE) +set(LAPACK_INCLUDE_DIRS "${LAPACK_INCLUDE_DIR}" CACHE PATH "" FORCE) +set(CLAPACK_INCLUDE_DIR "${LAPACK_INCLUDE_DIR}" CACHE PATH "" FORCE) +set(CLAPACK_INCLUDE_DIRS "${LAPACK_INCLUDE_DIR}" CACHE PATH "" FORCE) +set(F2C_INCLUDE_DIRS "${F2C_INCLUDE_DIR}" CACHE PATH "" FORCE) + +set(LAPACK_DLL_DIR ${LAPACK_INCLUDE_DIR}) +list(TRANSFORM LAPACK_DLL_DIR APPEND "/../bin") +message(STATUS "LAPACK_DLL_DIR: ${LAPACK_DLL_DIR}") + +if(WIN32) + find_file(LAPACK_LIBRARY_RELEASE_DLL NAMES lapack.dll PATHS ${LAPACK_DLL_DIR}) + find_file(LAPACK_LIBRARY_DEBUG_FOLDER NAMES lapackd.dll PATHS ${LAPACK_DLL_DIR}) + find_file(F2C_LIBRARY_RELEASE_DLL NAMES f2c.dll libf2c.dll PATHS ${LAPACK_DLL_DIR}) + find_file(F2C_LIBRARY_DEBUG_DLL NAMES f2cd.dll libf2cd.dll PATHS ${LAPACK_DLL_DIR}) +endif() + +set(LAPACK_BLAS_LIBRARY "${LAPACK_BLAS_LIBRARY}" CACHE STRING "" FORCE) +set(F2C_LIBRARIES "${F2C_LIBRARY}" CACHE STRING "" FORCE) +set(LAPACK_VERSION "${CLAPACK_VERSION}" CACHE STRING "" FORCE) +set(LAPACK_LIBRARIES "${LAPACK_LIBRARY}" CACHE STRING "" FORCE) +set(CLAPACK_LIBRARY "${LAPACK_LIBRARY}" CACHE STRING "" FORCE) +set(CLAPACK_LIBRARIES "${LAPACK_LIBRARY}" CACHE STRING "" FORCE) + +set(LAPACK_LIBRARY "${LAPACK_LIBRARY}" CACHE STRING "" FORCE) +set(F2C_LIBRARY "${F2C_LIBRARY}" CACHE STRING "" FORCE) +set(LAPACK_LIBRARY_RELEASE "${LAPACK_LIBRARY_RELEASE}" CACHE STRING "" FORCE) +set(LAPACK_LIBRARY_DEBUG "${LAPACK_LIBRARY_DEBUG}" CACHE STRING "" FORCE) +set(F2C_LIBRARY_RELEASE "${F2C_LIBRARY_RELEASE}" CACHE STRING "" FORCE) +set(F2C_LIBRARY_DEBUG "${F2C_LIBRARY_DEBUG}" CACHE STRING "" FORCE) + +find_package_handle_standard_args(CLAPACK DEFAULT_MSG CLAPACK_LIBRARY CLAPACK_INCLUDE_DIR) +mark_as_advanced(CLAPACK_INCLUDE_DIR CLAPACK_LIBRARY) + +find_package_handle_standard_args(LAPACK DEFAULT_MSG LAPACK_LIBRARY LAPACK_INCLUDE_DIR) +mark_as_advanced(LAPACK_INCLUDE_DIR LAPACK_LIBRARY) + +find_package_handle_standard_args(F2C DEFAULT_MSG F2C_LIBRARY F2C_INCLUDE_DIR) +mark_as_advanced(F2C_INCLUDE_DIR F2C_LIBRARY) + +#TARGETS +if(CLAPACK_FOUND AND NOT TARGET clapack::clapack) + if(EXISTS "${LAPACK_LIBRARY_RELEASE_DLL}") + add_library(clapack::clapack SHARED IMPORTED) + set_target_properties(clapack::clapack PROPERTIES + IMPORTED_LOCATION_RELEASE "${LAPACK_LIBRARY_RELEASE_DLL}" + IMPORTED_IMPLIB_RELEASE "${oLAPACK_LIBRARY_RELEASE}" + INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "$<$>:${oF2C_LIBRARY_RELEASE}>;$<$:${oF2C_LIBRARY_DEBUG}>;$<$>:${LAPACK_BLAS_LIBRARY_RELEASE}>;$<$:${LAPACK_BLAS_LIBRARY_DEBUG}>;$;$" + IMPORTED_CONFIGURATIONS Release + IMPORTED_LINK_INTERFACE_LANGUAGES "C") + if(EXISTS "${LAPACK_LIBRARY_DEBUG_DLL}") + set_property(TARGET clapack::clapack APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug) + set_target_properties(clapack::clapack PROPERTIES + IMPORTED_LOCATION_DEBUG "${LAPACK_LIBRARY_DEBUG_DLL}" + IMPORTED_IMPLIB_DEBUG "${oLAPACK_LIBRARY_DEBUG}") + endif() + else() + add_library(clapack::clapack UNKNOWN IMPORTED) + set_target_properties(clapack::clapack PROPERTIES + IMPORTED_LOCATION_RELEASE "${oLAPACK_LIBRARY_RELEASE}" + INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "$<$>:${oF2C_LIBRARY_RELEASE}>;$<$:${oF2C_LIBRARY_DEBUG}>;$<$>:${LAPACK_BLAS_LIBRARY_RELEASE}>;$<$:${LAPACK_BLAS_LIBRARY_DEBUG}>;$;$" + IMPORTED_CONFIGURATIONS Release + IMPORTED_LINK_INTERFACE_LANGUAGES "C") + if(EXISTS "${LAPACK_LIBRARY_DEBUG}") + set_property(TARGET clapack::clapack APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug) + set_target_properties(clapack::clapack PROPERTIES + IMPORTED_LOCATION_DEBUG "${oLAPACK_LIBRARY_DEBUG}") + endif() + endif() +endif() + +if(CLAPACK_FOUND AND NOT TARGET lapack) + if(EXISTS "${LAPACK_LIBRARY_RELEASE_DLL}") + add_library(lapack SHARED IMPORTED) + set_target_properties(lapack PROPERTIES + IMPORTED_LOCATION_RELEASE "${LAPACK_LIBRARY_RELEASE_DLL}" + IMPORTED_IMPLIB_RELEASE "${oLAPACK_LIBRARY_RELEASE}" + INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "$<$>:${oF2C_LIBRARY_RELEASE}>;$<$:${oF2C_LIBRARY_DEBUG}>;$<$>:${LAPACK_BLAS_LIBRARY_RELEASE}>;$<$:${LAPACK_BLAS_LIBRARY_DEBUG}>;$;$" + IMPORTED_CONFIGURATIONS Release + IMPORTED_LINK_INTERFACE_LANGUAGES "C") + if(EXISTS "${LAPACK_LIBRARY_DEBUG_DLL}") + set_property(TARGET lapack APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug) + set_target_properties(lapack PROPERTIES + IMPORTED_LOCATION_DEBUG "${LAPACK_LIBRARY_DEBUG_DLL}" + IMPORTED_IMPLIB_DEBUG "${oLAPACK_LIBRARY_DEBUG}") + endif() + else() + add_library(lapack UNKNOWN IMPORTED) + set_target_properties(lapack PROPERTIES + IMPORTED_LOCATION_RELEASE "${oLAPACK_LIBRARY_RELEASE}" + INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIR}" + IMPORTED_CONFIGURATIONS Release + INTERFACE_LINK_LIBRARIES "$<$>:${oF2C_LIBRARY_RELEASE}>;$<$:${oF2C_LIBRARY_DEBUG}>;$<$>:${LAPACK_BLAS_LIBRARY_RELEASE}>;$<$:${LAPACK_BLAS_LIBRARY_DEBUG}>;$;$" + IMPORTED_LINK_INTERFACE_LANGUAGES "C") + if(EXISTS "${LAPACK_LIBRARY_DEBUG}") + set_property(TARGET lapack APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug) + set_target_properties(lapack PROPERTIES + IMPORTED_LOCATION_DEBUG "${oLAPACK_LIBRARY_DEBUG}") + endif() + endif() +endif() diff --git a/ports/clapack/vcpkg-cmake-wrapper.cmake b/ports/clapack/vcpkg-cmake-wrapper.cmake index 26a0a1624b854d..8c9af9e8671acf 100644 --- a/ports/clapack/vcpkg-cmake-wrapper.cmake +++ b/ports/clapack/vcpkg-cmake-wrapper.cmake @@ -1,2 +1,10 @@ -include(${CMAKE_CURRENT_LIST_DIR}/FindLAPACK.cmake) +set(LAPACK_PREV_MODULE_PATH ${CMAKE_MODULE_PATH}) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) +list(REMOVE_ITEM ARGS "NO_MODULE") +list(REMOVE_ITEM ARGS "CONFIG") +list(REMOVE_ITEM ARGS "MODULE") + +_find_package(${ARGS}) + +set(CMAKE_MODULE_PATH ${LAPACK_PREV_MODULE_PATH}) \ No newline at end of file diff --git a/ports/openblas/CONTROL b/ports/openblas/CONTROL index 3c2b0b7ebe68d7..e72fba70188af8 100644 --- a/ports/openblas/CONTROL +++ b/ports/openblas/CONTROL @@ -1,5 +1,6 @@ Source: openblas -Version: 0.3.9-1 +Version: 0.3.9 +Port-Version: 2 Homepage: https://github.com/xianyi/OpenBLAS Build-Depends: pthread (linux) Description: OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. diff --git a/ports/openblas/FindBLAS.cmake b/ports/openblas/FindBLAS.cmake deleted file mode 100644 index 164e79f3b24c8c..00000000000000 --- a/ports/openblas/FindBLAS.cmake +++ /dev/null @@ -1,816 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindBLAS --------- - -Find Basic Linear Algebra Subprograms (BLAS) library - -This module finds an installed Fortran library that implements the -BLAS linear-algebra interface (see http://www.netlib.org/blas/). The -list of libraries searched for is taken from the ``autoconf`` macro file, -``acx_blas.m4`` (distributed at -http://ac-archive.sourceforge.net/ac-archive/acx_blas.html). - -Input Variables -^^^^^^^^^^^^^^^ - -The following variables may be set to influence this module's behavior: - -``BLA_STATIC`` - if ``ON`` use static linkage - -``BLA_VENDOR`` - If set, checks only the specified vendor, if not set checks all the - possibilities. List of vendors valid in this module: - - * Goto - * OpenBLAS - * FLAME - * ATLAS PhiPACK - * CXML - * DXML - * SunPerf - * SCSL - * SGIMATH - * IBMESSL - * Intel10_32 (intel mkl v10 32 bit) - * Intel10_64lp (intel mkl v10+ 64 bit, threaded code, lp64 model) - * Intel10_64lp_seq (intel mkl v10+ 64 bit, sequential code, lp64 model) - * Intel10_64ilp (intel mkl v10+ 64 bit, threaded code, ilp64 model) - * Intel10_64ilp_seq (intel mkl v10+ 64 bit, sequential code, ilp64 model) - * Intel (obsolete versions of mkl 32 and 64 bit) - * ACML - * ACML_MP - * ACML_GPU - * Apple - * NAS - * Generic - -``BLA_F95`` - if ``ON`` tries to find the BLAS95 interfaces - -``BLA_PREFER_PKGCONFIG`` - if set ``pkg-config`` will be used to search for a BLAS library first - and if one is found that is preferred - -Result Variables -^^^^^^^^^^^^^^^^ - -This module defines the following variables: - -``BLAS_FOUND`` - library implementing the BLAS interface is found -``BLAS_LINKER_FLAGS`` - uncached list of required linker flags (excluding ``-l`` and ``-L``). -``BLAS_LIBRARIES`` - uncached list of libraries (using full path name) to link against - to use BLAS (may be empty if compiler implicitly links BLAS) -``BLAS95_LIBRARIES`` - uncached list of libraries (using full path name) to link against - to use BLAS95 interface -``BLAS95_FOUND`` - library implementing the BLAS95 interface is found - -.. note:: - - C or CXX must be enabled to use Intel Math Kernel Library (MKL) - - For example, to use Intel MKL libraries and/or Intel compiler: - - .. code-block:: cmake - - set(BLA_VENDOR Intel10_64lp) - find_package(BLAS) - -Hints -^^^^^ - -Set ``MKLROOT`` environment variable to a directory that contains an MKL -installation. - -#]=======================================================================] - -include(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) -include(${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake) -include(${CMAKE_ROOT}/Modules/CMakePushCheckState.cmake) -include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) -cmake_push_check_state() -set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY}) - -set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - -# Check the language being used -if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED) ) - if(BLAS_FIND_REQUIRED) - message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.") - else() - message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)") - return() - endif() -endif() - -if(BLA_PREFER_PKGCONFIG) - find_package(PkgConfig) - pkg_check_modules(PKGC_BLAS blas) - if(PKGC_BLAS_FOUND) - set(BLAS_FOUND ${PKGC_BLAS_FOUND}) - set(BLAS_LIBRARIES "${PKGC_BLAS_LINK_LIBRARIES}") - return() - endif() -endif() - -macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) - # This macro checks for the existence of the combination of fortran libraries - # given by _list. If the combination is found, this macro checks (using the - # Check_Fortran_Function_Exists macro) whether can link against that library - # combination using the name of a routine given by _name using the linker - # flags given by _flags. If the combination of libraries is found and passes - # the link test, LIBRARIES is set to the list of complete library paths that - # have been found. Otherwise, LIBRARIES is set to FALSE. - - # N.B. _prefix is the prefix applied to the names of all cached variables that - # are generated internally and marked advanced by this macro. - - set(_libdir ${ARGN}) - - set(_libraries_work TRUE) - set(${LIBRARIES}) - set(_combined_name) - if (NOT _libdir) - if (WIN32) - set(_libdir ENV LIB) - elseif (APPLE) - set(_libdir ENV DYLD_LIBRARY_PATH) - else () - set(_libdir ENV LD_LIBRARY_PATH) - endif () - endif () - - list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - - foreach(_library ${_list}) - set(_combined_name ${_combined_name}_${_library}) - if(NOT "${_thread}" STREQUAL "") - set(_combined_name ${_combined_name}_thread) - endif() - if(_libraries_work) - if (BLA_STATIC) - if (WIN32) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif () - if (APPLE) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else () - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif () - else () - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - # for ubuntu's libblas3gf and liblapack3gf packages - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) - endif () - endif () - find_library(${_prefix}_${_library}_LIBRARY - NAMES ${_library} - PATHS ${_libdir} - ) - mark_as_advanced(${_prefix}_${_library}_LIBRARY) - set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) - set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) - endif() - endforeach() - if(_libraries_work) - # Test this combination of libraries. - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread}) - # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") - if (CMAKE_Fortran_COMPILER_LOADED) - check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) - else() - check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) - endif() - set(CMAKE_REQUIRED_LIBRARIES) - set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) - endif() - if(_libraries_work) - if("${_list}" STREQUAL "") - set(${LIBRARIES} "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES") - else() - set(${LIBRARIES} ${${LIBRARIES}} ${_thread}) # for static link - endif() - else() - set(${LIBRARIES} FALSE) - endif() - #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") -endmacro() - -set(BLAS_LINKER_FLAGS) -set(BLAS_LIBRARIES) -set(BLAS95_LIBRARIES) -if (NOT $ENV{BLA_VENDOR} STREQUAL "") - set(BLA_VENDOR $ENV{BLA_VENDOR}) -else () - if(NOT BLA_VENDOR) - set(BLA_VENDOR "All") - endif() -endif () - -if (BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - # Implicitly linked BLAS libraries - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "" - "" - ) - endif() -endif () - -#BLAS in intel mkl 10+ library? (em64t 64bit) -if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") - if (NOT BLAS_LIBRARIES) - - # System-specific settings - if (WIN32) - if (BLA_STATIC) - set(BLAS_mkl_DLL_SUFFIX "") - else() - set(BLAS_mkl_DLL_SUFFIX "_dll") - endif() - else() - # Switch to GNU Fortran support layer if needed (but not on Apple, where MKL does not provide it) - if(CMAKE_Fortran_COMPILER_LOADED AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT APPLE) - set(BLAS_mkl_INTFACE "gf") - set(BLAS_mkl_THREADING "gnu") - set(BLAS_mkl_OMP "gomp") - else() - set(BLAS_mkl_INTFACE "intel") - set(BLAS_mkl_THREADING "intel") - set(BLAS_mkl_OMP "iomp5") - endif() - set(BLAS_mkl_LM "-lm") - set(BLAS_mkl_LDL "-ldl") - endif() - - if (BLA_VENDOR MATCHES "_64ilp") - set(BLAS_mkl_ILP_MODE "ilp64") - else () - set(BLAS_mkl_ILP_MODE "lp64") - endif () - - if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED) - if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) - find_package(Threads) - else() - find_package(Threads REQUIRED) - endif() - - set(BLAS_SEARCH_LIBS "") - - if(BLA_F95) - set(BLAS_mkl_SEARCH_SYMBOL sgemm_f95) - set(_LIBRARIES BLAS95_LIBRARIES) - if (WIN32) - # Find the main file (32-bit or 64-bit) - set(BLAS_SEARCH_LIBS_WIN_MAIN "") - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN - "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}") - endif() - if (BLA_VENDOR MATCHES "^Intel10_64i?lp" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN - "mkl_blas95_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX} mkl_intel_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX}") - endif () - - # Add threading/sequential libs - set(BLAS_SEARCH_LIBS_WIN_THREAD "") - if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "mkl_sequential${BLAS_mkl_DLL_SUFFIX}") - endif() - if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") - # old version - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") - # mkl >= 10.3 - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") - endif() - - # Cartesian product of the above - foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN}) - foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD}) - list(APPEND BLAS_SEARCH_LIBS - "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}") - endforeach() - endforeach() - else () - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - # old version - list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95 mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide") - - # mkl >= 10.3 - list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95 mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}") - endif () - if (BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All") - # old version - list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95 mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide") - - # mkl >= 10.3 - list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}") - endif () - if (BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core") - endif () - endif () - else () - set(BLAS_mkl_SEARCH_SYMBOL sgemm) - set(_LIBRARIES BLAS_LIBRARIES) - if (WIN32) - # Find the main file (32-bit or 64-bit) - set(BLAS_SEARCH_LIBS_WIN_MAIN "") - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN - "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}") - endif() - if (BLA_VENDOR MATCHES "^Intel10_64i?lp" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN - "mkl_intel_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX}") - endif () - - # Add threading/sequential libs - set(BLAS_SEARCH_LIBS_WIN_THREAD "") - if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") - # old version - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") - # mkl >= 10.3 - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") - endif() - if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "mkl_sequential${BLAS_mkl_DLL_SUFFIX}") - endif() - - # Cartesian product of the above - foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN}) - foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD}) - list(APPEND BLAS_SEARCH_LIBS - "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}") - endforeach() - endforeach() - else () - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - # old version - list(APPEND BLAS_SEARCH_LIBS - "mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide") - - # mkl >= 10.3 - list(APPEND BLAS_SEARCH_LIBS - "mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}") - endif () - if (BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All") - # old version - list(APPEND BLAS_SEARCH_LIBS - "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide") - - # mkl >= 10.3 - list(APPEND BLAS_SEARCH_LIBS - "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}") - endif () - if (BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS - "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core") - endif () - - #older vesions of intel mkl libs - if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS - "mkl") - list(APPEND BLAS_SEARCH_LIBS - "mkl_ia32") - list(APPEND BLAS_SEARCH_LIBS - "mkl_em64t") - endif () - endif () - endif () - - if (DEFINED ENV{MKLROOT}) - if (BLA_VENDOR STREQUAL "Intel10_32") - set(_BLAS_MKLROOT_LIB_DIR "$ENV{MKLROOT}/lib/ia32") - elseif (BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$") - set(_BLAS_MKLROOT_LIB_DIR "$ENV{MKLROOT}/lib/intel64") - endif () - endif () - if (_BLAS_MKLROOT_LIB_DIR) - if (WIN32) - string(APPEND _BLAS_MKLROOT_LIB_DIR "_win") - elseif (APPLE) - string(APPEND _BLAS_MKLROOT_LIB_DIR "_mac") - else () - string(APPEND _BLAS_MKLROOT_LIB_DIR "_lin") - endif () - endif () - - foreach (IT ${BLAS_SEARCH_LIBS}) - string(REPLACE " " ";" SEARCH_LIBS ${IT}) - if (NOT ${_LIBRARIES}) - check_fortran_libraries( - ${_LIBRARIES} - BLAS - ${BLAS_mkl_SEARCH_SYMBOL} - "" - "${SEARCH_LIBS}" - "${CMAKE_THREAD_LIBS_INIT};${BLAS_mkl_LM};${BLAS_mkl_LDL}" - "${_BLAS_MKLROOT_LIB_DIR}" - ) - endif () - endforeach () - - endif () - unset(BLAS_mkl_ILP_MODE) - unset(BLAS_mkl_INTFACE) - unset(BLAS_mkl_THREADING) - unset(BLAS_mkl_OMP) - unset(BLAS_mkl_DLL_SUFFIX) - unset(BLAS_mkl_LM) - unset(BLAS_mkl_LDL) - endif () -endif () - -if(BLA_F95) - find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS95_LIBRARIES) - set(BLAS95_FOUND ${BLAS_FOUND}) - if(BLAS_FOUND) - set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}") - endif() -endif() - -if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - # gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "goto2" - "" - ) - endif() -endif () - -if (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - # OpenBLAS (http://www.openblas.net) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "openblas" - "" - ) - endif() - if(NOT BLAS_LIBRARIES) - find_package(Threads) - # OpenBLAS (http://www.openblas.net) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "openblas" - "${CMAKE_THREAD_LIBS_INIT}" - ) - endif() -endif () - -if (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - # FLAME's blis library (https://github.com/flame/blis) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "blis" - "" - ) - endif() -endif () - -if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - dgemm - "" - "f77blas;atlas" - "" - ) - endif() -endif () - -# BLAS in PhiPACK libraries? (requires generic BLAS lib, too) -if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "sgemm;dgemm;blas" - "" - ) - endif() -endif () - -# BLAS in Alpha CXML library? -if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "cxml" - "" - ) - endif() -endif () - -# BLAS in Alpha DXML library? (now called CXML, see above) -if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "dxml" - "" - ) - endif() -endif () - -# BLAS in Sun Performance library? -if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "-xlic_lib=sunperf" - "sunperf;sunmath" - "" - ) - if(BLAS_LIBRARIES) - set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf") - endif() - endif() -endif () - -# BLAS in SCSL library? (SGI/Cray Scientific Library) -if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "scsl" - "" - ) - endif() -endif () - -# BLAS in SGIMATH library? -if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "complib.sgimath" - "" - ) - endif() -endif () - -# BLAS in IBM ESSL library? (requires generic BLAS lib, too) -if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "essl;blas" - "" - ) - endif() -endif () - -#BLAS in acml library? -if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") - if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR - ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR - ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS)) - ) - # try to find acml in "standard" paths - if( WIN32 ) - file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" ) - else() - file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" ) - endif() - if( WIN32 ) - file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" ) - else() - file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" ) - endif() - list(GET _ACML_ROOT 0 _ACML_ROOT) - list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT) - if( _ACML_ROOT ) - get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH ) - if( SIZEOF_INTEGER EQUAL 8 ) - set( _ACML_PATH_SUFFIX "_int64" ) - else() - set( _ACML_PATH_SUFFIX "" ) - endif() - if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" ) - set( _ACML_COMPILER32 "ifort32" ) - set( _ACML_COMPILER64 "ifort64" ) - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" ) - set( _ACML_COMPILER32 "sun32" ) - set( _ACML_COMPILER64 "sun64" ) - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" ) - set( _ACML_COMPILER32 "pgi32" ) - if( WIN32 ) - set( _ACML_COMPILER64 "win64" ) - else() - set( _ACML_COMPILER64 "pgi64" ) - endif() - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" ) - # 32 bit builds not supported on Open64 but for code simplicity - # We'll just use the same directory twice - set( _ACML_COMPILER32 "open64_64" ) - set( _ACML_COMPILER64 "open64_64" ) - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" ) - set( _ACML_COMPILER32 "nag32" ) - set( _ACML_COMPILER64 "nag64" ) - else() - set( _ACML_COMPILER32 "gfortran32" ) - set( _ACML_COMPILER64 "gfortran64" ) - endif() - - if( BLA_VENDOR STREQUAL "ACML_MP" ) - set(_ACML_MP_LIB_DIRS - "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib" - "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" ) - else() - set(_ACML_LIB_DIRS - "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib" - "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" ) - endif() - endif() -elseif(BLAS_${BLA_VENDOR}_LIB_DIRS) - set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS}) -endif() - -if( BLA_VENDOR STREQUAL "ACML_MP" ) - foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS}) - check_fortran_libraries ( - BLAS_LIBRARIES - BLAS - sgemm - "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS} - ) - if( BLAS_LIBRARIES ) - break() - endif() - endforeach() -elseif( BLA_VENDOR STREQUAL "ACML_GPU" ) - foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS}) - check_fortran_libraries ( - BLAS_LIBRARIES - BLAS - sgemm - "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS} - ) - if( BLAS_LIBRARIES ) - break() - endif() - endforeach() -else() - foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} ) - check_fortran_libraries ( - BLAS_LIBRARIES - BLAS - sgemm - "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS} - ) - if( BLAS_LIBRARIES ) - break() - endif() - endforeach() -endif() - -# Either acml or acml_mp should be in LD_LIBRARY_PATH but not both -if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "acml;acml_mv" - "" - ) -endif() -if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "acml_mp;acml_mv" - "" - ) -endif() -if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "acml;acml_mv;CALBLAS" - "" - ) -endif() -endif () # ACML - -# Apple BLAS library? -if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - dgemm - "" - "Accelerate" - "" - ) - endif() -endif () - -if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") - if ( NOT BLAS_LIBRARIES ) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - dgemm - "" - "vecLib" - "" - ) - endif () -endif () - -# Generic BLAS library? -if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "blas" - "" - ) - endif() -endif () - -if(NOT BLA_F95) - find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS_LIBRARIES) -endif() - -# On compilers that implicitly link BLAS (such as ftn, cc, and CC on Cray HPC machines) -# we used a placeholder for empty BLAS_LIBRARIES to get through our logic above. -if (BLAS_LIBRARIES STREQUAL "BLAS_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES") - set(BLAS_LIBRARIES "") -endif() - -cmake_pop_check_state() -set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/ports/openblas/portfile.cmake b/ports/openblas/portfile.cmake index 2decb588380674..44b436d49f0351 100644 --- a/ports/openblas/portfile.cmake +++ b/ports/openblas/portfile.cmake @@ -1,5 +1,3 @@ -include(vcpkg_common_functions) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO xianyi/OpenBLAS @@ -96,13 +94,8 @@ file(READ ${SOURCE_PATH}/cblas.h CBLAS_H) string(REPLACE "#include \"common.h\"" "#include \"openblas_common.h\"" CBLAS_H "${CBLAS_H}") file(WRITE ${CURRENT_PACKAGES_DIR}/include/cblas.h "${CBLAS_H}") -# openblas is BSD -file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openblas) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/openblas/LICENSE ${CURRENT_PACKAGES_DIR}/share/openblas/copyright) - -file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/blas) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindBLAS.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/blas) - vcpkg_copy_pdbs() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/openblas/vcpkg-cmake-wrapper.cmake b/ports/openblas/vcpkg-cmake-wrapper.cmake deleted file mode 100644 index fc074f33ca15e6..00000000000000 --- a/ports/openblas/vcpkg-cmake-wrapper.cmake +++ /dev/null @@ -1,2 +0,0 @@ -message(STATUS "Using VCPKG FindBLAS. Remove if CMake has been updated to account for Threads in OpenBLAS!") -include(${CMAKE_CURRENT_LIST_DIR}/FindBLAS.cmake) diff --git a/ports/suitesparse/linux_blas_no_underscore.patch b/ports/suitesparse/linux_blas_no_underscore.patch new file mode 100644 index 00000000000000..b4f97b2e711761 --- /dev/null +++ b/ports/suitesparse/linux_blas_no_underscore.patch @@ -0,0 +1,13 @@ +diff --git a/CHOLMOD/Include/cholmod_blas.h b/CHOLMOD/Include/cholmod_blas.h +index aef3e63..a1eb0c7 100644 +--- a/CHOLMOD/Include/cholmod_blas.h ++++ b/CHOLMOD/Include/cholmod_blas.h +@@ -27,7 +27,7 @@ + #elif defined (__linux) || defined (MGLNX86) || defined (ARCH_GLNX86) + #define CHOLMOD_LINUX + #define CHOLMOD_ARCHITECTURE "Linux" +- ++#define BLAS_NO_UNDERSCORE + #elif defined (__APPLE__) + #define CHOLMOD_MAC + #define CHOLMOD_ARCHITECTURE "Mac" diff --git a/ports/suitesparse/portfile.cmake b/ports/suitesparse/portfile.cmake index 44dfa8c36234b4..e4fabf5807e08f 100644 --- a/ports/suitesparse/portfile.cmake +++ b/ports/suitesparse/portfile.cmake @@ -4,6 +4,8 @@ vcpkg_from_github( REF 71e330ca2bc0a2f12f416c461d23dbca21db4d8f SHA512 06c75927c924cfd5511b07504e826714f504586243d6f3449d67408a33f3ecea824a7f2de7a165171791b9bda4fc09c0d7093125970895c2ed8d4d37ca1d5a3d HEAD_REF master + PATCHES + linux_blas_no_underscore.patch ) vcpkg_from_github( diff --git a/ports/theia/CONTROL b/ports/theia/CONTROL index 2d527adcdf1295..521468056ad91c 100644 --- a/ports/theia/CONTROL +++ b/ports/theia/CONTROL @@ -1,5 +1,6 @@ Source: theia -Version: 0.8-2 +Version: 0.8 +Port-Version: 3 Build-Depends: flann, cereal, ceres[suitesparse], openimageio, glew, freeglut (!osx) Homepage: https://github.com/sweeneychris/TheiaSfM Description: An open source library for multiview geometry and structure from motion diff --git a/ports/theia/fix-external-dependencies.patch b/ports/theia/fix-external-dependencies.patch index 7a4b009611cf99..fc6e540f31e227 100644 --- a/ports/theia/fix-external-dependencies.patch +++ b/ports/theia/fix-external-dependencies.patch @@ -1,7 +1,22 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9c1b150..5810156 100644 +index 9c1b150..1adbfed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt +@@ -105,10 +105,10 @@ add_definitions(-DTHEIA_DATA_DIR="${CMAKE_SOURCE_DIR}/data") + + # Eigen + set(MIN_EIGEN_VERSION 3.2.0) +-find_package(Eigen ${MIN_EIGEN_VERSION} REQUIRED) +-if (EIGEN_FOUND) +- message("-- Found Eigen version ${EIGEN_VERSION}: ${EIGEN_INCLUDE_DIRS}") +-endif (EIGEN_FOUND) ++find_package(Eigen3 ${MIN_EIGEN_VERSION} REQUIRED) ++if (EIGEN3_FOUND) ++ message("-- Found Eigen version ${EIGEN3_VERSION}: ${EIGEN3_INCLUDE_DIRS}") ++endif (EIGEN3_FOUND) + + # Use a larger inlining threshold for Clang, since it hobbles Eigen, + # resulting in an unreasonably slow version of the blas routines. The @@ -129,70 +129,27 @@ endif () # GFlags. The namespace patch is borrow from Ceres Solver (see license in @@ -299,10 +314,48 @@ index 84f3829..f88d75a 100644 -add_subdirectory(visual_sfm) \ No newline at end of file +add_subdirectory(visual_sfm) +diff --git a/libraries/optimo/CMakeLists.txt b/libraries/optimo/CMakeLists.txt +index 80f5e5f..ea57f1b 100644 +--- a/libraries/optimo/CMakeLists.txt ++++ b/libraries/optimo/CMakeLists.txt +@@ -67,11 +67,11 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) + + # Locations to search for Eigen + # Eigen +-find_package(Eigen REQUIRED) +-if (EIGEN_FOUND) +- message("-- Found Eigen version ${EIGEN_VERSION}: ${EIGEN_INCLUDE_DIRS}") +-endif (EIGEN_FOUND) +-include_directories(${EIGEN_INCLUDE_DIRS}) ++find_package(Eigen3 REQUIRED) ++if (EIGEN3_FOUND) ++ message("-- Found Eigen version ${EIGEN3_VERSION_STRING}: ${EIGEN3_INCLUDE_DIRS}") ++endif (EIGEN3_FOUND) ++include_directories(${EIGEN3_INCLUDE_DIRS}) + + # Setting CXX FLAGS appropriately. The code below was inspired from + # Google CERES and modified for this library. diff --git a/libraries/statx/CMakeLists.txt b/libraries/statx/CMakeLists.txt -index 23b9e49..af236a3 100644 +index 23b9e49..c58a550 100644 --- a/libraries/statx/CMakeLists.txt +++ b/libraries/statx/CMakeLists.txt +@@ -72,11 +72,11 @@ message("-- Default Install prefix: ${CMAKE_INSTALL_PREFIX}") + option(STATX_WITH_CERES "Enables GEV parameter estimation using Ceres" ON) + + # Eigen +-find_package(Eigen REQUIRED) +-if (EIGEN_FOUND) +- message("-- Found Eigen version ${EIGEN_VERSION}: ${EIGEN_INCLUDE_DIRS}") +-endif (EIGEN_FOUND) +-include_directories(${EIGEN_INCLUDE_DIRS}) ++find_package(Eigen3 REQUIRED) ++if (EIGEN3_FOUND) ++ message("-- Found Eigen version ${EIGEN3_VERSION_STRING}: ${EIGEN3_INCLUDE_DIRS}") ++endif (EIGEN3_FOUND) ++include_directories(${EIGEN3_INCLUDE_DIRS}) + + # Google Flags + find_package(Gflags REQUIRED) @@ -103,7 +103,11 @@ if(STATX_WITH_CERES) endif(CERES_FOUND) diff --git a/ports/theia/portfile.cmake b/ports/theia/portfile.cmake index c131ac095435c3..2a347f57a0fab0 100644 --- a/ports/theia/portfile.cmake +++ b/ports/theia/portfile.cmake @@ -15,6 +15,7 @@ vcpkg_from_github( file(REMOVE ${SOURCE_PATH}/cmake/FindSuiteSparse.cmake) file(REMOVE ${SOURCE_PATH}/cmake/FindGflags.cmake) file(REMOVE ${SOURCE_PATH}/cmake/FindGlog.cmake) +file(REMOVE ${SOURCE_PATH}/cmake/FindEigen.cmake) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} From 695b7883dcb14be0c97831d3268b0ca68cfa66a7 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 16 Jul 2020 08:23:03 +0200 Subject: [PATCH 34/61] Update ports/nanogui/CONTROL Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> --- ports/nanogui/CONTROL | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/nanogui/CONTROL b/ports/nanogui/CONTROL index f2a160bca1e9a8..9c532e4f15e2ee 100644 --- a/ports/nanogui/CONTROL +++ b/ports/nanogui/CONTROL @@ -4,3 +4,4 @@ Port-Version: 1 Homepage: https://github.com/wjakob/nanogui Description: NanoGUI is a minimalistic cross-platform widget library for OpenGL 3.x or higher. Build-Depends: glfw3, nanovg, eigen3 +Supports: !uwp From b33a6ad7e801e4658759f05dbaa78cf1ddf0060b Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 16 Jul 2020 08:25:09 +0200 Subject: [PATCH 35/61] Update ports/nanogui/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> --- ports/nanogui/portfile.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/nanogui/portfile.cmake b/ports/nanogui/portfile.cmake index 165dda119462ea..cd1a915a5a1145 100644 --- a/ports/nanogui/portfile.cmake +++ b/ports/nanogui/portfile.cmake @@ -11,6 +11,7 @@ vcpkg_from_github( SHA512 36c93bf977862ced2df4030211e2b83625e60a11fc9fdb6c1f2996bb234758331d3f41a7fbafd25a5bca0239ed9bac9c93446a4a7fac4c5e6d7943af2be3e14a HEAD_REF master PATCHES + fix-cmakelists.patch fix-cmakelists.patch ) From 77ccbd0b724190f77c1da369ce329d235509ef65 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 16 Jul 2020 12:22:26 +0200 Subject: [PATCH 36/61] [nanogui] revert broken b33a6ad --- ports/nanogui/portfile.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/nanogui/portfile.cmake b/ports/nanogui/portfile.cmake index cd1a915a5a1145..118994be0022db 100644 --- a/ports/nanogui/portfile.cmake +++ b/ports/nanogui/portfile.cmake @@ -12,7 +12,6 @@ vcpkg_from_github( HEAD_REF master PATCHES fix-cmakelists.patch - fix-cmakelists.patch ) vcpkg_configure_cmake( From a05cd006f9c93daec5744ef478702efd0ac0646a Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 16 Jul 2020 12:46:45 +0200 Subject: [PATCH 37/61] apply fixes from review --- ports/ceres/portfile.cmake | 6 +++--- ports/nanogui/portfile.cmake | 6 ------ ports/openblas/portfile.cmake | 6 +++--- ports/theia/portfile.cmake | 4 ++-- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/ports/ceres/portfile.cmake b/ports/ceres/portfile.cmake index 2f11ba1cd55bb3..d4c3c10d9c64bc 100644 --- a/ports/ceres/portfile.cmake +++ b/ports/ceres/portfile.cmake @@ -6,7 +6,7 @@ if(VCPKG_CRT_LINKAGE STREQUAL "static") set(MSVC_USE_STATIC_CRT_VALUE ON) endif() -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") +if(VCPKG_TARGET_IS_LINUX) set(ADDITIONAL_PATCH "0005_blas_linux_fix.patch") endif() @@ -53,7 +53,7 @@ vcpkg_configure_cmake( vcpkg_install_cmake() -if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") +if(VCPKG_TARGET_IS_WINDOWS) vcpkg_fixup_cmake_targets(CONFIG_PATH CMake) else() vcpkg_fixup_cmake_targets(CONFIG_PATH lib${LIB_SUFFIX}/cmake/Ceres) @@ -62,7 +62,7 @@ endif() vcpkg_copy_pdbs() # Changes target search path -if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") +if(VCPKG_TARGET_IS_WINDOWS) file(READ ${CURRENT_PACKAGES_DIR}/share/ceres/CeresConfig.cmake CERES_TARGETS) string(REPLACE "get_filename_component(CURRENT_ROOT_INSTALL_DIR\n \${CERES_CURRENT_CONFIG_DIR}/../" "get_filename_component(CURRENT_ROOT_INSTALL_DIR\n \${CERES_CURRENT_CONFIG_DIR}/../../" CERES_TARGETS "${CERES_TARGETS}") diff --git a/ports/nanogui/portfile.cmake b/ports/nanogui/portfile.cmake index 118994be0022db..937c2c0a00d94e 100644 --- a/ports/nanogui/portfile.cmake +++ b/ports/nanogui/portfile.cmake @@ -1,9 +1,3 @@ -include(vcpkg_common_functions) - -if(VCPKG_TARGET_IS_UWP) - message(FATAL_ERROR "nanogui doesn't support UWP.") -endif() - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO wjakob/nanogui diff --git a/ports/openblas/portfile.cmake b/ports/openblas/portfile.cmake index 44b436d49f0351..4f727469d26930 100644 --- a/ports/openblas/portfile.cmake +++ b/ports/openblas/portfile.cmake @@ -26,7 +26,7 @@ set(COMMON_OPTIONS -DBUILD_WITHOUT_LAPACK=ON) # for UWP version, must build non uwp first for helper # binaries. -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") +if(VCPKG_TARGET_IS_UWP) message(STATUS "Building Windows helper files") set(TEMP_CMAKE_SYSTEM_NAME "${VCPKG_CMAKE_SYSTEM_NAME}") set(TEMP_CMAKE_SYSTEM_VERSION "${VCPKG_CMAKE_SYSTEM_VERSION}") @@ -55,13 +55,13 @@ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} - OPTIONS + OPTIONS ${COMMON_OPTIONS} -DCMAKE_SYSTEM_PROCESSOR=AMD64 -DVS_WINRT_COMPONENT=TRUE "-DBLASHELPER_BINARY_DIR=${CURRENT_BUILDTREES_DIR}/x64-windows-rel") -elseif(NOT VCPKG_CMAKE_SYSTEM_NAME) +elseif(VCPKG_TARGET_IS_WINDOWS) vcpkg_configure_cmake( PREFER_NINJA SOURCE_PATH ${SOURCE_PATH} diff --git a/ports/theia/portfile.cmake b/ports/theia/portfile.cmake index 2a347f57a0fab0..3a5a53cca8ca17 100644 --- a/ports/theia/portfile.cmake +++ b/ports/theia/portfile.cmake @@ -41,5 +41,5 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/theia/libraries/akaze/datase file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/theia/libraries/spectra/doxygen) # Handle copyright -file(INSTALL ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/theia RENAME copyright) -file(COPY ${SOURCE_PATH}/data/camera_sensor_database_license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/theia) +file(INSTALL ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +file(COPY ${SOURCE_PATH}/data/camera_sensor_database_license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) From e45075ed059e9d8c800cd683381f302771ad1e11 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 17 Jul 2020 11:33:10 +0200 Subject: [PATCH 38/61] Update ports/nanogui/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> --- ports/nanogui/portfile.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/nanogui/portfile.cmake b/ports/nanogui/portfile.cmake index 937c2c0a00d94e..f1cb824a72d1f8 100644 --- a/ports/nanogui/portfile.cmake +++ b/ports/nanogui/portfile.cmake @@ -1,3 +1,5 @@ +vcpkg_fail_port_install(ON_TARGET "uwp") + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO wjakob/nanogui From d97dff82b81e395ae6e15d7c8d009b7ac44e6923 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 17 Jul 2020 11:33:47 +0200 Subject: [PATCH 39/61] Update ports/openmvs/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> --- ports/openmvs/portfile.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/openmvs/portfile.cmake b/ports/openmvs/portfile.cmake index 9ae7790eff829c..2ec1bd0944171d 100644 --- a/ports/openmvs/portfile.cmake +++ b/ports/openmvs/portfile.cmake @@ -7,7 +7,7 @@ vcpkg_from_github( SHA512 baa9149853dc08c602deeb1a04cf57643d1cb0733aee2776f4e99b210279aad3b4a1013ab1d790e91a3a95b7c72b9c12c6be25f2c30a76b69b5319b610cb8e7a HEAD_REF master PATCHES - fix-build.patch + fix-build.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS From 5ca1f0ddcb9f4921ce200b80d191b9321c8c2259 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 17 Jul 2020 11:34:58 +0200 Subject: [PATCH 40/61] Update ports/theia/portfile.cmake --- ports/theia/portfile.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/ports/theia/portfile.cmake b/ports/theia/portfile.cmake index 3a5a53cca8ca17..77b4c11c3d58db 100644 --- a/ports/theia/portfile.cmake +++ b/ports/theia/portfile.cmake @@ -1,5 +1,3 @@ -include(vcpkg_common_functions) - vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( From 4a98e902adce5108ff99e92c08d82f6880ada7a9 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 23 Jul 2020 08:04:02 +0200 Subject: [PATCH 41/61] [eigen3] bump port revision version --- ports/eigen3/CONTROL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/eigen3/CONTROL b/ports/eigen3/CONTROL index 9a60167d29af70..90d0726e2ab0a9 100644 --- a/ports/eigen3/CONTROL +++ b/ports/eigen3/CONTROL @@ -1,5 +1,5 @@ Source: eigen3 Version: 3.3.7 -Port-Version: 6 +Port-Version: 7 Homepage: http://eigen.tuxfamily.org Description: C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms. From a6327e2a1839c3b94787f225b66f05536a0ce0e8 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Tue, 28 Jul 2020 14:28:13 +0200 Subject: [PATCH 42/61] [clapacj] improve pthreads handling --- ports/clapack/FindLAPACK.cmake | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ports/clapack/FindLAPACK.cmake b/ports/clapack/FindLAPACK.cmake index da0aca9b7b85e3..eff9bae705479e 100644 --- a/ports/clapack/FindLAPACK.cmake +++ b/ports/clapack/FindLAPACK.cmake @@ -119,7 +119,9 @@ if(NOT LAPACK_LIBRARY) list(APPEND LAPACK_LIBRARY_DEBUG ${LAPACK_BLAS_LIBRARY_DEBUG}) select_library_configurations(LAPACK) - list(APPEND LAPACK_LIBRARY Threads::Threads) + if(UNIX) + list(APPEND LAPACK_LIBRARY ${PTHREAD_LINK_NAME}) + endif() endif() if(NOT F2C_INCLUDE_DIR) @@ -162,15 +164,9 @@ set(LAPACK_LIBRARY_DEBUG "${LAPACK_LIBRARY_DEBUG}" CACHE STRING "" FORCE) set(F2C_LIBRARY_RELEASE "${F2C_LIBRARY_RELEASE}" CACHE STRING "" FORCE) set(F2C_LIBRARY_DEBUG "${F2C_LIBRARY_DEBUG}" CACHE STRING "" FORCE) -find_package_handle_standard_args(CLAPACK DEFAULT_MSG CLAPACK_LIBRARY CLAPACK_INCLUDE_DIR) -mark_as_advanced(CLAPACK_INCLUDE_DIR CLAPACK_LIBRARY) - find_package_handle_standard_args(LAPACK DEFAULT_MSG LAPACK_LIBRARY LAPACK_INCLUDE_DIR) mark_as_advanced(LAPACK_INCLUDE_DIR LAPACK_LIBRARY) -find_package_handle_standard_args(F2C DEFAULT_MSG F2C_LIBRARY F2C_INCLUDE_DIR) -mark_as_advanced(F2C_INCLUDE_DIR F2C_LIBRARY) - #TARGETS if(CLAPACK_FOUND AND NOT TARGET clapack::clapack) if(EXISTS "${LAPACK_LIBRARY_RELEASE_DLL}") From 869c5cc713cd8749b2c1a94da2d75a0c89d4866b Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 6 Aug 2020 10:41:46 +0200 Subject: [PATCH 43/61] Update ports/ceres/0004_fix_find_eigen.patch Co-authored-by: nicole mazzuca --- ports/ceres/0004_fix_find_eigen.patch | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ports/ceres/0004_fix_find_eigen.patch b/ports/ceres/0004_fix_find_eigen.patch index ed5d5b8e96a910..ad92228c0bc896 100644 --- a/ports/ceres/0004_fix_find_eigen.patch +++ b/ports/ceres/0004_fix_find_eigen.patch @@ -69,15 +69,6 @@ diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in index c4ed71f..b3d6a17 100644 --- a/cmake/CeresConfig.cmake.in +++ b/cmake/CeresConfig.cmake.in -@@ -70,7 +70,7 @@ - # unsets all public (designed to be used externally) variables and reports - # error message at priority depending upon [REQUIRED/QUIET/] argument. - macro(CERES_REPORT_NOT_FOUND REASON_MSG) -- # FindPackage() only references Ceres_FOUND, and requires it to be -+# FindPackage() only references Ceres_FOUND, and requires it to be - # explicitly set FALSE to denote not found (not merely undefined). - set(Ceres_FOUND FALSE) - set(CERES_FOUND FALSE) @@ -202,39 +202,39 @@ set(CERES_VERSION @CERES_VERSION@ ) # Eigen. From 688e08c754ac0d1cebb046c2c054ef36b6374f8f Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Mon, 10 Aug 2020 17:36:50 +0200 Subject: [PATCH 44/61] [openmvg] enable port also in single build type triplets --- ports/openmvg/portfile.cmake | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/ports/openmvg/portfile.cmake b/ports/openmvg/portfile.cmake index 236d94d31a89f9..fbf92e15c397e6 100644 --- a/ports/openmvg/portfile.cmake +++ b/ports/openmvg/portfile.cmake @@ -71,21 +71,27 @@ vcpkg_configure_cmake( vcpkg_install_cmake() vcpkg_fixup_cmake_targets(CONFIG_PATH share/openMVG/cmake) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) +if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) +endif() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/openMVG/image/image_test ${CURRENT_PACKAGES_DIR}/include/openMVG/exif/image_data ${CURRENT_PACKAGES_DIR}/include/openMVG_dependencies/nonFree/sift/vl) if(OpenMVG_BUILD_SHARED) - # release - file(GLOB DLL_FILES ${CURRENT_PACKAGES_DIR}/lib/*.dll) - file(COPY ${DLL_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/bin) - file(REMOVE_RECURSE ${DLL_FILES}) - # debug - file(GLOB DLL_FILES ${CURRENT_PACKAGES_DIR}/debug/lib/*.dll) - file(COPY ${DLL_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) - file(REMOVE_RECURSE ${DLL_FILES}) + if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + # release + file(GLOB DLL_FILES ${CURRENT_PACKAGES_DIR}/lib/*.dll) + file(COPY ${DLL_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/bin) + file(REMOVE_RECURSE ${DLL_FILES}) + endif() + if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + # debug + file(GLOB DLL_FILES ${CURRENT_PACKAGES_DIR}/debug/lib/*.dll) + file(COPY ${DLL_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) + file(REMOVE_RECURSE ${DLL_FILES}) + endif() endif() vcpkg_copy_pdbs() From 6912ee36e924fa0ce55539f7ee703ab2db498cb8 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Mon, 17 Aug 2020 14:38:30 +0200 Subject: [PATCH 45/61] [suitesparse] depend on lapack metaport --- ports/suitesparse/CONTROL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/suitesparse/CONTROL b/ports/suitesparse/CONTROL index a71dff77b5facf..832306d5a8c37f 100644 --- a/ports/suitesparse/CONTROL +++ b/ports/suitesparse/CONTROL @@ -1,5 +1,5 @@ Source: suitesparse Version: 5.8.0 -Build-Depends: clapack (!osx), metis +Build-Depends: lapack, metis Homepage: http://suitesparse.com Description: algebra library From c655b2b165123dec381b4f10d29184d999b881f4 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Wed, 19 Aug 2020 18:35:10 +0200 Subject: [PATCH 46/61] [openmvs] fix case --- ports/openmvs/fix-build.patch | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ports/openmvs/fix-build.patch b/ports/openmvs/fix-build.patch index 13460e83a47132..0cd759503f1f73 100644 --- a/ports/openmvs/fix-build.patch +++ b/ports/openmvs/fix-build.patch @@ -242,7 +242,7 @@ index 96b8fe2..454e846 100644 set(OpenMVS_LIBRARIES MVS) set(OpenMVS_BINARIES InterfaceVisualSFM DensifyPointCloud ReconstructMesh RefineMesh TextureMesh) diff --git a/build/Utils.cmake b/build/Utils.cmake -index f41c9d8..b717a1f 100644 +index f41c9d8..31cd292 100644 --- a/build/Utils.cmake +++ b/build/Utils.cmake @@ -160,7 +160,7 @@ macro(GetOperatingSystemArchitectureBitness) @@ -309,15 +309,16 @@ index f41c9d8..b717a1f 100644 # Offer the user the choice of overriding the installation directories - set(INSTALL_LIB_DIR "lib/${PROJECT_NAME}" CACHE PATH "Installation directory for libraries") - set(INSTALL_BIN_DIR "bin/${PROJECT_NAME}" CACHE PATH "Installation directory for executables") -+ set(INSTALL_LIB_DIR "lib" CACHE PATH "Installation directory for libraries") -+ set(INSTALL_BIN_DIR "bin" CACHE PATH "Installation directory for executables") - set(INSTALL_INCLUDE_DIR "include/${PROJECT_NAME}" CACHE PATH "Installation directory for header files") +- set(INSTALL_INCLUDE_DIR "include/${PROJECT_NAME}" CACHE PATH "Installation directory for header files") - if(WIN32 AND NOT CYGWIN) - set(DEF_INSTALL_CMAKE_DIR "CMake") - else() - set(DEF_INSTALL_CMAKE_DIR "lib/CMake/${PROJECT_NAME}") - endif() -+ set(DEF_INSTALL_CMAKE_DIR "share/${PROJECT_NAME}") ++ set(INSTALL_LIB_DIR "lib" CACHE PATH "Installation directory for libraries") ++ set(INSTALL_BIN_DIR "bin" CACHE PATH "Installation directory for executables") ++ set(INSTALL_INCLUDE_DIR "include/openmvs" CACHE PATH "Installation directory for header files") ++ set(DEF_INSTALL_CMAKE_DIR "share/openmvs") set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files") - + From e66064e05c3fb046a817452aa0846e2c3e66115b Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 20 Aug 2020 18:16:09 +0200 Subject: [PATCH 47/61] [LAPACK] fix bug that was making LAPACK completely broken outside Windows --- ports/lapack-reference/FindLAPACK.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/lapack-reference/FindLAPACK.cmake b/ports/lapack-reference/FindLAPACK.cmake index 1edaa0f831a5f9..b6df00319650ac 100644 --- a/ports/lapack-reference/FindLAPACK.cmake +++ b/ports/lapack-reference/FindLAPACK.cmake @@ -482,7 +482,7 @@ if(BLAS_FOUND) LAPACK cheev "" - "lapack;-lm;-lgfortran" + "lapack;m;gfortran" "" "" "" From ff67f4bb02a8538a19c75c29904666bfbd45deec Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 20 Aug 2020 18:19:24 +0200 Subject: [PATCH 48/61] [lapack] bump CONTROL --- ports/lapack-reference/CONTROL | 1 + ports/lapack/CONTROL | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ports/lapack-reference/CONTROL b/ports/lapack-reference/CONTROL index 493e7f50e4cd36..0ac1c8d0e894ee 100644 --- a/ports/lapack-reference/CONTROL +++ b/ports/lapack-reference/CONTROL @@ -1,5 +1,6 @@ Source: lapack-reference Version: 3.8.0 +Port-Version: 1 Description: LAPACK — Linear Algebra PACKage http://www.netlib.org/lapack/ Default-Features: blas-select Build-Depends: vcpkg-gfortran (windows) diff --git a/ports/lapack/CONTROL b/ports/lapack/CONTROL index c4e27f77d36db5..b16436d7fe9499 100644 --- a/ports/lapack/CONTROL +++ b/ports/lapack/CONTROL @@ -1,4 +1,4 @@ Source: lapack -Version: 1 +Version: 2 Description: Metapackage for packages which provide LAPACK -Build-Depends: clapack ((arm&windows)|uwp), lapack-reference(!uwp&!(arm&windows)) \ No newline at end of file +Build-Depends: clapack ((arm&windows)|uwp), lapack-reference(!uwp&!(arm&windows)) From bb14712333fa7beafd9557467db0ccac1905679e Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 20 Aug 2020 18:21:33 +0200 Subject: [PATCH 49/61] [ceres] bump CONTROL --- ports/ceres/CONTROL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/ceres/CONTROL b/ports/ceres/CONTROL index ecd8f1de63bc79..5870df378323f4 100644 --- a/ports/ceres/CONTROL +++ b/ports/ceres/CONTROL @@ -1,6 +1,6 @@ Source: ceres Version: 1.14.0 -Port-Version: 8 +Port-Version: 9 Build-Depends: glog, eigen3 Homepage: https://github.com/ceres-solver/ceres-solver Description: non-linear optimization package From 2ebd56e2227169b0360395fa76dcd76c2faf9d5f Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 20 Aug 2020 18:21:45 +0200 Subject: [PATCH 50/61] [openblas] bump CONTROL --- ports/openblas/CONTROL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/openblas/CONTROL b/ports/openblas/CONTROL index ea246834dd9953..a5240e2b49b079 100644 --- a/ports/openblas/CONTROL +++ b/ports/openblas/CONTROL @@ -1,6 +1,6 @@ Source: openblas Version: 0.3.9 -Port-Version: 2 +Port-Version: 3 Homepage: https://github.com/xianyi/OpenBLAS Build-Depends: pthread (linux&osx) Description: OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. From 24fed1d69d0e29b4a558b7e252b856dafee82fc4 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 21 Aug 2020 12:56:20 +0200 Subject: [PATCH 51/61] [OpenBLAS] now that lapack-reference uses it on osx, remove a dangerous mixture of BLAS vendors. Fix OpenBLAS on gcc in the meantime --- ports/armadillo/CONTROL | 4 ++-- ports/dlib/CONTROL | 4 ++-- ports/ensmallen/CONTROL | 5 ++--- ports/geogram/CONTROL | 3 ++- ports/mlpack/CONTROL | 4 ++-- ports/openblas/openblas_common.h | 16 +--------------- ports/shogun/CONTROL | 5 +++-- ports/shogun/portfile.cmake | 11 ++--------- 8 files changed, 16 insertions(+), 36 deletions(-) diff --git a/ports/armadillo/CONTROL b/ports/armadillo/CONTROL index c266b9112f2711..850809579a8f54 100644 --- a/ports/armadillo/CONTROL +++ b/ports/armadillo/CONTROL @@ -1,5 +1,5 @@ Source: armadillo Version: 2019-04-16 -Port-Version: 9 +Port-Version: 10 Description: Armadillo is a high quality linear algebra library (matrix maths) for the C++ language, aiming towards a good balance between speed and ease of use -Build-Depends: openblas (!osx), lapack +Build-Depends: openblas, lapack diff --git a/ports/dlib/CONTROL b/ports/dlib/CONTROL index 61df74294412f1..0ff4fa39179535 100644 --- a/ports/dlib/CONTROL +++ b/ports/dlib/CONTROL @@ -1,7 +1,7 @@ Source: dlib Version: 19.19 -Port-Version: 2 -Build-Depends: libjpeg-turbo, libpng, openblas (!osx), lapack +Port-Version: 3 +Build-Depends: libjpeg-turbo, libpng, openblas, lapack Homepage: https://github.com/davisking/dlib Description: Modern C++ toolkit containing machine learning algorithms and tools for creating complex software in C++ Default-Features: fftw3, sqlite3 diff --git a/ports/ensmallen/CONTROL b/ports/ensmallen/CONTROL index bf13812e416277..39a63bc91594a7 100644 --- a/ports/ensmallen/CONTROL +++ b/ports/ensmallen/CONTROL @@ -1,7 +1,6 @@ Source: ensmallen Version: 2.11.2 -Port-Version: 1 +Port-Version: 2 Homepage: https://github.com/mlpack/ensmallen Description: A header-only C++ library for mathematical optimization. -Build-Depends: openblas (!osx), lapack, armadillo - +Build-Depends: openblas, lapack, armadillo diff --git a/ports/geogram/CONTROL b/ports/geogram/CONTROL index 8661aa1e4f086b..83b210ac3f4f06 100644 --- a/ports/geogram/CONTROL +++ b/ports/geogram/CONTROL @@ -1,8 +1,9 @@ Source: geogram Version: 1.7.5 +Port-Version: 1 Homepage: https://gforge.inria.fr/projects/geogram/ Description: Geogram is a programming library of geometric algorithms. -Build-Depends: openblas (!osx), lapack +Build-Depends: openblas, lapack Feature: graphics Description: Build viewers and geogram_gfx library. diff --git a/ports/mlpack/CONTROL b/ports/mlpack/CONTROL index 252c669976b6b9..7d3debb83ac583 100644 --- a/ports/mlpack/CONTROL +++ b/ports/mlpack/CONTROL @@ -1,9 +1,9 @@ Source: mlpack Version: 3.2.2 -Port-Version: 5 +Port-Version: 6 Homepage: https://github.com/mlpack/mlpack Description: mlpack is a fast, flexible machine learning library, written in C++, that aims to provide fast, extensible implementations of cutting-edge machine learning algorithms. -Build-Depends: openblas (!osx), lapack, boost, armadillo, ensmallen, stb +Build-Depends: openblas, lapack, boost, armadillo, ensmallen, stb Feature: tools Description: Build command-line executables. diff --git a/ports/openblas/openblas_common.h b/ports/openblas/openblas_common.h index 6652a17e9902d5..9b798e577e50cb 100644 --- a/ports/openblas/openblas_common.h +++ b/ports/openblas/openblas_common.h @@ -13,6 +13,7 @@ #ifdef NEEDBUNDERSCORE #define BLASFUNC(FUNC) FUNC##_ + #else #define BLASFUNC(FUNC) FUNC #endif @@ -57,18 +58,3 @@ typedef int blasint; predefined macros with some compilers (e.g. GCC 4.7 on Linux). This occurs as a side effect of including either or . */ #include -#ifndef OPENBLAS_COMPLEX_STRUCT -#define OPENBLAS_COMPLEX_STRUCT -typedef struct { float real, imag; } openblas_complex_float; -typedef struct { double real, imag; } openblas_complex_double; -typedef struct { xdouble real, imag; } openblas_complex_xdouble; -#define openblas_make_complex_float(real, imag) {(real), (imag)} -#define openblas_make_complex_double(real, imag) {(real), (imag)} -#define openblas_make_complex_xdouble(real, imag) {(real), (imag)} -#define openblas_complex_float_real(z) ((z).real) -#define openblas_complex_float_imag(z) ((z).imag) -#define openblas_complex_double_real(z) ((z).real) -#define openblas_complex_double_imag(z) ((z).imag) -#define openblas_complex_xdouble_real(z) ((z).real) -#define openblas_complex_xdouble_imag(z) ((z).imag) -#endif \ No newline at end of file diff --git a/ports/shogun/CONTROL b/ports/shogun/CONTROL index 5f46ded2a07afa..580a8be31b8782 100644 --- a/ports/shogun/CONTROL +++ b/ports/shogun/CONTROL @@ -1,5 +1,6 @@ Source: shogun -Version: 6.1.4-1 -Build-Depends: bzip2, eigen3, liblzma, libxml2, openblas (x64&!osx), nlopt, rxcpp, snappy, zlib, protobuf, curl, lzo, dirent +Version: 6.1.4 +Port-Version: 2 +Build-Depends: bzip2, eigen3, liblzma, libxml2, openblas, nlopt, rxcpp, snappy, zlib, protobuf, curl, lzo, dirent Homepage: https://github.com/shogun-toolbox/shogun Description: Unified and efficient Machine Learning \ No newline at end of file diff --git a/ports/shogun/portfile.cmake b/ports/shogun/portfile.cmake index ce68bcb57c1796..47555a75b6379a 100644 --- a/ports/shogun/portfile.cmake +++ b/ports/shogun/portfile.cmake @@ -1,11 +1,5 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) -if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") - set(CMAKE_DISABLE_FIND_PACKAGE_BLAS 0) -else() - set(CMAKE_DISABLE_FIND_PACKAGE_BLAS 1) -endif() - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO shogun-toolbox/shogun @@ -44,10 +38,9 @@ vcpkg_configure_cmake( -DCMAKE_DISABLE_FIND_PACKAGE_ARPREC=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_Ctags=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_CCache=TRUE - -DCMAKE_DISABLE_FIND_PACKAGE_LAPACK=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_CURL=TRUE - -DCMAKE_DISABLE_FIND_PACKAGE_BLAS=${CMAKE_DISABLE_FIND_PACKAGE_BLAS} + -DCMAKE_DISABLE_FIND_PACKAGE_OpenMP=TRUE -DINSTALL_TARGETS=shogun-static ) @@ -62,4 +55,4 @@ file(REMOVE_RECURSE ) # Handle copyright -file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) From 4d22962ac8e6b65006f4c88374ea7a2351785c55 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 21 Aug 2020 17:03:48 +0200 Subject: [PATCH 52/61] [openmvs] do not depend on tools in windows static, openmvg has problems building them --- ports/openmvs/CONTROL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/openmvs/CONTROL b/ports/openmvs/CONTROL index fc94afde00b19e..bf4f0f53c752ae 100644 --- a/ports/openmvs/CONTROL +++ b/ports/openmvs/CONTROL @@ -3,7 +3,7 @@ Version: 1.1 Port-Version: 2 Description: OpenMVS: open Multi-View Stereo reconstruction library Homepage: https://cdcseacave.github.io/openMVS -Build-Depends: zlib, boost-iostreams, boost-program-options, boost-system, boost-serialization, eigen3, opencv, cgal[core], glew, glfw3, vcglib, openmvg[software], libpng, tiff +Build-Depends: zlib, boost-iostreams, boost-program-options, boost-system, boost-serialization, eigen3, opencv, cgal[core], glew, glfw3, vcglib, openmvg[software] (!(windows&static)), libpng, tiff Feature: cuda Build-Depends: cuda From 4b78d2c7b1ce3faa17dc612eb98c99f80b451bfb Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 21 Aug 2020 17:14:33 +0200 Subject: [PATCH 53/61] remove openmvs from linux failing list --- ports/ceres/CONTROL | 2 +- ports/suitesparse/CONTROL | 1 + scripts/ci.baseline.txt | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/ceres/CONTROL b/ports/ceres/CONTROL index 5870df378323f4..5fb8186add93ee 100644 --- a/ports/ceres/CONTROL +++ b/ports/ceres/CONTROL @@ -1,6 +1,6 @@ Source: ceres Version: 1.14.0 -Port-Version: 9 +Port-Version: 10 Build-Depends: glog, eigen3 Homepage: https://github.com/ceres-solver/ceres-solver Description: non-linear optimization package diff --git a/ports/suitesparse/CONTROL b/ports/suitesparse/CONTROL index 832306d5a8c37f..843ea516a53593 100644 --- a/ports/suitesparse/CONTROL +++ b/ports/suitesparse/CONTROL @@ -1,5 +1,6 @@ Source: suitesparse Version: 5.8.0 +Port-Version: 1 Build-Depends: lapack, metis Homepage: http://suitesparse.com Description: algebra library diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index e5292ed5c19047..5e607941dafb8d 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -208,7 +208,7 @@ chmlib:x64-uwp=fail civetweb:arm64-windows = skip civetweb:arm-uwp = skip civetweb:x64-uwp = skip -# clapack is replaced by lapack-reference. +# clapack is replaced by lapack-reference. clapack:x64-linux = skip clapack:x64-windows = skip clapack:x64-windows-static = skip @@ -1227,7 +1227,6 @@ openmpi:x64-uwp=fail openmpi:x64-windows=fail openmpi:x64-windows-static=fail openmpi:x86-windows=fail -openmvs:x64-linux=fail openni2:x64-uwp=fail openni2:x64-windows-static=fail openscap:x64-linux=fail From d893422ae830edbb8d110b3703c380b4f78ab1bf Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Sat, 22 Aug 2020 16:53:49 +0200 Subject: [PATCH 54/61] [ceres] remove a broken patch which made blas function non resolved --- ports/ceres/0005_blas_linux_fix.patch | 22 ---------------------- ports/ceres/portfile.cmake | 5 ----- 2 files changed, 27 deletions(-) delete mode 100644 ports/ceres/0005_blas_linux_fix.patch diff --git a/ports/ceres/0005_blas_linux_fix.patch b/ports/ceres/0005_blas_linux_fix.patch deleted file mode 100644 index 5fffee5e231cf4..00000000000000 --- a/ports/ceres/0005_blas_linux_fix.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/internal/ceres/blas.cc b/internal/ceres/blas.cc -index 3ba63bb..071a26e 100644 ---- a/internal/ceres/blas.cc -+++ b/internal/ceres/blas.cc -@@ -33,7 +33,7 @@ - #include "glog/logging.h" - - #ifndef CERES_NO_LAPACK --extern "C" void dsyrk_(char* uplo, -+extern "C" void dsyrk(char* uplo, - char* trans, - int* n, - int* k, -@@ -64,7 +64,7 @@ void BLAS::SymmetricRankKUpdate(int num_rows, - int k = transpose ? num_rows : num_cols; - int lda = k; - int ldc = n; -- dsyrk_(&uplo, -+ dsyrk(&uplo, - &trans, - &n, - &k, diff --git a/ports/ceres/portfile.cmake b/ports/ceres/portfile.cmake index d4c3c10d9c64bc..7df54e1a8a9370 100644 --- a/ports/ceres/portfile.cmake +++ b/ports/ceres/portfile.cmake @@ -6,10 +6,6 @@ if(VCPKG_CRT_LINKAGE STREQUAL "static") set(MSVC_USE_STATIC_CRT_VALUE ON) endif() -if(VCPKG_TARGET_IS_LINUX) - set(ADDITIONAL_PATCH "0005_blas_linux_fix.patch") -endif() - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO ceres-solver/ceres-solver @@ -21,7 +17,6 @@ vcpkg_from_github( 0002_use_glog_target.patch 0003_fix_exported_ceres_config.patch 0004_fix_find_eigen.patch - ${ADDITIONAL_PATCH} ) file(REMOVE ${SOURCE_PATH}/cmake/FindCXSparse.cmake) From 540ebb3f595d8478eacde0c782019de4fae34702 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Sat, 22 Aug 2020 23:57:15 +0200 Subject: [PATCH 55/61] [SuiteSparse] remove another unnecessary blas-breaking patch --- ports/suitesparse/linux_blas_no_underscore.patch | 13 ------------- ports/suitesparse/portfile.cmake | 2 -- 2 files changed, 15 deletions(-) delete mode 100644 ports/suitesparse/linux_blas_no_underscore.patch diff --git a/ports/suitesparse/linux_blas_no_underscore.patch b/ports/suitesparse/linux_blas_no_underscore.patch deleted file mode 100644 index b4f97b2e711761..00000000000000 --- a/ports/suitesparse/linux_blas_no_underscore.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CHOLMOD/Include/cholmod_blas.h b/CHOLMOD/Include/cholmod_blas.h -index aef3e63..a1eb0c7 100644 ---- a/CHOLMOD/Include/cholmod_blas.h -+++ b/CHOLMOD/Include/cholmod_blas.h -@@ -27,7 +27,7 @@ - #elif defined (__linux) || defined (MGLNX86) || defined (ARCH_GLNX86) - #define CHOLMOD_LINUX - #define CHOLMOD_ARCHITECTURE "Linux" -- -+#define BLAS_NO_UNDERSCORE - #elif defined (__APPLE__) - #define CHOLMOD_MAC - #define CHOLMOD_ARCHITECTURE "Mac" diff --git a/ports/suitesparse/portfile.cmake b/ports/suitesparse/portfile.cmake index e4fabf5807e08f..44dfa8c36234b4 100644 --- a/ports/suitesparse/portfile.cmake +++ b/ports/suitesparse/portfile.cmake @@ -4,8 +4,6 @@ vcpkg_from_github( REF 71e330ca2bc0a2f12f416c461d23dbca21db4d8f SHA512 06c75927c924cfd5511b07504e826714f504586243d6f3449d67408a33f3ecea824a7f2de7a165171791b9bda4fc09c0d7093125970895c2ed8d4d37ca1d5a3d HEAD_REF master - PATCHES - linux_blas_no_underscore.patch ) vcpkg_from_github( From 22db3a648d1aa3d85c0153e9a4fd80303d4be6b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jack=C2=B7Boos=C2=B7Yu?= <47264268+JackBoosY@users.noreply.github.com> Date: Sun, 23 Aug 2020 22:59:56 -0700 Subject: [PATCH 56/61] Update ports/ceres/CONTROL Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> --- ports/ceres/CONTROL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/ceres/CONTROL b/ports/ceres/CONTROL index 5fb8186add93ee..5870df378323f4 100644 --- a/ports/ceres/CONTROL +++ b/ports/ceres/CONTROL @@ -1,6 +1,6 @@ Source: ceres Version: 1.14.0 -Port-Version: 10 +Port-Version: 9 Build-Depends: glog, eigen3 Homepage: https://github.com/ceres-solver/ceres-solver Description: non-linear optimization package From 3921e9eb3c527059e136f0913aca5be3a27eed76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jack=C2=B7Boos=C2=B7Yu?= <47264268+JackBoosY@users.noreply.github.com> Date: Sun, 23 Aug 2020 23:00:05 -0700 Subject: [PATCH 57/61] Update ports/ceres/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> --- ports/ceres/portfile.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/ceres/portfile.cmake b/ports/ceres/portfile.cmake index 7df54e1a8a9370..e7c455c562097f 100644 --- a/ports/ceres/portfile.cmake +++ b/ports/ceres/portfile.cmake @@ -25,7 +25,6 @@ file(REMOVE ${SOURCE_PATH}/cmake/FindGlog.cmake) file(REMOVE ${SOURCE_PATH}/cmake/FindEigen.cmake) file(REMOVE ${SOURCE_PATH}/cmake/FindSuiteSparse.cmake) - vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS "suitesparse" SUITESPARSE "cxsparse" CXSPARSE From d29561cb1f6457dfc3a88437019da484754b8d64 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Tue, 25 Aug 2020 12:02:16 +0200 Subject: [PATCH 58/61] restore qt5-base portfile --- ports/qt5-base/portfile.cmake | 58 +++++++++++++++++------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/ports/qt5-base/portfile.cmake b/ports/qt5-base/portfile.cmake index 95b9c046b68764..1044df3174644f 100644 --- a/ports/qt5-base/portfile.cmake +++ b/ports/qt5-base/portfile.cmake @@ -17,13 +17,13 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake) if("latest" IN_LIST FEATURES) # latest = core currently set(QT_BUILD_LATEST ON) - set(PATCHES + set(PATCHES patches/Qt5BasicConfig.patch patches/Qt5PluginTarget.patch patches/create_cmake.patch ) else() - set(PATCHES + set(PATCHES patches/Qt5BasicConfig.patch patches/Qt5PluginTarget.patch patches/create_cmake.patch @@ -54,15 +54,15 @@ qt_download_submodule( OUT_SOURCE_PATH SOURCE_PATH PATCHES patches/winmain_pro.patch #Moves qtmain to manual-link patches/windows_prf.patch #fixes the qtmain dependency due to the above move - patches/qt_app.patch #Moves the target location of qt5 host apps to always install into the host dir. + patches/qt_app.patch #Moves the target location of qt5 host apps to always install into the host dir. patches/gui_configure.patch #Patches the gui configure.json to break freetype/fontconfig autodetection because it does not include its dependencies. patches/icu.patch #Help configure find static icu builds in vcpkg on windows patches/xlib.patch #Patches Xlib check to actually use Pkgconfig instead of makeSpec only - patches/egl.patch #Fix egl detection logic. - patches/8c44d70.diff #Upstream fix for MSVC 16.6.2. static init of std::atomic. - #patches/static_opengl.patch #Use this patch if you really want to statically link angle on windows (e.g. using -opengl es2 and -static). - #Be carefull since it requires definining _GDI32_ for all dependent projects due to redefinition errors in the - #the windows supplied gl.h header and the angle gl.h otherwise. + patches/egl.patch #Fix egl detection logic. + patches/8c44d70.diff #Upstream fix for MSVC 16.6.2. static init of std::atomic. + #patches/static_opengl.patch #Use this patch if you really want to statically link angle on windows (e.g. using -opengl es2 and -static). + #Be carefull since it requires definining _GDI32_ for all dependent projects due to redefinition errors in the + #the windows supplied gl.h header and the angle gl.h otherwise. #CMake fixes ${PATCHES} patches/Qt5GuiConfigExtras.patch # Patches the library search behavior for EGL since angle is not build with Qt @@ -87,7 +87,7 @@ set(CORE_OPTIONS -opensource #-simulator_and_device #-ltcg - #-combined-angle-lib + #-combined-angle-lib # ENV ANGLE_DIR to external angle source dir. (Will always be compiled with Qt) #-optimized-tools #-force-debug-info @@ -123,9 +123,9 @@ find_library(PCRE2_RELEASE NAMES pcre2-16 PATHS "${CURRENT_INSTALLED_DIR}/lib" N find_library(PCRE2_DEBUG NAMES pcre2-16 pcre2-16d PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) find_library(FREETYPE_RELEASE NAMES freetype PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) #zlib, bzip2, libpng find_library(FREETYPE_DEBUG NAMES freetype freetyped PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) -find_library(DOUBLECONVERSION_RELEASE NAMES double-conversion PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) +find_library(DOUBLECONVERSION_RELEASE NAMES double-conversion PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) find_library(DOUBLECONVERSION_DEBUG NAMES double-conversion PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) -find_library(HARFBUZZ_RELEASE NAMES harfbuzz PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) +find_library(HARFBUZZ_RELEASE NAMES harfbuzz PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) find_library(HARFBUZZ_DEBUG NAMES harfbuzz PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) find_library(SQLITE_RELEASE NAMES sqlite3 PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) # Depends on openssl and zlib(linux) find_library(SQLITE_DEBUG NAMES sqlite3 sqlite3d PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) @@ -214,7 +214,7 @@ if(VCPKG_TARGET_IS_WINDOWS) if(NOT ${VCPKG_LIBRARY_LINKAGE} STREQUAL "static") list(APPEND CORE_OPTIONS -opengl dynamic) # other options are "-no-opengl", "-opengl angle", and "-opengl desktop" and "-opengel es2" else() - list(APPEND CORE_OPTIONS -opengl dynamic) # other possible option without moving angle dlls: "-opengl desktop". "-opengel es2" only works with commented patch + list(APPEND CORE_OPTIONS -opengl dynamic) # other possible option without moving angle dlls: "-opengl desktop". "-opengel es2" only works with commented patch endif() list(APPEND RELEASE_OPTIONS "PSQL_LIBS=${PSQL_RELEASE} ${SSL_RELEASE} ${EAY_RELEASE} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib" @@ -222,7 +222,7 @@ if(VCPKG_TARGET_IS_WINDOWS) "HARFBUZZ_LIBS=${HARFBUZZ_RELEASE} ${FREETYPE_RELEASE_ALL}" "OPENSSL_LIBS=${SSL_RELEASE} ${EAY_RELEASE} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib" ) - + list(APPEND DEBUG_OPTIONS "PSQL_LIBS=${PSQL_DEBUG} ${SSL_DEBUG} ${EAY_DEBUG} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib" "SQLITE_LIBS=${SQLITE_DEBUG}" @@ -308,7 +308,7 @@ else() ######################### #TODO: Make this a function since it is also done by modular scripts! # e.g. by patching mkspecs/features/qt_tools.prf somehow - file(GLOB_RECURSE PRL_FILES "${CURRENT_PACKAGES_DIR}/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/mkspecs/*.pri" + file(GLOB_RECURSE PRL_FILES "${CURRENT_PACKAGES_DIR}/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/mkspecs/*.pri" "${CURRENT_PACKAGES_DIR}/debug/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/debug/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/debug/mkspecs/*.pri") file(TO_CMAKE_PATH "${CURRENT_INSTALLED_DIR}/include" CMAKE_INCLUDE_PATH) @@ -325,10 +325,10 @@ else() file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share) file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake ${CURRENT_PACKAGES_DIR}/share/cmake) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) # TODO: check if important debug information for cmake is lost + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) # TODO: check if important debug information for cmake is lost - #This needs a new VCPKG policy or a static angle build (ANGLE needs to be fixed in VCPKG!) - if(VCPKG_TARGET_IS_WINDOWS AND ${VCPKG_LIBRARY_LINKAGE} MATCHES "static") # Move angle dll libraries + #This needs a new VCPKG policy or a static angle build (ANGLE needs to be fixed in VCPKG!) + if(VCPKG_TARGET_IS_WINDOWS AND ${VCPKG_LIBRARY_LINKAGE} MATCHES "static") # Move angle dll libraries if(EXISTS "${CURRENT_PACKAGES_DIR}/bin") message(STATUS "Moving ANGLE dlls from /bin to /tools/qt5-angle/bin. In static builds dlls are not allowed in /bin") file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/qt5-angle) @@ -345,32 +345,32 @@ else() file(READ "${cmakefile}" _contents) if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_BUILD_TYPE) string(REPLACE "set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)" "set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)" _contents "${_contents}") - string(REPLACE - [[set(imported_location "${_qt5Core_install_prefix}/lib/qtmain.lib")]] + string(REPLACE + [[set(imported_location "${_qt5Core_install_prefix}/lib/qtmain.lib")]] [[set(imported_location_release "${_qt5Core_install_prefix}/lib/manual-link/qtmain.lib") - set(imported_location_debug "${_qt5Core_install_prefix}/debug/lib/manual-link/qtmaind.lib")]] + set(imported_location_debug "${_qt5Core_install_prefix}/debug/lib/manual-link/qtmaind.lib")]] _contents "${_contents}") - string(REPLACE + string(REPLACE [[ set_target_properties(Qt5::WinMain PROPERTIES IMPORTED_LOCATION_RELEASE ${imported_location} - )]] + )]] [[ set_target_properties(Qt5::WinMain PROPERTIES IMPORTED_LOCATION_RELEASE ${imported_location_release} IMPORTED_LOCATION_DEBUG ${imported_location_debug} - )]] + )]] _contents "${_contents}") else() # Single configuration build (either debug or release) # Release case - string(REPLACE + string(REPLACE [[set(imported_location "${_qt5Core_install_prefix}/lib/qtmain.lib")]] [[set(imported_location "${_qt5Core_install_prefix}/lib/manual-link/qtmain.lib")]] _contents "${_contents}") # Debug case (whichever will match) - string(REPLACE + string(REPLACE [[set(imported_location "${_qt5Core_install_prefix}/lib/qtmaind.lib")]] [[set(imported_location "${_qt5Core_install_prefix}/debug/lib/manual-link/qtmaind.lib")]] _contents "${_contents}") - string(REPLACE + string(REPLACE [[set(imported_location "${_qt5Core_install_prefix}/debug/lib/qtmaind.lib")]] [[set(imported_location "${_qt5Core_install_prefix}/debug/lib/manual-link/qtmaind.lib")]] _contents "${_contents}") @@ -387,7 +387,7 @@ else() file(COPY ${CURRENT_PACKAGES_DIR}/tools/qt5/bin DESTINATION ${CURRENT_PACKAGES_DIR}/tools/qt5/debug) vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/qt5/debug/bin) endif() - + if(EXISTS ${CURRENT_PACKAGES_DIR}/tools/qt5/bin/qt.conf) file(REMOVE "${CURRENT_PACKAGES_DIR}/tools/qt5/bin/qt.conf") endif() @@ -395,7 +395,7 @@ else() set(CURRENT_INSTALLED_DIR "./../../.." ) # Making the qt.conf relative and not absolute configure_file(${CURRENT_PACKAGES_DIR}/tools/qt5/qt_release.conf ${CURRENT_PACKAGES_DIR}/tools/qt5/bin/qt.conf) # This makes the tools at least useable for release set(CURRENT_INSTALLED_DIR "${CURRENT_INSTALLED_DIR_BACKUP}") - + qt_install_copyright(${SOURCE_PATH}) endif() #install scripts for other qt ports @@ -429,7 +429,7 @@ if(QT_BUILD_LATEST) ) endif() -# #Code to get generated CMake files from CI +# #Code to get generated CMake files from CI # file(RENAME "${CURRENT_PACKAGES_DIR}/share/cmake/Qt5Core/Qt5CoreConfig.cmake" "${CURRENT_BUILDTREES_DIR}/Qt5CoreConfig.cmake.log") # file(GLOB_RECURSE CMAKE_GUI_FILES "${CURRENT_PACKAGES_DIR}/share/cmake/Qt5Gui/*.cmake" ) # foreach(cmake_file ${CMAKE_GUI_FILES}) From e2c1de8d4fd0778e5c69aec940a764b729c6e6e8 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Wed, 26 Aug 2020 12:46:39 +0200 Subject: [PATCH 59/61] [OpenMVG] error message when static CRT linking and software tools feature enabled --- ports/openmvg/portfile.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/openmvg/portfile.cmake b/ports/openmvg/portfile.cmake index fbf92e15c397e6..0b3265d6a3c6f5 100644 --- a/ports/openmvg/portfile.cmake +++ b/ports/openmvg/portfile.cmake @@ -3,6 +3,10 @@ vcpkg_buildpath_length_warning(37) #the port produces some empty dlls when building shared libraries, since some components do not export anything, breaking the internal build itself vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +if("software" IN_LIST FEATURES AND VCPKG_CRT_LINKAGE STREQUAL static) + message(FATAL_ERROR "OpenMVG software currently cannot be built with static CRT linking. Please open an issue if you require this feature.") +endif() + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO openMVG/openMVG From 93fb76b9e352fa88bc4e77ae9fe1b7320eba3cf7 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Wed, 26 Aug 2020 14:17:00 +0200 Subject: [PATCH 60/61] [mlpack] fix tools regression --- ports/mlpack/portfile.cmake | 56 ++++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/ports/mlpack/portfile.cmake b/ports/mlpack/portfile.cmake index a7d73b2e310ae7..11f6aa815ad9a7 100644 --- a/ports/mlpack/portfile.cmake +++ b/ports/mlpack/portfile.cmake @@ -38,14 +38,56 @@ vcpkg_install_cmake() vcpkg_copy_pdbs() if("tools" IN_LIST FEATURES) - file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools) - file(GLOB MLPACK_TOOLS ${CURRENT_PACKAGES_DIR}/bin/*.exe) - file(COPY ${MLPACK_TOOLS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}) - file(REMOVE ${MLPACK_TOOLS}) - file(GLOB MLPACK_TOOLS_DEBUG ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe) - file(REMOVE ${MLPACK_TOOLS_DEBUG}) + vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES + mlpack_adaboost + mlpack_approx_kfn + mlpack_cf + mlpack_dbscan + mlpack_decision_stump + mlpack_decision_tree + mlpack_det + mlpack_emst + mlpack_fastmks + mlpack_gmm_generate + mlpack_gmm_probability + mlpack_gmm_train + mlpack_hmm_generate + mlpack_hmm_loglik + mlpack_hmm_train + mlpack_hmm_viterbi + mlpack_hoeffding_tree + mlpack_kde + mlpack_kernel_pca + mlpack_kfn + mlpack_kmeans + mlpack_knn + mlpack_krann + mlpack_lars + mlpack_linear_regression + mlpack_linear_svm + mlpack_lmnn + mlpack_local_coordinate_coding + mlpack_logistic_regression + mlpack_lsh + mlpack_mean_shift + mlpack_nbc + mlpack_nca + mlpack_nmf + mlpack_pca + mlpack_perceptron + mlpack_preprocess_binarize + mlpack_preprocess_describe + mlpack_preprocess_imputer + mlpack_preprocess_scale + mlpack_preprocess_split + mlpack_radical + mlpack_random_forest + mlpack_range_search + mlpack_softmax_regression + mlpack_sparse_coding + ) endif() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -file(INSTALL ${SOURCE_PATH}/COPYRIGHT.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file +file(INSTALL ${SOURCE_PATH}/COPYRIGHT.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) From ea517c4f512a0c9624ca18efe1f8ea4c742cb92c Mon Sep 17 00:00:00 2001 From: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> Date: Thu, 27 Aug 2020 09:56:42 +0800 Subject: [PATCH 61/61] Update ports/suitesparse/CONTROL --- ports/suitesparse/CONTROL | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/suitesparse/CONTROL b/ports/suitesparse/CONTROL index 843ea516a53593..832306d5a8c37f 100644 --- a/ports/suitesparse/CONTROL +++ b/ports/suitesparse/CONTROL @@ -1,6 +1,5 @@ Source: suitesparse Version: 5.8.0 -Port-Version: 1 Build-Depends: lapack, metis Homepage: http://suitesparse.com Description: algebra library