Merge pull request #1178 from codicodi/shared-lzo

[lzo] enable dynamic build
This commit is contained in:
Robert Schumacher 2017-05-28 13:09:04 -07:00 committed by GitHub
commit e95a098696
2 changed files with 24 additions and 11 deletions

View File

@ -1,3 +1,3 @@
Source: lzo
Version: 2.10
Version: 2.10-1
Description: Lossless data compression library

View File

@ -6,11 +6,6 @@
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
message(STATUS "Warning: Dynamic building not supported yet. Building static.")
set(VCPKG_LIBRARY_LINKAGE static)
endif()
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lzo-2.10)
vcpkg_download_distfile(ARCHIVE
@ -20,20 +15,38 @@ vcpkg_download_distfile(ARCHIVE
)
vcpkg_extract_source_archive(${ARCHIVE})
set(LZO_STATIC OFF)
set(LZO_SHARED OFF)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(LZO_STATIC ON)
else()
set(LZO_SHARED ON)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
# OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2
# OPTIONS_RELEASE -DOPTIMIZE=1
# OPTIONS_DEBUG -DDEBUGGABLE=1
PREFER_NINJA
OPTIONS
-DENABLE_STATIC=${LZO_STATIC}
-DENABLE_SHARED=${LZO_SHARED}
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/libexec)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/libexec)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(READ ${CURRENT_PACKAGES_DIR}/include/lzo/lzoconf.h LZO_CONFIG)
string(REPLACE "# define __LZO_EXPORT1 /*empty*/"
"# define __LZO_EXPORT1 __declspec(dllimport)" LZO_CONFIG "${LZO_CONFIG}")
file(WRITE ${CURRENT_PACKAGES_DIR}/include/lzo/lzoconf.h "${LZO_CONFIG}")
endif()
# Handle copyright
file(COPY ${CURRENT_BUILDTREES_DIR}/src/lzo-2.10/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/lzo)
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/lzo)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/lzo/COPYING ${CURRENT_PACKAGES_DIR}/share/lzo/copyright)