Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.

Commit 2e5a97f

Browse files
author
Daniel
authored
Merge pull request #11 from danielTobon43/app-dependencies
Set app dependencies
2 parents 2c867e8 + 43e945b commit 2e5a97f

File tree

9 files changed

+59
-94
lines changed

9 files changed

+59
-94
lines changed

CMakeLists.txt

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR)
55

66
# set project name
7-
project(app VERSION 1.0.3)
7+
project(app VERSION 1.0.5)
88

99
# set build type = Debug mode
10-
set(CMAKE_BUILD_TYPE Debug)
10+
set(CMAKE_BUILD_TYPE Release)
1111

1212
include("${CMAKE_CURRENT_LIST_DIR}/cmake/color.cmake")
1313

@@ -22,18 +22,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
2222
# #############################################################################
2323
# PACKAGES
2424
# #############################################################################
25-
message("${BoldYellow}***********************")
26-
message("${BoldYellow}VTK PACKAGE")
27-
message("${BoldYellow}***********************")
28-
find_package(VTK 8.1 REQUIRED QUIET)
29-
30-
if(VTK_FOUND)
31-
message(STATUS "${BoldGreen}VTK status:")
32-
message(STATUS " version: ${VTK_VERSION}")
33-
message(STATUS " directory: ${VTK_DIR}")
34-
else()
35-
message(FATAL_ERROR "${BoldRed} ERROR: VTK minimum required version 8.1. Not found")
36-
endif()
25+
# vtkRenderingContext2D vtkRenderingOpenGL2 vtkRenderingCore
26+
find_package(PCL 1.8 REQUIRED QUIET COMPONENTS visualization)
27+
find_package(VTK 8.1 REQUIRED QUIET COMPONENTS vtkRenderingContextOpenGL2)
3728

3829
# #############################################################################
3930
# ADD LIBRARIES FOLDER
@@ -56,9 +47,10 @@ add_executable(${PROJECT_NAME} ${MAIN_SOURCE})
5647
# TARGET LIBRARIES
5748
# #############################################################################
5849
target_include_directories(${PROJECT_NAME} PRIVATE ${VTK_INCLUDE_DIRS} include)
59-
target_link_libraries(${PROJECT_NAME} ${VTK_LIBRARIES} argparse dbscan cloudparse)
50+
target_link_libraries(${PROJECT_NAME} argparse dbscan cloudparse ${VTK_LIBRARIES} ${PCL_VISUALIZATION_LIBRARIES})
6051
target_compile_options(${PROJECT_NAME} PRIVATE -Wno-cpp)
6152

53+
# vtk_module_autoinit(TARGETS ${PROJECT_NAME} MODULES VTK::RenderingContextOpenGL2)
6254
message("${BoldCyan}=========================================")
6355
message("${BoldCyan}Project: ${PROJECT_NAME} COMPILED WITH CMAKE " ${CMAKE_VERSION})
6456
message("${BoldCyan}=========================================")

cmake/CMakeGraphVizOptions.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# https://cmake.org/cmake/help/latest/module/CMakeGraphVizOptions.html
2+
set(GRAPHVIZ_UNKNOWN_LIBS OFF)
3+
set(GRAPHVIZ_EXTERNAL_LIBS ON)
4+
set(GRAPHVIZ_OBJECT_LIBS OFF)
5+
set(GRAPHVIZ_STATIC_LIBS OFF)
6+
set(GRAPHVIZ_GENERATE_DEPENDERS ON)
7+
set(GRAPHVIZ_GENERATE_PER_TARGET ON)
8+
set(GRAPHVIZ_IGNORE_TARGETS "VTK" "Boost" "dl" "libGL" "libexecinfo" "Threads")

cmake/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Generating Dependency Graphs with CMake
2+
By using CMake you can automatically generate dependency graphs
3+
(dot/graphviz) of the targets in your project. This works for
4+
dependencies within the project, as well as dependencies to external
5+
libraries.
6+
7+
![dbscan-dependencies](https://user-images.githubusercontent.com/35694200/178576867-4a78b269-8abd-46c3-912e-a01bb812713e.png)
8+
9+
## Usage
10+
To use it, run cmake in the build tree:
11+
```
12+
cmake --graphviz=test.dot .
13+
```
14+
15+
## Variables specific to the Graphviz support
16+
The resulting graphs can be huge. The look and content of the generated graphs can be controlled using the file `CMakeGraphVizOptions.cmake`. This file is first searched in `CMAKE_BINARY_DIR`, and then in `CMAKE_SOURCE_DIR`. If found, the variables set in it are used to adjust options for the generated Graphviz files.
17+
18+
## Graphviz (.dot) file to .png
19+
```
20+
dot -Tpng test.dot -o foo.png
21+
```
22+
23+
## Reference
24+
- https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/Graphviz
25+
- https://cmake.org/cmake/help/latest/module/CMakeGraphVizOptions.html

dbscanlib/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ project(dbscan
88
LANGUAGES CXX
99
)
1010

11-
find_package(PCL 1.8 REQUIRED QUIET COMPONENTS io common octree visualization kdtree)
11+
set(Eigen3_DIR /usr/share/cmake/Modules)
12+
find_package(Eigen3 REQUIRED)
13+
find_package(PCL 1.8 REQUIRED QUIET COMPONENTS octree kdtree)
1214

1315
if(PCL_FOUND)
1416
message(STATUS "PCL status:")
1517
message(STATUS " version: ${PCL_VERSION}")
1618
message(STATUS " directory: ${PCL_DIR}")
17-
add_definitions(${PCL_DEFINITIONS})
1819
else()
1920
message(FATAL_ERROR " ERROR: PCL minimum required version 1.8. Not found")
2021
endif()
@@ -48,7 +49,8 @@ target_include_directories(${PROJECT_NAME} PUBLIC
4849
# #############################################################################
4950
# LIBRARY DEPENDENCIES
5051
# #############################################################################
51-
target_link_libraries(${PROJECT_NAME} PUBLIC ${PCL_LIBRARIES})
52+
# target_link_libraries(${PROJECT_NAME} PUBLIC ${PCL_LIBRARIES})
53+
target_link_libraries(${PROJECT_NAME} PUBLIC ${PCL_KDTREE_LIBRARY} ${PCL_OCTREE_LIBRARY} Eigen3::Eigen)
5254

5355
# #############################################################################
5456
# COMPILATION FLAGS: MMX, SSE(1, 2, 3, 3S, 4.1, 4.2), CLMUL, RdRand, VT-x, x86-64

dbscanlib/include/dbscan/HTRBasicDataStructures.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/**
22
*@file HTRBasicDataStructures.h
33
*Data structures that do not depend on external classes.
4-
*
4+
* https://pointclouds.org/documentation/tutorials/adding_custom_ptype.html#adding-your-own-custom-pointt-type
55
*/
6-
#include <pcl/pcl_macros.h>
7-
#include <pcl/point_types.h>
8-
#define PCL_NO_PRECOMPILE
9-
#pragma once
6+
107
#ifndef HTR_BASIC_DATA_STRUCTURES_H
118
#define HTR_BASIC_DATA_STRUCTURES_H
9+
#define PCL_NO_PRECOMPILE
10+
11+
#include <pcl/point_types.h>
1212

1313
/// Modified pcl point to include an id.
1414
namespace pcl {

dbscanlib/include/dbscan/OctreeGenerator.h

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,16 @@
44
*
55
*/
66

7-
#define _CRT_SECURE_NO_WARNINGS
8-
97
#ifndef OCTREE_GENERATOR_H
108
#define OCTREE_GENERATOR_H
11-
12-
//#include <pcl/point_cloud.h>
13-
#include <pcl/octree/octree.h>
149
// #include <pcl/octree/octree_impl.h>
1510

1611
#include <pcl/common/centroid.h>
17-
#include <pcl/common/concatenate.h>
18-
#include <pcl/common/copy_point.h>
19-
#include <pcl/common/io.h>
20-
#include <pcl/pcl_macros.h>
21-
#include <pcl/point_types.h>
22-
23-
#include <cstdio>
24-
#include <cstdlib>
25-
#include <fstream>
26-
#include <iostream>
27-
#include <locale> // std::locale, std::isdigit
28-
#include <pcl/impl/point_types.hpp>
29-
#include <string>
12+
#include <pcl/octree/octree.h>
13+
#include <pcl/octree/octree_search.h>
14+
#include <pcl/point_cloud.h>
15+
16+
#include <Eigen/Core>
3017
#include <vector>
3118

3219
#include "HTRBasicDataStructures.h"
@@ -93,28 +80,12 @@ class OctreeGenerator {
9380
void calculateCloudCentroid();
9481
};
9582

96-
/// Initializes pcl's cloud data structure from a vector of any type containing x, y, and z member
97-
/// variables.
83+
/// Initializes pcl's cloud data structure from a vector of any type containing x, y, and z member variables.
9884
///@param[in] points The input data vector.
9985
template <typename T>
10086
void OctreeGenerator::initCloudFromVector(const std::vector<T> &points, const pcl::PointCloud<pcl::PointXYZRGB>::Ptr &input_cloud) {
10187
// Note: Width and Height are only used to store the cloud as an image.
10288
// Source width and height can be used instead of a linear representation.
103-
// pcl::copyPointCloud<pcl::PointXYZRGB, pcl::PointXYZRGB>(*input_cloud, *cloud);
104-
// pcl::PointCloud<pcl::PointXYZRGB>::Ptr new_cloud(new pcl::PointCloud<pcl::PointXYZRGB>());
105-
// pcl::copyPointCloud<pcl::mod_pointXYZ>(*input_cloud, cloud);
106-
/*
107-
for (const pcl::mod_pointXYZ &point : input_cloud) {
108-
point.
109-
cloud->points.push_back(point);
110-
}
111-
*/
112-
// cloud_xyzrgb.reset(new pcl::PointCloud<pcl::PointXYZRGB>());
113-
// pcl::copyPointCloud(*input_cloud, *cloud_xyzrgb);
114-
115-
// cloud_xyzrgb->width = input_cloud->points.size();
116-
// cloud_xyzrgb->height = 1;
117-
11889
cloud->width = input_cloud->points.size();
11990
cloud->height = 1;
12091

dbscanlib/include/dbscan/dbScan.h

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,14 @@
11
#ifndef DBSCAN
22
#define DBSCAN
33

4-
// #include <omp.h>
5-
#include <pcl/common/centroid.h>
6-
#include <pcl/common/common.h>
7-
#include <pcl/common/geometry.h>
8-
#include <pcl/common/transforms.h>
9-
#include <pcl/console/parse.h>
10-
#include <pcl/console/print.h>
11-
#include <pcl/console/time.h>
12-
#include <pcl/io/file_io.h>
13-
#include <pcl/io/io.h>
14-
#include <pcl/io/pcd_io.h>
15-
#include <pcl/io/ply/ply.h>
16-
#include <pcl/io/ply/ply_parser.h>
17-
#include <pcl/io/ply_io.h>
18-
#include <pcl/io/vtk_io.h>
19-
#include <pcl/io/vtk_lib_io.h>
20-
#include <pcl/pcl_macros.h>
21-
#include <pcl/point_types.h>
22-
#include <pcl/visualization/pcl_visualizer.h>
23-
#include <stdio.h>
24-
25-
#include <algorithm>
26-
#include <chrono>
27-
#include <cmath>
28-
#include <random>
29-
#include <vector>
30-
314
#include "HTRBasicDataStructures.h"
325
#include "OctreeGenerator.h"
336
#include "cluster.h"
347

358
namespace dbScanSpace {
369
class dbscan {
3710
public:
11+
dbscan(const char *filename, const int octreeResolution_, const float eps_, const int minPtsAux_, const int minPts_);
3812
dbscan();
3913
~dbscan();
4014

dbscanlib/src/OctreeGenerator.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
#include <dbscan/OctreeGenerator.h>
22

3-
#include <ctime>
4-
#include <fstream>
5-
6-
using std::ifstream;
7-
using std::iterator;
8-
93
namespace htr {
104

115
/// The default constructor.

parser/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ include(GNUInstallDirs)
1010
include(CMakePackageConfigHelpers)
1111
string(REPLACE "/${CMAKE_LIBRARY_ARCHITECTURE}" "" CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}")
1212

13-
find_package(PCL 1.8 REQUIRED QUIET COMPONENTS io common octree visualization kdtree)
13+
find_package(PCL 1.8 REQUIRED QUIET COMPONENTS io)
1414

1515
if(PCL_FOUND)
1616
message(STATUS "PCL status:")
1717
message(STATUS " version: ${PCL_VERSION}")
1818
message(STATUS " directory: ${PCL_DIR}")
19-
add_definitions(${PCL_DEFINITIONS})
2019
else()
2120
message(FATAL_ERROR " ERROR: PCL minimum required version 1.8. Not found")
2221
endif()
@@ -49,7 +48,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC
4948
# #############################################################################
5049
# LIBRARY DEPENDENCIES
5150
# #############################################################################
52-
target_link_libraries(${PROJECT_NAME} PUBLIC ${PCL_LIBRARIES})
51+
target_link_libraries(${PROJECT_NAME} PUBLIC ${PCL_IO_LIBRARIES})
5352

5453
# #############################################################################
5554
# COMPILATION FLAGS

0 commit comments

Comments
 (0)