[dlib] Fix static builds. Add cmake files back in.

This commit is contained in:
Robert Schumacher 2017-06-22 14:54:34 -07:00
parent df3f73d825
commit 5c93bc0102
2 changed files with 27 additions and 22 deletions

View File

@ -1,4 +1,4 @@
Source: dlib
Version: 19.4-3
Version: 19.4-4
Build-Depends: libjpeg-turbo, libpng, sqlite3, fftw3
Description: Modern C++ toolkit containing machine learning algorithms and tools for creating complex software in C++

View File

@ -8,43 +8,48 @@
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/dlib-19.4)
vcpkg_download_distfile(ARCHIVE
URLS "http://dlib.net/files/dlib-19.4.tar.bz2"
FILENAME "dlib-19.4.tar.bz2"
SHA512 c5ae22c507b57a13d880d79e9671730829114d0276508b0a41b373d3abae9057d960fce84fafe1be468d943910853baaa70c88f2516e20a0c41f3895bf217f7b
URLS "http://dlib.net/files/dlib-19.4.tar.bz2"
FILENAME "dlib-19.4.tar.bz2"
SHA512 c5ae22c507b57a13d880d79e9671730829114d0276508b0a41b373d3abae9057d960fce84fafe1be468d943910853baaa70c88f2516e20a0c41f3895bf217f7b
)
vcpkg_extract_source_archive(${ARCHIVE})
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_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DDLIB_LINK_WITH_SQLITE3=ON
-DDLIB_USE_FFTW=ON
-DDLIB_PNG_SUPPORT=ON
-DDLIB_JPEG_SUPPORT=ON
-DDLIB_USE_BLAS=OFF
-DDLIB_USE_LAPACK=OFF
-DDLIB_USE_CUDA=OFF
-DDLIB_GIF_SUPPORT=OFF
-DDLIB_USE_MKL_FFT=OFF
#-DDLIB_USE_CUDA=ON
OPTIONS_DEBUG
-DDLIB_ENABLE_ASSERTS=ON
#-DDLIB_ENABLE_STACK_TRACE=ON
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DDLIB_LINK_WITH_SQLITE3=ON
-DDLIB_USE_FFTW=ON
-DDLIB_PNG_SUPPORT=ON
-DDLIB_JPEG_SUPPORT=ON
-DDLIB_USE_BLAS=OFF
-DDLIB_USE_LAPACK=OFF
-DDLIB_USE_CUDA=OFF
-DDLIB_GIF_SUPPORT=OFF
-DDLIB_USE_MKL_FFT=OFF
#-DDLIB_USE_CUDA=ON
OPTIONS_DEBUG
-DDLIB_ENABLE_ASSERTS=ON
#-DDLIB_ENABLE_STACK_TRACE=ON
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake)
# 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)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake)
# Remove other files not required in package
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/all)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/test)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/travis)