Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class MeshSource : public Source<PointInT> {
std::vector<std::string> files;
std::string start;
std::string ext = std::string("ply");
bf::path dir = path_;
pcl_fs::path dir = path_;
getModelsInDirectory(dir, start, files, ext);

models_.reset(new std::vector<ModelT>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ class RegisteredViewsSource : public Source<PointInT> {
}

void
getViewsFilenames(bf::path& path_with_views, std::vector<std::string>& view_filenames)
getViewsFilenames(pcl_fs::path& path_with_views,
std::vector<std::string>& view_filenames)
{
int number_of_views = 0;
for (const auto& dir_entry : bf::directory_iterator(path_with_views)) {
if (!(bf::is_directory(dir_entry))) {
for (const auto& dir_entry : pcl_fs::directory_iterator(path_with_views)) {
if (!(pcl_fs::is_directory(dir_entry))) {
std::vector<std::string> strs;
std::vector<std::string> strs_;

Expand Down Expand Up @@ -101,19 +102,19 @@ class RegisteredViewsSource : public Source<PointInT> {
loadOrGenerate(std::string& dir, std::string& model_path, ModelT& model)
{
const std::string pathmodel = dir + '/' + model.class_ + '/' + model.id_;
const bf::path trained_dir = pathmodel;
const pcl_fs::path trained_dir = pathmodel;

model.views_.reset(new std::vector<typename pcl::PointCloud<PointInT>::Ptr>);
model.poses_.reset(
new std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f>>);
model.self_occlusions_.reset(new std::vector<float>);

if (bf::exists(trained_dir)) {
if (pcl_fs::exists(trained_dir)) {
// load views and poses
std::vector<std::string> view_filenames;
for (const auto& dir_entry : bf::directory_iterator(trained_dir)) {
for (const auto& dir_entry : pcl_fs::directory_iterator(trained_dir)) {
// check if its a directory, then get models in it
if (!(bf::is_directory(*itr))) {
if (!(pcl_fs::is_directory(*itr))) {
// check that it is a ply file and then add, otherwise ignore..
std::vector<std::string> strs;
std::vector<std::string> strs_;
Expand Down Expand Up @@ -174,7 +175,7 @@ class RegisteredViewsSource : public Source<PointInT> {
createClassAndModelDirectories(dir, model.class_, model.id_);

std::vector<std::string> view_filenames;
bf::path model_dir = model_path;
pcl_fs::path model_dir = model_path;

getViewsFilenames(model_dir, view_filenames);
std::cout << view_filenames.size() << std::endl;
Expand Down Expand Up @@ -213,11 +214,11 @@ class RegisteredViewsSource : public Source<PointInT> {
}

bool
isleafDirectory(bf::path& path)
isleafDirectory(pcl_fs::path& path)
{
bool no_dirs_inside = true;
for (const auto& dir_entry : bf::directory_iterator(path)) {
if (bf::is_directory(dir_entry)) {
for (const auto& dir_entry : pcl_fs::directory_iterator(path)) {
if (pcl_fs::is_directory(dir_entry)) {
no_dirs_inside = false;
}
}
Expand All @@ -226,16 +227,16 @@ class RegisteredViewsSource : public Source<PointInT> {
}

void
getModelsInDirectory(bf::path& dir,
getModelsInDirectory(pcl_fs::path& dir,
std::string& rel_path_so_far,
std::vector<std::string>& relative_paths)
{
for (const auto& dir_entry : bf::directory_iterator(dir)) {
for (const auto& dir_entry : pcl_fs::directory_iterator(dir)) {
// check if its a directory, then get models in it
if (bf::is_directory(dir_entry)) {
if (pcl_fs::is_directory(dir_entry)) {
std::string so_far =
rel_path_so_far + (dir_entry.path().filename()).string() + '/';
bf::path curr_path = dir_entry.path();
pcl_fs::path curr_path = dir_entry.path();

if (isleafDirectory(curr_path)) {
std::string path = rel_path_so_far + (dir_entry.path().filename()).string();
Expand All @@ -262,7 +263,7 @@ class RegisteredViewsSource : public Source<PointInT> {
// get models in directory
std::vector<std::string> files;
std::string start = "";
bf::path dir = path_;
pcl_fs::path dir = path_;
getModelsInDirectory(dir, start, files);

models_.reset(new std::vector<ModelT>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
#pragma once

#include <pcl/apps/3d_rec_framework/utils/persistence_utils.h>
#include <pcl/common/pcl_filesystem.h>
#include <pcl/filters/voxel_grid.h>

#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>

namespace bf = boost::filesystem;

namespace pcl {
namespace rec_3d_framework {
Expand Down Expand Up @@ -91,25 +89,25 @@ class Source {
std::string& id,
std::string& classname)
{
const bf::path path = filename;
const pcl_fs::path path = filename;
classname = path.parent_path().string() + '/';
id = path.stem().string();
}

void
createTrainingDir(std::string& training_dir)
{
bf::path trained_dir = training_dir;
if (!bf::exists(trained_dir))
bf::create_directory(trained_dir);
pcl_fs::path trained_dir = training_dir;
if (!pcl_fs::exists(trained_dir))
pcl_fs::create_directory(trained_dir);
}

void
createClassAndModelDirectories(std::string& training_dir,
std::string& class_str,
std::string& id_str)
{
bf::create_directories(training_dir + '/' + class_str + '/' + id_str);
pcl_fs::create_directories(training_dir + '/' + class_str + '/' + id_str);
}

public:
Expand Down Expand Up @@ -137,18 +135,18 @@ class Source {
}

void
getModelsInDirectory(bf::path& dir,
getModelsInDirectory(pcl_fs::path& dir,
std::string& rel_path_so_far,
std::vector<std::string>& relative_paths,
std::string& ext)
{
for (const auto& dir_entry : bf::directory_iterator(dir)) {
for (const auto& dir_entry : pcl_fs::directory_iterator(dir)) {
// check if its a directory, then get models in it
if (bf::is_directory(dir_entry)) {
if (pcl_fs::is_directory(dir_entry)) {
std::string so_far =
rel_path_so_far + (dir_entry.path().filename()).string() + '/';

bf::path curr_path = dir_entry.path();
pcl_fs::path curr_path = dir_entry.path();
getModelsInDirectory(curr_path, so_far, relative_paths, ext);
}
else {
Expand Down Expand Up @@ -205,7 +203,7 @@ class Source {
bool
modelAlreadyTrained(ModelT m, std::string& base_dir, std::string& descr_name)
{
return bf::exists(getModelDescriptorDir(m, base_dir, descr_name));
return pcl_fs::exists(getModelDescriptorDir(m, base_dir, descr_name));
}

std::string
Expand All @@ -219,9 +217,9 @@ class Source {
{
std::string dir = getModelDescriptorDir(m, base_dir, descr_name);

bf::path desc_dir = dir;
if (bf::exists(desc_dir))
bf::remove_all(desc_dir);
pcl_fs::path desc_dir = dir;
if (pcl_fs::exists(desc_dir))
pcl_fs::remove_all(desc_dir);
}

void
Expand Down
15 changes: 4 additions & 11 deletions cmake/pcl_find_boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,10 @@ else()
endif()
endif()

if(CMAKE_CXX_STANDARD MATCHES "14")
# Optional boost modules
set(BOOST_OPTIONAL_MODULES serialization mpi)
# Required boost modules
set(BOOST_REQUIRED_MODULES filesystem iostreams)
else()
# Optional boost modules
set(BOOST_OPTIONAL_MODULES filesystem serialization mpi)
# Required boost modules
set(BOOST_REQUIRED_MODULES iostreams)
endif()
# Optional boost modules (filesystem no longer needed - using std::filesystem with C++17)
set(BOOST_OPTIONAL_MODULES serialization mpi)
# Required boost modules
set(BOOST_REQUIRED_MODULES iostreams)

find_package(Boost 1.71.0 QUIET COMPONENTS ${BOOST_OPTIONAL_MODULES} CONFIG)
find_package(Boost 1.71.0 REQUIRED COMPONENTS ${BOOST_REQUIRED_MODULES} CONFIG)
Expand Down
3 changes: 0 additions & 3 deletions cmake/pcl_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ set(PCL_QHULL_REQUIRED_TYPE "DONTCARE" CACHE STRING "Select build type to use ST
set_property(CACHE PCL_QHULL_REQUIRED_TYPE PROPERTY STRINGS DONTCARE SHARED STATIC)
mark_as_advanced(PCL_QHULL_REQUIRED_TYPE)

option(PCL_PREFER_BOOST_FILESYSTEM "Prefer boost::filesystem over std::filesystem (if compiled as C++17 or higher, std::filesystem is chosen by default)" OFF)
mark_as_advanced(PCL_PREFER_BOOST_FILESYSTEM)

set(PCL_XYZ_POINT_TYPES "(pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZL)(pcl::PointXYZRGBA)(pcl::PointXYZRGB)(pcl::PointXYZRGBL)(pcl::PointXYZLAB)(pcl::PointXYZHSV)(pcl::InterestPoint)(pcl::PointNormal)(pcl::PointXYZRGBNormal)(pcl::PointXYZINormal)(pcl::PointXYZLNormal)(pcl::PointWithRange)(pcl::PointWithViewpoint)(pcl::PointWithScale)(pcl::PointSurfel)(pcl::PointDEM)" CACHE STRING "Point types with xyz information for which PCL classes will be instantiated. Alternative to PCL_ONLY_CORE_POINT_TYPES. You can remove unneeded types to reduce compile time and library size.")
mark_as_advanced(PCL_XYZ_POINT_TYPES)

Expand Down
12 changes: 1 addition & 11 deletions cmake/pcl_pclconfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ set(PCLCONFIG_SSE_DEFINITIONS "${SSE_DEFINITIONS}")
set(PCLCONFIG_SSE_COMPILE_OPTIONS ${SSE_FLAGS})
set(PCLCONFIG_AVX_COMPILE_OPTIONS ${AVX_FLAGS})

# Eigen has a custom mechanism to guarantee aligned memory (used for everything older than C++17, see Memory.h in the Eigen project)
# If PCL is compiled with C++14 and the user project is compiled with C++17, this will lead to problems (e.g. memory allocated with the custom mechanism but freed without it)
# Defining EIGEN_HAS_CXX17_OVERALIGN=0 forces Eigen in the user project to use Eigen's custom mechanism, even in C++17 and newer.
if(${CMAKE_CXX_STANDARD} LESS 17)
string(APPEND PCLCONFIG_SSE_DEFINITIONS " -DEIGEN_HAS_CXX17_OVERALIGN=0")
endif()

foreach(_ss ${PCL_SUBSYSTEMS_MODULES})
PCL_GET_SUBSYS_STATUS(_status ${_ss})

Expand Down Expand Up @@ -85,10 +78,7 @@ foreach(_ss ${PCL_SUBSYSTEMS_MODULES})
endforeach()

#Boost modules
set(PCLCONFIG_AVAILABLE_BOOST_MODULES "system iostreams")
if(Boost_FILESYSTEM_FOUND)
string(APPEND PCLCONFIG_AVAILABLE_BOOST_MODULES " filesystem")
endif()
set(PCLCONFIG_AVAILABLE_BOOST_MODULES "iostreams")
if(Boost_SERIALIZATION_FOUND)
string(APPEND PCLCONFIG_AVAILABLE_BOOST_MODULES " serialization")
endif()
Expand Down
10 changes: 1 addition & 9 deletions common/include/pcl/common/pcl_filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@

#pragma once

#include <pcl/pcl_config.h> // for PCL_PREFER_BOOST_FILESYSTEM

#if (__cplusplus >= 201703L) && !defined(PCL_PREFER_BOOST_FILESYSTEM)
#define PCL_USING_STD_FILESYSTEM
#include <filesystem>

namespace pcl_fs = std::filesystem;
#else
#define PCL_USING_BOOST_FILESYSTEM
#include <boost/filesystem.hpp>
namespace pcl_fs = boost::filesystem;
#endif
2 changes: 0 additions & 2 deletions cuda/apps/src/kinect_mapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/visualization/point_cloud_handlers.h>

#include <boost/filesystem.hpp>

#include <Eigen/Core>
#include <Eigen/Geometry>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
#include <pcl/io/pcd_grabber.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/png_io.h>
#include <boost/filesystem.hpp>

#include <iostream>

Expand Down
2 changes: 1 addition & 1 deletion examples/outofcore/example_outofcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main (int, char** argv)
Eigen::Vector3d max (10.0, 10.0, 10.0);

//specify the destination of the tree
boost::filesystem::path file_location ("tree/tree.oct_idx");
pcl_fs::path file_location ("tree/tree.oct_idx");

//create the tree with bounding box that will encompass the region of points in the PCD files
OctreeDisk* octree;
Expand Down
2 changes: 1 addition & 1 deletion examples/outofcore/example_outofcore_with_lod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int main (int, char** argv)
int depth = 3;
Eigen::Vector3d min (-10.0, -10.0, -10.0);
Eigen::Vector3d max (10.0, 10.0, 10.0);
boost::filesystem::path file_location ("tree/tree.oct_idx");
pcl_fs::path file_location ("tree/tree.oct_idx");

OctreeDisk* octree;

Expand Down
3 changes: 0 additions & 3 deletions io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,6 @@ add_definitions(${VTK_DEFINES})
PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME} SOURCES ${srcs} ${incs} ${compression_incs} ${impl_incs} ${OPENNI_INCLUDES} ${OPENNI2_INCLUDES})

target_link_libraries("${LIB_NAME}" Boost::boost Boost::iostreams pcl_common pcl_io_ply pcl_octree)
if(TARGET Boost::filesystem)
target_link_libraries("${LIB_NAME}" Boost::filesystem)
endif()

if(VTK_FOUND)
if(${VTK_VERSION} VERSION_GREATER_EQUAL 9.0)
Expand Down
8 changes: 0 additions & 8 deletions io/src/pcd_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ pcl::PCDWriter::setLockingPermissions (const std::string &file_name,

try
{
#ifdef PCL_USING_STD_FILESYSTEM
pcl_fs::permissions (pcl_fs::path (file_name), pcl_fs::perms::set_gid, pcl_fs::perm_options::add);
#else
pcl_fs::permissions (pcl_fs::path (file_name), pcl_fs::add_perms | pcl_fs::set_gid_on_exe);
#endif
}
catch (const std::exception &e)
{
Expand All @@ -95,11 +91,7 @@ pcl::PCDWriter::resetLockingPermissions (const std::string &file_name,
#ifndef NO_MANDATORY_LOCKING
try
{
#ifdef PCL_USING_STD_FILESYSTEM
pcl_fs::permissions (pcl_fs::path (file_name), pcl_fs::perms::set_gid, pcl_fs::perm_options::remove);
#else
pcl_fs::permissions (pcl_fs::path (file_name), pcl_fs::remove_perms | pcl_fs::set_gid_on_exe);
#endif
}
catch (const std::exception &e)
{
Expand Down
11 changes: 3 additions & 8 deletions outofcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ else()
set(SUBSYS_DEPS common io filters octree)
endif()

if(NOT TARGET Boost::filesystem)
set(DEFAULT FALSE)
set(REASON "Boost filesystem is not available.")
else()
set(DEFAULT TRUE)
endif()
set(DEFAULT TRUE)

PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}")
PCL_SUBSYS_DEPEND(build NAME ${SUBSYS_NAME} DEPS ${SUBSYS_DEPS})
Expand Down Expand Up @@ -76,10 +71,10 @@ set(LIB_NAME "pcl_${SUBSYS_NAME}")

if(BUILD_visualization)
PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME} SOURCES ${srcs} ${incs} ${impl_incs} ${visualization_incs})
target_link_libraries("${LIB_NAME}" pcl_common pcl_visualization Boost::filesystem)
target_link_libraries("${LIB_NAME}" pcl_common pcl_visualization)
else()
PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME} SOURCES ${srcs} ${incs} ${impl_incs})
target_link_libraries("${LIB_NAME}" pcl_common Boost::filesystem)
target_link_libraries("${LIB_NAME}" pcl_common)
endif()
if(HAVE_CJSON)
target_link_libraries("${LIB_NAME}" ${CJSON_LIBRARIES})
Expand Down
Loading