mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 08:19:10 +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>
80 lines
3.4 KiB
CMake
80 lines
3.4 KiB
CMake
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
|
|
|
vcpkg_from_github(
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
REPO davisking/dlib
|
|
REF v19.21
|
|
SHA512 57133cdcbc5017d324a368ff36a628de55001f1ec0b3ac078b4ad49a63c8c9fb48674617c6a5838ca4e381a6b001fe4aa5a7b3353eb288c58062d2a8fc7b171e
|
|
HEAD_REF master
|
|
PATCHES
|
|
fix-sqlite3-fftw-linkage.patch
|
|
force_finding_packages.patch
|
|
find_blas.patch
|
|
)
|
|
|
|
file(REMOVE_RECURSE ${SOURCE_PATH}/dlib/external/libjpeg)
|
|
file(REMOVE_RECURSE ${SOURCE_PATH}/dlib/external/libpng)
|
|
file(REMOVE_RECURSE ${SOURCE_PATH}/dlib/external/zlib)
|
|
|
|
# This fixes static builds; dlib doesn't pull in the needed transitive dependencies
|
|
file(READ "${SOURCE_PATH}/dlib/CMakeLists.txt" DLIB_CMAKE)
|
|
string(REPLACE "PNG_LIBRARY" "PNG_LIBRARIES" DLIB_CMAKE "${DLIB_CMAKE}")
|
|
file(WRITE "${SOURCE_PATH}/dlib/CMakeLists.txt" "${DLIB_CMAKE}")
|
|
|
|
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
|
FEATURES
|
|
"sqlite3" DLIB_LINK_WITH_SQLITE3
|
|
"fftw3" DLIB_USE_FFTW
|
|
"cuda" DLIB_USE_CUDA
|
|
)
|
|
|
|
vcpkg_configure_cmake(
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
PREFER_NINJA
|
|
OPTIONS
|
|
${FEATURE_OPTIONS}
|
|
-DDLIB_PNG_SUPPORT=ON
|
|
-DDLIB_JPEG_SUPPORT=ON
|
|
-DDLIB_USE_BLAS=ON
|
|
-DDLIB_USE_LAPACK=ON
|
|
-DDLIB_GIF_SUPPORT=OFF
|
|
-DDLIB_USE_MKL_FFT=OFF
|
|
-DCMAKE_DEBUG_POSTFIX=d
|
|
OPTIONS_DEBUG
|
|
-DDLIB_ENABLE_ASSERTS=ON
|
|
#-DDLIB_ENABLE_STACK_TRACE=ON
|
|
)
|
|
|
|
vcpkg_install_cmake()
|
|
|
|
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/dlib)
|
|
|
|
# There is no way to suppress installation of the headers and resource files in debug build.
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
|
|
|
# Remove other files not required in package
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/all)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/appveyor)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/test)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/travis)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/cmake_utils/test_for_neon)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/cmake_utils/test_for_cudnn)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/cmake_utils/test_for_cuda)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/cmake_utils/test_for_cpp11)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/cmake_utils/test_for_avx)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/cmake_utils/test_for_sse4)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/cmake_utils/test_for_libjpeg)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/cmake_utils/test_for_libpng)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/external/libpng/arm)
|
|
|
|
# Dlib encodes debug/release in its config.h. Patch it to respond to the NDEBUG macro instead.
|
|
file(READ ${CURRENT_PACKAGES_DIR}/include/dlib/config.h _contents)
|
|
string(REPLACE "/* #undef ENABLE_ASSERTS */" "#if defined(_DEBUG)\n#define ENABLE_ASSERTS\n#endif" _contents ${_contents})
|
|
string(REPLACE "#define DLIB_DISABLE_ASSERTS" "#if !defined(_DEBUG)\n#define DLIB_DISABLE_ASSERTS\n#endif" _contents ${_contents})
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/include/dlib/config.h "${_contents}")
|
|
|
|
# Handle copyright
|
|
file(INSTALL ${SOURCE_PATH}/dlib/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc)
|