Wednesday, June 12, 2019

vcpkg opencv install

./vcpkg install opencv[core,cuda]:x64-windows
The following packages will be built and installed:
Starting package 1/1: opencv:x64-windows
Building package opencv[core,cuda]:x64-windows...
-- Downloading
-- Extracting source C:/vcpkg/downloads/opencv-opencv-3.4.3.tar.gz
-- Applying patch C:/vcpkg/ports/opencv/0001-winrt-fixes.patch
-- Applying patch C:/vcpkg/ports/opencv/0002-install-options.patch
-- Applying patch C:/vcpkg/ports/opencv/0003-disable-downloading.patch
-- Applying patch C:/vcpkg/ports/opencv/0004-use-find-package-required.patch
-- Applying patch C:/vcpkg/ports/opencv/0005-remove-custom-protobuf-find-package.patch
-- Using source at C:/vcpkg/buildtrees/opencv/src/3.4.3-701a6234df
-- Configuring x64-windows
-- Building x64-windows-dbg
-- Building x64-windows-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package opencv[core,cuda]:x64-windows... done
Installing package opencv[core,cuda]:x64-windows...
Installing package opencv[core,cuda]:x64-windows... done
Elapsed time for package opencv:x64-windows: 2.544 h

Total elapsed time: 2.544 h

The package opencv provides CMake integration:

    find_package(OpenCV REQUIRED)
    target_include_directories(main PRIVATE ${OpenCV_INCLUDE_DIRS})
    target_link_libraries(main PRIVATE ${OpenCV_LIBS})

Sunday, June 9, 2019

Point Cloud Library Install

I've been trying to get point clouds to work for days now. Manual installation is a pain in the ass due to the library's dozens of dependencies. The machine I'm compiling for is a windows 10 laptop. The solution to this was to use Microsoft's vcpkg, a package manager that I used in powershell.

.\vcpkg install pcl:x64-windows-static

Building all the dependencies and the PCL itself took 7.448 hours on my laptop. This was the result:

The package pcl:x64-windows-static provides CMake targets:

    find_package(PCL CONFIG REQUIRED)
    target_link_libraries(main PRIVATE ${pcl_component})

.\vcpkg integrate install

Applied user-wide integration for this vcpkg root.

All MSBuild C++ projects can now #include any installed libraries.
Linking will be handled automatically.
Installing new libraries will make them instantly available.

CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake"

Thank you Stack Overflow!