From ca58367c9ae70739eb55fa46ed2b339e3aaf50df Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Thu, 29 Mar 2018 18:34:38 -0700 Subject: [cryptopp] Fix UWP builds --- ports/cryptopp/CONTROL | 2 +- ports/cryptopp/cmake.patch | 15 +++++++++++++++ ports/cryptopp/patch.patch | 12 ++++++++++++ ports/cryptopp/portfile.cmake | 7 +++++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 ports/cryptopp/cmake.patch create mode 100644 ports/cryptopp/patch.patch diff --git a/ports/cryptopp/CONTROL b/ports/cryptopp/CONTROL index ef8e6fd75..6fea020bd 100644 --- a/ports/cryptopp/CONTROL +++ b/ports/cryptopp/CONTROL @@ -1,3 +1,3 @@ Source: cryptopp -Version: 6.1.0-1 +Version: 6.1.0-2 Description: Crypto++ is a free C++ class library of cryptographic schemes. diff --git a/ports/cryptopp/cmake.patch b/ports/cryptopp/cmake.patch new file mode 100644 index 000000000..fbe725eb9 --- /dev/null +++ b/ports/cryptopp/cmake.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5b6e1e6..a0adcf6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -329,6 +329,10 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FI\"winapifamily.h\"" ) + endif () + ++if(WINDOWS_STORE) ++ add_definitions(-DCRYPTOPP_DISABLE_NACL=1) ++endif() ++ + # Enable PIC for all target machines except 32-bit i386 due to register pressures. + if (NOT CRYPTOPP_I386) + SET(CMAKE_POSITION_INDEPENDENT_CODE 1) diff --git a/ports/cryptopp/patch.patch b/ports/cryptopp/patch.patch new file mode 100644 index 000000000..5c49d2757 --- /dev/null +++ b/ports/cryptopp/patch.patch @@ -0,0 +1,12 @@ +diff --git a/config.h b/config.h +index b96b7aa..3f004ac 100644 +--- a/config.h ++++ b/config.h +@@ -795,6 +795,7 @@ NAMESPACE_END + #endif + + #ifdef CRYPTOPP_WIN32_AVAILABLE ++#include + # if !defined(WINAPI_FAMILY) + # define THREAD_TIMER_AVAILABLE + # elif defined(WINAPI_FAMILY) diff --git a/ports/cryptopp/portfile.cmake b/ports/cryptopp/portfile.cmake index b0b59d29c..6b4b844c4 100644 --- a/ports/cryptopp/portfile.cmake +++ b/ports/cryptopp/portfile.cmake @@ -23,6 +23,13 @@ vcpkg_from_github( file(COPY ${CMAKE_SOURCE_PATH}/cryptopp-config.cmake DESTINATION ${SOURCE_PATH}) file(COPY ${CMAKE_SOURCE_PATH}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +vcpkg_apply_patches( + SOURCE_PATH "${SOURCE_PATH}" + PATCHES + "${CMAKE_CURRENT_LIST_DIR}/patch.patch" + "${CMAKE_CURRENT_LIST_DIR}/cmake.patch" +) + # Dynamic linking should be avoided for Crypto++ to reduce the attack surface, # so generate a static lib for both dynamic and static vcpkg targets. # See also: -- cgit v1.2.3