mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-15 15:51:37 +08:00
0e1dc12185
* [rollup:2021-07-16 1/7] PR #18201 (@JackBoosY) [vcpkg-cmake] Add check for unused cmake variables * [rollup:2021-07-16 2/7] PR #18397 (@strega-nil) [vcpkg_list] add new function * [rollup:2021-07-16 3/7] PR #18782 (@strega-nil) [scripts-audit] vcpkg_build_ninja * [rollup:2021-07-16 4/7] PR #18784 (@strega-nil) [scripts-audit] vcpkg_minimum_required * [rollup:2021-07-16 5/7] PR #18785 (@strega-nil) [scripts-audit] vcpkg_replace_string * [rollup:2021-07-16 6/7] PR #18786 (@strega-nil) [scripts-audit] windows scripts * [rollup:2021-07-16 7/7] PR #18945 (@strega-nil) [many ports] remove deprecated vcpkg_check_features call [1/5] Co-authored-by: nicole mazzuca <mazzucan@outlook.com> Co-authored-by: PhoebeHui <20694052+PhoebeHui@users.noreply.github.com>
87 lines
3.4 KiB
CMake
87 lines
3.4 KiB
CMake
set(MSVC_USE_STATIC_CRT_VALUE OFF)
|
|
if(VCPKG_CRT_LINKAGE STREQUAL "static")
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
message(FATAL_ERROR "Ceres does not currently support mixing static CRT and dynamic library linkage")
|
|
endif()
|
|
set(MSVC_USE_STATIC_CRT_VALUE ON)
|
|
endif()
|
|
|
|
vcpkg_from_github(
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
REPO ceres-solver/ceres-solver
|
|
REF 2.0.0
|
|
SHA512 6379666ef57af4ea85026644fa21365ce18fbaa12d50bd452bcdae0743a7b013effdd42c961e90c31815991bf315bd6904553dcc1a382ff5ed8c7abe9edf9a6c
|
|
HEAD_REF master
|
|
PATCHES
|
|
0001_cmakelists_fixes.patch
|
|
0002_use_glog_target.patch
|
|
0003_fix_exported_ceres_config.patch
|
|
0004_fix_lib_path_linux.patch
|
|
find-package-required.patch
|
|
)
|
|
|
|
file(REMOVE ${SOURCE_PATH}/cmake/FindCXSparse.cmake)
|
|
file(REMOVE ${SOURCE_PATH}/cmake/FindGflags.cmake)
|
|
file(REMOVE ${SOURCE_PATH}/cmake/FindGlog.cmake)
|
|
file(REMOVE ${SOURCE_PATH}/cmake/FindEigen.cmake)
|
|
file(REMOVE ${SOURCE_PATH}/cmake/FindSuiteSparse.cmake)
|
|
|
|
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
|
FEATURES
|
|
"suitesparse" SUITESPARSE
|
|
"cxsparse" CXSPARSE
|
|
"lapack" LAPACK
|
|
"eigensparse" EIGENSPARSE
|
|
"tools" GFLAGS
|
|
)
|
|
|
|
vcpkg_configure_cmake(
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
PREFER_NINJA
|
|
OPTIONS
|
|
${FEATURE_OPTIONS}
|
|
-DEXPORT_BUILD_DIR=ON
|
|
-DBUILD_BENCHMARKS=OFF
|
|
-DBUILD_EXAMPLES=OFF
|
|
-DBUILD_TESTING=OFF
|
|
-DBUILD_BENCHMARKS=OFF
|
|
-DPROVIDE_UNINSTALL_TARGET=OFF
|
|
-DMSVC_USE_STATIC_CRT=${MSVC_USE_STATIC_CRT_VALUE}
|
|
-DLIB_SUFFIX=${LIB_SUFFIX}
|
|
)
|
|
|
|
vcpkg_install_cmake()
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
vcpkg_fixup_cmake_targets(CONFIG_PATH CMake)
|
|
else()
|
|
vcpkg_fixup_cmake_targets(CONFIG_PATH lib${LIB_SUFFIX}/cmake/Ceres)
|
|
endif()
|
|
file(READ ${CURRENT_PACKAGES_DIR}/share/ceres/CeresConfig.cmake CERES_CONFIG)
|
|
string(REPLACE "set_target_properties(ceres PROPERTIES INTERFACE_LINK_LIBRARIES Ceres::ceres)"
|
|
"set_target_properties(ceres PROPERTIES INTERFACE_LINK_LIBRARIES Ceres::ceres)
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)" CERES_CONFIG "${CERES_CONFIG}")
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/ceres/CeresConfig.cmake "${CERES_CONFIG}")
|
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
# Changes target search path
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
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}")
|
|
else()
|
|
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}")
|
|
endif()
|
|
|
|
# Clean
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
|
|
|
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|