diff --git a/.travis.sh b/.travis.sh index 5cf78dafc03..f65d01b6a84 100755 --- a/.travis.sh +++ b/.travis.sh @@ -10,35 +10,111 @@ ADVANCED_DIR=$BUILD_DIR/doc/advanced/html CMAKE_C_FLAGS="-Wall -Wextra -Wabi -O2" CMAKE_CXX_FLAGS="-Wall -Wextra -Wabi -O2" -DOWNLOAD_DIR=$HOME/download - -export FLANN_ROOT=$HOME/flann -export VTK_DIR=$HOME/vtk -export QHULL_ROOT=$HOME/qhull -export DOXYGEN_DIR=$HOME/doxygen - function build () { case $CC in - clang ) build_clang;; - gcc ) build_gcc;; + clang ) build_lib;; + gcc ) build_lib_core;; esac } -function build_clang () +function build_lib () +{ + # A complete build + # Configure + mkdir $BUILD_DIR && cd $BUILD_DIR + cmake -DCMAKE_C_FLAGS=$CMAKE_C_FLAGS -DCMAKE_CXX_FLAGS=$CMAKE_CXX_FLAGS \ + -DPCL_ONLY_CORE_POINT_TYPES=ON \ + -DPCL_QT_VERSION=4 \ + -DBUILD_simulation=ON \ + -DBUILD_global_tests=OFF \ + -DBUILD_examples=OFF \ + -DBUILD_tools=OFF \ + -DBUILD_apps=OFF \ + -DBUILD_apps_3d_rec_framework=OFF \ + -DBUILD_apps_cloud_composer=OFF \ + -DBUILD_apps_in_hand_scanner=OFF \ + -DBUILD_apps_modeler=OFF \ + -DBUILD_apps_optronic_viewer=OFF \ + -DBUILD_apps_point_cloud_editor=OFF \ + $PCL_DIR + # Build + make -j2 +} + +function build_examples () +{ + # A complete build + # Configure + mkdir $BUILD_DIR && cd $BUILD_DIR + cmake -DCMAKE_C_FLAGS=$CMAKE_C_FLAGS -DCMAKE_CXX_FLAGS=$CMAKE_CXX_FLAGS \ + -DPCL_ONLY_CORE_POINT_TYPES=ON \ + -DPCL_QT_VERSION=4 \ + -DBUILD_simulation=ON \ + -DBUILD_global_tests=OFF \ + -DBUILD_examples=ON \ + -DBUILD_tools=OFF \ + -DBUILD_apps=OFF \ + -DBUILD_apps_3d_rec_framework=OFF \ + -DBUILD_apps_cloud_composer=OFF \ + -DBUILD_apps_in_hand_scanner=OFF \ + -DBUILD_apps_modeler=OFF \ + -DBUILD_apps_optronic_viewer=OFF \ + -DBUILD_apps_point_cloud_editor=OFF \ + $PCL_DIR + # Build + make -j2 +} + +function build_tools () +{ + # A complete build + # Configure + mkdir $BUILD_DIR && cd $BUILD_DIR + cmake -DCMAKE_C_FLAGS=$CMAKE_C_FLAGS -DCMAKE_CXX_FLAGS=$CMAKE_CXX_FLAGS \ + -DPCL_ONLY_CORE_POINT_TYPES=ON \ + -DPCL_QT_VERSION=4 \ + -DBUILD_simulation=ON \ + -DBUILD_global_tests=OFF \ + -DBUILD_examples=OFF \ + -DBUILD_tools=ON \ + -DBUILD_apps=OFF \ + -DBUILD_apps_3d_rec_framework=OFF \ + -DBUILD_apps_cloud_composer=OFF \ + -DBUILD_apps_in_hand_scanner=OFF \ + -DBUILD_apps_modeler=OFF \ + -DBUILD_apps_optronic_viewer=OFF \ + -DBUILD_apps_point_cloud_editor=OFF \ + $PCL_DIR + # Build + make -j2 +} + +function build_apps () { # A complete build # Configure mkdir $BUILD_DIR && cd $BUILD_DIR cmake -DCMAKE_C_FLAGS=$CMAKE_C_FLAGS -DCMAKE_CXX_FLAGS=$CMAKE_CXX_FLAGS \ -DPCL_ONLY_CORE_POINT_TYPES=ON \ + -DPCL_QT_VERSION=4 \ + -DBUILD_simulation=ON \ -DBUILD_global_tests=OFF \ + -DBUILD_examples=OFF \ + -DBUILD_tools=OFF \ + -DBUILD_apps=ON \ + -DBUILD_apps_3d_rec_framework=ON \ + -DBUILD_apps_cloud_composer=ON \ + -DBUILD_apps_in_hand_scanner=ON \ + -DBUILD_apps_modeler=ON \ + -DBUILD_apps_optronic_viewer=ON \ + -DBUILD_apps_point_cloud_editor=ON \ $PCL_DIR # Build make -j2 } -function build_gcc () +function build_lib_core () { # A reduced build, only pcl_common # Configure @@ -72,15 +148,169 @@ function build_gcc () make -j2 } -function test () +function test_core () { # Configure mkdir $BUILD_DIR && cd $BUILD_DIR cmake -DCMAKE_C_FLAGS=$CMAKE_C_FLAGS \ -DCMAKE_CXX_FLAGS=$CMAKE_CXX_FLAGS \ -DPCL_ONLY_CORE_POINT_TYPES=ON \ + -DPCL_NO_PRECOMPILE=ON \ + -DBUILD_tools=OFF \ + -DBUILD_examples=OFF \ + -DBUILD_apps=OFF \ + -DBUILD_2d=ON \ + -DBUILD_features=ON \ + -DBUILD_filters=ON \ + -DBUILD_geometry=ON \ + -DBUILD_io=ON \ + -DBUILD_kdtree=ON \ + -DBUILD_keypoints=ON \ + -DBUILD_ml=OFF \ + -DBUILD_octree=ON \ + -DBUILD_outofcore=OFF \ + -DBUILD_people=OFF \ + -DBUILD_recognition=OFF \ + -DBUILD_registration=OFF \ + -DBUILD_sample_consensus=ON \ + -DBUILD_search=ON \ + -DBUILD_segmentation=OFF \ + -DBUILD_simulation=OFF \ + -DBUILD_stereo=OFF \ + -DBUILD_surface=OFF \ + -DBUILD_tracking=OFF \ + -DBUILD_visualization=OFF \ -DBUILD_global_tests=ON \ + -DBUILD_tests_2d=ON \ + -DBUILD_tests_common=ON \ + -DBUILD_tests_features=ON \ + -DBUILD_tests_filters=OFF \ + -DBUILD_tests_geometry=ON \ + -DBUILD_tests_io=OFF \ + -DBUILD_tests_kdtree=ON \ + -DBUILD_tests_keypoints=ON \ + -DBUILD_tests_octree=ON \ + -DBUILD_tests_outofcore=OFF \ + -DBUILD_tests_people=OFF \ + -DBUILD_tests_recognition=OFF \ + -DBUILD_tests_registration=OFF \ + -DBUILD_tests_sample_consensus=ON \ + -DBUILD_tests_search=ON \ + -DBUILD_tests_segmentation=OFF \ + -DBUILD_tests_surface=OFF \ + -DBUILD_tests_visualization=OFF \ + $PCL_DIR + # Build and run tests + make -j2 tests +} + +function test_ext_1 () +{ + # Configure + mkdir $BUILD_DIR && cd $BUILD_DIR + cmake -DCMAKE_C_FLAGS=$CMAKE_C_FLAGS \ + -DCMAKE_CXX_FLAGS=$CMAKE_CXX_FLAGS \ + -DPCL_ONLY_CORE_POINT_TYPES=ON \ -DPCL_NO_PRECOMPILE=ON \ + -DBUILD_tools=OFF \ + -DBUILD_examples=OFF \ + -DBUILD_apps=OFF \ + -DBUILD_2d=ON \ + -DBUILD_features=ON \ + -DBUILD_filters=ON \ + -DBUILD_geometry=ON \ + -DBUILD_io=ON \ + -DBUILD_kdtree=ON \ + -DBUILD_keypoints=OFF \ + -DBUILD_ml=OFF \ + -DBUILD_octree=ON \ + -DBUILD_outofcore=ON \ + -DBUILD_people=OFF \ + -DBUILD_recognition=OFF \ + -DBUILD_registration=ON \ + -DBUILD_sample_consensus=ON \ + -DBUILD_search=ON \ + -DBUILD_segmentation=OFF \ + -DBUILD_simulation=OFF \ + -DBUILD_stereo=OFF \ + -DBUILD_surface=ON \ + -DBUILD_tracking=OFF \ + -DBUILD_visualization=ON \ + -DBUILD_global_tests=ON \ + -DBUILD_tests_2d=OFF \ + -DBUILD_tests_common=OFF \ + -DBUILD_tests_features=OFF \ + -DBUILD_tests_filters=OFF \ + -DBUILD_tests_geometry=OFF \ + -DBUILD_tests_io=ON \ + -DBUILD_tests_kdtree=OFF \ + -DBUILD_tests_keypoints=OFF \ + -DBUILD_tests_octree=OFF \ + -DBUILD_tests_outofcore=ON \ + -DBUILD_tests_people=OFF \ + -DBUILD_tests_recognition=OFF \ + -DBUILD_tests_registration=ON \ + -DBUILD_tests_sample_consensus=OFF \ + -DBUILD_tests_search=OFF \ + -DBUILD_tests_segmentation=OFF \ + -DBUILD_tests_surface=ON \ + -DBUILD_tests_visualization=ON \ + $PCL_DIR + # Build and run tests + make tests +} + +function test_ext_2 () +{ + # Configure + mkdir $BUILD_DIR && cd $BUILD_DIR + cmake -DCMAKE_C_FLAGS=$CMAKE_C_FLAGS \ + -DCMAKE_CXX_FLAGS=$CMAKE_CXX_FLAGS \ + -DPCL_ONLY_CORE_POINT_TYPES=ON \ + -DPCL_NO_PRECOMPILE=ON \ + -DBUILD_tools=OFF \ + -DBUILD_examples=OFF \ + -DBUILD_apps=OFF \ + -DBUILD_2d=ON \ + -DBUILD_features=ON \ + -DBUILD_filters=ON \ + -DBUILD_geometry=ON \ + -DBUILD_io=ON \ + -DBUILD_kdtree=ON \ + -DBUILD_keypoints=OFF \ + -DBUILD_ml=ON \ + -DBUILD_octree=ON \ + -DBUILD_outofcore=OFF \ + -DBUILD_people=ON \ + -DBUILD_recognition=ON \ + -DBUILD_registration=ON \ + -DBUILD_sample_consensus=ON \ + -DBUILD_search=ON \ + -DBUILD_segmentation=ON \ + -DBUILD_simulation=OFF \ + -DBUILD_stereo=OFF \ + -DBUILD_surface=OFF \ + -DBUILD_tracking=OFF \ + -DBUILD_visualization=ON \ + -DBUILD_global_tests=ON \ + -DBUILD_tests_2d=OFF \ + -DBUILD_tests_common=OFF \ + -DBUILD_tests_features=OFF \ + -DBUILD_tests_filters=ON \ + -DBUILD_tests_geometry=OFF \ + -DBUILD_tests_io=OFF \ + -DBUILD_tests_kdtree=OFF \ + -DBUILD_tests_keypoints=OFF \ + -DBUILD_tests_octree=OFF \ + -DBUILD_tests_outofcore=OFF \ + -DBUILD_tests_people=ON \ + -DBUILD_tests_recognition=ON \ + -DBUILD_tests_registration=OFF \ + -DBUILD_tests_sample_consensus=OFF \ + -DBUILD_tests_search=OFF \ + -DBUILD_tests_segmentation=ON \ + -DBUILD_tests_surface=OFF \ + -DBUILD_tests_visualization=OFF \ $PCL_DIR # Build and run tests make tests @@ -90,8 +320,7 @@ function doc () { # Do not generate documentation for pull requests if [[ $TRAVIS_PULL_REQUEST != 'false' ]]; then exit; fi - # Add installed doxygen to path and install sphinx - export PATH=$DOXYGEN_DIR/bin:$PATH + # Install sphinx pip install --user sphinx pyparsing==2.1.9 sphinxcontrib-doxylink # Configure mkdir $BUILD_DIR && cd $BUILD_DIR @@ -128,206 +357,20 @@ function doc () # Commit and push cd $DOC_DIR git add --all - git commit --amend -m "Documentation for commit $TRAVIS_COMMIT" -q + git commit --amend --reset-author -m "Documentation for commit $TRAVIS_COMMIT" -q git push --force else exit 2 fi } -function install_flann() -{ - local pkg_ver=1.8.4 - local pkg_file="flann-${pkg_ver}-src" - local pkg_url="http://people.cs.ubc.ca/~mariusm/uploads/FLANN/${pkg_file}.zip" - local pkg_md5sum="a0ecd46be2ee11a68d2a7d9c6b4ce701" - local FLANN_DIR=$HOME/flann - local config=$FLANN_DIR/include/flann/config.h - echo "Installing FLANN ${pkg_ver}" - if [[ -d $FLANN_DIR ]]; then - if [[ -e ${config} ]]; then - local version=`grep -Po "(?<=FLANN_VERSION_ \").*(?=\")" ${config}` - if [[ "$version" = "$pkg_ver" ]]; then - local modified=`stat -c %y ${config} | cut -d ' ' -f1` - echo " > Found cached installation of FLANN" - echo " > Version ${pkg_ver}, built on ${modified}" - return 0 - fi - fi - fi - download ${pkg_url} ${pkg_md5sum} - if [[ $? -ne 0 ]]; then - return $? - fi - unzip -qq pkg - cd ${pkg_file} - mkdir build && cd build - cmake .. \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=$FLANN_DIR \ - -DBUILD_MATLAB_BINDINGS=OFF \ - -DBUILD_PYTHON_BINDINGS=OFF \ - -DBUILD_CUDA_LIB=OFF \ - -DBUILD_C_BINDINGS=OFF \ - -DUSE_OPENMP=OFF - make -j2 && make install && touch ${config} - return $? -} - -function install_vtk() -{ - local pkg_ver=5.10.1 - local pkg_file="vtk-${pkg_ver}" - local pkg_url="http://www.vtk.org/files/release/${pkg_ver:0:4}/${pkg_file}.tar.gz" - local pkg_md5sum="264b0052e65bd6571a84727113508789" - local VTK_DIR=$HOME/vtk - local config=$VTK_DIR/include/vtk-${pkg_ver:0:4}/vtkConfigure.h - echo "Installing VTK ${pkg_ver}" - if [[ -d $VTK_DIR ]]; then - if [[ -e ${config} ]]; then - local version=`grep -Po "(?<=VTK_VERSION \").*(?=\")" ${config}` - if [[ "$version" = "$pkg_ver" ]]; then - local modified=`stat -c %y ${config} | cut -d ' ' -f1` - echo " > Found cached installation of VTK" - echo " > Version ${pkg_ver}, built on ${modified}" - return 0 - fi - fi - fi - download ${pkg_url} ${pkg_md5sum} - if [[ $? -ne 0 ]]; then - return $? - fi - tar xzf pkg - cd "VTK${pkg_ver}" - mkdir build && cd build - cmake .. \ - -Wno-dev \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_SHARED_LIBS=ON \ - -DCMAKE_INSTALL_PREFIX=$VTK_DIR \ - -DBUILD_DOCUMENTATION=OFF \ - -DBUILD_EXAMPLES=OFF \ - -DBUILD_TESTING=OFF \ - -DVTK_USE_BOOST=ON \ - -DVTK_USE_CHARTS=ON \ - -DVTK_USE_VIEWS=ON \ - -DVTK_USE_RENDERING=ON \ - -DVTK_USE_CHEMISTRY=OFF \ - -DVTK_USE_HYBRID=OFF \ - -DVTK_USE_PARALLEL=OFF \ - -DVTK_USE_PATENTED=OFF \ - -DVTK_USE_INFOVIS=ON \ - -DVTK_USE_GL2PS=OFF \ - -DVTK_USE_MYSQL=OFF \ - -DVTK_USE_FFMPEG_ENCODER=OFF \ - -DVTK_USE_TEXT_ANALYSIS=OFF \ - -DVTK_WRAP_JAVA=OFF \ - -DVTK_WRAP_PYTHON=OFF \ - -DVTK_WRAP_TCL=OFF \ - -DVTK_USE_QT=OFF \ - -DVTK_USE_GUISUPPORT=OFF \ - -DVTK_USE_SYSTEM_ZLIB=ON \ - -DCMAKE_CXX_FLAGS="-D__STDC_CONSTANT_MACROS" - make -j2 && make install && touch ${config} - return $? -} - -function install_qhull() -{ - local pkg_ver=2012.1 - local pkg_file="qhull-${pkg_ver}" - local pkg_url="http://www.qhull.org/download/${pkg_file}-src.tgz" - local pkg_md5sum="d0f978c0d8dfb2e919caefa56ea2953c" - local QHULL_DIR=$HOME/qhull - local announce=$QHULL_DIR/share/doc/qhull/Announce.txt - echo "Installing QHull ${pkg_ver}" - if [[ -d $QHULL_DIR ]]; then - if [[ -e ${announce} ]]; then - local version=`grep -Po "(?<=Qhull )[0-9.]*(?= )" ${announce}` - if [[ "$version" = "$pkg_ver" ]]; then - local modified=`stat -c %y ${announce} | cut -d ' ' -f1` - echo " > Found cached installation of QHull" - echo " > Version ${pkg_ver}, built on ${modified}" - return 0 - fi - fi - fi - download ${pkg_url} ${pkg_md5sum} - if [[ $? -ne 0 ]]; then - return $? - fi - tar xzf pkg - cd ${pkg_file} - mkdir -p build && cd build - cmake .. \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_CXX_FLAGS=-fPIC \ - -DCMAKE_C_FLAGS=-fPIC \ - -DCMAKE_INSTALL_PREFIX=$QHULL_DIR - make -j2 && make install && touch ${announce} - return $? -} - -function install_doxygen() -{ - local pkg_ver=1.8.9.1 - local pkg_file="doxygen-${pkg_ver}" - local pkg_url="http://ftp.stack.nl/pub/users/dimitri/${pkg_file}.src.tar.gz" - local pkg_md5sum="3d1a5c26bef358c10a3894f356a69fbc" - local DOXYGEN_EXE=$DOXYGEN_DIR/bin/doxygen - echo "Installing Doxygen ${pkg_ver}" - if [[ -d $DOXYGEN_DIR ]]; then - if [[ -e $DOXYGEN_EXE ]]; then - local version=`$DOXYGEN_EXE --version` - if [[ "$version" = "$pkg_ver" ]]; then - local modified=`stat -c %y $DOXYGEN_EXE | cut -d ' ' -f1` - echo " > Found cached installation of Doxygen" - echo " > Version ${pkg_ver}, built on ${modified}" - return 0 - fi - fi - fi - download ${pkg_url} ${pkg_md5sum} - if [[ $? -ne 0 ]]; then - return $? - fi - tar xzf pkg - cd ${pkg_file} - ./configure --prefix $DOXYGEN_DIR - make -j2 && make install - return $? -} - -function install_dependencies() -{ - install_flann - install_vtk - install_qhull - install_doxygen -} - -function download() -{ - mkdir -p $DOWNLOAD_DIR && cd $DOWNLOAD_DIR && rm -rf * - wget --output-document=pkg $1 - if [[ $? -ne 0 ]]; then - return $? - fi - if [[ $# -ge 2 ]]; then - echo "$2 pkg" > "md5" - md5sum -c "md5" --quiet --status - if [[ $? -ne 0 ]]; then - echo "MD5 mismatch" - return 1 - fi - fi - return 0 -} - case $1 in - install ) install_dependencies;; build ) build;; - test ) test;; + build-examples ) build_examples;; + build-tools ) build_tools;; + build-apps ) build_apps;; + test-core ) test_core;; + test-ext-1 ) test_ext_1;; + test-ext-2 ) test_ext_2;; doc ) doc;; esac diff --git a/.travis.yml b/.travis.yml index b7d2204c709..bb27c5bf63f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,15 +32,27 @@ env: - secure: PZivWbaCWFA2BFFY8n3UMxdEWjz7rBh568u9LF5LH3HgWADnfiwWzNriACqX9fhe7tSmDru5Bk978s+xPPAY9v24cfiDEX5a5MQ/XVr2rP48n3vlUDWERDhIodJ73F9F9GGZXToGdNz0MBUAHgiv7Lb0GYUfmOYzUJjWghngLBw= matrix: include: + - compiler: clang + env: TASK="build-examples" + - compiler: clang + env: TASK="build-tools" + - compiler: clang + env: TASK="build-apps" - compiler: gcc - env: TASK="test" - - env: TASK="doc" + env: TASK="test-core" + - compiler: gcc + env: TASK="test-ext-1" + - compiler: gcc + env: TASK="test-ext-2" + - compiler: gcc + env: TASK="doc" addons: apt: sources: - kalakris-cmake - boost-latest - kubuntu-backports + - sourceline: 'ppa:kedazo/doxygen-updates-precise' packages: - cmake - libboost1.55-all-dev @@ -49,13 +61,12 @@ addons: - doxygen-latex - dvipng - libusb-1.0-0-dev -cache: - directories: - - $HOME/flann - - $HOME/vtk - - $HOME/qhull - - $HOME/doxygen -before_install: - - bash .travis.sh install + - libqhull-dev + - libvtk5-dev + - libflann-dev + - doxygen + - libqt4-dev + - libvtk5-qt4-dev + - libglew-dev script: - bash .travis.sh $TASK diff --git a/cmake/pcl_targets.cmake b/cmake/pcl_targets.cmake index 691ead0b7a5..8073b5db777 100644 --- a/cmake/pcl_targets.cmake +++ b/cmake/pcl_targets.cmake @@ -116,6 +116,12 @@ macro(PCL_SUBSYS_DEPEND _var _name) endif(NOT ${EXT_DEP_FOUND} OR (NOT (${EXT_DEP_FOUND} STREQUAL "TRUE"))) endforeach(_dep) endif(SUBSYS_EXT_DEPS) + if(SUBSYS_OPT_DEPS) + foreach(_dep ${SUBSYS_OPT_DEPS}) + PCL_GET_SUBSYS_INCLUDE_DIR(_include_dir ${_dep}) + include_directories(${PROJECT_SOURCE_DIR}/${_include_dir}/include) + endforeach(_dep) + endif(SUBSYS_OPT_DEPS) endif(${_var} AND (NOT ("${subsys_status}" STREQUAL "AUTO_OFF"))) endmacro(PCL_SUBSYS_DEPEND) @@ -862,3 +868,11 @@ macro(PCL_ADD_GRABBER_DEPENDENCY _name _description) endif() endif() endmacro(PCL_ADD_GRABBER_DEPENDENCY) + +############################################################################### +# Set the dependencies for a specific test module on the provided variable +# _var The variable to be filled with the dependencies +# _module The module name +macro(PCL_SET_TEST_DEPENDENCIES _var _module) + set(${_var} global_tests ${_module} ${PCL_SUBSYS_DEPS_${_module}}) +endmacro(PCL_SET_TEST_DEPENDENCIES) diff --git a/io/CMakeLists.txt b/io/CMakeLists.txt index 84bfd0d341f..efaa798517c 100644 --- a/io/CMakeLists.txt +++ b/io/CMakeLists.txt @@ -197,6 +197,8 @@ if(build) ) PCL_ADD_LIBRARY(pcl_io_ply "${SUBSYS_NAME}" ${PLY_SOURCES} ${PLY_INCLUDES}) PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}/ply" ${PLY_INCLUDES}) + target_include_directories(pcl_io_ply PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") + set(srcs src/debayer.cpp @@ -316,9 +318,9 @@ if(build) set(LIB_NAME "pcl_${SUBSYS_NAME}") - include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" ${VTK_INCLUDE_DIRECTORIES}) add_definitions(${VTK_DEFINES}) PCL_ADD_LIBRARY("${LIB_NAME}" "${SUBSYS_NAME}" ${srcs} ${incs} ${compression_incs} ${impl_incs} ${OPENNI_INCLUDES} ${OPENNI2_INCLUDES}) + target_include_directories(${LIB_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ${VTK_INCLUDE_DIRECTORIES}) link_directories(${VTK_LINK_DIRECTORIES}) target_link_libraries("${LIB_NAME}" pcl_common pcl_io_ply ${VTK_LIBRARIES} ) if(PNG_FOUND) diff --git a/octree/CMakeLists.txt b/octree/CMakeLists.txt index 1b0a9bd3724..f4505b12622 100644 --- a/octree/CMakeLists.txt +++ b/octree/CMakeLists.txt @@ -45,9 +45,9 @@ if(build) ) set(LIB_NAME "pcl_${SUBSYS_NAME}") - include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include") PCL_ADD_LIBRARY("${LIB_NAME}" "${SUBSYS_NAME}" ${srcs} ${incs} ${impl_incs}) target_link_libraries("${LIB_NAME}") + target_include_directories(${LIB_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") PCL_MAKE_PKGCONFIG("${LIB_NAME}" "${SUBSYS_NAME}" "${SUBSYS_DESC}" "${SUBSYS_DEPS}" "" "" "" "") diff --git a/test/2d/CMakeLists.txt b/test/2d/CMakeLists.txt index 61c7d45babb..5510efe057e 100644 --- a/test/2d/CMakeLists.txt +++ b/test/2d/CMakeLists.txt @@ -1,13 +1,27 @@ -PCL_ADD_TEST(test_2d test_2d FILES test_2d.cpp - LINK_WITH pcl_io pcl_gtest - ARGUMENTS "${PCL_SOURCE_DIR}/test/2d/lena.pcd" - "${PCL_SOURCE_DIR}/test/2d/gauss_smooth.pcd" - "${PCL_SOURCE_DIR}/test/2d/erosion.pcd" - "${PCL_SOURCE_DIR}/test/2d/dilation.pcd" - "${PCL_SOURCE_DIR}/test/2d/opening.pcd" - "${PCL_SOURCE_DIR}/test/2d/closing.pcd" - "${PCL_SOURCE_DIR}/test/2d/erosion_binary.pcd" - "${PCL_SOURCE_DIR}/test/2d/dilation_binary.pcd" - "${PCL_SOURCE_DIR}/test/2d/opening_binary.pcd" - "${PCL_SOURCE_DIR}/test/2d/closing_binary.pcd" - "${PCL_SOURCE_DIR}/test/2d/canny.pcd") +set(SUBSYS_NAME tests_2d) +set(SUBSYS_DESC "Point cloud library 2d module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS 2d) + + +set(OPT_DEPS) + +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) + +if(build) + PCL_ADD_TEST(test_2d test_2d FILES test_2d.cpp + LINK_WITH pcl_io pcl_gtest + ARGUMENTS "${PCL_SOURCE_DIR}/test/2d/lena.pcd" + "${PCL_SOURCE_DIR}/test/2d/gauss_smooth.pcd" + "${PCL_SOURCE_DIR}/test/2d/erosion.pcd" + "${PCL_SOURCE_DIR}/test/2d/dilation.pcd" + "${PCL_SOURCE_DIR}/test/2d/opening.pcd" + "${PCL_SOURCE_DIR}/test/2d/closing.pcd" + "${PCL_SOURCE_DIR}/test/2d/erosion_binary.pcd" + "${PCL_SOURCE_DIR}/test/2d/dilation_binary.pcd" + "${PCL_SOURCE_DIR}/test/2d/opening_binary.pcd" + "${PCL_SOURCE_DIR}/test/2d/closing_binary.pcd" + "${PCL_SOURCE_DIR}/test/2d/canny.pcd") +endif(build) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3b3e2d7891b..6a1d55d965f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,14 +1,6 @@ set(SUBSYS_NAME global_tests) set(SUBSYS_DESC "Point cloud library global unit tests") -if(BUILD_visualization) - include("${VTK_USE_FILE}") - set(SUBSYS_DEPS 2d common sample_consensus io kdtree features filters geometry keypoints search surface registration segmentation octree recognition people outofcore visualization) - set(OPT_DEPS vtk) -else() - set(SUBSYS_DEPS 2d common sample_consensus io kdtree features filters geometry keypoints search surface registration segmentation octree recognition people outofcore) -endif() - set(DEFAULT OFF) set(build TRUE) PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") @@ -26,8 +18,6 @@ if(build) endif() enable_testing() - include_directories(${PCL_INCLUDE_DIRS}) - add_custom_target(tests "${CMAKE_CTEST_COMMAND}" "-V" VERBATIM) add_subdirectory(2d) @@ -37,55 +27,16 @@ if(build) add_subdirectory(geometry) add_subdirectory(io) add_subdirectory(kdtree) + add_subdirectory(keypoints) + add_subdirectory(people) add_subdirectory(octree) add_subdirectory(outofcore) + add_subdirectory(recognition) add_subdirectory(registration) add_subdirectory(search) - add_subdirectory(keypoints) add_subdirectory(surface) add_subdirectory(segmentation) add_subdirectory(sample_consensus) - - PCL_ADD_TEST(a_recognition_ism_test test_recognition_ism - FILES test_recognition_ism.cpp - LINK_WITH pcl_gtest pcl_io pcl_features - ARGUMENTS "${PCL_SOURCE_DIR}/test/ism_train.pcd" "${PCL_SOURCE_DIR}/test/ism_test.pcd") - - PCL_ADD_TEST(search test_search - FILES test_search.cpp - LINK_WITH pcl_gtest pcl_search pcl_io pcl_kdtree - ARGUMENTS "${PCL_SOURCE_DIR}/test/table_scene_mug_stereo_textured.pcd") - - PCL_ADD_TEST(a_transforms_test test_transforms - FILES test_transforms.cpp - LINK_WITH pcl_gtest pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") - - PCL_ADD_TEST(a_segmentation_test test_segmentation - FILES test_segmentation.cpp - LINK_WITH pcl_gtest pcl_io pcl_segmentation pcl_features pcl_kdtree pcl_search pcl_common - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" "${PCL_SOURCE_DIR}/test/car6.pcd" "${PCL_SOURCE_DIR}/test/colored_cloud.pcd") - - PCL_ADD_TEST(test_non_linear test_non_linear - FILES test_non_linear.cpp - LINK_WITH pcl_gtest pcl_common pcl_io pcl_sample_consensus pcl_segmentation pcl_kdtree pcl_search - ARGUMENTS "${PCL_SOURCE_DIR}/test/noisy_slice_displaced.pcd") - - PCL_ADD_TEST(a_recognition_cg_test test_recognition_cg - FILES test_recognition_cg.cpp - LINK_WITH pcl_gtest pcl_common pcl_io pcl_kdtree pcl_features pcl_recognition pcl_keypoints - ARGUMENTS "${PCL_SOURCE_DIR}/test/milk.pcd" "${PCL_SOURCE_DIR}/test/milk_cartoon_all_small_clorox.pcd") - - PCL_ADD_TEST(a_people_detection_test test_people_detection - FILES test_people_groundBasedPeopleDetectionApp.cpp - LINK_WITH pcl_gtest pcl_common pcl_io pcl_kdtree pcl_search pcl_features pcl_sample_consensus pcl_filters pcl_io pcl_segmentation pcl_people - ARGUMENTS "${PCL_SOURCE_DIR}/people/data/trainedLinearSVMForPeopleDetectionWithHOG.yaml" "${PCL_SOURCE_DIR}/test/five_people.pcd") - - if(BUILD_visualization AND (NOT UNIX OR (UNIX AND DEFINED ENV{DISPLAY}))) - PCL_ADD_TEST(a_visualization_test test_visualization - FILES test_visualization.cpp - LINK_WITH pcl_gtest pcl_io pcl_visualization pcl_features - ARGUMENTS "${PCL_SOURCE_DIR}/test/bunny.pcd") - endif() + add_subdirectory(visualization) endif(build) diff --git a/test/boost.h b/test/boost.h deleted file mode 100644 index fb1c68b95f2..00000000000 --- a/test/boost.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2010-2011, Willow Garage, Inc. - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $Id: io.h 5850 2012-06-06 14:04:59Z stfox88 $ - * - */ - -#ifndef PCL_TEST_BOOST_H_ -#define PCL_TEST_BOOST_H_ - -#ifdef __GNUC__ -#pragma GCC system_header -#endif - -// Marking all Boost headers as system headers to remove warnings -#include -#include -#include -#include -#include -#include -#include - -#endif // PCL_TEST_BOOST_H_ diff --git a/test/common/CMakeLists.txt b/test/common/CMakeLists.txt index 7491588f559..b025f1ab940 100644 --- a/test/common/CMakeLists.txt +++ b/test/common/CMakeLists.txt @@ -1,22 +1,41 @@ -# Args: name, executable_name -PCL_ADD_TEST(common_test_wrappers test_wrappers FILES test_wrappers.cpp LINK_WITH pcl_gtest pcl_common) -PCL_ADD_TEST(common_test_macros test_macros FILES test_macros.cpp LINK_WITH pcl_gtest pcl_common) -PCL_ADD_TEST(common_vector_average test_vector_average FILES test_vector_average.cpp LINK_WITH pcl_gtest) -PCL_ADD_TEST(common_common test_common FILES test_common.cpp LINK_WITH pcl_gtest pcl_common) -PCL_ADD_TEST(common_geometry test_geometry FILES test_geometry.cpp LINK_WITH pcl_gtest pcl_common) -PCL_ADD_TEST(common_copy_point test_copy_point FILES test_copy_point.cpp LINK_WITH pcl_gtest pcl_common) -PCL_ADD_TEST(common_centroid test_centroid FILES test_centroid.cpp LINK_WITH pcl_gtest pcl_common) -PCL_ADD_TEST(common_int test_plane_intersection FILES test_plane_intersection.cpp LINK_WITH pcl_gtest pcl_common) -PCL_ADD_TEST(common_pca test_pca FILES test_pca.cpp LINK_WITH pcl_gtest pcl_common) -#PCL_ADD_TEST(common_spring test_spring FILES test_spring.cpp LINK_WITH pcl_gtest pcl_common) -PCL_ADD_TEST(common_gaussian test_gaussian FILES test_gaussian.cpp LINK_WITH pcl_gtest pcl_common) -PCL_ADD_TEST(common_operators test_operators FILES test_operators.cpp LINK_WITH pcl_gtest pcl_common) -#PCL_ADD_TEST(common_convolution test_convolution FILES test_convolution.cpp LINK_WITH pcl_gtest pcl_common) -PCL_ADD_TEST(common_eigen test_eigen FILES test_eigen.cpp LINK_WITH pcl_gtest pcl_common) -PCL_ADD_TEST(common_intensity test_intensity FILES test_intensity.cpp LINK_WITH pcl_gtest pcl_common) -PCL_ADD_TEST(common_generator test_generator FILES test_generator.cpp LINK_WITH pcl_gtest pcl_common) -PCL_ADD_TEST(common_io test_common_io FILES test_io.cpp LINK_WITH pcl_gtest pcl_common) -PCL_ADD_TEST(common_copy_make_borders test_copy_make_borders FILES test_copy_make_borders.cpp LINK_WITH pcl_gtest pcl_common) -PCL_ADD_TEST(common_bearing_angle_image test_bearing_angle_image FILES test_bearing_angle_image.cpp LINK_WITH pcl_gtest pcl_common) +set(SUBSYS_NAME tests_common) +set(SUBSYS_DESC "Point cloud library common module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS common) +set(OPT_DEPS io features search kdtree octree) -PCL_ADD_TEST(common_point_type_conversion test_common_point_type_conversion FILES test_point_type_conversion.cpp LINK_WITH pcl_gtest pcl_common) +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) + +if (build) + # Args: name, executable_name + PCL_ADD_TEST(common_test_wrappers test_wrappers FILES test_wrappers.cpp LINK_WITH pcl_gtest pcl_common) + PCL_ADD_TEST(common_test_macros test_macros FILES test_macros.cpp LINK_WITH pcl_gtest pcl_common) + PCL_ADD_TEST(common_vector_average test_vector_average FILES test_vector_average.cpp LINK_WITH pcl_gtest) + PCL_ADD_TEST(common_common test_common FILES test_common.cpp LINK_WITH pcl_gtest pcl_common) + PCL_ADD_TEST(common_geometry test_geometry FILES test_geometry.cpp LINK_WITH pcl_gtest pcl_common) + PCL_ADD_TEST(common_copy_point test_copy_point FILES test_copy_point.cpp LINK_WITH pcl_gtest pcl_common) + PCL_ADD_TEST(common_centroid test_centroid FILES test_centroid.cpp LINK_WITH pcl_gtest pcl_common) + PCL_ADD_TEST(common_int test_plane_intersection FILES test_plane_intersection.cpp LINK_WITH pcl_gtest pcl_common) + PCL_ADD_TEST(common_pca test_pca FILES test_pca.cpp LINK_WITH pcl_gtest pcl_common) + #PCL_ADD_TEST(common_spring test_spring FILES test_spring.cpp LINK_WITH pcl_gtest pcl_common) + PCL_ADD_TEST(common_gaussian test_gaussian FILES test_gaussian.cpp LINK_WITH pcl_gtest pcl_common) + PCL_ADD_TEST(common_operators test_operators FILES test_operators.cpp LINK_WITH pcl_gtest pcl_common) + #PCL_ADD_TEST(common_convolution test_convolution FILES test_convolution.cpp LINK_WITH pcl_gtest pcl_common) + PCL_ADD_TEST(common_eigen test_eigen FILES test_eigen.cpp LINK_WITH pcl_gtest pcl_common) + PCL_ADD_TEST(common_intensity test_intensity FILES test_intensity.cpp LINK_WITH pcl_gtest pcl_common) + PCL_ADD_TEST(common_generator test_generator FILES test_generator.cpp LINK_WITH pcl_gtest pcl_common) + PCL_ADD_TEST(common_io test_common_io FILES test_io.cpp LINK_WITH pcl_gtest pcl_common) + PCL_ADD_TEST(common_copy_make_borders test_copy_make_borders FILES test_copy_make_borders.cpp LINK_WITH pcl_gtest pcl_common) + PCL_ADD_TEST(common_bearing_angle_image test_bearing_angle_image FILES test_bearing_angle_image.cpp LINK_WITH pcl_gtest pcl_common) + + PCL_ADD_TEST(common_point_type_conversion test_common_point_type_conversion FILES test_point_type_conversion.cpp LINK_WITH pcl_gtest pcl_common) + + if (BUILD_io AND BUILD_features) + PCL_ADD_TEST(a_transforms_test test_transforms + FILES test_transforms.cpp + LINK_WITH pcl_gtest pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + endif (BUILD_io AND BUILD_features) +endif (build) diff --git a/test/test_transforms.cpp b/test/common/test_transforms.cpp similarity index 100% rename from test/test_transforms.cpp rename to test/common/test_transforms.cpp diff --git a/test/features/CMakeLists.txt b/test/features/CMakeLists.txt index ca60f9dee02..afa18a5f1f0 100644 --- a/test/features/CMakeLists.txt +++ b/test/features/CMakeLists.txt @@ -1,91 +1,108 @@ -PCL_ADD_TEST(features_ptr test_features_ptr - FILES test_ptr.cpp - LINK_WITH pcl_gtest pcl_features) +set(SUBSYS_NAME tests_features) +set(SUBSYS_DESC "Point cloud library features module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS features) +set(OPT_DEPS io keypoints) # module does not depend on these -PCL_ADD_TEST(feature_base test_base_feature - FILES test_base_feature.cpp - LINK_WITH pcl_gtest pcl_features pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(feature_cppf_estimation test_cppf_estimation - FILES test_cppf_estimation.cpp - LINK_WITH pcl_gtest pcl_features pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/colored_cloud.pcd") -PCL_ADD_TEST(feature_normal_estimation test_normal_estimation - FILES test_normal_estimation.cpp - LINK_WITH pcl_gtest pcl_features pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(feature_pfh_estimation test_pfh_estimation - FILES test_pfh_estimation.cpp - LINK_WITH pcl_gtest pcl_features pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) -PCL_ADD_TEST(feature_cvfh_estimation test_cvfh_estimation - FILES test_cvfh_estimation.cpp - LINK_WITH pcl_gtest pcl_features pcl_io pcl_filters - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" "${PCL_SOURCE_DIR}/test/milk.pcd") +if (build) + PCL_ADD_TEST(features_ptr test_features_ptr + FILES test_ptr.cpp + LINK_WITH pcl_gtest pcl_features) + PCL_ADD_TEST(feature_gradient_estimation test_gradient_estimation + FILES test_gradient_estimation.cpp + LINK_WITH pcl_gtest pcl_features) + PCL_ADD_TEST(feature_rift_estimation test_rift_estimation + FILES test_rift_estimation.cpp + LINK_WITH pcl_gtest pcl_features) + + if (BUILD_io) + PCL_ADD_TEST(feature_base test_base_feature + FILES test_base_feature.cpp + LINK_WITH pcl_gtest pcl_features pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(feature_cppf_estimation test_cppf_estimation + FILES test_cppf_estimation.cpp + LINK_WITH pcl_gtest pcl_features pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/colored_cloud.pcd") + PCL_ADD_TEST(feature_normal_estimation test_normal_estimation + FILES test_normal_estimation.cpp + LINK_WITH pcl_gtest pcl_features pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(feature_pfh_estimation test_pfh_estimation + FILES test_pfh_estimation.cpp + LINK_WITH pcl_gtest pcl_features pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + + PCL_ADD_TEST(feature_cvfh_estimation test_cvfh_estimation + FILES test_cvfh_estimation.cpp + LINK_WITH pcl_gtest pcl_features pcl_io pcl_filters + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" "${PCL_SOURCE_DIR}/test/milk.pcd") + + PCL_ADD_TEST(feature_ppf_estimation test_ppf_estimation + FILES test_ppf_estimation.cpp + LINK_WITH pcl_gtest pcl_features pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(feature_shot_estimation test_shot_estimation + FILES test_shot_estimation.cpp + LINK_WITH pcl_gtest pcl_features pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(feature_boundary_estimation test_boundary_estimation + FILES test_boundary_estimation.cpp + LINK_WITH pcl_gtest pcl_features pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(feature_curvatures_estimation test_curvatures_estimation + FILES test_curvatures_estimation.cpp + LINK_WITH pcl_gtest pcl_features pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(feature_spin_estimation test_spin_estimation + FILES test_spin_estimation.cpp + LINK_WITH pcl_gtest pcl_features pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(feature_rsd_estimation test_rsd_estimation + FILES test_rsd_estimation.cpp + LINK_WITH pcl_gtest pcl_features pcl_io pcl_kdtree + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(feature_grsd_estimation test_grsd_estimation + FILES test_grsd_estimation.cpp + LINK_WITH pcl_gtest pcl_features pcl_io pcl_kdtree + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(feature_invariants_estimation test_invariants_estimation + FILES test_invariants_estimation.cpp + LINK_WITH pcl_gtest pcl_features pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(feature_board_estimation test_board_estimation + FILES test_board_estimation.cpp + LINK_WITH pcl_gtest pcl_features pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(feature_shot_lrf_estimation test_shot_lrf_estimation + FILES test_shot_lrf_estimation.cpp + LINK_WITH pcl_gtest pcl_features pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(features_narf test_narf + FILES test_narf.cpp + LINK_WITH pcl_gtest pcl_features ${FLANN_LIBRARIES}) + PCL_ADD_TEST(a_ii_normals_test test_ii_normals + FILES test_ii_normals.cpp + LINK_WITH pcl_gtest pcl_io pcl_features + ARGUMENTS "${PCL_SOURCE_DIR}/test/table_scene_mug_stereo_textured.pcd") + PCL_ADD_TEST(feature_moment_of_inertia_estimation test_moment_of_inertia_estimation + FILES test_moment_of_inertia_estimation.cpp + LINK_WITH pcl_gtest pcl_io pcl_features + ARGUMENTS "${PCL_SOURCE_DIR}/test/lamppost.pcd") + PCL_ADD_TEST(feature_rops_estimation test_rops_estimation + FILES test_rops_estimation.cpp + LINK_WITH pcl_gtest pcl_io pcl_features + ARGUMENTS "${PCL_SOURCE_DIR}/test/rops_cloud.pcd" "${PCL_SOURCE_DIR}/test/rops_indices.txt" "${PCL_SOURCE_DIR}/test/rops_triangles.txt") + if (BUILD_keypoints) + PCL_ADD_TEST(feature_brisk test_brisk + FILES test_brisk.cpp + LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_filters pcl_keypoints pcl_common pcl_features pcl_search + ARGUMENTS "${PCL_SOURCE_DIR}/test/brisk_image_gt.pcd" "${PCL_SOURCE_DIR}/test/brisk_keypoints_gt.pcd" "${PCL_SOURCE_DIR}/test/brisk_descriptors_gt.pcd") + endif (BUILD_keypoints) + endif (BUILD_io) +endif (build) -PCL_ADD_TEST(feature_ppf_estimation test_ppf_estimation - FILES test_ppf_estimation.cpp - LINK_WITH pcl_gtest pcl_features pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(feature_shot_estimation test_shot_estimation - FILES test_shot_estimation.cpp - LINK_WITH pcl_gtest pcl_features pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(feature_boundary_estimation test_boundary_estimation - FILES test_boundary_estimation.cpp - LINK_WITH pcl_gtest pcl_features pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(feature_curvatures_estimation test_curvatures_estimation - FILES test_curvatures_estimation.cpp - LINK_WITH pcl_gtest pcl_features pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(feature_spin_estimation test_spin_estimation - FILES test_spin_estimation.cpp - LINK_WITH pcl_gtest pcl_features pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(feature_rsd_estimation test_rsd_estimation - FILES test_rsd_estimation.cpp - LINK_WITH pcl_gtest pcl_features pcl_io pcl_kdtree - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(feature_grsd_estimation test_grsd_estimation - FILES test_grsd_estimation.cpp - LINK_WITH pcl_gtest pcl_features pcl_io pcl_kdtree - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(feature_invariants_estimation test_invariants_estimation - FILES test_invariants_estimation.cpp - LINK_WITH pcl_gtest pcl_features pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(feature_gradient_estimation test_gradient_estimation - FILES test_gradient_estimation.cpp - LINK_WITH pcl_gtest pcl_features) -PCL_ADD_TEST(feature_rift_estimation test_rift_estimation - FILES test_rift_estimation.cpp - LINK_WITH pcl_gtest pcl_features) -PCL_ADD_TEST(feature_board_estimation test_board_estimation - FILES test_board_estimation.cpp - LINK_WITH pcl_gtest pcl_features pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(feature_shot_lrf_estimation test_shot_lrf_estimation - FILES test_shot_lrf_estimation.cpp - LINK_WITH pcl_gtest pcl_features pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(feature_brisk test_brisk - FILES test_brisk.cpp - LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_filters pcl_keypoints pcl_common pcl_features pcl_search - ARGUMENTS "${PCL_SOURCE_DIR}/test/brisk_image_gt.pcd" "${PCL_SOURCE_DIR}/test/brisk_keypoints_gt.pcd" "${PCL_SOURCE_DIR}/test/brisk_descriptors_gt.pcd") -PCL_ADD_TEST(features_narf test_narf - FILES test_narf.cpp - LINK_WITH pcl_gtest pcl_features ${FLANN_LIBRARIES}) -PCL_ADD_TEST(a_ii_normals_test test_ii_normals - FILES test_ii_normals.cpp - LINK_WITH pcl_gtest pcl_io pcl_features - ARGUMENTS "${PCL_SOURCE_DIR}/test/table_scene_mug_stereo_textured.pcd") -PCL_ADD_TEST(feature_moment_of_inertia_estimation test_moment_of_inertia_estimation - FILES test_moment_of_inertia_estimation.cpp - LINK_WITH pcl_gtest pcl_io pcl_features - ARGUMENTS "${PCL_SOURCE_DIR}/test/lamppost.pcd") -PCL_ADD_TEST(feature_rops_estimation test_rops_estimation - FILES test_rops_estimation.cpp - LINK_WITH pcl_gtest pcl_io pcl_features - ARGUMENTS "${PCL_SOURCE_DIR}/test/rops_cloud.pcd" "${PCL_SOURCE_DIR}/test/rops_indices.txt" "${PCL_SOURCE_DIR}/test/rops_triangles.txt") diff --git a/test/filters/CMakeLists.txt b/test/filters/CMakeLists.txt index 9d1246b1aaf..d36e7c30151 100644 --- a/test/filters/CMakeLists.txt +++ b/test/filters/CMakeLists.txt @@ -1,34 +1,52 @@ -#PCL_ADD_TEST(common_convolution test_convolution FILES test_convolution.cpp LINK_WITH pcl_filters pcl_common) - -PCL_ADD_TEST(filters_filters test_filters - FILES test_filters.cpp - LINK_WITH pcl_gtest pcl_filters pcl_io pcl_sample_consensus pcl_kdtree pcl_features pcl_segmentation - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" "${PCL_SOURCE_DIR}/test/milk_cartoon_all_small_clorox.pcd") - -PCL_ADD_TEST(filters_sampling test_filters_sampling - FILES test_sampling.cpp - LINK_WITH pcl_gtest pcl_filters pcl_io pcl_kdtree pcl_features - ARGUMENTS "${PCL_SOURCE_DIR}/test/sac_plane_test.pcd" "${PCL_SOURCE_DIR}/test/cturtle.pcd") - -PCL_ADD_TEST(filters_bilateral test_filters_bilateral - FILES test_bilateral.cpp - LINK_WITH pcl_gtest pcl_filters pcl_io pcl_kdtree - ARGUMENTS "${PCL_SOURCE_DIR}/test/milk_cartoon_all_small_clorox.pcd") - -PCL_ADD_TEST(filters_grid_minimum test_filters_grid_minimum - FILES test_grid_minimum.cpp - LINK_WITH pcl_gtest pcl_common pcl_filters) - -PCL_ADD_TEST(filters_model_outlier_removal test_model_outlier_removal - FILES test_model_outlier_removal.cpp - LINK_WITH pcl_gtest pcl_filters pcl_io pcl_sample_consensus pcl_kdtree pcl_features - ARGUMENTS ${PCL_SOURCE_DIR}/test/milk_cartoon_all_small_clorox.pcd) - -PCL_ADD_TEST(filters_morphological test_morphological - FILES test_morphological.cpp - LINK_WITH pcl_gtest pcl_common pcl_filters) - -PCL_ADD_TEST(filters_local_maximum test_filters_local_maximum - FILES test_local_maximum.cpp - LINK_WITH pcl_gtest pcl_common pcl_filters) - +set(SUBSYS_NAME tests_filters) +set(SUBSYS_DESC "Point cloud library filters module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS filters) +set(OPT_DEPS io features segmentation) + +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) + +if (build) + #PCL_ADD_TEST(common_convolution test_convolution FILES test_convolution.cpp LINK_WITH pcl_filters pcl_common) + + PCL_ADD_TEST(filters_grid_minimum test_filters_grid_minimum + FILES test_grid_minimum.cpp + LINK_WITH pcl_gtest pcl_common pcl_filters) + + PCL_ADD_TEST(filters_morphological test_morphological + FILES test_morphological.cpp + LINK_WITH pcl_gtest pcl_common pcl_filters) + + PCL_ADD_TEST(filters_local_maximum test_filters_local_maximum + FILES test_local_maximum.cpp + LINK_WITH pcl_gtest pcl_common pcl_filters pcl_search pcl_octree) + + if (BUILD_io) + + PCL_ADD_TEST(filters_bilateral test_filters_bilateral + FILES test_bilateral.cpp + LINK_WITH pcl_gtest pcl_filters pcl_io pcl_kdtree + ARGUMENTS "${PCL_SOURCE_DIR}/test/milk_cartoon_all_small_clorox.pcd") + + if (BUILD_features) + PCL_ADD_TEST(filters_sampling test_filters_sampling + FILES test_sampling.cpp + LINK_WITH pcl_gtest pcl_filters pcl_io pcl_kdtree pcl_features + ARGUMENTS "${PCL_SOURCE_DIR}/test/sac_plane_test.pcd" "${PCL_SOURCE_DIR}/test/cturtle.pcd") + + PCL_ADD_TEST(filters_model_outlier_removal test_model_outlier_removal + FILES test_model_outlier_removal.cpp + LINK_WITH pcl_gtest pcl_filters pcl_io pcl_sample_consensus pcl_kdtree pcl_features + ARGUMENTS ${PCL_SOURCE_DIR}/test/milk_cartoon_all_small_clorox.pcd) + + if (BUILD_segmentation) + PCL_ADD_TEST(filters_filters test_filters + FILES test_filters.cpp + LINK_WITH pcl_gtest pcl_filters pcl_io pcl_sample_consensus pcl_kdtree pcl_features pcl_segmentation + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" "${PCL_SOURCE_DIR}/test/milk_cartoon_all_small_clorox.pcd") + endif (BUILD_segmentation) + endif (BUILD_features) + endif (BUILD_io) +endif (build) diff --git a/test/geometry/CMakeLists.txt b/test/geometry/CMakeLists.txt index 32d817f6f6b..edc5639f108 100644 --- a/test/geometry/CMakeLists.txt +++ b/test/geometry/CMakeLists.txt @@ -1,44 +1,55 @@ -PCL_ADD_TEST(geometry_iterator test_iterator - FILES test_iterator.cpp - LINK_WITH pcl_gtest pcl_common) - -PCL_ADD_TEST(geometry_mesh_circulators test_mesh_circulators - FILES test_mesh_circulators.cpp - LINK_WITH pcl_gtest) - -PCL_ADD_TEST(geometry_mesh_conversion test_mesh_conversion - FILES test_mesh_conversion.cpp - LINK_WITH pcl_gtest pcl_common) - -PCL_ADD_TEST(geometry_mesh_data test_mesh_data - FILES test_mesh_data.cpp - LINK_WITH pcl_gtest) - -PCL_ADD_TEST(geometry_mesh_get_boundary test_mesh_get_boundary - FILES test_mesh_get_boundary.cpp - LINK_WITH pcl_gtest) - -PCL_ADD_TEST(geometry_mesh_indices test_mesh_indices - FILES test_mesh_indices.cpp - LINK_WITH pcl_gtest) - -add_definitions(-DPCL_TEST_GEOMETRY_BINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}") -PCL_ADD_TEST(geometry_mesh_io test_mesh_io - FILES test_mesh_io.cpp - LINK_WITH pcl_gtest) - -PCL_ADD_TEST(geometry_mesh test_mesh - FILES test_mesh.cpp test_mesh_common_functions.h - LINK_WITH pcl_gtest) - -PCL_ADD_TEST(geometry_polygon_mesh test_polygon_mesh - FILES test_polygon_mesh.cpp - LINK_WITH pcl_gtest) - -PCL_ADD_TEST(geometry_quad_mesh test_quad_mesh - FILES test_quad_mesh.cpp - LINK_WITH pcl_gtest) - -PCL_ADD_TEST(geometry_triangle_mesh test_triangle_mesh - FILES test_triangle_mesh.cpp - LINK_WITH pcl_gtest) +set(SUBSYS_NAME tests_geometry) +set(SUBSYS_DESC "Point cloud library geometry module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS geometry) + +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) + +if (build) + PCL_ADD_TEST(geometry_iterator test_iterator + FILES test_iterator.cpp + LINK_WITH pcl_gtest pcl_common) + + PCL_ADD_TEST(geometry_mesh_circulators test_mesh_circulators + FILES test_mesh_circulators.cpp + LINK_WITH pcl_gtest) + + PCL_ADD_TEST(geometry_mesh_conversion test_mesh_conversion + FILES test_mesh_conversion.cpp + LINK_WITH pcl_gtest pcl_common) + + PCL_ADD_TEST(geometry_mesh_data test_mesh_data + FILES test_mesh_data.cpp + LINK_WITH pcl_gtest) + + PCL_ADD_TEST(geometry_mesh_get_boundary test_mesh_get_boundary + FILES test_mesh_get_boundary.cpp + LINK_WITH pcl_gtest) + + PCL_ADD_TEST(geometry_mesh_indices test_mesh_indices + FILES test_mesh_indices.cpp + LINK_WITH pcl_gtest) + + add_definitions(-DPCL_TEST_GEOMETRY_BINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}") + PCL_ADD_TEST(geometry_mesh_io test_mesh_io + FILES test_mesh_io.cpp + LINK_WITH pcl_gtest) + + PCL_ADD_TEST(geometry_mesh test_mesh + FILES test_mesh.cpp test_mesh_common_functions.h + LINK_WITH pcl_gtest) + + PCL_ADD_TEST(geometry_polygon_mesh test_polygon_mesh + FILES test_polygon_mesh.cpp + LINK_WITH pcl_gtest) + + PCL_ADD_TEST(geometry_quad_mesh test_quad_mesh + FILES test_quad_mesh.cpp + LINK_WITH pcl_gtest) + + PCL_ADD_TEST(geometry_triangle_mesh test_triangle_mesh + FILES test_triangle_mesh.cpp + LINK_WITH pcl_gtest) +endif (build) diff --git a/test/io/CMakeLists.txt b/test/io/CMakeLists.txt index 69e23891f36..1872e6b354f 100644 --- a/test/io/CMakeLists.txt +++ b/test/io/CMakeLists.txt @@ -1,32 +1,44 @@ -PCL_ADD_TEST(io_io test_io - FILES test_io.cpp - LINK_WITH pcl_gtest pcl_io) +set(SUBSYS_NAME tests_io) +set(SUBSYS_DESC "Point cloud library io module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS io) +set(OPT_DEPS visualization) -PCL_ADD_TEST(io_iterators test_iterators - FILES test_iterators.cpp - LINK_WITH pcl_gtest pcl_io) +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) -PCL_ADD_TEST(compression_range_coder test_range_coder - FILES test_range_coder.cpp - LINK_WITH pcl_gtest pcl_io) +if (build) + PCL_ADD_TEST(io_io test_io + FILES test_io.cpp + LINK_WITH pcl_gtest pcl_io) -PCL_ADD_TEST (io_grabbers test_grabbers - FILES test_grabbers.cpp - LINK_WITH pcl_gtest pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/grabber_sequences") -# Uses VTK readers to verify -if (VTK_FOUND AND NOT ANDROID) - PCL_ADD_TEST (io_ply_mesh_io test_ply_mesh_io - FILES test_ply_mesh_io.cpp - LINK_WITH pcl_gtest pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/tum_rabbit.vtk") -endif () + PCL_ADD_TEST(io_iterators test_iterators + FILES test_iterators.cpp + LINK_WITH pcl_gtest pcl_io) + + PCL_ADD_TEST(compression_range_coder test_range_coder + FILES test_range_coder.cpp + LINK_WITH pcl_gtest pcl_io) -PCL_ADD_TEST(point_cloud_image_extractors test_point_cloud_image_extractors - FILES test_point_cloud_image_extractors.cpp - LINK_WITH pcl_gtest pcl_io) + PCL_ADD_TEST (io_grabbers test_grabbers + FILES test_grabbers.cpp + LINK_WITH pcl_gtest pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/grabber_sequences") + # Uses VTK readers to verify + if (VTK_FOUND AND NOT ANDROID) + include_directories(${VTK_INCLUDE_DIRS}) + PCL_ADD_TEST (io_ply_mesh_io test_ply_mesh_io + FILES test_ply_mesh_io.cpp + LINK_WITH pcl_gtest pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/tum_rabbit.vtk") + endif () -PCL_ADD_TEST(buffers test_buffers - FILES test_buffers.cpp - LINK_WITH pcl_gtest) + PCL_ADD_TEST(point_cloud_image_extractors test_point_cloud_image_extractors + FILES test_point_cloud_image_extractors.cpp + LINK_WITH pcl_gtest pcl_io) + PCL_ADD_TEST(buffers test_buffers + FILES test_buffers.cpp + LINK_WITH pcl_gtest pcl_common) +endif (build) diff --git a/test/io/test_octree_compression.cpp b/test/io/test_octree_compression.cpp new file mode 100644 index 00000000000..d2521d69d51 --- /dev/null +++ b/test/io/test_octree_compression.cpp @@ -0,0 +1,209 @@ +/* + * Software License Agreement (BSD License) + * + * Point Cloud Library (PCL) - www.pointclouds.org + * Copyright (c) 2014-, Centrum Wiskunde Informatica. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of the copyright holder(s) nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using namespace std; + +int total_runs = 0; + +char* pcd_file; + +#define MAX_POINTS 10000.0 +#define MAX_XYZ 1024.0 +#define MAX_COLOR 255 +#define NUMBER_OF_TEST_RUNS 2 + +TEST (PCL, OctreeDeCompressionRandomPointXYZRGBA) +{ + srand(static_cast (time(NULL))); + + // iterate over all pre-defined compression profiles + for (int compression_profile = pcl::io::LOW_RES_ONLINE_COMPRESSION_WITHOUT_COLOR; + compression_profile != pcl::io::COMPRESSION_PROFILE_COUNT; ++compression_profile) { + // instantiate point cloud compression encoder/decoder + pcl::io::OctreePointCloudCompression* pointcloud_encoder = new pcl::io::OctreePointCloudCompression((pcl::io::compression_Profiles_e) compression_profile, false); + pcl::io::OctreePointCloudCompression* pointcloud_decoder = new pcl::io::OctreePointCloudCompression(); + pcl::PointCloud::Ptr cloud_out(new pcl::PointCloud()); + // iterate over runs + for (int test_idx = 0; test_idx < NUMBER_OF_TEST_RUNS; test_idx++, total_runs++) + { + try + { + int point_count = MAX_POINTS * rand() / RAND_MAX; + if (point_count < 1) + { // empty point cloud hangs decoder + total_runs--; + continue; + } + // create shared pointcloud instances + pcl::PointCloud::Ptr cloud(new pcl::PointCloud()); + // assign input point clouds to octree + // create random point cloud + for (int point = 0; point < point_count; point++) + { + // gereate a random point + pcl::PointXYZRGBA new_point; + new_point.x = static_cast (MAX_XYZ * rand() / RAND_MAX); + new_point.y = static_cast (MAX_XYZ * rand() / RAND_MAX), + new_point.z = static_cast (MAX_XYZ * rand() / RAND_MAX); + new_point.r = static_cast (MAX_COLOR * rand() / RAND_MAX); + new_point.g = static_cast (MAX_COLOR * rand() / RAND_MAX); + new_point.b = static_cast (MAX_COLOR * rand() / RAND_MAX); + new_point.a = static_cast (MAX_COLOR * rand() / RAND_MAX); + // OctreePointCloudPointVector can store all points.. + cloud->push_back(new_point); + } + +// std::cout << "Run: " << total_runs << " compression profile:" << compression_profile << " point_count: " << point_count; + std::stringstream compressed_data; + pointcloud_encoder->encodePointCloud(cloud, compressed_data); + pointcloud_decoder->decodePointCloud(compressed_data, cloud_out); + EXPECT_GT((int)cloud_out->width, 0) << "decoded PointCloud width <= 0"; + EXPECT_GT((int)cloud_out->height, 0) << " decoded PointCloud height <= 0 "; + } + catch (std::exception& e) + { + std::cout << e.what() << std::endl; + } + } // runs + } // compression profiles +} // TEST + +TEST (PCL, OctreeDeCompressionRandomPointXYZ) +{ + srand(static_cast (time(NULL))); + + // iterate over all pre-defined compression profiles + for (int compression_profile = pcl::io::LOW_RES_ONLINE_COMPRESSION_WITHOUT_COLOR; + compression_profile != pcl::io::COMPRESSION_PROFILE_COUNT; ++compression_profile) + { + // instantiate point cloud compression encoder/decoder + pcl::io::OctreePointCloudCompression* pointcloud_encoder = new pcl::io::OctreePointCloudCompression((pcl::io::compression_Profiles_e) compression_profile, false); + pcl::io::OctreePointCloudCompression* pointcloud_decoder = new pcl::io::OctreePointCloudCompression(); + pcl::PointCloud::Ptr cloud_out(new pcl::PointCloud()); + // loop over runs + for (int test_idx = 0; test_idx < NUMBER_OF_TEST_RUNS; test_idx++, total_runs++) + { + int point_count = MAX_POINTS * rand() / RAND_MAX; + // create shared pointcloud instances + pcl::PointCloud::Ptr cloud(new pcl::PointCloud()); + // assign input point clouds to octree + // create random point cloud + for (int point = 0; point < point_count; point++) + { + // generate a random point + pcl::PointXYZ new_point(static_cast (MAX_XYZ * rand() / RAND_MAX), + static_cast (MAX_XYZ * rand() / RAND_MAX), + static_cast (MAX_XYZ * rand() / RAND_MAX)); + cloud->push_back(new_point); + } +// std::cout << "Run: " << total_runs << " compression profile:" << compression_profile << " point_count: " << point_count; + std::stringstream compressed_data; + try + { // decodePointCloud() throws exceptions on errors + pointcloud_encoder->encodePointCloud(cloud, compressed_data); + pointcloud_decoder->decodePointCloud(compressed_data, cloud_out); + EXPECT_GT((int)cloud_out->width, 0) << "decoded PointCloud width <= 0"; + EXPECT_GT((int)cloud_out->height, 0) << " decoded PointCloud height <= 0 "; + } + catch (std::exception& e) + { + std::cout << e.what() << std::endl; + } + } // runs + } // compression profiles +} // TEST + +TEST(PCL, OctreeDeCompressionFile) +{ + pcl::PointCloud::Ptr input_cloud_ptr (new pcl::PointCloud); + + // load point cloud from file, when present + if (pcd_file == NULL) return; + int rv = pcl::io::loadPCDFile(pcd_file, *input_cloud_ptr); + float voxel_sizes[] = { 0.1, 0.01 }; + + EXPECT_EQ(rv, 0) << " loadPCDFile " << pcd_file; + EXPECT_GT((int) input_cloud_ptr->width , 0) << "invalid point cloud width from " << pcd_file; + EXPECT_GT((int) input_cloud_ptr->height, 0) << "invalid point cloud heigth from " << pcd_file; + + // iterate over compression profiles + for (int compression_profile = pcl::io::LOW_RES_ONLINE_COMPRESSION_WITHOUT_COLOR; + compression_profile != pcl::io::COMPRESSION_PROFILE_COUNT; ++compression_profile) { + // instantiate point cloud compression encoder/decoder + pcl::io::OctreePointCloudCompression* PointCloudEncoder = new pcl::io::OctreePointCloudCompression((pcl::io::compression_Profiles_e) compression_profile, false); + pcl::io::OctreePointCloudCompression* PointCloudDecoder = new pcl::io::OctreePointCloudCompression(); + + // iterate over various voxel sizes + for (int i = 0; i < sizeof(voxel_sizes)/sizeof(voxel_sizes[0]); i++) { + pcl::octree::OctreePointCloud octree(voxel_sizes[i]); + pcl::PointCloud::Ptr octree_out(new pcl::PointCloud()); + octree.setInputCloud((*input_cloud_ptr).makeShared()); + octree.addPointsFromInputCloud(); + + std::stringstream compressedData; + PointCloudEncoder->encodePointCloud(octree.getInputCloud(), compressedData); + PointCloudDecoder->decodePointCloud(compressedData, octree_out); + EXPECT_GT((int)octree_out->width, 0) << "decoded PointCloud width <= 0"; + EXPECT_GT((int)octree_out->height, 0) << " decoded PointCloud height <= 0 "; + total_runs++; + } + delete PointCloudDecoder; + delete PointCloudEncoder; + } +} + +/* ---[ */ +int +main (int argc, char** argv) +{ + testing::InitGoogleTest (&argc, argv); + if (argc > 1) { + pcd_file = argv[1]; + } + return (RUN_ALL_TESTS ()); + std::cerr << "Finished " << total_runs << " runs." << std::endl; +} +/* ]--- */ diff --git a/test/kdtree/CMakeLists.txt b/test/kdtree/CMakeLists.txt index 7b5b461a4e9..67532ac7807 100644 --- a/test/kdtree/CMakeLists.txt +++ b/test/kdtree/CMakeLists.txt @@ -1,4 +1,18 @@ -PCL_ADD_TEST (kdtree_kdtree test_kdtree - FILES test_kdtree.cpp - LINK_WITH pcl_gtest pcl_kdtree pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/sac_plane_test.pcd" "${PCL_SOURCE_DIR}/test/kdtree/kdtree_unit_test_results.xml") +set(SUBSYS_NAME tests_kdtree) +set(SUBSYS_DESC "Point cloud library kdtree module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS kdtree) +set(OPT_DEPS io) # io is not a mandatory dependency in kdtree + +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) + +if (build) + if (BUILD_io) + PCL_ADD_TEST (kdtree_kdtree test_kdtree + FILES test_kdtree.cpp + LINK_WITH pcl_gtest pcl_kdtree pcl_io pcl_common + ARGUMENTS "${PCL_SOURCE_DIR}/test/sac_plane_test.pcd" "${PCL_SOURCE_DIR}/test/kdtree/kdtree_unit_test_results.xml") + endif (BUILD_io) +endif (build) diff --git a/test/keypoints/CMakeLists.txt b/test/keypoints/CMakeLists.txt index b4c765a607a..1d31a3a2ab5 100644 --- a/test/keypoints/CMakeLists.txt +++ b/test/keypoints/CMakeLists.txt @@ -1,9 +1,23 @@ -PCL_ADD_TEST(keypoints_general test_keypoints - FILES test_keypoints.cpp - LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_filters pcl_keypoints - ARGUMENTS "${PCL_SOURCE_DIR}/test/cturtle.pcd") +set(SUBSYS_NAME tests_keypoints) +set(SUBSYS_DESC "Point cloud library keypoints module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS keypoints) +set(OPT_DEPS io) # module does not depend on these -PCL_ADD_TEST(keypoints_iss_3d test_iss_3d - FILES test_iss_3d.cpp - LINK_WITH pcl_gtest pcl_keypoints pcl_io - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) + +if (build) + if (BUILD_io) + PCL_ADD_TEST(keypoints_general test_keypoints + FILES test_keypoints.cpp + LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_filters pcl_keypoints + ARGUMENTS "${PCL_SOURCE_DIR}/test/cturtle.pcd") + + PCL_ADD_TEST(keypoints_iss_3d test_iss_3d + FILES test_iss_3d.cpp + LINK_WITH pcl_gtest pcl_keypoints pcl_io + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + endif (BUILD_io) +endif (build) diff --git a/test/octree/CMakeLists.txt b/test/octree/CMakeLists.txt index 9e87a4371e4..a1c8fe7359a 100644 --- a/test/octree/CMakeLists.txt +++ b/test/octree/CMakeLists.txt @@ -1,3 +1,14 @@ -PCL_ADD_TEST(a_octree_test test_octree - FILES test_octree.cpp - LINK_WITH pcl_gtest pcl_common) +set(SUBSYS_NAME tests_octree) +set(SUBSYS_DESC "Point cloud library octree module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS octree) + +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) + +if (build) + PCL_ADD_TEST(a_octree_test test_octree + FILES test_octree.cpp + LINK_WITH pcl_gtest pcl_common) +endif (build) diff --git a/test/outofcore/CMakeLists.txt b/test/outofcore/CMakeLists.txt index 5dfcfa0cdc0..849da3c3920 100644 --- a/test/outofcore/CMakeLists.txt +++ b/test/outofcore/CMakeLists.txt @@ -1,5 +1,18 @@ -PCL_ADD_TEST (outofcore_test test_outofcore - FILES test_outofcore.cpp - LINK_WITH pcl_gtest pcl_common pcl_io pcl_filters pcl_outofcore - #ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" - ) +set(SUBSYS_NAME tests_outofcore) +set(SUBSYS_DESC "Point cloud library outofcore module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS outofcore) +set(OPT_DEPS) # module does not depend on these + +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) + +if (build) + include_directories(${VTK_INCLUDE_DIRS}) + PCL_ADD_TEST (outofcore_test test_outofcore + FILES test_outofcore.cpp + LINK_WITH pcl_gtest pcl_common pcl_io pcl_filters pcl_outofcore pcl_visualization + #ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" + ) +endif (build) diff --git a/test/people/CMakeLists.txt b/test/people/CMakeLists.txt new file mode 100644 index 00000000000..e4ee0fbc140 --- /dev/null +++ b/test/people/CMakeLists.txt @@ -0,0 +1,17 @@ +set(SUBSYS_NAME tests_people) +set(SUBSYS_DESC "Point cloud library people module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS people) +set(OPT_DEPS) # module does not depend on these + +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) + +if (build) + include_directories(${VTK_INCLUDE_DIRS}) + PCL_ADD_TEST(a_people_detection_test test_people_detection + FILES test_people_groundBasedPeopleDetectionApp.cpp + LINK_WITH pcl_gtest pcl_common pcl_io pcl_kdtree pcl_search pcl_features pcl_sample_consensus pcl_filters pcl_io pcl_segmentation pcl_people + ARGUMENTS "${PCL_SOURCE_DIR}/people/data/trainedLinearSVMForPeopleDetectionWithHOG.yaml" "${PCL_SOURCE_DIR}/test/five_people.pcd") +endif (build) diff --git a/test/test_people_groundBasedPeopleDetectionApp.cpp b/test/people/test_people_groundBasedPeopleDetectionApp.cpp similarity index 100% rename from test/test_people_groundBasedPeopleDetectionApp.cpp rename to test/people/test_people_groundBasedPeopleDetectionApp.cpp diff --git a/test/recognition/CMakeLists.txt b/test/recognition/CMakeLists.txt new file mode 100644 index 00000000000..585b63297e7 --- /dev/null +++ b/test/recognition/CMakeLists.txt @@ -0,0 +1,23 @@ +set(SUBSYS_NAME tests_recognition) +set(SUBSYS_DESC "Point cloud library recognition module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS recognition) +set(OPT_DEPS keypoints) # module does not depend on these + +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) + +if (build) + PCL_ADD_TEST(a_recognition_ism_test test_recognition_ism + FILES test_recognition_ism.cpp + LINK_WITH pcl_gtest pcl_io pcl_features + ARGUMENTS "${PCL_SOURCE_DIR}/test/ism_train.pcd" "${PCL_SOURCE_DIR}/test/ism_test.pcd") + + if (BUILD_keypoints) + PCL_ADD_TEST(a_recognition_cg_test test_recognition_cg + FILES test_recognition_cg.cpp + LINK_WITH pcl_gtest pcl_common pcl_io pcl_kdtree pcl_features pcl_recognition pcl_keypoints + ARGUMENTS "${PCL_SOURCE_DIR}/test/milk.pcd" "${PCL_SOURCE_DIR}/test/milk_cartoon_all_small_clorox.pcd") + endif (BUILD_keypoints) +endif (build) diff --git a/test/test_recognition_cg.cpp b/test/recognition/test_recognition_cg.cpp similarity index 100% rename from test/test_recognition_cg.cpp rename to test/recognition/test_recognition_cg.cpp diff --git a/test/test_recognition_ism.cpp b/test/recognition/test_recognition_ism.cpp similarity index 100% rename from test/test_recognition_ism.cpp rename to test/recognition/test_recognition_ism.cpp diff --git a/test/registration/CMakeLists.txt b/test/registration/CMakeLists.txt index 7a4dd2c7733..ff6c7ad94bc 100644 --- a/test/registration/CMakeLists.txt +++ b/test/registration/CMakeLists.txt @@ -1,32 +1,46 @@ -PCL_ADD_TEST(a_registration_test test_registration - FILES test_registration.cpp - LINK_WITH pcl_gtest pcl_io pcl_registration pcl_features pcl_search pcl_kdtree pcl_kdtree - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" "${PCL_SOURCE_DIR}/test/bun4.pcd" "${PCL_SOURCE_DIR}/test/milk_color.pcd") - -PCL_ADD_TEST(registration_api test_registration_api - FILES test_registration_api.cpp test_registration_api_data.h - LINK_WITH pcl_gtest pcl_io pcl_registration pcl_features pcl_kdtree - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" "${PCL_SOURCE_DIR}/test/bun4.pcd") - -PCL_ADD_TEST(registration_warp_api test_warps +set(SUBSYS_NAME tests_registration) +set(SUBSYS_DESC "Point cloud library registration module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS registration) +set(OPT_DEPS io) # module does not depend on these + +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) + +if (build) + PCL_ADD_TEST(registration_warp_api test_warps FILES test_warps.cpp - LINK_WITH pcl_gtest pcl_io pcl_registration) - -PCL_ADD_TEST(correspondence_estimation test_correspondence_estimation - FILES test_correspondence_estimation.cpp - LINK_WITH pcl_gtest pcl_io pcl_registration pcl_features) - -PCL_ADD_TEST(correspondence_rejectors test_correspondence_rejectors - FILES test_correspondence_rejectors.cpp - LINK_WITH pcl_gtest pcl_io pcl_registration pcl_features - ARGUMENTS "${PCL_SOURCE_DIR}/test/bunny.pcd") - -PCL_ADD_TEST(fpcs_ia test_fpcs_ia - FILES test_fpcs_ia.cpp test_fpcs_ia_data.h - LINK_WITH pcl_gtest pcl_io pcl_registration pcl_features pcl_search pcl_kdtree - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" "${PCL_SOURCE_DIR}/test/bun4.pcd") - -PCL_ADD_TEST(kfpcs_ia test_kfpcs_ia - FILES test_kfpcs_ia.cpp test_kfpcs_ia_data.h - LINK_WITH pcl_gtest pcl_io pcl_registration pcl_features pcl_search pcl_kdtree - ARGUMENTS "${PCL_SOURCE_DIR}/test/office1_keypoints.pcd" "${PCL_SOURCE_DIR}/test/office2_keypoints.pcd") \ No newline at end of file + LINK_WITH pcl_gtest pcl_registration) + + PCL_ADD_TEST(correspondence_estimation test_correspondence_estimation + FILES test_correspondence_estimation.cpp + LINK_WITH pcl_gtest pcl_registration pcl_features) + + if (BUILD_io) + PCL_ADD_TEST(a_registration_test test_registration + FILES test_registration.cpp + LINK_WITH pcl_gtest pcl_io pcl_registration pcl_features pcl_search pcl_kdtree pcl_kdtree + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" "${PCL_SOURCE_DIR}/test/bun4.pcd" "${PCL_SOURCE_DIR}/test/milk_color.pcd") + + PCL_ADD_TEST(registration_api test_registration_api + FILES test_registration_api.cpp test_registration_api_data.h + LINK_WITH pcl_gtest pcl_io pcl_registration pcl_features pcl_kdtree + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" "${PCL_SOURCE_DIR}/test/bun4.pcd") + + PCL_ADD_TEST(correspondence_rejectors test_correspondence_rejectors + FILES test_correspondence_rejectors.cpp + LINK_WITH pcl_gtest pcl_io pcl_registration pcl_features + ARGUMENTS "${PCL_SOURCE_DIR}/test/bunny.pcd") + + PCL_ADD_TEST(fpcs_ia test_fpcs_ia + FILES test_fpcs_ia.cpp test_fpcs_ia_data.h + LINK_WITH pcl_gtest pcl_io pcl_registration pcl_features pcl_search pcl_kdtree + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" "${PCL_SOURCE_DIR}/test/bun4.pcd") + + PCL_ADD_TEST(kfpcs_ia test_kfpcs_ia + FILES test_kfpcs_ia.cpp test_kfpcs_ia_data.h + LINK_WITH pcl_gtest pcl_io pcl_registration pcl_features pcl_search pcl_kdtree + ARGUMENTS "${PCL_SOURCE_DIR}/test/office1_keypoints.pcd" "${PCL_SOURCE_DIR}/test/office2_keypoints.pcd") + endif (BUILD_io) +endif (build) diff --git a/test/sample_consensus/CMakeLists.txt b/test/sample_consensus/CMakeLists.txt index 3d221f9ce73..222405342eb 100644 --- a/test/sample_consensus/CMakeLists.txt +++ b/test/sample_consensus/CMakeLists.txt @@ -1,16 +1,30 @@ -PCL_ADD_TEST(sample_consensus test_sample_consensus - FILES test_sample_consensus.cpp - LINK_WITH pcl_gtest pcl_sample_consensus) +set(SUBSYS_NAME tests_sample_consensus) +set(SUBSYS_DESC "Point cloud library sample_consensus module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS sample_consensus) +set(OPT_DEPS io) -PCL_ADD_TEST(sample_consensus_plane_models test_sample_consensus_plane_models - FILES test_sample_consensus_plane_models.cpp - LINK_WITH pcl_gtest pcl_io pcl_sample_consensus - ARGUMENTS "${PCL_SOURCE_DIR}/test/sac_plane_test.pcd") +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) -PCL_ADD_TEST(sample_consensus_quadric_models test_sample_consensus_quadric_models - FILES test_sample_consensus_quadric_models.cpp - LINK_WITH pcl_gtest pcl_sample_consensus) +if (build) + PCL_ADD_TEST(sample_consensus test_sample_consensus + FILES test_sample_consensus.cpp + LINK_WITH pcl_gtest pcl_sample_consensus pcl_search pcl_common) -PCL_ADD_TEST(sample_consensus_line_models test_sample_consensus_line_models - FILES test_sample_consensus_line_models.cpp - LINK_WITH pcl_gtest pcl_sample_consensus) + if (BUILD_io) + PCL_ADD_TEST(sample_consensus_plane_models test_sample_consensus_plane_models + FILES test_sample_consensus_plane_models.cpp + LINK_WITH pcl_gtest pcl_io pcl_sample_consensus + ARGUMENTS "${PCL_SOURCE_DIR}/test/sac_plane_test.pcd") + endif (BUILD_io) + + PCL_ADD_TEST(sample_consensus_quadric_models test_sample_consensus_quadric_models + FILES test_sample_consensus_quadric_models.cpp + LINK_WITH pcl_gtest pcl_sample_consensus) + + PCL_ADD_TEST(sample_consensus_line_models test_sample_consensus_line_models + FILES test_sample_consensus_line_models.cpp + LINK_WITH pcl_gtest pcl_sample_consensus) +endif (build) diff --git a/test/search/CMakeLists.txt b/test/search/CMakeLists.txt index 31940f96091..5963c8dfae2 100644 --- a/test/search/CMakeLists.txt +++ b/test/search/CMakeLists.txt @@ -1,14 +1,33 @@ -PCL_ADD_TEST(kdtree_search test_kdtree_search - FILES test_kdtree.cpp - LINK_WITH pcl_gtest pcl_search pcl_io pcl_kdtree) +set(SUBSYS_NAME tests_search) +set(SUBSYS_DESC "Point cloud library search module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS search) +set(OPT_DEPS io) + +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) + +if (build) + PCL_ADD_TEST(kdtree_search test_kdtree_search + FILES test_kdtree.cpp + LINK_WITH pcl_gtest pcl_search pcl_kdtree) PCL_ADD_TEST(flann_search test_flann_search FILES test_flann_search.cpp - LINK_WITH pcl_gtest pcl_search pcl_io pcl_kdtree) + LINK_WITH pcl_gtest pcl_search pcl_kdtree) PCL_ADD_TEST(organized_neighbor test_organized_search FILES test_organized.cpp - LINK_WITH pcl_gtest pcl_search pcl_io pcl_kdtree) + LINK_WITH pcl_gtest pcl_search pcl_kdtree) + + PCL_ADD_TEST(octree_search test_octree_search + FILES test_octree.cpp + LINK_WITH pcl_gtest pcl_search pcl_octree pcl_common) -PCL_ADD_TEST(octree_search test_octree_search - FILES test_octree.cpp - LINK_WITH pcl_gtest pcl_search pcl_io pcl_kdtree) + if (BUILD_io) + PCL_ADD_TEST(search test_search + FILES test_search.cpp + LINK_WITH pcl_gtest pcl_search pcl_io pcl_kdtree + ARGUMENTS "${PCL_SOURCE_DIR}/test/table_scene_mug_stereo_textured.pcd") + endif (BUILD_io) +endif (build) diff --git a/test/test_search.cpp b/test/search/test_search.cpp similarity index 99% rename from test/test_search.cpp rename to test/search/test_search.cpp index de780de7fe0..8d997fb6daa 100644 --- a/test/test_search.cpp +++ b/test/search/test_search.cpp @@ -41,9 +41,11 @@ #include #include #include -#include "boost.h" - #include +#include +#include +#include +#include using namespace pcl; using namespace std; diff --git a/test/segmentation/CMakeLists.txt b/test/segmentation/CMakeLists.txt index aee5d624e5f..cc1f5585797 100644 --- a/test/segmentation/CMakeLists.txt +++ b/test/segmentation/CMakeLists.txt @@ -1,7 +1,29 @@ -# Random walker requires Eigen::Sparse module that is available since 3.1.0 -if(NOT ("${EIGEN_VERSION}" VERSION_LESS 3.1.0)) - PCL_ADD_TEST(random_walker test_random_walker - FILES test_random_walker.cpp - LINK_WITH pcl_gtest - ARGUMENTS "${PCL_SOURCE_DIR}/test/segmentation/data") -endif() +set(SUBSYS_NAME tests_segmentation) +set(SUBSYS_DESC "Point cloud library segmentation module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS segmentation) +set(OPT_DEPS) # module does not depend on these + +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) + +if (build) + # Random walker requires Eigen::Sparse module that is available since 3.1.0 + if(NOT ("${EIGEN_VERSION}" VERSION_LESS 3.1.0)) + PCL_ADD_TEST(random_walker test_random_walker + FILES test_random_walker.cpp + LINK_WITH pcl_gtest + ARGUMENTS "${PCL_SOURCE_DIR}/test/segmentation/data") + endif() + + PCL_ADD_TEST(a_segmentation_test test_segmentation + FILES test_segmentation.cpp + LINK_WITH pcl_gtest pcl_io pcl_segmentation pcl_features pcl_kdtree pcl_search pcl_common + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" "${PCL_SOURCE_DIR}/test/car6.pcd" "${PCL_SOURCE_DIR}/test/colored_cloud.pcd") + + PCL_ADD_TEST(test_non_linear test_non_linear + FILES test_non_linear.cpp + LINK_WITH pcl_gtest pcl_common pcl_io pcl_sample_consensus pcl_segmentation pcl_kdtree pcl_search + ARGUMENTS "${PCL_SOURCE_DIR}/test/noisy_slice_displaced.pcd") +endif (build) diff --git a/test/test_non_linear.cpp b/test/segmentation/test_non_linear.cpp similarity index 100% rename from test/test_non_linear.cpp rename to test/segmentation/test_non_linear.cpp diff --git a/test/test_segmentation.cpp b/test/segmentation/test_segmentation.cpp similarity index 100% rename from test/test_segmentation.cpp rename to test/segmentation/test_segmentation.cpp diff --git a/test/surface/CMakeLists.txt b/test/surface/CMakeLists.txt index ca500262408..453d7095689 100644 --- a/test/surface/CMakeLists.txt +++ b/test/surface/CMakeLists.txt @@ -1,40 +1,55 @@ -PCL_ADD_TEST(surface_marching_cubes test_marching_cubes - FILES test_marching_cubes.cpp - LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_search - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(surface_moving_least_squares test_moving_least_squares - FILES test_moving_least_squares.cpp - LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_search - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(surface_gp3 test_gp3 - FILES test_gp3.cpp - LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_search - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(surface_organized_fast_mesh test_organized_fast_mesh - FILES test_organized_fast_mesh.cpp - LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_search - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(surface_grid_projection test_grid_projection - FILES test_grid_projection.cpp - LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_search - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -PCL_ADD_TEST(surface_ear_clipping test_ear_clipping - FILES test_ear_clipping.cpp - LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_search - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -#PCL_ADD_TEST(surface_poisson test_poisson -# FILES test_poisson.cpp -# LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features -# ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") +set(SUBSYS_NAME tests_surface) +set(SUBSYS_DESC "Point cloud library surface module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS surface) +set(OPT_DEPS io features sample_consensus filters) # module does not depend on these -if(QHULL_FOUND) - PCL_ADD_TEST(surface_convex_hull test_convex_hull - FILES test_convex_hull.cpp - LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_filters pcl_search - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") - PCL_ADD_TEST(surface_concave test_concave_hull - FILES test_concave_hull.cpp - LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_filters pcl_search - ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") -endif(QHULL_FOUND) +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) +if (build) + if (BUILD_io AND BUILD_features) + PCL_ADD_TEST(surface_marching_cubes test_marching_cubes + FILES test_marching_cubes.cpp + LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_search + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(surface_moving_least_squares test_moving_least_squares + FILES test_moving_least_squares.cpp + LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_search + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(surface_gp3 test_gp3 + FILES test_gp3.cpp + LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_search + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(surface_organized_fast_mesh test_organized_fast_mesh + FILES test_organized_fast_mesh.cpp + LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_search + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(surface_grid_projection test_grid_projection + FILES test_grid_projection.cpp + LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_search + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(surface_ear_clipping test_ear_clipping + FILES test_ear_clipping.cpp + LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_search + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + #PCL_ADD_TEST(surface_poisson test_poisson + # FILES test_poisson.cpp + # LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features + # ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + + if(QHULL_FOUND) + PCL_ADD_TEST(surface_convex_hull test_convex_hull + FILES test_convex_hull.cpp + LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_filters pcl_search + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + if (BUILD_sample_consensus AND BUILD_filters) + PCL_ADD_TEST(surface_concave test_concave_hull + FILES test_concave_hull.cpp + LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_filters pcl_search pcl_sample_consensus + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + endif (BUILD_sample_consensus AND BUILD_filters) + endif(QHULL_FOUND) + endif (BUILD_io AND BUILD_features) +endif (build) diff --git a/test/visualization/CMakeLists.txt b/test/visualization/CMakeLists.txt new file mode 100644 index 00000000000..b3545c4c1d4 --- /dev/null +++ b/test/visualization/CMakeLists.txt @@ -0,0 +1,18 @@ +set(SUBSYS_NAME tests_visualization) +set(SUBSYS_DESC "Point cloud library visualization module unit tests") +PCL_SET_TEST_DEPENDENCIES(SUBSYS_DEPS visualization) +set(OPT_DEPS features) # module does not depend on these + +set(DEFAULT ON) +set(build TRUE) +PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS}) + +if (build) + if(BUILD_features AND NOT UNIX OR (UNIX AND DEFINED ENV{DISPLAY})) + PCL_ADD_TEST(a_visualization_test test_visualization + FILES test_visualization.cpp + LINK_WITH pcl_gtest pcl_io pcl_visualization pcl_features + ARGUMENTS "${PCL_SOURCE_DIR}/test/bunny.pcd") + endif (BUILD_features AND NOT UNIX OR (UNIX AND DEFINED ENV{DISPLAY})) +endif (build) diff --git a/test/test_visualization.cpp b/test/visualization/test_visualization.cpp similarity index 100% rename from test/test_visualization.cpp rename to test/visualization/test_visualization.cpp