vcpkg/ports/ceres/portfile.cmake

55 lines
2.0 KiB
CMake
Raw Normal View History

if(VCPKG_CRT_LINKAGE STREQUAL "static")
message(FATAL_ERROR "Ceres does not currently support static CRT linkage")
endif()
2017-06-09 11:53:01 +08:00
include(vcpkg_common_functions)
2017-06-10 01:16:58 +08:00
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ceres-solver/ceres-solver
2017-08-09 13:31:44 +08:00
REF 1.13.0
SHA512 b548a303d1d4eeb75545551c381624879e363a2eba13cdd998fb3bea9bd51f6b9215b579d59d6133117b70d8bf35e18b983400c3d6200403210c18fcb1886ebb
HEAD_REF master
2017-06-09 11:53:01 +08:00
)
2017-06-30 23:13:09 +08:00
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/fix-find-packages.patch
)
# Ninja crash compiler with error:
# "fatal error C1001: An internal error has occurred in the compiler. (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 255)"
2017-06-09 11:53:01 +08:00
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
2017-06-10 18:05:44 +08:00
OPTIONS
-DEXPORT_BUILD_DIR=ON
-DBUILD_EXAMPLES=OFF
-DBUILD_TESTING=OFF
-DCXSPARSE=ON
-DEIGENSPARSE=ON
-DSUITESPARSE=ON
2017-06-30 23:13:09 +08:00
-DGFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION=OFF # TheiaSfm doesn't work well with this
-DGLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION=OFF # TheiaSfm doesn't work well with this
2017-06-09 11:53:01 +08:00
)
2017-06-10 18:05:44 +08:00
2017-06-09 11:53:01 +08:00
vcpkg_install_cmake()
2017-06-10 18:05:44 +08:00
vcpkg_fixup_cmake_targets(CONFIG_PATH "CMake")
2017-06-09 11:53:01 +08:00
vcpkg_copy_pdbs()
2017-06-30 23:13:09 +08:00
# Changes target search path
file(READ ${CURRENT_PACKAGES_DIR}/share/ceres/CeresConfig.cmake CERES_TARGETS)
string(REPLACE "get_filename_component(CURRENT_ROOT_INSTALL_DIR\n \${CERES_CURRENT_CONFIG_DIR}/../"
"get_filename_component(CURRENT_ROOT_INSTALL_DIR\n \${CERES_CURRENT_CONFIG_DIR}/../../" CERES_TARGETS "${CERES_TARGETS}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/ceres/CeresConfig.cmake "${CERES_TARGETS}")
# Clean
2017-06-09 11:53:01 +08:00
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
2017-06-10 18:05:44 +08:00
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
2017-06-09 11:53:01 +08:00
# Handle copyright of suitesparse and metis
2017-06-10 01:16:58 +08:00
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/ceres)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/ceres/LICENSE ${CURRENT_PACKAGES_DIR}/share/ceres/copyright)