diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index bc6f4c26..704eaebc 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -80,7 +80,7 @@ add_subdirectory(model) add_subdirectory(renderer) -add_subdirectory(Example) add_subdirectory(PolyFit) +add_subdirectory(polyfit) diff --git a/code/basic/CMakeLists.txt b/code/basic/CMakeLists.txt index faca5906..4a56ec76 100644 --- a/code/basic/CMakeLists.txt +++ b/code/basic/CMakeLists.txt @@ -50,7 +50,7 @@ set(basic_SOURCES ) -add_library(${PROJECT_NAME} SHARED ${basic_SOURCES} ${basic_HEADERS}) +add_library(${PROJECT_NAME} STATIC ${basic_SOURCES} ${basic_HEADERS}) set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "PolyFit") diff --git a/code/math/CMakeLists.txt b/code/math/CMakeLists.txt index 1f97adc6..5b59d7b5 100644 --- a/code/math/CMakeLists.txt +++ b/code/math/CMakeLists.txt @@ -36,7 +36,7 @@ set(math_SOURCES ) -add_library(${PROJECT_NAME} SHARED ${math_SOURCES} ${math_HEADERS}) +add_library(${PROJECT_NAME} STATIC ${math_SOURCES} ${math_HEADERS}) set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "PolyFit") diff --git a/code/method/CMakeLists.txt b/code/method/CMakeLists.txt index 74c511aa..c48160cd 100644 --- a/code/method/CMakeLists.txt +++ b/code/method/CMakeLists.txt @@ -24,7 +24,7 @@ set(method_SOURCES ) -add_library(${PROJECT_NAME} SHARED ${method_SOURCES} ${method_HEADERS}) +add_library(${PROJECT_NAME} STATIC ${method_SOURCES} ${method_HEADERS}) set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "PolyFit") diff --git a/code/model/CMakeLists.txt b/code/model/CMakeLists.txt index 37ea7773..937ea8fb 100644 --- a/code/model/CMakeLists.txt +++ b/code/model/CMakeLists.txt @@ -49,7 +49,7 @@ set(model_SOURCES kdtree/kdTree.cpp ) -add_library(${PROJECT_NAME} SHARED ${model_SOURCES} ${model_HEADERS}) +add_library(${PROJECT_NAME} STATIC ${model_SOURCES} ${model_HEADERS}) set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "PolyFit") diff --git a/code/Example/CMakeLists.txt b/code/polyfit/CMakeLists.txt similarity index 100% rename from code/Example/CMakeLists.txt rename to code/polyfit/CMakeLists.txt diff --git a/code/Example/main.cpp b/code/polyfit/main.cpp similarity index 79% rename from code/Example/main.cpp rename to code/polyfit/main.cpp index 135a772e..eb540e80 100644 --- a/code/Example/main.cpp +++ b/code/polyfit/main.cpp @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "../basic/logger.h" +#include "../basic/file_utils.h" #include "../model/point_set.h" #include "../model/map.h" #include "../method/method_global.h" @@ -33,10 +34,23 @@ int main(int argc, char **argv) // initialize the logger (this is not optional) Logger::initialize(); - // input point cloud file name - const std::string input_file = (argc > 1) ? argv[1] : std::string(POLYFIT_CODE_DIR) + "/../data/toy_data.bvg"; - // output mesh file name - const std::string output_file = (argc > 2) ? argv[2] : std::string(POLYFIT_CODE_DIR) + "/../data/toy_data-result.obj"; + if (argc != 3) { + std::cerr << "Usage:" << std::endl + << "\t./polyfit " << std::endl + << "Example:" << std::endl + << "\t./polyfit sphere.bvg sphere-result.obj" << std::endl; + return EXIT_FAILURE; + } + const std::string input_file = argv[1]; + if (!FileUtils::is_file(input_file)) { + std::cerr << "file '" << input_file << "' does not exist. Please check and make sure the path is correct" << std::endl; + return EXIT_FAILURE; + } + const std::string output_file = argv[2]; + if (FileUtils::extension(output_file) != "obj") { + std::cerr << "the output file is expected to have 'obj' as file extension" << std::endl; + return EXIT_FAILURE; + } // below are the default parameters (change these when necessary) Method::lambda_data_fitting = 0.43; diff --git a/code/renderer/CMakeLists.txt b/code/renderer/CMakeLists.txt index 1a89a83e..5371ffaa 100644 --- a/code/renderer/CMakeLists.txt +++ b/code/renderer/CMakeLists.txt @@ -19,7 +19,7 @@ set(renderer_SOURCES ) -add_library(${PROJECT_NAME} SHARED ${renderer_SOURCES} ${renderer_HEADERS}) +add_library(${PROJECT_NAME} STATIC ${renderer_SOURCES} ${renderer_HEADERS}) set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "PolyFit")