[zstd] Reduce modifications to the upstream CMake. Remove all variation from the import lib name.

This commit is contained in:
Robert Schumacher 2016-11-26 02:40:38 -08:00
parent c076567336
commit 02f00dfbc7

View File

@ -7,30 +7,6 @@ vcpkg_download_distfile(ARCHIVE
)
vcpkg_extract_source_archive(${ARCHIVE})
# Name dynamic libs to be non-versioned and simpler "zstd".
# Avoid name conflict with static, so postfix static to "zstd-static"
# This seems to be less painful than renaming a DLL file after creation.
set(lib_cmake_filename ${SOURCE_PATH}/build/cmake/lib/CMakeLists.txt)
if (NOT EXISTS ${lib_cmake_filename}.orig)
file(INSTALL ${SOURCE_PATH}/build/cmake/lib/CMakeLists.txt
DESTINATION ${SOURCE_PATH}/build/cmake/lib
RENAME CMakeLists.txt.orig)
endif()
file(READ "${lib_cmake_filename}" lib_cmake_content)
string(REPLACE
"SET(SHARED_LIBRARY_OUTPUT_NAME \${LIBRARY_BASE_NAME}.\${LIBVER_MAJOR}.\${LIBVER_MINOR}.\${LIBVER_RELEASE})"
"SET(SHARED_LIBRARY_OUTPUT_NAME zstd)"
lib_cmake_content
"${lib_cmake_content}"
)
string(REPLACE
"SET(STATIC_LIBRARY_OUTPUT_NAME \${LIBRARY_BASE_NAME})"
"SET(STATIC_LIBRARY_OUTPUT_NAME zstd-static)"
lib_cmake_content
"${lib_cmake_content}"
)
file(WRITE "${lib_cmake_filename}" "${lib_cmake_content}")
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}/build/cmake
OPTIONS -DZSTD_LEGACY_SUPPORT=1
@ -46,17 +22,19 @@ file(COPY ${SOURCE_PATH}/lib/dictBuilder/zdict.h DESTINATION ${CURRENT_PACKAGES_
set(RELDIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lib/Release)
set(DEBDIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lib/Debug)
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(INSTALL ${RELDIR}/ DESTINATION ${CURRENT_PACKAGES_DIR}/lib FILES_MATCHING PATTERN "zstd_*.lib")
file(INSTALL ${RELDIR}/ DESTINATION ${CURRENT_PACKAGES_DIR}/bin FILES_MATCHING PATTERN "zstd_*.dll")
file(INSTALL ${DEBDIR}/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib FILES_MATCHING PATTERN "zstd_*.lib")
file(INSTALL ${DEBDIR}/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin FILES_MATCHING PATTERN "zstd_*.dll")
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
file(INSTALL ${RELDIR}/zstdlib.1.1.1024_${TRIPLET_SYSTEM_ARCH}.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib RENAME zstdlib.lib)
file(INSTALL ${DEBDIR}/zstdlib.1.1.1024_${TRIPLET_SYSTEM_ARCH}.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib RENAME zstdlib.lib)
file(INSTALL ${RELDIR}/ DESTINATION ${CURRENT_PACKAGES_DIR}/bin FILES_MATCHING PATTERN "*.dll")
file(INSTALL ${DEBDIR}/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin FILES_MATCHING PATTERN "*.dll")
vcpkg_copy_pdbs()
else()
file(INSTALL ${RELDIR}/ DESTINATION ${CURRENT_PACKAGES_DIR}/lib FILES_MATCHING PATTERN "zstd-static_*.lib")
file(INSTALL ${DEBDIR}/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib FILES_MATCHING PATTERN "zstd-static_*.lib")
file(INSTALL ${RELDIR}/zstdlib_${TRIPLET_SYSTEM_ARCH}.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib RENAME zstdlib.lib)
file(INSTALL ${DEBDIR}/zstdlib_${TRIPLET_SYSTEM_ARCH}.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib RENAME zstdlib.lib)
endif()
# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/zstd)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/zstd/LICENSE ${CURRENT_PACKAGES_DIR}/share/zstd/copyright)