From 66a7fed49bbf8ef2295eaa3a6be5e7a9705c9325 Mon Sep 17 00:00:00 2001 From: Daniel Tobon Date: Wed, 10 Aug 2022 07:44:04 -0500 Subject: [PATCH 1/5] added cloudparse module --- src/CMakeLists.txt | 106 ------------ src/main.cpp | 404 +++++++++++++++------------------------------ 2 files changed, 130 insertions(+), 380 deletions(-) delete mode 100644 src/CMakeLists.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 3d9ea13..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,106 +0,0 @@ -############################################################################## -# CMAKE CONFIGURATION -############################################################################## -cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR) - -# set project name -project(upsampling_cloud VERSION 1.0.0 LANGUAGES CXX) - -# set build type = Release mode -set(CMAKE_BUILD_TYPE Release) - -message("\n" "=========================================") -message("Project: ${PROJECT_NAME} ") -message("=========================================") - -# set the include directive in the same project folder -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -# set corresponding package directories -set(PCL_DIR /opt/pcl-1.9.1/build) -#set(VTK_DIR 8 ) - -#set the CMP0074 policy to old behavior (disable warnings) (CMake 3.12.0-rc1) -if(${CMAKE_VERSION} MATCHES 3.12.0) - cmake_policy(SET CMP0074 OLD) - if(POLICY CMP0048) - cmake_policy(SET CMP0048 NEW) - endif(POLICY CMP0048) -endif() - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") - -# Include dependencies of pcl 1.8.1 in project directorie -set(CMAKE_MODULE_PATH ${PCL_DIR}/../cmake/Modules) - -# set cmake for use std c++11 and output executable folder to bin -#set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin) - -############################################################################## -# PACKAGES -############################################################################## -message("***********************") -message("point cloud library pkg") -message("***********************") - -find_package(PCL 1.8 PATHS ${PCL_DIR} QUIET) -if(PCL_FOUND) - message(STATUS "PCL status:") - message(STATUS " version: ${PCL_VERSION}") - message(STATUS " pcl directorie: ${PCL_DIR}") -else() - message(WARNING " PCL 1.8 not found, attempting 1.7...") - find_package(PCL 1.7 REQUIRED) - if(PCL_FOUND) - message(STATUS "PCL status:") - message(STATUS " version: ${PCL_VERSION}") - message(STATUS " pcl directorie: ${PCL_DIR}") - else() - message(FATAL_ERROR " ERROR: PCL minimum required version 1.7. Not found") - endif() -endif() - -############################################################################## -# HEADERS -############################################################################## -include_directories( - ${PCL_INCLUDE_DIRS} - -) - -include(CheckFunctionExists) - -# Use the compile definitions defined in PCL -add_definitions(${PCL_DEFINITIONS}) - -############################################################################## -# LIBRARIES PATH -############################################################################## -link_directories( - ${PCL_LIBRARY_DIRS} - -) - -############################################################################## -# SOURCE CODE -############################################################################## -set(MAIN_SOURCE "main.cpp") - -############################################################################## -# EXECUTABLES -############################################################################## -add_executable(${PROJECT_NAME} - ${MAIN_SOURCE} -) - -############################################################################## -# TARGET LIBRARIES -############################################################################## -target_link_libraries(${PROJECT_NAME} - ${PCL_LIBRARIES} - - ) - -message("=========================================") -message("Project: ${PROJECT_NAME} COMPILED WITH CMAKE " ${CMAKE_VERSION}) -message("=========================================") diff --git a/src/main.cpp b/src/main.cpp index 74bf297..d05a4a5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,288 +1,144 @@ /********************************* HEADERS **********************************/ +#include +#include +#include +#include +#include #include #include #include - -#include - -#include -#include - -#include -#include #include - -#include - -#include +#include +#include #include - -#include +#include #include +#include +#include +#include -#include -#include -#include - -#include #include +#include #include -void printUsage (const char* progName){ - std::cout << "\nUse: " << progName << " " << std::endl << - "support: .pcd .ply .txt .xyz" << std::endl << - "[q] to exit" << std::endl; -} - - -int main(int argc, char **argv){ - - pcl::PointCloud::Ptr input_cloud(new pcl::PointCloud()); - - pcl::PolygonMesh cl; - std::vector filenames; - bool file_is_pcd = false; - bool file_is_ply = false; - bool file_is_txt = false; - bool file_is_xyz = false; - - - if(argc < 2 or argc > 2){ - printUsage (argv[0]); - return -1; - } - - pcl::console::TicToc tt; - pcl::console::print_highlight ("Loading "); - - filenames = pcl::console::parse_file_extension_argument(argc, argv, ".ply"); - if(filenames.size()<=0){ - filenames = pcl::console::parse_file_extension_argument(argc, argv, ".pcd"); - if(filenames.size()<=0){ - filenames = pcl::console::parse_file_extension_argument(argc, argv, ".txt"); - if(filenames.size()<=0){ - filenames = pcl::console::parse_file_extension_argument(argc, argv, ".xyz"); - if(filenames.size()<=0){ - printUsage (argv[0]); - return -1; - }else if(filenames.size() == 1){ - file_is_xyz = true; - } - }else if(filenames.size() == 1){ - file_is_txt = true; - } - }else if(filenames.size() == 1){ - file_is_pcd = true; - } - }else if(filenames.size() == 1){ - file_is_ply = true; - }else{ - printUsage (argv[0]); - return -1; - } - - if(file_is_pcd){ - if(pcl::io::loadPCDFile(argv[filenames[0]], *input_cloud) < 0){ - std::cout << "Error loading point cloud " << argv[filenames[0]] << "\n"; - printUsage (argv[0]); - return -1; - } - pcl::console::print_info("\nFound pcd file.\n"); - pcl::console::print_info ("[done, "); - pcl::console::print_value ("%g", tt.toc ()); - pcl::console::print_info (" ms : "); - pcl::console::print_value ("%d", input_cloud->size ()); - pcl::console::print_info (" points]\n"); - }else if(file_is_ply){ - pcl::io::loadPLYFile(argv[filenames[0]],*input_cloud); - if(input_cloud->points.size()<=0 or input_cloud->points.at(0).x <=0 and input_cloud->points.at(0).y <=0 and input_cloud->points.at(0).z <=0){ - pcl::console::print_warn("\nloadPLYFile could not read the cloud, attempting to loadPolygonFile...\n"); - pcl::io::loadPolygonFile(argv[filenames[0]], cl); - pcl::fromPCLPointCloud2(cl.cloud, *input_cloud); - if(input_cloud->points.size()<=0 or input_cloud->points.at(0).x <=0 and input_cloud->points.at(0).y <=0 and input_cloud->points.at(0).z <=0){ - pcl::console::print_warn("\nloadPolygonFile could not read the cloud, attempting to PLYReader...\n"); - pcl::PLYReader plyRead; - plyRead.read(argv[filenames[0]],*input_cloud); - if(input_cloud->points.size()<=0 or input_cloud->points.at(0).x <=0 and input_cloud->points.at(0).y <=0 and input_cloud->points.at(0).z <=0){ - pcl::console::print_error("\nError. ply file is not compatible.\n"); - return -1; - } - } - } - - pcl::console::print_info("\nFound ply file.\n"); - pcl::console::print_info ("[done, "); - pcl::console::print_value ("%g", tt.toc ()); - pcl::console::print_info (" ms : "); - pcl::console::print_value ("%d", input_cloud->points.size ()); - pcl::console::print_info (" points]\n"); - - }else if(file_is_txt){ - std::ifstream file(argv[filenames[0]]); - if(!file.is_open()){ - std::cout << "Error: Could not find "<< argv[filenames[0]] << std::endl; - return -1; - } - - std::cout << "file opened." << std::endl; - double x_,y_,z_; - unsigned int r, g, b; - - while(file >> x_ >> y_ >> z_ >> r >> g >> b){ - pcl::PointXYZRGB pt; - pt.x = x_; - pt.y = y_; - pt.z= z_; - - uint8_t r_, g_, b_; - r_ = uint8_t(r); - g_ = uint8_t(g); - b_ = uint8_t(b); - - uint32_t rgb_ = ((uint32_t)r_ << 16 | (uint32_t)g_ << 8 | (uint32_t)b_); - pt.rgb = *reinterpret_cast(&rgb_); - - input_cloud->points.push_back(pt); - //std::cout << "pointXYZRGB:" << pt << std::endl; - } - - pcl::console::print_info("\nFound txt file.\n"); - pcl::console::print_info ("[done, "); - pcl::console::print_value ("%g", tt.toc ()); - pcl::console::print_info (" ms : "); - pcl::console::print_value ("%d", input_cloud->points.size ()); - pcl::console::print_info (" points]\n"); - - }else if(file_is_xyz){ - std::ifstream file(argv[filenames[0]]); - if(!file.is_open()){ - std::cout << "Error: Could not find "<< argv[filenames[0]] << std::endl; - return -1; - } - - std::cout << "file opened." << std::endl; - double x_,y_,z_; - - while(file >> x_ >> y_ >> z_){ - - pcl::PointXYZRGB pt; - pt.x = x_; - pt.y = y_; - pt.z= z_; - - input_cloud->points.push_back(pt); - //std::cout << "pointXYZRGB:" << pt << std::endl; - } - - pcl::console::print_info("\nFound xyz file.\n"); - pcl::console::print_info ("[done, "); - pcl::console::print_value ("%g", tt.toc ()); - pcl::console::print_info (" ms : "); - pcl::console::print_value ("%d", input_cloud->points.size ()); - pcl::console::print_info (" points]\n"); - } - - input_cloud->width = (int) input_cloud->points.size (); - input_cloud->height = 1; - input_cloud->is_dense = true; - - pcl::PointCloud::Ptr output_cloud (new pcl::PointCloud ()); - pcl::PointCloud::Ptr dense_points (new pcl::PointCloud ()); - - pcl::search::KdTree::Ptr kd_tree (new pcl::search::KdTree); - pcl::PointCloud::Ptr mls_points (new pcl::PointCloud()); - pcl::MovingLeastSquares mls; - - double search_radius = 0.03; //0.03 - double sampling_radius = 0.005; //0.005 - double step_size = 0.005; //0.005 - double gauss_param = (double)std::pow(search_radius,2); - int pol_order = 2; - unsigned int num_threats = 1; - - mls.setComputeNormals(true); - mls.setInputCloud(input_cloud); - mls.setSearchMethod(kd_tree); - mls.setSearchRadius(search_radius); - mls.setUpsamplingMethod(pcl::MovingLeastSquares::UpsamplingMethod::SAMPLE_LOCAL_PLANE); - mls.setUpsamplingRadius(sampling_radius); - mls.setUpsamplingStepSize(step_size); - mls.setPolynomialOrder(pol_order); - mls.setSqrGaussParam(gauss_param);// (the square of the search radius works best in general) - mls.setCacheMLSResults(true);//Set whether the mls results should be stored for each point in the input cloud. - mls.setNumberOfThreads(num_threats); - //mls.setDilationVoxelSize();//Used only in the VOXEL_GRID_DILATION upsampling method - //mls.setPointDensity(15); //15 - mls.process(*dense_points); - - *output_cloud = *input_cloud; - *output_cloud += *dense_points; - - pcl::console::print_info("\nNew points: "); - pcl::console::print_value("%d", dense_points->points.size()); - - pcl::console::print_info("\nOutput cloud points: "); - pcl::console::print_value("%d", output_cloud->points.size()); - pcl::console::print_info("\n"); - - vtkObject::GlobalWarningDisplayOff(); // Disable vtk render warning - boost::shared_ptr viewer (new pcl::visualization::PCLVisualizer ("VISUALIZER")); - - int PORT1 = 0; - viewer->createViewPort(0.0, 0.0, 0.5, 1.0, PORT1); - viewer->setBackgroundColor (0, 0, 0, PORT1); - viewer->addText("ORIGINAL", 10, 10, "PORT1", PORT1); - - int PORT2 = 0; - viewer->createViewPort(0.5, 0.0, 1.0, 1.0, PORT2); - viewer->setBackgroundColor (0, 0, 0, PORT2); - viewer->addText("UPSAMPLING", 10, 10, "PORT2", PORT2); - - viewer->removeAllPointClouds(0); - - if(input_cloud->points[0].r <= 0 and input_cloud->points[0].g <= 0 and input_cloud->points[0].b<= 0 ){ - pcl::visualization::PointCloudColorHandlerCustom color_handler(input_cloud,255,255,0); - viewer->addPointCloud(input_cloud,color_handler,"Original",PORT1); - }else{ - viewer->addPointCloud(input_cloud,"Original",PORT1); - } - - if(output_cloud->points[0].r <= 0 and output_cloud->points[0].g <= 0 and output_cloud->points[0].b<= 0 ){ - pcl::visualization::PointCloudColorHandlerCustom color_handler(output_cloud,255,255,0); - viewer->addPointCloud(output_cloud,color_handler,"transform1 rvec",PORT2); - }else{ - viewer->addPointCloud(output_cloud,"transform1 rvec",PORT2); - } - - pcl::io::savePCDFile ("upsampled_cloud.pcd", *output_cloud); - - pcl::PointXYZ p1, p2, p3; - p1.getArray3fMap() << 1, 0, 0; - p2.getArray3fMap() << 0, 1, 0; - p3.getArray3fMap() << 0,0.1,1; - - viewer->addCoordinateSystem(1,"original_usc",PORT1); - viewer->addText3D("x", p1, 0.2, 1, 0, 0, "x_",PORT1); - viewer->addText3D("y", p2, 0.2, 0, 1, 0, "y_",PORT1); - viewer->addText3D ("z", p3,0.2, 0, 0, 1, "z_",PORT1); - - viewer->addCoordinateSystem(1,"transform_ucs",PORT2); - viewer->addText3D("x", p1, 0.2, 1, 0, 0, "x_",PORT2); - viewer->addText3D("y", p2, 0.2, 0, 1, 0, "y_",PORT2); - viewer->addText3D ("z", p3,0.2, 0, 0, 1, "z_",PORT2); - - viewer->setPosition(0,0); - viewer->initCameraParameters(); - viewer->resetCamera(); - - std::cout << "\nPress [q] to exit" << std::endl; - - while(!viewer->wasStopped ()) { - viewer->spin(); - } - - return 0; - +#include "cloudparse/parser.hpp" + +void printUsage(const char* progName) { std::cout << "\nUse: " << progName << " " << std::endl << "support: .pcd .ply .txt .xyz" << std::endl << "[q] to exit" << std::endl; } + +int main(int argc, char** argv) { + if (argc < 2 or argc > 2) { + printUsage(argv[0]); + return -1; + } + + // -----------------Read input cloud file ----------------- + pcl::PointCloud::Ptr input_cloud(new pcl::PointCloud()); + + // cloud parser object + CloudParserLibrary::ParserCloudFile cloud_parser; + cloud_parser.load_cloudfile(argv[1], input_cloud); + + // set cloud metadata + input_cloud->width = (int)input_cloud->points.size(); + input_cloud->height = 1; + input_cloud->is_dense = true; + + pcl::PointCloud::Ptr output_cloud(new pcl::PointCloud()); + pcl::PointCloud::Ptr dense_points(new pcl::PointCloud()); + + pcl::search::KdTree::Ptr kd_tree(new pcl::search::KdTree); + pcl::PointCloud::Ptr mls_points(new pcl::PointCloud()); + pcl::MovingLeastSquares mls; + + double search_radius = 0.03; // 0.03 + double sampling_radius = 0.005; // 0.005 + double step_size = 0.005; // 0.005 + double gauss_param = (double)std::pow(search_radius, 2); + int pol_order = 2; + unsigned int num_threats = 1; + + mls.setComputeNormals(true); + mls.setInputCloud(input_cloud); + mls.setSearchMethod(kd_tree); + mls.setSearchRadius(search_radius); + mls.setUpsamplingMethod(pcl::MovingLeastSquares::UpsamplingMethod::SAMPLE_LOCAL_PLANE); + mls.setUpsamplingRadius(sampling_radius); + mls.setUpsamplingStepSize(step_size); + mls.setPolynomialOrder(pol_order); + mls.setSqrGaussParam(gauss_param); // (the square of the search radius works best in general) + mls.setCacheMLSResults(true); // Set whether the mls results should be stored for each point in the input cloud. + mls.setNumberOfThreads(num_threats); + // mls.setDilationVoxelSize();//Used only in the VOXEL_GRID_DILATION upsampling method + // mls.setPointDensity(15); //15 + mls.process(*dense_points); + + *output_cloud = *input_cloud; + *output_cloud += *dense_points; + + pcl::console::print_info("\nNew points: "); + pcl::console::print_value("%d", dense_points->points.size()); + + pcl::console::print_info("\nOutput cloud points: "); + pcl::console::print_value("%d", output_cloud->points.size()); + pcl::console::print_info("\n"); + + vtkObject::GlobalWarningDisplayOff(); // Disable vtk render warning + boost::shared_ptr viewer(new pcl::visualization::PCLVisualizer("VISUALIZER")); + + int PORT1 = 0; + viewer->createViewPort(0.0, 0.0, 0.5, 1.0, PORT1); + viewer->setBackgroundColor(0, 0, 0, PORT1); + viewer->addText("ORIGINAL", 10, 10, "PORT1", PORT1); + + int PORT2 = 0; + viewer->createViewPort(0.5, 0.0, 1.0, 1.0, PORT2); + viewer->setBackgroundColor(0, 0, 0, PORT2); + viewer->addText("UPSAMPLING", 10, 10, "PORT2", PORT2); + + viewer->removeAllPointClouds(0); + + if (input_cloud->points[0].r <= 0 and input_cloud->points[0].g <= 0 and input_cloud->points[0].b <= 0) { + pcl::visualization::PointCloudColorHandlerCustom color_handler(input_cloud, 255, 255, 0); + viewer->addPointCloud(input_cloud, color_handler, "Original", PORT1); + } else { + viewer->addPointCloud(input_cloud, "Original", PORT1); + } + + if (output_cloud->points[0].r <= 0 and output_cloud->points[0].g <= 0 and output_cloud->points[0].b <= 0) { + pcl::visualization::PointCloudColorHandlerCustom color_handler(output_cloud, 255, 255, 0); + viewer->addPointCloud(output_cloud, color_handler, "transform1 rvec", PORT2); + } else { + viewer->addPointCloud(output_cloud, "transform1 rvec", PORT2); + } + + pcl::io::savePCDFile("upsampled_cloud.pcd", *output_cloud); + + pcl::PointXYZ p1, p2, p3; + p1.getArray3fMap() << 1, 0, 0; + p2.getArray3fMap() << 0, 1, 0; + p3.getArray3fMap() << 0, 0.1, 1; + + viewer->addCoordinateSystem(1, "original_usc", PORT1); + viewer->addText3D("x", p1, 0.2, 1, 0, 0, "x_", PORT1); + viewer->addText3D("y", p2, 0.2, 0, 1, 0, "y_", PORT1); + viewer->addText3D("z", p3, 0.2, 0, 0, 1, "z_", PORT1); + + viewer->addCoordinateSystem(1, "transform_ucs", PORT2); + viewer->addText3D("x", p1, 0.2, 1, 0, 0, "x_", PORT2); + viewer->addText3D("y", p2, 0.2, 0, 1, 0, "y_", PORT2); + viewer->addText3D("z", p3, 0.2, 0, 0, 1, "z_", PORT2); + + viewer->setPosition(0, 0); + viewer->initCameraParameters(); + viewer->resetCamera(); + + std::cout << "\nPress [q] to exit" << std::endl; + + while (!viewer->wasStopped()) { + viewer->spin(); + } + + return 0; } From ae8b6bec0de4d050ea9123fddeb7ef020a14e7b8 Mon Sep 17 00:00:00 2001 From: Daniel Tobon Date: Wed, 10 Aug 2022 07:44:47 -0500 Subject: [PATCH 2/5] added clang format config --- .clang-format | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..14c70c7 --- /dev/null +++ b/.clang-format @@ -0,0 +1,2 @@ +BasedOnStyle: Google +ColumnLimit: 180 \ No newline at end of file From 4cb8b52ce2ad023c33cdf5d7e05cc233db828648 Mon Sep 17 00:00:00 2001 From: Daniel Tobon Date: Wed, 10 Aug 2022 07:44:59 -0500 Subject: [PATCH 3/5] added gitignore file --- .gitignore | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9c32a71 --- /dev/null +++ b/.gitignore @@ -0,0 +1,41 @@ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# Folders +build/ +build-vscode/ +PCL-Build-Action/ +.vscode + +# nektos/act secrets +.secrets \ No newline at end of file From 34fdf6debcaee377397d006fa36fb307ff5610da Mon Sep 17 00:00:00 2001 From: Daniel Tobon Date: Wed, 10 Aug 2022 07:45:13 -0500 Subject: [PATCH 4/5] added functions.cmake module --- cmake/functions.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 cmake/functions.cmake diff --git a/cmake/functions.cmake b/cmake/functions.cmake new file mode 100644 index 0000000..24d38fc --- /dev/null +++ b/cmake/functions.cmake @@ -0,0 +1,10 @@ +include(FetchContent) + +function(fetch_project) + cmake_parse_arguments(FETCH_SOURCE "" "NAME;URL" "" ${ARGN}) + FetchContent_Declare(${FETCH_SOURCE_NAME} + URL ${FETCH_SOURCE_URL} + ) + + FetchContent_MakeAvailable(${FETCH_SOURCE_NAME}) +endfunction() \ No newline at end of file From 1732fe0878a733573b67ac8cc78ee63240c81b3c Mon Sep 17 00:00:00 2001 From: Daniel Tobon Date: Wed, 10 Aug 2022 07:45:27 -0500 Subject: [PATCH 5/5] refactored CMakeLists.txt --- CMakeLists.txt | 106 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..de645db --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,106 @@ +# ############################################################################# +# CMAKE CONFIGURATION +# ############################################################################# +cmake_minimum_required(VERSION 3.15 FATAL_ERROR) + +set(CMAKE_BUILD_TYPE_INIT Release) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") + +include("${CMAKE_CURRENT_LIST_DIR}/cmake/functions.cmake") + +project(upsampling_cloud VERSION 1.1.0 LANGUAGES CXX) + +message("\n" "=========================================") +message("Project: ${PROJECT_NAME} ") +message("=========================================") + +# set the CMP0074 policy to old behavior (disable warnings) (CMake 3.12.0-rc1) +if(${CMAKE_VERSION} MATCHES 3.12.0) + cmake_policy(SET CMP0074 OLD) + + if(POLICY CMP0048) + cmake_policy(SET CMP0048 NEW) + endif(POLICY CMP0048) +endif() + +# ############################################################################# +# PACKAGES +# ############################################################################# +find_package(PCL 1.8 REQUIRED QUIET) + +if(PCL_FOUND) + message(STATUS "PCL status:") + message(STATUS " version: ${PCL_VERSION}") + message(STATUS " directory: ${PCL_DIR}") +else() + message(FATAL_ERROR " ERROR: PCL minimum required version 1.8. Not found") +endif() + +fetch_project( + NAME cloudparse + URL https://github.com/danielTobon43/cloudparse/archive/v0.2.1.tar.gz +) + +# ############################################################################# +# SOURCE CODE +# ############################################################################# +set(MAIN_SOURCE "src/main.cpp") + +# ############################################################################# +# EXECUTABLES +# ############################################################################# +add_executable(${PROJECT_NAME} ${MAIN_SOURCE}) + +# ############################################################################# +# HEADERS +# ############################################################################# +target_include_directories(${PROJECT_NAME} PRIVATE + ${PCL_INCLUDE_DIRS} +) + +# ############################################################################# +# TARGET LIBRARIES +# ############################################################################# +target_link_libraries(${PROJECT_NAME} PRIVATE + ${PCL_LIBRARIES} + cloudparse +) + +# ############################################################################# +# COMPILATION FLAGS: MMX, SSE(1, 2, 3, 3S, 4.1, 4.2), CLMUL, RdRand, VT-x, x86-64 +# ############################################################################# +target_compile_options(${PROJECT_NAME} PRIVATE -Wno-cpp + -mmmx + -msse + -msse2 + -msse3 + -mssse3 + -msse4.2 + -msse4.1 + -mno-sse4a + -mno-avx + -mno-avx2 + -mno-fma + -mno-fma4 + -mno-f16c + -mno-xop + -mno-bmi + -mno-bmi2 + -mrdrnd + -mno-3dnow + -mlzcnt + -mfsgsbase + -mpclmul +) + +# ############################################################################# +# INSTALL DIRECTORY +# ############################################################################# +install(TARGETS ${PROJECT_NAME} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) + +message("=========================================") +message("Project: ${PROJECT_NAME} COMPILED WITH CMAKE " ${CMAKE_VERSION}) +message("=========================================")