From e5f9c7309f495b865ee238e088c36e03754f262e Mon Sep 17 00:00:00 2001 From: webfolderio Date: Mon, 29 Apr 2019 15:35:40 +0300 Subject: [PATCH] Added vcpkg support --- vcpkg/CONTROL | 3 +++ vcpkg/fix-picojson.patch | 12 ++++++++++++ vcpkg/fix-warning.patch | 31 +++++++++++++++++++++++++++++++ vcpkg/portfile.cmake | 23 +++++++++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 vcpkg/CONTROL create mode 100644 vcpkg/fix-picojson.patch create mode 100644 vcpkg/fix-warning.patch create mode 100644 vcpkg/portfile.cmake diff --git a/vcpkg/CONTROL b/vcpkg/CONTROL new file mode 100644 index 0000000..d29834f --- /dev/null +++ b/vcpkg/CONTROL @@ -0,0 +1,3 @@ +Source: jwt-cpp +Version: 2019-04-20 +Description: A header only library for creating and validating json web tokens in c++ \ No newline at end of file diff --git a/vcpkg/fix-picojson.patch b/vcpkg/fix-picojson.patch new file mode 100644 index 0000000..44c04fe --- /dev/null +++ b/vcpkg/fix-picojson.patch @@ -0,0 +1,12 @@ +diff --git a/include/jwt-cpp/jwt.h b/include/jwt-cpp/jwt.h +index ec56810..a26fd97 100644 +--- a/include/jwt-cpp/jwt.h ++++ b/include/jwt-cpp/jwt.h +@@ -1,6 +1,6 @@ + #pragma once + #define PICOJSON_USE_INT64 +-#include "picojson.h" ++#include "picojson/picojson.h" + #include "base.h" + #include + #include diff --git a/vcpkg/fix-warning.patch b/vcpkg/fix-warning.patch new file mode 100644 index 0000000..d013a77 --- /dev/null +++ b/vcpkg/fix-warning.patch @@ -0,0 +1,31 @@ +diff --git a/include/jwt-cpp/base.h b/include/jwt-cpp/base.h +index dfca7fc..4d05c0b 100644 +--- a/include/jwt-cpp/base.h ++++ b/include/jwt-cpp/base.h +@@ -2,6 +2,10 @@ + #include + #include + ++#ifdef _MSC_VER ++#pragma warning(disable : 4267) ++#endif ++ + namespace jwt { + namespace alphabet { + struct base64 { +diff --git a/include/jwt-cpp/jwt.h b/include/jwt-cpp/jwt.h +index ec56810..313cef2 100644 +--- a/include/jwt-cpp/jwt.h ++++ b/include/jwt-cpp/jwt.h +@@ -12,6 +12,11 @@ + #include + #include + ++#ifdef _MSC_VER ++#pragma warning(disable : 4267) ++#pragma warning(disable : 4067) ++#endif ++ + //If openssl version less than 1.1 + #if OPENSSL_VERSION_NUMBER < 269484032 + #define OPENSSL10 diff --git a/vcpkg/portfile.cmake b/vcpkg/portfile.cmake new file mode 100644 index 0000000..1e10e3c --- /dev/null +++ b/vcpkg/portfile.cmake @@ -0,0 +1,23 @@ +#header-only library +include(vcpkg_common_functions) + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/jwt-cpp) + +vcpkg_from_github(OUT_SOURCE_PATH SOURCE_PATH + REPO Thalhammer/jwt-cpp + REF f0e37a79f605312686065405dd720fc197cc3df0 + SHA512 ae83c205dbb340dedc58d0d3f0e2453c4edcf5ce43b401f49d02692dc8a2a4b7260f1ced05ddfa7c1d5d6f92446e232629ddbdf67a58a119b50c5c8163591598 + HEAD_REF master + PATCHES fix-picojson.patch + fix-warning.patch) + +# Copy the constexpr header files +file(GLOB HEADER_FILES ${SOURCE_PATH}/include/jwt-cpp/*) +file(COPY ${HEADER_FILES} + DESTINATION ${CURRENT_PACKAGES_DIR}/include/jwt-cpp + REGEX "\.(gitattributes|gitignore|picojson.h)$" EXCLUDE) + +# Put the licence file where vcpkg expects it +file(COPY ${SOURCE_PATH}/LICENSE + DESTINATION ${CURRENT_PACKAGES_DIR}/share/jwt-cpp) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/jwt-cpp/LICENSE ${CURRENT_PACKAGES_DIR}/share/jwt-cpp/copyright) \ No newline at end of file