Skip to content

Commit

Permalink
Added PCL_IO_ENABLE_MAND_LOCKING cmake flag. (#2315)
Browse files Browse the repository at this point in the history
Add PCL_IO_ENABLE_MAND_LOCKING cmake option
  • Loading branch information
Florian Kramer authored and taketwo committed May 23, 2018
1 parent d1c9870 commit a4e4692
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ endif(WIN32)

PCL_ADD_DOC("${SUBSYS_NAME}")

if(NOT WIN32)
option(PCL_IO_ENABLE_MAND_LOCKING "Enables the use of mandatory locking on filesystems mounted using the mand option." ON)
mark_as_advanced(PCL_IO_ENABLE_MAND_LOCKING)
if (NOT PCL_IO_ENABLE_MAND_LOCKING)
add_definitions(-DNO_MANDATORY_LOCKING)
endif(PCL_IO_ENABLE_MAND_LOCKING)
endif(NOT WIN32)

if(build)
if(WITH_OPENNI2)
set(IMAGE_INCLUDES
Expand Down
4 changes: 4 additions & 0 deletions io/src/pcd_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pcl::PCDWriter::setLockingPermissions (const std::string &file_name,
(void)file_name;
(void)lock;
#ifndef WIN32
#ifndef NO_MANDATORY_LOCKING
// Boost version 1.49 introduced permissions
#if BOOST_VERSION >= 104900
// Attempt to lock the file.
Expand All @@ -93,6 +94,7 @@ pcl::PCDWriter::setLockingPermissions (const std::string &file_name,
}
#endif
#endif
#endif
}

///////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -103,6 +105,7 @@ pcl::PCDWriter::resetLockingPermissions (const std::string &file_name,
(void)file_name;
(void)lock;
#ifndef WIN32
#ifndef NO_MANDATORY_LOCKING
// Boost version 1.49 introduced permissions
#if BOOST_VERSION >= 104900
(void)file_name;
Expand All @@ -118,6 +121,7 @@ pcl::PCDWriter::resetLockingPermissions (const std::string &file_name,
lock.unlock ();
#endif
#endif
#endif
}

///////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit a4e4692

Please sign in to comment.