Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CMake] Add option to choose pcl::index_t while compiling #4166

Merged
merged 18 commits into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from 8 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
6 changes: 6 additions & 0 deletions cmake/pcl_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,9 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
option(BUILD_tools "Useful PCL-based command line tools" ON)

option(WITH_DOCS "Build doxygen documentation" OFF)

# set index size
set(PCL_SIZE_INDEX 32 CACHE STRING "Set index size. Available options are: 8 16 32 64")
SergioRAgostinho marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please read the note in types.h regarding the default size. It can't be 32 for PCL 1.11 due to compatibility. It can be 32 for PCL 1.12 since the user can then override the size at compile time

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would modifying types.h to be

#if PCL_MINOR_VERSION <= 11
// sizeof returns bytes, while we measure size by bits in the template
#undef PCL_INDEX_SIZE
#define PCL_INDEX_SIZE (sizeof(int) * 8)
#else
#ifndef PCL_INDEX_SIZE
#define PCL_INDEX_SIZE 32
#endif  // PCL_INDEX_SIZE
#endif  // PCL_MINOR_VERSION

be an option or should the changes be made solely in the cmake configuration?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can modify anything as long as it keeps the behavior (and is sane) 😄


#set whether indices are signed or unsigned
set(PCL_SIGNED_INDEX true CACHE STRING "Set whether indices need to be signed or unsigned. Signed by default.")
SergioRAgostinho marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion common/include/pcl/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
* \ingroup common
*/

#include <pcl/pcl_config.h>
#include <pcl/pcl_macros.h>

#include <vector>

#include <cstdint>
Expand Down
4 changes: 4 additions & 0 deletions pcl_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@
PCL_VERSION_CALC(PCL_MAJOR_VERSION, PCL_MINOR_VERSION, PCL_REVISION_VERSION)
#define PCL_VERSION_COMPARE(OP, MAJ, MIN, PATCH) \
(PCL_VERSION*10+PCL_DEV_VERSION OP PCL_VERSION_CALC(MAJ, MIN, PATCH)*10)
/* Index type and signed/unsigned property */
#define PCL_INDEX_SIZE ${PCL_SIZE_INDEX}
#define PCL_INDEX_SIGNED ${PCL_SIGNED_INDEX}

#cmakedefine HAVE_TBB 1
SergioRAgostinho marked this conversation as resolved.
Show resolved Hide resolved

#cmakedefine HAVE_OPENNI 1

#cmakedefine HAVE_OPENNI2 1


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded?

#cmakedefine HAVE_QHULL 1

#cmakedefine HAVE_QHULL_2011 1
Expand Down