diff --git a/src/aliceVision/system/CMakeLists.txt b/src/aliceVision/system/CMakeLists.txt index c29101c339..c8cd65afd4 100644 --- a/src/aliceVision/system/CMakeLists.txt +++ b/src/aliceVision/system/CMakeLists.txt @@ -1,6 +1,7 @@ # Headers set(system_files_headers cpu.hpp + main.hpp MemoryInfo.hpp system.hpp Timer.hpp diff --git a/src/aliceVision/system/main.hpp b/src/aliceVision/system/main.hpp new file mode 100644 index 0000000000..48d032dee9 --- /dev/null +++ b/src/aliceVision/system/main.hpp @@ -0,0 +1,48 @@ +// This file is part of the AliceVision project. +// Copyright (c) 2020 AliceVision contributors. +// This Source Code Form is subject to the terms of the Mozilla Public License, +// v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at https://mozilla.org/MPL/2.0/. + +#pragma once + +/** + * @file \c main() function wrapper + * Provides an implementation of \c main() that automatically catches and logs + * otherwise unhandled exceptions. + * + * To use this wrapper you need to change your source file containing \c main() as such: + * 1. Include this header + * 2. Rename \c main() to \c aliceVision_main() + */ + +#include "Logger.hpp" + +#include + +/** + * @brief Name of the application entry function, replacing \c main(). + */ +int aliceVision_main(int argc, char* argv[]); + +/* Implementation of the unique main() entry point. + * This method will call aliceVision_main() and, in case of any exception not + * handled there, catch those and log the error message. + * On Windows, unhandled exceptions abort the program with the cause hard to + * find out, something this main() function avoids. */ +int main(int argc, char* argv[]) +{ + try + { + return aliceVision_main(argc, argv); + } + catch(const std::exception& e) + { + ALICEVISION_LOG_FATAL(e.what()); + } + catch(...) + { + ALICEVISION_LOG_FATAL("Unknown exception"); + } + return EXIT_FAILURE; +} diff --git a/src/software/convert/main_convertFloatDescriptorToUchar.cpp b/src/software/convert/main_convertFloatDescriptorToUchar.cpp index 24e523cadd..0a2991d329 100644 --- a/src/software/convert/main_convertFloatDescriptorToUchar.cpp +++ b/src/software/convert/main_convertFloatDescriptorToUchar.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -25,7 +26,7 @@ using namespace aliceVision; namespace po = boost::program_options; namespace fs = boost::filesystem; -int main( int argc, char** argv ) +int aliceVision_main( int argc, char** argv ) { std::string verboseLevel = system::EVerboseLevel_enumToString(system::Logger::getDefaultVerboseLevel()); std::string outputFolder; @@ -181,4 +182,6 @@ int main( int argc, char** argv ) } } ALICEVISION_LOG_INFO("Converted " << countDesc << " files .desc and copied " << countFeat << " files .feat"); + + return EXIT_SUCCESS; } diff --git a/src/software/convert/main_convertLDRToHDR.cpp b/src/software/convert/main_convertLDRToHDR.cpp index 868e019e6a..10838dde96 100644 --- a/src/software/convert/main_convertLDRToHDR.cpp +++ b/src/software/convert/main_convertLDRToHDR.cpp @@ -8,6 +8,7 @@ #include #include #include +#include /*SFMData*/ #include @@ -100,7 +101,7 @@ inline std::istream& operator>>(std::istream& in, ECalibrationMethod& calibratio } -int main(int argc, char * argv[]) +int aliceVision_main(int argc, char * argv[]) { std::string verboseLevel = system::EVerboseLevel_enumToString(system::Logger::getDefaultVerboseLevel()); std::string sfmInputDataFilename = ""; diff --git a/src/software/convert/main_convertRAW.cpp b/src/software/convert/main_convertRAW.cpp index 3a214863ba..0718bdca1f 100644 --- a/src/software/convert/main_convertRAW.cpp +++ b/src/software/convert/main_convertRAW.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -25,7 +26,7 @@ using namespace aliceVision; namespace po = boost::program_options; namespace fs = boost::filesystem; -int main(int argc, char** argv) +int aliceVision_main(int argc, char** argv) { // command-line parameters diff --git a/src/software/convert/main_convertSfMFormat.cpp b/src/software/convert/main_convertSfMFormat.cpp index dea5fe8da1..29ad6996af 100644 --- a/src/software/convert/main_convertSfMFormat.cpp +++ b/src/software/convert/main_convertSfMFormat.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -31,7 +32,7 @@ namespace po = boost::program_options; namespace fs = boost::filesystem; // convert from a SfMData format to another -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/export/main_exportAnimatedCamera.cpp b/src/software/export/main_exportAnimatedCamera.cpp index eed2a4c63f..36f60002d4 100644 --- a/src/software/export/main_exportAnimatedCamera.cpp +++ b/src/software/export/main_exportAnimatedCamera.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -30,7 +31,7 @@ using namespace aliceVision; namespace po = boost::program_options; namespace fs = boost::filesystem; -int main(int argc, char** argv) +int aliceVision_main(int argc, char** argv) { // command-line parameters diff --git a/src/software/export/main_exportCameraFrustums.cpp b/src/software/export/main_exportCameraFrustums.cpp index 8a7f56ad03..fc717fc0c4 100644 --- a/src/software/export/main_exportCameraFrustums.cpp +++ b/src/software/export/main_exportCameraFrustums.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -26,7 +27,7 @@ namespace po = boost::program_options; namespace fs = boost::filesystem; /// Export camera frustrums as a triangle PLY file -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/export/main_exportColoredPointCloud.cpp b/src/software/export/main_exportColoredPointCloud.cpp index 4bdb7959bc..9d11d71387 100644 --- a/src/software/export/main_exportColoredPointCloud.cpp +++ b/src/software/export/main_exportColoredPointCloud.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -27,7 +28,7 @@ using namespace aliceVision; namespace po = boost::program_options; // Convert from a SfMData format to another -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/export/main_exportKeypoints.cpp b/src/software/export/main_exportKeypoints.cpp index 34ef2c1d73..141d33ccc1 100644 --- a/src/software/export/main_exportKeypoints.cpp +++ b/src/software/export/main_exportKeypoints.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -41,7 +42,7 @@ using namespace svg; namespace po = boost::program_options; namespace fs = boost::filesystem; -int main(int argc, char ** argv) +int aliceVision_main(int argc, char ** argv) { // command-line parameters diff --git a/src/software/export/main_exportMVE2.cpp b/src/software/export/main_exportMVE2.cpp index ad4e949961..2bf8528834 100644 --- a/src/software/export/main_exportMVE2.cpp +++ b/src/software/export/main_exportMVE2.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -240,7 +241,7 @@ bool exportToMVE2Format( return bOk; } -int main(int argc, char *argv[]) +int aliceVision_main(int argc, char *argv[]) { // command-line parameters diff --git a/src/software/export/main_exportMVSTexturing.cpp b/src/software/export/main_exportMVSTexturing.cpp index 556e240026..5c066666db 100644 --- a/src/software/export/main_exportMVSTexturing.cpp +++ b/src/software/export/main_exportMVSTexturing.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -27,7 +28,7 @@ using namespace aliceVision::sfmData; namespace po = boost::program_options; namespace fs = boost::filesystem; -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/export/main_exportMatches.cpp b/src/software/export/main_exportMatches.cpp index 6568c38630..5e26f355b9 100644 --- a/src/software/export/main_exportMatches.cpp +++ b/src/software/export/main_exportMatches.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include @@ -71,7 +72,7 @@ void hslToRgb(float h, float s, float l, } } -int main(int argc, char ** argv) +int aliceVision_main(int argc, char ** argv) { // command-line parameters diff --git a/src/software/export/main_exportMatlab.cpp b/src/software/export/main_exportMatlab.cpp index b03dfcbe6b..65bee75989 100644 --- a/src/software/export/main_exportMatlab.cpp +++ b/src/software/export/main_exportMatlab.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -137,7 +138,7 @@ bool exportToMatlab( return true; } -int main(int argc, char *argv[]) +int aliceVision_main(int argc, char *argv[]) { // command-line parameters diff --git a/src/software/export/main_exportMeshlab.cpp b/src/software/export/main_exportMeshlab.cpp index 71aa46d547..e1f18a3d95 100644 --- a/src/software/export/main_exportMeshlab.cpp +++ b/src/software/export/main_exportMeshlab.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -29,7 +30,7 @@ using namespace aliceVision::sfmData; namespace po = boost::program_options; namespace fs = boost::filesystem; -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/export/main_exportMeshroomMaya.cpp b/src/software/export/main_exportMeshroomMaya.cpp index 8a2ac0712f..53542e4aa0 100644 --- a/src/software/export/main_exportMeshroomMaya.cpp +++ b/src/software/export/main_exportMeshroomMaya.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -27,7 +28,7 @@ namespace po = boost::program_options; namespace fs = boost::filesystem; namespace oiio = OIIO; -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/export/main_exportPMVS.cpp b/src/software/export/main_exportPMVS.cpp index 372c8bf80f..1d045e8238 100644 --- a/src/software/export/main_exportPMVS.cpp +++ b/src/software/export/main_exportPMVS.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -304,7 +305,7 @@ bool exportToBundlerFormat( return true; } -int main(int argc, char *argv[]) +int aliceVision_main(int argc, char *argv[]) { // command-line parameters diff --git a/src/software/export/main_exportTracks.cpp b/src/software/export/main_exportTracks.cpp index d78534668b..85c1ec6451 100644 --- a/src/software/export/main_exportTracks.cpp +++ b/src/software/export/main_exportTracks.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -41,7 +42,7 @@ using namespace svg; namespace po = boost::program_options; namespace fs = boost::filesystem; -int main(int argc, char ** argv) +int aliceVision_main(int argc, char ** argv) { // command-line parameters diff --git a/src/software/pipeline/main_cameraCalibration.cpp b/src/software/pipeline/main_cameraCalibration.cpp index 4997f3b986..b46d7bee49 100644 --- a/src/software/pipeline/main_cameraCalibration.cpp +++ b/src/software/pipeline/main_cameraCalibration.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -48,7 +49,7 @@ namespace bfs = boost::filesystem; namespace po = boost::program_options; -int main(int argc, char** argv) +int aliceVision_main(int argc, char** argv) { // Command line arguments bfs::path inputPath; diff --git a/src/software/pipeline/main_cameraInit.cpp b/src/software/pipeline/main_cameraInit.cpp index afa81b2834..2da0d06a0a 100644 --- a/src/software/pipeline/main_cameraInit.cpp +++ b/src/software/pipeline/main_cameraInit.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -167,7 +168,7 @@ inline std::istream& operator>>(std::istream& in, EGroupCameraFallback& s) * @brief Create the description of an input image dataset for AliceVision toolsuite * - Export a SfMData file with View & Intrinsic data */ -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/pipeline/main_cameraLocalization.cpp b/src/software/pipeline/main_cameraLocalization.cpp index 4c480e2a13..7db14dba4c 100644 --- a/src/software/pipeline/main_cameraLocalization.cpp +++ b/src/software/pipeline/main_cameraLocalization.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -60,7 +61,7 @@ std::string myToString(std::size_t i, std::size_t zeroPadding) return ss.str(); } -int main(int argc, char** argv) +int aliceVision_main(int argc, char** argv) { /// the calibration file std::string calibFile; @@ -519,4 +520,6 @@ int main(int argc, char** argv) ALICEVISION_COUT("Mean time for localization: " << bacc::mean(stats) << " [ms]"); ALICEVISION_COUT("Max time for localization: " << bacc::max(stats) << " [ms]"); ALICEVISION_COUT("Min time for localization: " << bacc::min(stats) << " [ms]"); + + return EXIT_SUCCESS; } diff --git a/src/software/pipeline/main_computeStructureFromKnownPoses.cpp b/src/software/pipeline/main_computeStructureFromKnownPoses.cpp index 2509c23877..1ff18a9a66 100644 --- a/src/software/pipeline/main_computeStructureFromKnownPoses.cpp +++ b/src/software/pipeline/main_computeStructureFromKnownPoses.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -29,7 +30,7 @@ namespace po = boost::program_options; namespace fs = boost::filesystem; /// Compute the structure of a scene according existing camera poses. -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/pipeline/main_depthMapEstimation.cpp b/src/software/pipeline/main_depthMapEstimation.cpp index 21b3da8aea..d3c4dc3b94 100644 --- a/src/software/pipeline/main_depthMapEstimation.cpp +++ b/src/software/pipeline/main_depthMapEstimation.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -28,7 +29,7 @@ using namespace aliceVision; namespace po = boost::program_options; -int main(int argc, char* argv[]) +int aliceVision_main(int argc, char* argv[]) { system::Timer timer; diff --git a/src/software/pipeline/main_depthMapFiltering.cpp b/src/software/pipeline/main_depthMapFiltering.cpp index a1d53d388d..2108a279b5 100644 --- a/src/software/pipeline/main_depthMapFiltering.cpp +++ b/src/software/pipeline/main_depthMapFiltering.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -28,7 +29,7 @@ using namespace aliceVision; namespace po = boost::program_options; -int main(int argc, char* argv[]) +int aliceVision_main(int argc, char* argv[]) { system::Timer timer; diff --git a/src/software/pipeline/main_featureExtraction.cpp b/src/software/pipeline/main_featureExtraction.cpp index 67601977de..e935461824 100644 --- a/src/software/pipeline/main_featureExtraction.cpp +++ b/src/software/pipeline/main_featureExtraction.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -254,7 +255,7 @@ class FeatureExtractor /// - Compute view image description (feature & descriptor extraction) /// - Export computed data -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/pipeline/main_featureMatching.cpp b/src/software/pipeline/main_featureMatching.cpp index a1831a84a4..2b611803bb 100644 --- a/src/software/pipeline/main_featureMatching.cpp +++ b/src/software/pipeline/main_featureMatching.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -86,7 +87,7 @@ void getStatsMap(const PairwiseMatches& map) /// - Compute putative local feature matches (descriptors matching) /// - Compute geometric coherent feature matches (robust model estimation from putative matches) /// - Export computed data -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/pipeline/main_globalSfM.cpp b/src/software/pipeline/main_globalSfM.cpp index 524b27555e..0d6ba4d747 100644 --- a/src/software/pipeline/main_globalSfM.cpp +++ b/src/software/pipeline/main_globalSfM.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -29,7 +30,7 @@ using namespace aliceVision; namespace po = boost::program_options; namespace fs = boost::filesystem; -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/pipeline/main_imageMatching.cpp b/src/software/pipeline/main_imageMatching.cpp index 1ee0bd5618..6fc2059c95 100644 --- a/src/software/pipeline/main_imageMatching.cpp +++ b/src/software/pipeline/main_imageMatching.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -543,7 +544,7 @@ void conditionVocTree(const std::string& treeName, bool withWeights, const std:: } } -int main(int argc, char** argv) +int aliceVision_main(int argc, char** argv) { // command-line parameters diff --git a/src/software/pipeline/main_incrementalSfM.cpp b/src/software/pipeline/main_incrementalSfM.cpp index 18ab030f1f..19ad5a984f 100644 --- a/src/software/pipeline/main_incrementalSfM.cpp +++ b/src/software/pipeline/main_incrementalSfM.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -70,7 +71,7 @@ bool retrieveViewIdFromImageName(const sfmData::SfMData& sfmData, } -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/pipeline/main_meshDecimate.cpp b/src/software/pipeline/main_meshDecimate.cpp index 17dc5f534e..332e4ed9a9 100644 --- a/src/software/pipeline/main_meshDecimate.cpp +++ b/src/software/pipeline/main_meshDecimate.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -30,7 +31,7 @@ using namespace aliceVision; namespace bfs = boost::filesystem; namespace po = boost::program_options; -int main(int argc, char* argv[]) +int aliceVision_main(int argc, char* argv[]) { system::Timer timer; diff --git a/src/software/pipeline/main_meshDenoising.cpp b/src/software/pipeline/main_meshDenoising.cpp index aa818151cf..ff31f85b60 100644 --- a/src/software/pipeline/main_meshDenoising.cpp +++ b/src/software/pipeline/main_meshDenoising.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -32,7 +33,7 @@ using namespace aliceVision; namespace bfs = boost::filesystem; namespace po = boost::program_options; -int main(int argc, char* argv[]) +int aliceVision_main(int argc, char* argv[]) { system::Timer timer; diff --git a/src/software/pipeline/main_meshFiltering.cpp b/src/software/pipeline/main_meshFiltering.cpp index 884e48df19..29f3ed57e8 100644 --- a/src/software/pipeline/main_meshFiltering.cpp +++ b/src/software/pipeline/main_meshFiltering.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -24,7 +25,7 @@ using namespace aliceVision; namespace bfs = boost::filesystem; namespace po = boost::program_options; -int main(int argc, char* argv[]) +int aliceVision_main(int argc, char* argv[]) { system::Timer timer; diff --git a/src/software/pipeline/main_meshResampling.cpp b/src/software/pipeline/main_meshResampling.cpp index 4d05ae9f15..a8c5095f32 100644 --- a/src/software/pipeline/main_meshResampling.cpp +++ b/src/software/pipeline/main_meshResampling.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -32,7 +33,7 @@ using namespace aliceVision; namespace bfs = boost::filesystem; namespace po = boost::program_options; -int main(int argc, char* argv[]) +int aliceVision_main(int argc, char* argv[]) { system::Timer timer; diff --git a/src/software/pipeline/main_meshing.cpp b/src/software/pipeline/main_meshing.cpp index 2db60fb731..e87ee1dfd3 100644 --- a/src/software/pipeline/main_meshing.cpp +++ b/src/software/pipeline/main_meshing.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -129,7 +130,7 @@ void removeLandmarksWithoutObservations(sfmData::SfMData& sfmData) } -int main(int argc, char* argv[]) +int aliceVision_main(int argc, char* argv[]) { system::Timer timer; diff --git a/src/software/pipeline/main_panoramaCompositing.cpp b/src/software/pipeline/main_panoramaCompositing.cpp index 05cea4508b..9cdaf3b53d 100644 --- a/src/software/pipeline/main_panoramaCompositing.cpp +++ b/src/software/pipeline/main_panoramaCompositing.cpp @@ -16,6 +16,7 @@ /*Reading command line options*/ #include #include +#include /*IO*/ #include @@ -853,7 +854,7 @@ class LaplacianCompositer : public Compositer { size_t _bands; }; -int main(int argc, char **argv) { +int aliceVision_main(int argc, char **argv) { /** * Program description diff --git a/src/software/pipeline/main_panoramaEstimation.cpp b/src/software/pipeline/main_panoramaEstimation.cpp index 84d67e6be1..2c32d558c9 100644 --- a/src/software/pipeline/main_panoramaEstimation.cpp +++ b/src/software/pipeline/main_panoramaEstimation.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -42,7 +43,7 @@ inline std::istream& operator>>(std::istream& in, std::pair& out) return in; } -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/pipeline/main_panoramaExternalInfo.cpp b/src/software/pipeline/main_panoramaExternalInfo.cpp index ee87cad4e5..3d3261932a 100644 --- a/src/software/pipeline/main_panoramaExternalInfo.cpp +++ b/src/software/pipeline/main_panoramaExternalInfo.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -20,7 +21,7 @@ namespace po = boost::program_options; namespace fs = boost::filesystem; namespace pt = boost::property_tree; -int main(int argc, char * argv[]) { +int aliceVision_main(int argc, char * argv[]) { std::string verboseLevel = system::EVerboseLevel_enumToString(system::Logger::getDefaultVerboseLevel()); std::string externalInfoFilename = ""; std::string sfmInputDataFilename = ""; diff --git a/src/software/pipeline/main_panoramaWarping.cpp b/src/software/pipeline/main_panoramaWarping.cpp index b858182dcd..8c6fd32dfe 100644 --- a/src/software/pipeline/main_panoramaWarping.cpp +++ b/src/software/pipeline/main_panoramaWarping.cpp @@ -16,6 +16,7 @@ /*Reading command line options*/ #include #include +#include /*IO*/ #include @@ -1088,7 +1089,7 @@ bool computeOptimalPanoramaSize(std::pair & optimalSize, const sfmData return true; } -int main(int argc, char **argv) { +int aliceVision_main(int argc, char **argv) { /** * Program description diff --git a/src/software/pipeline/main_prepareDenseScene.cpp b/src/software/pipeline/main_prepareDenseScene.cpp index d0c38459bf..12e7bcbc9a 100644 --- a/src/software/pipeline/main_prepareDenseScene.cpp +++ b/src/software/pipeline/main_prepareDenseScene.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -231,7 +232,7 @@ bool prepareDenseScene(const SfMData& sfmData, return true; } -int main(int argc, char *argv[]) +int aliceVision_main(int argc, char *argv[]) { // command-line parameters diff --git a/src/software/pipeline/main_rigCalibration.cpp b/src/software/pipeline/main_rigCalibration.cpp index 97dff6e743..140875d777 100644 --- a/src/software/pipeline/main_rigCalibration.cpp +++ b/src/software/pipeline/main_rigCalibration.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -58,7 +59,7 @@ std::string myToString(std::size_t i, std::size_t zeroPadding) } -int main(int argc, char** argv) +int aliceVision_main(int argc, char** argv) { // common parameters /// the AliceVision .json/abc data file diff --git a/src/software/pipeline/main_rigLocalization.cpp b/src/software/pipeline/main_rigLocalization.cpp index a1ee77c4ef..b8a65882ed 100644 --- a/src/software/pipeline/main_rigLocalization.cpp +++ b/src/software/pipeline/main_rigLocalization.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -59,7 +60,7 @@ std::string myToString(std::size_t i, std::size_t zeroPadding) } -int main(int argc, char** argv) +int aliceVision_main(int argc, char** argv) { // common parameters /// the AliceVision .json/abc data file @@ -486,4 +487,6 @@ int main(int argc, char** argv) ALICEVISION_COUT("Mean time for localization: " << bacc::mean(stats) << " [ms]"); ALICEVISION_COUT("Max time for localization: " << bacc::max(stats) << " [ms]"); ALICEVISION_COUT("Min time for localization: " << bacc::min(stats) << " [ms]"); + + return EXIT_SUCCESS; } diff --git a/src/software/pipeline/main_texturing.cpp b/src/software/pipeline/main_texturing.cpp index 4cb4de6c48..6c71c1faea 100644 --- a/src/software/pipeline/main_texturing.cpp +++ b/src/software/pipeline/main_texturing.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -36,7 +37,7 @@ bfs::path absolutePathNoExt(const bfs::path& p) return p.parent_path() / p.stem(); } -int main(int argc, char* argv[]) +int aliceVision_main(int argc, char* argv[]) { system::Timer timer; diff --git a/src/software/utils/main_computeUncertainty.cpp b/src/software/utils/main_computeUncertainty.cpp index 173306e4e3..51811720b0 100644 --- a/src/software/utils/main_computeUncertainty.cpp +++ b/src/software/utils/main_computeUncertainty.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -31,7 +32,7 @@ using namespace aliceVision::sfmDataIO; namespace po = boost::program_options; -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/utils/main_fisheyeProjection.cpp b/src/software/utils/main_fisheyeProjection.cpp index a3c749d048..19cea3d28a 100644 --- a/src/software/utils/main_fisheyeProjection.cpp +++ b/src/software/utils/main_fisheyeProjection.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -252,7 +253,7 @@ void stitchPanorama(const std::vector& imagePaths, const std::vecto } -int main(int argc, char** argv) +int aliceVision_main(int argc, char** argv) { // command-line parameters std::string verboseLevel = system::EVerboseLevel_enumToString(system::Logger::getDefaultVerboseLevel()); diff --git a/src/software/utils/main_frustumFiltering.cpp b/src/software/utils/main_frustumFiltering.cpp index b353f6dd4d..743fe4eedb 100644 --- a/src/software/utils/main_frustumFiltering.cpp +++ b/src/software/utils/main_frustumFiltering.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -66,7 +67,7 @@ PairSet BuildPairsFromFrustumsIntersections( return frustum_filter.getFrustumIntersectionPairs(); } -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/utils/main_imageProcessing.cpp b/src/software/utils/main_imageProcessing.cpp index c424fbc4ab..f8d6649468 100644 --- a/src/software/utils/main_imageProcessing.cpp +++ b/src/software/utils/main_imageProcessing.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -26,7 +27,7 @@ namespace po = boost::program_options; namespace fs = boost::filesystem; -int main(int argc, char * argv[]) +int aliceVision_main(int argc, char * argv[]) { std::string verboseLevel = system::EVerboseLevel_enumToString(system::Logger::getDefaultVerboseLevel()); std::string sfmInputDataFilename = ""; diff --git a/src/software/utils/main_keyframeSelection.cpp b/src/software/utils/main_keyframeSelection.cpp index 2310e5398c..31f3dde7af 100644 --- a/src/software/utils/main_keyframeSelection.cpp +++ b/src/software/utils/main_keyframeSelection.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -24,7 +25,7 @@ using namespace aliceVision::keyframe; namespace po = boost::program_options; namespace fs = boost::filesystem; -int main(int argc, char** argv) +int aliceVision_main(int argc, char** argv) { // command-line parameters std::string verboseLevel = aliceVision::system::EVerboseLevel_enumToString(aliceVision::system::Logger::getDefaultVerboseLevel()); diff --git a/src/software/utils/main_qualityEvaluation.cpp b/src/software/utils/main_qualityEvaluation.cpp index d23e224628..d10810bd35 100644 --- a/src/software/utils/main_qualityEvaluation.cpp +++ b/src/software/utils/main_qualityEvaluation.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -33,7 +34,7 @@ using namespace aliceVision; namespace po = boost::program_options; namespace fs = boost::filesystem; -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/utils/main_rigTransform.cpp b/src/software/utils/main_rigTransform.cpp index fec6cdab1c..65fb0b94b9 100644 --- a/src/software/utils/main_rigTransform.cpp +++ b/src/software/utils/main_rigTransform.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -39,7 +40,7 @@ static std::vector ReadIntrinsicsFile(const std::string& fname) return v; } -int main(int argc, char** argv) +int aliceVision_main(int argc, char** argv) { std::string verboseLevel = system::EVerboseLevel_enumToString(system::Logger::getDefaultVerboseLevel()); std::string exportFile; diff --git a/src/software/utils/main_sfmAlignment.cpp b/src/software/utils/main_sfmAlignment.cpp index 4a5bc0dc95..12ecd53f0d 100644 --- a/src/software/utils/main_sfmAlignment.cpp +++ b/src/software/utils/main_sfmAlignment.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -89,7 +90,7 @@ inline std::ostream& operator<<(std::ostream& os, EAlignmentMethod e) } -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/utils/main_sfmColorHarmonize.cpp b/src/software/utils/main_sfmColorHarmonize.cpp index 1da8c3daca..3c95069b39 100644 --- a/src/software/utils/main_sfmColorHarmonize.cpp +++ b/src/software/utils/main_sfmColorHarmonize.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include @@ -27,7 +28,7 @@ using namespace aliceVision; namespace po = boost::program_options; namespace fs = boost::filesystem; -int main( int argc, char **argv ) +int aliceVision_main( int argc, char **argv ) { // command-line parameters diff --git a/src/software/utils/main_sfmLocalization.cpp b/src/software/utils/main_sfmLocalization.cpp index fbf743ea39..442b549537 100644 --- a/src/software/utils/main_sfmLocalization.cpp +++ b/src/software/utils/main_sfmLocalization.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -35,7 +36,7 @@ namespace fs = boost::filesystem; // if 3D-2D matches are found // - A demonstration mode (default): // - try to locate all the view of the SfM_Data reconstruction -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/utils/main_sfmTransfer.cpp b/src/software/utils/main_sfmTransfer.cpp index 1e7125c74b..18b06093a1 100644 --- a/src/software/utils/main_sfmTransfer.cpp +++ b/src/software/utils/main_sfmTransfer.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -83,7 +84,7 @@ inline std::ostream& operator<<(std::ostream& os, EMatchingMethod e) } -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/utils/main_sfmTransform.cpp b/src/software/utils/main_sfmTransform.cpp index ba81895aed..20010e20d6 100644 --- a/src/software/utils/main_sfmTransform.cpp +++ b/src/software/utils/main_sfmTransform.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -114,7 +115,7 @@ static bool parseAlignScale(const std::string& alignScale, double& S, Mat3& R, V } -int main(int argc, char **argv) +int aliceVision_main(int argc, char **argv) { // command-line parameters diff --git a/src/software/utils/main_split360Images.cpp b/src/software/utils/main_split360Images.cpp index e7477f56c4..fe58504ed4 100644 --- a/src/software/utils/main_split360Images.cpp +++ b/src/software/utils/main_split360Images.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include @@ -303,7 +304,7 @@ bool splitEquirectangularDemo(const std::string& imagePath, const std::string& o return true; } -int main(int argc, char** argv) +int aliceVision_main(int argc, char** argv) { // command-line parameters std::string verboseLevel = system::EVerboseLevel_enumToString(system::Logger::getDefaultVerboseLevel()); diff --git a/src/software/utils/main_voctreeCreation.cpp b/src/software/utils/main_voctreeCreation.cpp index 3d1f4877fb..c05efcfdfc 100644 --- a/src/software/utils/main_voctreeCreation.cpp +++ b/src/software/utils/main_voctreeCreation.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include @@ -42,7 +43,7 @@ typedef aliceVision::feature::Descriptor DescriptorUCh /* * This program is used to load the sift descriptors from a list of files and create a vocabulary tree */ -int main(int argc, char** argv) +int aliceVision_main(int argc, char** argv) { std::string verboseLevel = system::EVerboseLevel_enumToString(system::Logger::getDefaultVerboseLevel()); int tbVerbosity = 2; diff --git a/src/software/utils/main_voctreeQueryUtility.cpp b/src/software/utils/main_voctreeQueryUtility.cpp index 7abe2cc726..fc58bdc7fd 100644 --- a/src/software/utils/main_voctreeQueryUtility.cpp +++ b/src/software/utils/main_voctreeQueryUtility.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -107,7 +108,7 @@ static const std::string programDescription = * This program is used to create a database with a provided dataset of image descriptors using a trained vocabulary tree * The database is then queried with the same images in order to retrieve for each image the set of most similar images in the dataset */ -int main(int argc, char** argv) +int aliceVision_main(int argc, char** argv) { std::string verboseLevel = system::EVerboseLevel_enumToString(system::Logger::getDefaultVerboseLevel()); /// the filename for the voctree weights diff --git a/src/software/utils/main_voctreeStatistics.cpp b/src/software/utils/main_voctreeStatistics.cpp index ec3c9d1ef1..2fdc57f0e8 100644 --- a/src/software/utils/main_voctreeStatistics.cpp +++ b/src/software/utils/main_voctreeStatistics.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -78,7 +79,7 @@ static const std::string programDescription = * This program is used to create a database with a provided dataset of image descriptors using a trained vocabulary tree * The database is then queried with the same images in order to retrieve for each image the set of most similar images in the dataset */ -int main(int argc, char** argv) +int aliceVision_main(int argc, char** argv) { std::string verboseLevel = system::EVerboseLevel_enumToString(system::Logger::getDefaultVerboseLevel()); std::string weightsName; // the filename for the voctree weights