[msgpack] update to 2.1.5, disable static libs in dynamic build

This commit is contained in:
codicodi 2017-08-04 02:07:15 +02:00
parent 4ca877437c
commit 54ac84f3f3
3 changed files with 101 additions and 13 deletions

View File

@ -1,3 +1,3 @@
Source: msgpack
Version: 2.1.1
Version: 2.1.5
Description: MessagePack is an efficient binary serialization format, which lets you exchange data among multiple languages like JSON, except that it's faster and smaller.

View File

@ -0,0 +1,84 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f92363e..b0becbb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -196,27 +196,28 @@ IF (MSGPACK_ENABLE_SHARED)
${CMAKE_CURRENT_SOURCE_DIR}
)
ENDIF ()
+IF (MSGPACK_ENABLE_STATIC)
+ ADD_LIBRARY (msgpackc-static STATIC
+ ${msgpackc_SOURCES}
+ ${msgpackc_HEADERS}
+ )
-ADD_LIBRARY (msgpackc-static STATIC
- ${msgpackc_SOURCES}
- ${msgpackc_HEADERS}
-)
-
-TARGET_INCLUDE_DIRECTORIES (msgpackc-static
- PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
- $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
- $<INSTALL_INTERFACE:include>
- PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}
-)
+ TARGET_INCLUDE_DIRECTORIES (msgpackc-static
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
+ $<INSTALL_INTERFACE:include>
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+ SET_TARGET_PROPERTIES (msgpackc-static PROPERTIES OUTPUT_NAME "msgpackc" COMPILE_DEFINITIONS MSGPACK_DLLEXPORT=)
+ENDIF ()
-IF (NOT MSGPACK_ENABLE_SHARED)
+IF (MSGPACK_ENABLE_STATIC AND NOT MSGPACK_ENABLE_SHARED)
# Add alias for subdirectories
ADD_LIBRARY (msgpackc ALIAS msgpackc-static)
ENDIF ()
-SET_TARGET_PROPERTIES (msgpackc-static PROPERTIES OUTPUT_NAME "msgpackc")
IF (MSGPACK_ENABLE_SHARED)
IF (MSVC)
SET_TARGET_PROPERTIES (msgpackc PROPERTIES IMPORT_SUFFIX "_import.lib")
@@ -239,14 +240,18 @@ IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" ST
IF (MSGPACK_ENABLE_SHARED)
SET_PROPERTY (TARGET msgpackc APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3 -DPIC")
ENDIF ()
- SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3" )
+ IF (MSGPACK_ENABLE_STATIC)
+ SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3" )
+ ENDIF ()
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
IF (MSGPACK_ENABLE_SHARED)
SET_PROPERTY (TARGET msgpackc APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags")
ENDIF ()
- SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags")
+ IF (MSGPACK_ENABLE_STATIC)
+ SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags")
+ ENDIF ()
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
@@ -278,10 +283,12 @@ IF (MSGPACK_BUILD_EXAMPLES)
ADD_SUBDIRECTORY (example)
ENDIF ()
-IF (MSGPACK_ENABLE_SHARED)
+IF (MSGPACK_ENABLE_SHARED AND MSGPACK_ENABLE_STATIC)
SET (MSGPACK_INSTALLTARGETS msgpackc msgpackc-static)
-ELSE()
+ELSEIF (MSGPACK_ENABLE_STATIC)
SET (MSGPACK_INSTALLTARGETS msgpackc-static)
+ELSE ()
+ SET (MSGPACK_INSTALLTARGETS msgpackc)
ENDIF ()
INSTALL (TARGETS ${MSGPACK_INSTALLTARGETS} EXPORT msgpack-targets

View File

@ -1,30 +1,34 @@
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO msgpack/msgpack-c
REF cpp-2.1.5
SHA512 aab8357e494bb5aa7407b53e5e650382869ea95812a6677e085530d5f27cde6946fbfd0095b19608c75163dbb82de9ccb6a695234e7c03659fc6efc2da300e19
HEAD_REF master)
set(MSGPACK_VERSION 2.1.1)
set(MSGPACK_HASH 31ed6fda498d43da6fdbbe000ce36c40e4cf886f00d879c57d406def7f5bba4eaf66f02f221398cb50f6f4c748d5cde9c97eca0cfa21b368c7c933c3301cf9b5)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/msgpack-${MSGPACK_VERSION})
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/msgpack/msgpack-c/releases/download/cpp-${MSGPACK_VERSION}/msgpack-${MSGPACK_VERSION}.tar.gz"
FILENAME "msgpack-${MSGPACK_VERSION}.tar.gz"
SHA512 ${MSGPACK_HASH}
)
vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/add-static-lib-option.patch)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(MSGPACK_ENABLE_SHARED OFF)
set(MSGPACK_ENABLE_STATIC ON)
else()
set(MSGPACK_ENABLE_SHARED ON)
set(MSGPACK_ENABLE_STATIC OFF)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS -DMSGPACK_ENABLE_SHARED=${MSGPACK_ENABLE_SHARED}
)
OPTIONS
-DMSGPACK_ENABLE_SHARED=${MSGPACK_ENABLE_SHARED}
-DMSGPACK_ENABLE_STATIC=${MSGPACK_ENABLE_STATIC}
-DMSGPACK_BUILD_EXAMPLES=OFF
-DMSGPACK_BUILD_TESTS=OFF)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/msgpack)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)