Skip to content

Instantly share code, notes, and snippets.

@pierceh89
Forked from UnaNancyOwen/PCL1.10.0.md
Last active September 5, 2021 09:01
Show Gist options
  • Save pierceh89/8f942221599e625a2a08 to your computer and use it in GitHub Desktop.
Save pierceh89/8f942221599e625a2a08 to your computer and use it in GitHub Desktop.
Building PCL with Visual Studio

Building PCL with Visual Studio 2013 ( 비주얼 스투디오 2013에서 PCL 빌드하기, 64bit version )

Download

  1. 아래 주소에서 PCL을 다운받아 압축을 푼다. (예 C:\PCL-1.7.2)
    https://github.com/PointCloudLibrary/pcl/tree/pcl-1.7.2

3rdParty

  1. PCL을 빌드하는데 필요한 3rdParty 라이브러리들을 모두 다운받아 빌드한다.

주의: 모든 라이브러리는 Debug/Release 모드로 한번씩 빌드하고 모두 INSTALL해야한다! * Boost https://gist.github.com/pierceh89/20c96a6a6125b5eb519b#file-boost1-56-0-md
* Eigen https://gist.github.com/pierceh89/253d04ff4a55e0ef3084
* FLANN https://gist.github.com/pierceh89/4f105538305d2d2306f5
* QHull https://gist.github.com/pierceh89/66af6812625ff6240e59 * VTK https://gist.github.com/pierceh89/09b94fc9b0f87bb3910f#file-vtk6-md

  1. 3rdParty 라이브러리들을 빌드하고 INSTALL까지 한 뒤에 아래 처럼 환경변수 설정을 해준다.
    • BOOST_ROOT C:\Program Files\Boost
    • EIGEN_ROOT C:\Program Files\Eigen
    • FLANN_ROOT C:\Program Files\flann
    • QHULL_ROOT C:\Program Files\qhull
    • VTK_DIR C:\Program Files\VTK

CMake

  1. CMake 3.0.2보다 최신 버전을 사용할 경우 다음을 변경해 준다. (내 경우 1.72버전 빌드 할 때 수정해줄 필요 없었음.) https://github.com/PointCloudLibrary/pcl/commit/f9c0d73a0536e85c06432732d19e38349a785ad4

  2. CMake GUI에서 다음 칸들을 채워준다.

    • Where is the source code: C:\PCL-master (PCL 소스 코드가 있는 경로)
    • Where is build the binaries: C:\PCL-master\build (PCL 빌드가 저장될 경로)
  3. [Configure]를 누르면 컴파일러 선택하는 창이 나오는데 Visual studio 12 2013 Win64(혹은 다른 버전의 비주얼 스투디오)를 선택하면 된다.

  4. 3rdParty 라이브러리들을 제대로 설치했다면 문제없이 Configuration이 가능하다. 이제 다양한 설정을 해줘야 한다. (Grouped, Advanced에 체크를 해주면 설정을 확인하기 쉽다.) 여기 나오는 설명대로 따라했을 경우엔 DIR경로들이 비슷하게 나왔을 것이다. 찾아보면서 각 Entry에 값이 제대로 설정되있는지 확인한다. Ungrouped Entries

    • EIGEN_INCLUDE_DIR C:\Program Files\Eigen\include\eigen3
    • VTK_DIR C:\Program Files\VTK\lib\cmake\vtk-6.1

    BUILD (빌드하는 버전이 다르다면, 다른 옵션이 더 있을 수도 있는데, uncheck하라는것만 uncheck하면 될듯 하다.)

    • BUILD_OPENNI ☐(uncheck)
    • BUILD_OPENNI2 ☐(uncheck)
    • BUILD_all_in_one_installer ☐(uncheck)
    • BUILD_apps ☐(uncheck)
    • BUILD_common ☑(check)
    • BUILD_example ☐(uncheck)
    • BUILD_features ☑(check)
    • BUILD_filters ☑(check)
    • BUILD_geometry ☑(check)
    • BUILD_global_tests ☐(uncheck)
    • BUILD_io ☑(check)
    • BUILD_kdtree ☑(check)
    • BUILD_keypoints ☑(check)
    • BUILD_outofcore ☑(check)
    • BUILD_people ☑(check)
    • BUILD_recognition ☑(check)
    • BUILD_registration ☑(check)
    • BUILD_sample_consensus ☑(check)
    • BUILD_search ☑(check)
    • BUILD_segmentation ☑(check)
    • BUILD_surface ☑(check)
    • BUILD_surface_on_nurbs ☑(check)
    • BUILD_tools ☑(check)
    • BUILD_tracking ☑(check)
    • BUILD_visualization ☑(check)

    Boost

    • Boost_DATE_TIME_LIBRARY_DEBUG C:\Program Files\Boost\lib\libboost_date_time-vc120-mt-gd-1_56.lib
    • Boost_DATE_TIME_LIBRARY_RELEASE C:\Program Files\Boost\lib\libboost_date_time-vc120-mt-1_56.lib
    • Boost_FILESYSTEM_LIBRARY_DEBUG C:\Program Files\Boost\lib\libboost_filesystem-vc120-mt-gd-1_56.lib
    • Boost_FILESYSTEM_LIBRARY_RELEASE C:\Program Files\Boost\lib\libboost_filesystem-vc120-mt-1_56.lib
    • Boost_INCLUDE_DIR C:\Program Files\Boost\include\boost-1_56
    • Boost_IOSTREAMS_LIBRARY_DEBUG C:\Program Files\Boost\lib\libboost_iostreams-vc120-mt-gd-1_56.lib
    • Boost_IOSTREAMS_LIBRARY_RELEASE C:\Program Files\Boost\lib\libboost_iostreams-vc120-mt-1_56.lib
    • Boost_MPI_LIBRARY_DEBUG C:\Program Files\Boost\lib\libboost_mpi-vc120-mt-gd-1_56.lib
    • Boost_MPI_LIBRARY_RELEASE C:\Program Files\Boost\lib\libboost_mpi-vc120-mt-1_56.lib
    • Boost_SERIALIZATION_LIBRARY_DEBUG C:\Program Files\Boost\lib\libboost_serialization-vc120-mt-gd-1_56.lib
    • Boost_SERIALIZATION_LIBRARY_RELEASE C:\Program Files\Boost\lib\libboost_serialization-vc120-mt-1_56.lib
    • Boost_SYSTEM_LIBRARY_DEBUG C:\Program Files\Boost\lib\libboost_system-vc120-mt-gd-1_56.lib
    • Boost_SYSTEM_LIBRARY_RELEASE C:\Program Files\Boost\lib\libboost_system-vc120-mt-1_56.lib
    • Boost_THREAD_LIBRARY_DEBUG C:\Program Files\Boost\lib\libboost_thread-vc120-mt-gd-1_56.lib
    • Boost_THREAD_LIBRARY_RELEASE C:\Program Files\Boost\lib\libboost_thread-vc120-mt-1_56.lib

    CMAKE

    • CMAKE_CONFIGURATION_TYPES Debug;Release
    • CMAKE_INSTALL_PREFIX C:\Program Files\PCL

    FLANN

    • FLANN_INCLUDE_DIR C:\Program Files\flann\include
    • FLANN_LIBRARY C:\Program Files\flann\lib\flann_cpp_s.lib
    • FLANN_LIBRARY_DEBUG C:\Program Files\flann\lib\flann_cpp_s-gd.lib

    QHULL

    • QHULL_INCLUDE_DIR C:\Program Files\qhull\include
    • QHULL_LIBRARY C:\Program Files\qhull\lib\qhullstatic.lib
    • QHULL_LIBRARY_DEBUG C:\Program Files\qhull\lib\qhullstatic_d.lib

    WITH

    • WITH_DOCS ☐(uncheck)
    • WITH_FZAPI ☐(uncheck)
    • WITH_LIBUSB ☐(uncheck)
    • WITH_OPENNI ☐(uncheck)
    • WITH_OPENNI2 ☐(uncheck)
    • WITH_PCAP ☐(uncheck)
    • WITH_PNG ☐(uncheck)
    • WITH_PXCAPI ☐(uncheck)
    • WITH_QHULL ☑(check)
    • WITH_QT ☐(uncheck)
    • WITH_VTK ☑(check)
  5. 아래의 세팅을 확인해보자.

    • Boost version: 1.56.0
      Found the following Boost libraries:
      system
      filesystem
      thread
      date_time
      iostreams
      chrono
    • Eigen found (include: C:/Program Files/Eigen/include/eigen3, version: 3.2.2)
    • FLANN found (include: C:/Program Files/flann/include, lib: optimized;C:/Program Files/flann/lib/flann_cpp_s.lib;debug;C:/Program Files/flann/lib/flann_cpp_s-gd.lib)
    • QHULL found (include: C:/Program Files/qhull/include, lib: optimized;C:/Program Files/qhull/lib/qhullstatic.lib;debug;C:/Program Files/qhull/lib/qhullstatic_d.lib)
    • VTK_MAJOR_VERSION 6
      VTK found (include: C:/Program Files/VTK/include/vtk-6.1, lib: vtkalglib;vtkChartsCore;vtkCommonColor;vtkCommonDataModel;vtkCommonMath;vtkCommonCore;vtksys;vtkCommonMisc;vtkCommonSystem;vtkCommonTransforms;vtkInfovisCore;vtkFiltersExtraction;vtkCommonExecutionModel;vtkFiltersCore;vtkFiltersGeneral;vtkCommonComputationalGeometry;vtkFiltersStatistics;vtkImagingFourier;vtkImagingCore;vtkRenderingContext2D;vtkRenderingCore;vtkFiltersGeometry;vtkFiltersSources;vtkRenderingFreeType;vtkfreetype;vtkzlib;vtkftgl;vtkRenderingOpenGL;vtkImagingHybrid;vtkIOImage;vtkDICOMParser;vtkIOCore;vtkmetaio;vtkjpeg;vtkpng;vtktiff;vtkDomainsChemistry;vtkIOXML;vtkIOGeometry;vtkjsoncpp;vtkIOXMLParser;vtkexpat;vtkexoIIc;vtkNetCDF;vtkNetCDF_cxx;vtkhdf5_hl;vtkhdf5;vtkFiltersAMR;vtkParallelCore;vtkIOLegacy;vtkFiltersFlowPaths;vtkFiltersGeneric;vtkFiltersHybrid;vtkImagingSources;vtkFiltersHyperTree;vtkFiltersImaging;vtkImagingGeneral;vtkFiltersModeling;vtkFiltersParallel;vtkFiltersParallelImaging;vtkFiltersProgrammable;vtkFiltersSelection;vtkFiltersSMP;vtkFiltersTexture;vtkFiltersVerdict;verdict;vtkGeovisCore;vtkInfovisLayout;vtkInteractionStyle;vtkInteractionWidgets;vtkRenderingAnnotation;vtkImagingColor;vtkRenderingVolume;vtkViewsCore;vtkproj4;vtkgl2ps;vtkImagingMath;vtkImagingMorphological;vtkImagingStatistics;vtkImagingStencil;vtkInteractionImage;vtkIOAMR;vtkIOEnSight;vtkIOExodus;vtkIOExport;vtkRenderingGL2PS;vtkRenderingLabel;vtkIOImport;vtkIOInfovis;vtklibxml2;vtkIOLSDyna;vtkIOMINC;vtkIOMovie;vtkoggtheora;vtkIONetCDF;vtkIOParallel;vtkIOPLY;vtkIOSQL;vtksqlite;vtkIOVideo;vtkRenderingFreeTypeOpenGL;vtkRenderingImage;vtkRenderingLIC;vtkRenderingLOD;vtkRenderingVolumeAMR;vtkRenderingVolumeOpenGL;vtkViewsContext2D;vtkViewsGeovis;vtkViewsInfovis)
  6. [Generate]를 눌러서 솔루션이 나오는지 확인해본다. 오류 안나면 거의 끝!

Build

  1. PCL의 솔루션 파일 sln을 연다. 이 때 Visual Studio를 관리자 모드로 열지 않으면 나중에 INSTALL - 빌드된 파일들을 모두 C:\Program Files\PCL\ 에 카피하는 과정 - 이 되지 않는다.

  2. 이제 PCL을 빌드한다.

    1. Debug 모드, Release 모드 중 하나를 선택한다.
    2. 솔루션 창에서 ALL_BUILD를 선택한다.
    3. [빌드] -> [빌드 솔루션]을 눌러서 PCL을 빌드한다.
  3. PCL을 INSTALL하기

    1. 솔루션 탐색기에서 INSTALL을 선택한다.
    2. [빌드] -> [프로젝트만] -> [INSTALL만 빌드] 선택하여 INSTALL한다.

Environment Variable (환경 변수)

  1. PCL_ROOT 로 환경 변수를 만든다. 경로 (C:\Program Files\PCL)

  2. Path 에 다음을 추가한다. PCL binary와 3rd party의 binary 경로들

    • ;%PCL_ROOT%\bin
@pierceh89
Copy link
Author

@dpwls1379 도움이 되셨다니 다행입니다!

@yjbong
Copy link

yjbong commented Jul 21, 2021

혹시 Visual Studio 2019 에서도 될까요?

@pierceh89
Copy link
Author

혹시 Visual Studio 2019 에서도 될까요?

안녕하세요. 최근에는 윈도우 장비가 없어서 테스트해볼수 없는 상황입니다. 하지만 의존성 라이브러리 - boost, eigen, flann, qhull, vtk를 빌드할 때 동일한 버전으로 맞춰주시면 2019버전에서도 가능하실 거에요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment