Merge pull request #1283 from UnaNancyOwen/add_pcl

Add PCL port
This commit is contained in:
Alexander Karatarakis 2017-08-10 13:56:07 -07:00 committed by GitHub
commit a8359841a6
7 changed files with 194 additions and 0 deletions

4
ports/pcl/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: pcl
Version: 1.8.1
Build-Depends: boost, eigen3, flann, qhull, vtk, openni2, qt5
Description: Point Cloud Library (PCL) is open source library for 2D/3D image and point cloud processing.

63
ports/pcl/config.patch Normal file
View File

@ -0,0 +1,63 @@
diff --git a/PCLConfig.cmake.in b/PCLConfig.cmake.in
index f4ef6a0ff..3a2c259dc 100644
--- a/PCLConfig.cmake.in
+++ b/PCLConfig.cmake.in
@@ -155,7 +155,7 @@ macro(find_qhull)
NAMES "@QHULL_LIBRARY_DEBUG_NAME@"
HINTS "${QHULL_ROOT}" "$ENV{QHULL_ROOT}"
PATHS "$ENV{PROGRAMFILES}/qhull" "$ENV{PROGRAMW6432}/qhull"
- PATH_SUFFIXES project build bin lib)
+ PATH_SUFFIXES project build bin debug/lib)
find_package_handle_standard_args(qhull DEFAULT_MSG QHULL_LIBRARY QHULL_INCLUDE_DIRS)
@@ -443,7 +443,7 @@ macro(find_flann)
HINTS ${PC_FLANN_LIBDIR} ${PC_FLANN_LIBRARY_DIRS} "${FLANN_ROOT}" "$ENV{FLANN_ROOT}"
PATHS "$ENV{PROGRAMFILES}/flann 1.6.9" "$ENV{PROGRAMW6432}/flann 1.6.9"
"$ENV{PROGRAMFILES}/flann" "$ENV{PROGRAMW6432}/flann"
- PATH_SUFFIXES lib)
+ PATH_SUFFIXES debug/lib)
find_package_handle_standard_args(Flann DEFAULT_MSG FLANN_LIBRARY FLANN_INCLUDE_DIRS)
if(FLANN_FOUND)
@@ -715,25 +715,18 @@ file(TO_CMAKE_PATH "${PCL_DIR}" PCL_DIR)
if(WIN32 AND NOT MINGW)
# PCLConfig.cmake is installed to PCL_ROOT/cmake
get_filename_component(PCL_ROOT "${PCL_DIR}" PATH)
+ get_filename_component(PCL_ROOT "${PCL_ROOT}" PATH)
else(WIN32 AND NOT MINGW)
# PCLConfig.cmake is installed to PCL_ROOT/share/pcl-x.y
get_filename_component(PCL_ROOT "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
endif(WIN32 AND NOT MINGW)
# check whether PCLConfig.cmake is found into a PCL installation or in a build tree
-if(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h")
+if(EXISTS "${PCL_ROOT}/include/pcl/pcl_config.h")
# Found a PCL installation
# pcl_message("Found a PCL installation")
- set(PCL_INCLUDE_DIRS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}")
- set(PCL_LIBRARY_DIRS "${PCL_ROOT}/@LIB_INSTALL_DIR@")
- if(EXISTS "${PCL_ROOT}/3rdParty")
- set(PCL_ALL_IN_ONE_INSTALLER ON)
- endif(EXISTS "${PCL_ROOT}/3rdParty")
-elseif(EXISTS "${PCL_ROOT}/include/pcl/pcl_config.h")
- # Found a non-standard (likely ANDROID) PCL installation
- # pcl_message("Found a PCL installation")
set(PCL_INCLUDE_DIRS "${PCL_ROOT}/include")
- set(PCL_LIBRARY_DIRS "${PCL_ROOT}/lib")
+ set(PCL_LIBRARY_DIRS "${PCL_ROOT}/@LIB_INSTALL_DIR@" "${PCL_ROOT}/debug/@LIB_INSTALL_DIR@")
if(EXISTS "${PCL_ROOT}/3rdParty")
set(PCL_ALL_IN_ONE_INSTALLER ON)
endif(EXISTS "${PCL_ROOT}/3rdParty")
@@ -743,9 +736,9 @@ elseif(EXISTS "${PCL_DIR}/include/pcl/pcl_config.h")
set(PCL_INCLUDE_DIRS "${PCL_DIR}/include") # for pcl_config.h
set(PCL_LIBRARY_DIRS "${PCL_DIR}/@LIB_INSTALL_DIR@")
set(PCL_SOURCES_TREE "@CMAKE_SOURCE_DIR@")
-else(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h")
+else(EXISTS "${PCL_ROOT}/include/pcl/pcl_config.h")
pcl_report_not_found("PCL can not be found on this machine")
-endif(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h")
+endif(EXISTS "${PCL_ROOT}/include/pcl/pcl_config.h")
#set a suffix for debug libraries
set(PCL_DEBUG_SUFFIX "@CMAKE_DEBUG_POSTFIX@")

View File

@ -0,0 +1,22 @@
diff --git a/cmake/pcl_utils.cmake b/cmake/pcl_utils.cmake
index 69f1e76a4..37305815e 100644
--- a/cmake/pcl_utils.cmake
+++ b/cmake/pcl_utils.cmake
@@ -105,7 +105,7 @@ macro(SET_INSTALL_DIRS)
endif (NOT DEFINED LIB_INSTALL_DIR)
if(NOT ANDROID)
set(INCLUDE_INSTALL_ROOT
- "include/${PROJECT_NAME_LOWER}-${PCL_MAJOR_VERSION}.${PCL_MINOR_VERSION}")
+ "include")
else(NOT ANDROID)
set(INCLUDE_INSTALL_ROOT "include") # Android, don't put into subdir
endif(NOT ANDROID)
@@ -114,7 +114,7 @@ macro(SET_INSTALL_DIRS)
set(BIN_INSTALL_DIR "bin")
set(PKGCFG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig")
if(WIN32 AND NOT MINGW)
- set(PCLCONFIG_INSTALL_DIR "cmake")
+ set(PCLCONFIG_INSTALL_DIR "share/pcl")
else(WIN32 AND NOT MINGW)
set(PCLCONFIG_INSTALL_DIR "share/${PROJECT_NAME_LOWER}-${PCL_MAJOR_VERSION}.${PCL_MINOR_VERSION}")
endif(WIN32 AND NOT MINGW)

View File

@ -0,0 +1,15 @@
diff --git a/cmake/Modules/FindFLANN.cmake b/cmake/Modules/FindFLANN.cmake
index b5739dc95..4041a2539 100644
--- a/cmake/Modules/FindFLANN.cmake
+++ b/cmake/Modules/FindFLANN.cmake
@@ -10,8 +10,8 @@
# look for shared ones
if(FLANN_USE_STATIC)
- set(FLANN_RELEASE_NAME flann_cpp_s)
- set(FLANN_DEBUG_NAME flann_cpp_s-gd)
+ set(FLANN_RELEASE_NAME flann_cpp)
+ set(FLANN_DEBUG_NAME flann_cpp-gd)
else(FLANN_USE_STATIC)
set(FLANN_RELEASE_NAME flann_cpp)
set(FLANN_DEBUG_NAME flann_cpp-gd)

View File

@ -0,0 +1,12 @@
diff --git a/cmake/Modules/FindOpenNI2.cmake b/cmake/Modules/FindOpenNI2.cmake
index 713099a14..f31de96a6 100644
--- a/cmake/Modules/FindOpenNI2.cmake
+++ b/cmake/Modules/FindOpenNI2.cmake
@@ -51,6 +51,7 @@ find_path(OPENNI2_INCLUDE_DIRS OpenNI.h
PATHS
"$ENV{OPENNI2_INCLUDE${OPENNI2_SUFFIX}}" # Win64 needs '64' suffix
/usr/include/openni2 # common path for deb packages
+ PATH_SUFFIXES include/openni2
)
find_library(OPENNI2_LIBRARY

View File

@ -0,0 +1,13 @@
diff --git a/cmake/Modules/FindQhull.cmake b/cmake/Modules/FindQhull.cmake
index 698bd151b..44c1d5d8d 100644
--- a/cmake/Modules/FindQhull.cmake
+++ b/cmake/Modules/FindQhull.cmake
@@ -55,7 +55,7 @@ find_library(QHULL_LIBRARY_DEBUG
NAMES ${QHULL_DEBUG_NAME} ${QHULL_RELEASE_NAME}
HINTS "${QHULL_ROOT}" "$ENV{QHULL_ROOT}"
PATHS "$ENV{PROGRAMFILES}/QHull" "$ENV{PROGRAMW6432}/QHull"
- PATH_SUFFIXES project build bin lib)
+ PATH_SUFFIXES project build bin debug/lib)
if(NOT QHULL_LIBRARY_DEBUG)
set(QHULL_LIBRARY_DEBUG ${QHULL_LIBRARY})

65
ports/pcl/portfile.cmake Normal file
View File

@ -0,0 +1,65 @@
# Common Ambient Variables:
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
# PORT = current port name (zlib, etc)
# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
#
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO PointCloudLibrary/pcl
REF pcl-1.8.1
SHA512 9e7c87fb750a176712f08d215a906012c9e8174b687bbc8c08fa65de083b4468951bd8017b10409015d5eff0fc343885d2aae5c340346118b1a251af7bdd5cd7
HEAD_REF master
)
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES "${CMAKE_CURRENT_LIST_DIR}/config.patch"
"${CMAKE_CURRENT_LIST_DIR}/config_install.patch"
"${CMAKE_CURRENT_LIST_DIR}/find_flann.patch"
"${CMAKE_CURRENT_LIST_DIR}/find_qhull.patch"
"${CMAKE_CURRENT_LIST_DIR}/find_openni2.patch"
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(LIBRARY_LINKAGE ON)
elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(LIBRARY_LINKAGE OFF)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
# BUILD
-DBUILD_surface_on_nurbs=ON
-DBUILD_tools=OFF
# PCL
-DPCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32=${LIBRARY_LINKAGE}
-DPCL_BUILD_WITH_FLANN_DYNAMIC_LINKING_WIN32=${LIBRARY_LINKAGE}
-DPCL_SHARED_LIBS=${LIBRARY_LINKAGE}
# WITH
-DWITH_CUDA=OFF
-DWITH_LIBUSB=OFF
-DWITH_OPENNI2=ON
-DWITH_PCAP=OFF
-DWITH_PNG=OFF
-DWITH_QHULL=ON
-DWITH_QT=ON
-DWITH_VTK=ON
)
vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/pcl)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/pcl/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/pcl/copyright)