g2o
portfile.cmake
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO RainerKuemmerle/g2o
#REF 20170730_git
REF master
#SHA512 a85e3f79e6a8bd0f81a9a1a7a01227779100d9f4ebd0ae9c03537bbdcc246018f292b53045f027bbe28ecf63b98de2f22f5528c992c93c9790eb6a3a40995903
SHA512 04fdbc9209ed1b4511d39faaf8a1bf5011c39eb1117463dd0f422a644d3c7eb63f8546d967f8887646ef4dba49aac17ed653a8ef52ddc54bf77a380b6d6a13a3
HEAD_REF master
)
#vcpkg_download_distfile(ARCHIVE
# URLS "https://github.com/RainerKuemmerle/g2o/archive/master.zip"
# FILENAME "g2o-master.zip"
# SHA512 f9f7233b6e88d2ff4d4acf1f5101bcf0b9c64ae5b6a9304d638d14216c9168d11182f302a001249bc2fe59067bedddc3cf868ea3d1568ce2b5812a41de5ac910
#)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_LGPL_SHARED_LIBS)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DBUILD_LGPL_SHARED_LIBS=${BUILD_LGPL_SHARED_LIBS}
-DG2O_BUILD_EXAMPLES=OFF
-DG2O_BUILD_APPS=OFF
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(GLOB_RECURSE HEADERS "${CURRENT_PACKAGES_DIR}/include/*")
foreach(HEADER ${HEADERS})
file(READ ${HEADER} HEADER_CONTENTS)
string(REPLACE "#ifdef G2O_SHARED_LIBS" "#if 1" HEADER_CONTENTS "${HEADER_CONTENTS}")
file(WRITE ${HEADER} "${HEADER_CONTENTS}")
endforeach()
endif()
#remove duplicated files
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# remove not used cmake files
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share )
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake )
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake )
file(GLOB EXE ${CURRENT_PACKAGES_DIR}/bin/*.exe)
file(GLOB DEBUG_EXE ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe)
if(EXE OR DEBUG_EXE)
file(REMOVE ${EXE} ${DEBUG_EXE})
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
# Put the license file where vcpkg expects it
file(COPY ${SOURCE_PATH}/doc/license-bsd.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/g2o/)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/g2o/license-bsd.txt ${CURRENT_PACKAGES_DIR}/share/g2o/copyright)