1.vcpkg安装
1.1 下载vcpkg源码
>> git clone git@github.com:microsoft/vcpkg.git
1.2 编译生成vcpkg工具
>> .\vcpkg\bootstrap-vcpkg.bat
这样在vcpkg文件夹下就会生成vcpkg.exe文件
2.colmap安装
2.1 命令安装colmap的gpu版本
>> .\vcpkg install colmap[cuda,tests]:x64-windows
不出意外应该会报错
2.2 更改colmap的版本
把ports下面colmap信息修改一下
修改后的portfile.cmake文件内容如下:
set(COLMAP_REF "8e13af17d9628d61db1704fbbe30ee954f1eee52") # 3.7 fix
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO colmap/colmap
REF ${COLMAP_REF}
SHA512 892755d0e1ac1b99e5dc53c20d60e79900be5eb262307ea1d0bbcd61c74e7ec7f98bd6761f79ff03d29ac7d39419a5dd86744509aa2f49e7381f27118894695e
HEAD_REF dev
PATCHES
fix-dependencies.patch
)
if (NOT TRIPLET_SYSTEM_ARCH STREQUAL "x64" AND ("cuda" IN_LIST FEATURES OR "cuda-redist" IN_LIST FEATURES))
message(FATAL_ERROR "Feature cuda and cuda-redist require x64 triplet.")
endif()
# set GIT_COMMIT_ID and GIT_COMMIT_DATE
if(DEFINED VCPKG_HEAD_VERSION)
set(GIT_COMMIT_ID "${VCPKG_HEAD_VERSION}")
else()
set(GIT_COMMIT_ID "${COLMAP_REF}")
endif()
string(TIMESTAMP COLMAP_GIT_COMMIT_DATE "%Y-%m-%d")
set(CUDA_ENABLED OFF)
set(TESTS_ENABLED OFF)
if("cuda" IN_LIST FEATURES)
set(CUDA_ENABLED ON)
endif()
if("cuda-redist" IN_LIST FEATURES)
set(CUDA_ENABLED ON)
set(CUDA_ARCHS "Common")
endif()
if("tests" IN_LIST FEATURES)
set(TESTS_ENABLED ON)
endif()
set(OPENMP_ENABLED ON)
if (VCPKG_TARGET_IS_OSX AND VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
set(OPENMP_ENABLED Off)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DCUDA_ENABLED=${CUDA_ENABLED}
-DCUDA_ARCHS=${CUDA_ARCHS}
-DTESTS_ENABLED=${TESTS_ENABLED}
-DGIT_COMMIT_ID=${GIT_COMMIT_ID}
-DGIT_COMMIT_DATE=${COLMAP_GIT_COMMIT_DATE}
-DOPENMP_ENABLED=${OPENMP_ENABLED}
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup()
file(GLOB TOOL_FILENAMES "${CURRENT_PACKAGES_DIR}/bin/*")
foreach(TOOL_FILENAME ${TOOL_FILENAMES})
get_filename_component(TEST_TOOL_NAME ${TOOL_FILENAME} NAME_WLE)
list(APPEND COLMAP_TOOL_NAMES "${TEST_TOOL_NAME}")
endforeach()
vcpkg_copy_tools(TOOL_NAMES ${COLMAP_TOOL_NAMES} AUTO_CLEAN)
# remove empty folders and unused files
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/include/colmap/exe"
"${CURRENT_PACKAGES_DIR}/include/colmap/lib/Graclus/multilevelLib"
"${CURRENT_PACKAGES_DIR}/include/colmap/tools"
"${CURRENT_PACKAGES_DIR}/include/colmap/ui/media"
"${CURRENT_PACKAGES_DIR}/include/colmap/ui/shaders"
"${CURRENT_PACKAGES_DIR}/COLMAP.bat"
"${CURRENT_PACKAGES_DIR}/RUN_TESTS.bat"
"${CURRENT_PACKAGES_DIR}/debug/COLMAP.bat"
"${CURRENT_PACKAGES_DIR}/debug/RUN_TESTS.bat"
"${CURRENT_PACKAGES_DIR}/debug/bin"
)
vcpkg_copy_pdbs()
file(INSTALL "${SOURCE_PATH}/COPYING.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
再次运行上面安装命令就可以安装成功,这里说明一下,我这边挂了vpn。
2.3 把colmap源码里面src->exe文件夹里的.h文件拷贝出来,放到vcpkg安装colmap路径
3.安装pycolmap
3.1 下载源码
>> git clone --recursive git@github.com:colmap/pycolmap.git
3.2 切换到v0.3.0版本
>> git checkout v0.3.0
3.3 安装pycolmap
>> cd pycolmap && pip install .
不出意外就安装成功了。
打完收工!
参考资料
[1] https://github.com/colmap/pycolmap
[2] https://github.com/colmap/colmap
[3] https://github.com/microsoft/vcpkg