[Thrift] Make Thrift static again (#7302)

* Make thrift static

* Update CONTROL

* Thrift able to build statically and dynamically

* Clean up bin dir in static

* Changes as per discussion

* Remove comment

* Better comment
This commit is contained in:
Phil Felton 2019-07-25 01:50:17 +01:00 committed by dan-shaw
parent 8255ef3521
commit 8522c799ea
2 changed files with 22 additions and 4 deletions

View File

@ -1,5 +1,5 @@
Source: thrift
Version: 2019-05-07-2
Version: 2019-05-07-3
Build-Depends: zlib, libevent, openssl, boost-range, boost-smart-ptr, boost-date-time, boost-locale, boost-scope-exit
Homepage: https://github.com/apache/thrift
Description: Apache Thrift is a software project spanning a variety of programming languages and use cases. Our goal is to make reliable, performant communication and data serialization across languages as efficient and seamless as possible.

View File

@ -1,5 +1,10 @@
include(vcpkg_common_functions)
# We currently insist on static only because:
# - Thrift doesn't yet support building as a DLL on Windows,
# - x64-linux only builds static anyway.
# From https://github.com/apache/thrift/blob/master/CHANGES.md
# it looks like it will be supported in v0.13.
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_find_acquire_program(FLEX)
@ -13,11 +18,15 @@ vcpkg_from_github(
HEAD_REF master
)
# note we specify values for WITH_STATIC_LIB and WITH_SHARED_LIB because even though
# they're marked as deprecated, Thrift incorrectly hard-codes a value for BUILD_SHARED_LIBS.
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
NO_CHARSET_FLAG
OPTIONS
-DWITH_SHARED_LIB=off
-DWITH_STATIC_LIB=on
-DWITH_STDTHREADS=ON
-DBUILD_TESTING=off
-DBUILD_JAVA=off
@ -38,14 +47,23 @@ file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/th
# Move CMake config files to the right place
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/thrift)
file(GLOB COMPILER "${CURRENT_PACKAGES_DIR}/bin/thrift*")
file(GLOB COMPILER "${CURRENT_PACKAGES_DIR}/bin/thrift" "${CURRENT_PACKAGES_DIR}/bin/thrift.exe")
if(COMPILER)
file(COPY ${COMPILER} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/thrift)
file(REMOVE ${COMPILER})
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/thrift)
endif()
file(GLOB COMPILERD "${CURRENT_PACKAGES_DIR}/debug/bin/thrift" "${CURRENT_PACKAGES_DIR}/debug/bin/thrift.exe")
if(COMPILERD)
file(REMOVE ${COMPILERD})
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
if ("${VCPKG_LIBRARY_LINKAGE}" STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
endif()
vcpkg_copy_pdbs()