diff --git a/CMakeLists.txt b/CMakeLists.txt index f3f657aaff..6ef5877db4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1094,6 +1094,10 @@ include_directories(SYSTEM ${OATPP_SWAGGER_INCLUDE_DIR}) ADD_THIRDPARTY_LIB(oatpp-swagger STATIC_LIB "${OATPP_SWAGGER_STATIC_LIB}") +## jwt-cpp +find_package(JwtCpp REQUIRED) +include_directories(${JWT_CPP_INCLUDE_DIR}) + ## OpenSSL ## ## Version 1.0.0 or higher is required because we are using the following diff --git a/cmake_modules/FindJwtCpp.cmake b/cmake_modules/FindJwtCpp.cmake new file mode 100644 index 0000000000..1a7b1ada82 --- /dev/null +++ b/cmake_modules/FindJwtCpp.cmake @@ -0,0 +1,29 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Find jwt-cpp headers. +# This module defines: +# - JWT_CPP_INCLUDE_DIR, where to find jwt-cpp header files. +# - JwtCpp_FOUND, If false, do not try to use jwt-cpp. + +find_path(JWT_CPP_INCLUDE_DIR jwt-cpp/jwt.h + DOC "Path to the jwt-cpp header file" + NO_CMAKE_SYSTEM_PATH + NO_SYSTEM_ENVIRONMENT_PATH) + +find_package_handle_standard_args(JwtCpp REQUIRED_VARS + JWT_CPP_INCLUDE_DIR) diff --git a/thirdparty/build-definitions.sh b/thirdparty/build-definitions.sh index f4f22a75e7..7a1ce24efd 100644 --- a/thirdparty/build-definitions.sh +++ b/thirdparty/build-definitions.sh @@ -1125,3 +1125,19 @@ build_oatpp_swagger(){ make -j$PARALLEL install popd } + +build_jwt_cpp() { + JWT_CPP_BUILD_DIR=$TP_BUILD_DIR/$JWT_CPP_NAME$MODE_SUFFIX + mkdir -p $JWT_CPP_BUILD_DIR + pushd $JWT_CPP_BUILD_DIR + CFLAGS="$EXTRA_CFLAGS" \ + CXXFLAGS="$EXTRA_CXXFLAGS $OPENSSL_CFLAGS" \ + LDFLAGS="$EXTRA_LDFLAGS $OPENSSL_LDFLAGS" \ + cmake \ + -DCMAKE_BUILD_TYPE=release \ + -DCMAKE_INSTALL_PREFIX=$PREFIX \ + -DJWT_BUILD_EXAMPLES=OFF \ + $JWT_CPP_SOURCE + make -j$PARALLEL install + popd +} diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh index aa95364ac6..0f70d1c19c 100755 --- a/thirdparty/build-thirdparty.sh +++ b/thirdparty/build-thirdparty.sh @@ -107,6 +107,7 @@ else "ranger") F_RANGER=1 ;; "oatpp") F_OATPP=1 ;; "oatpp-swagger") F_OATPP_SWAGGER=1 ;; + "jwt-cpp") F_JWT_CPP=1;; *) echo "Unknown module: $arg"; exit 1 ;; esac done @@ -421,6 +422,10 @@ if [ -n "$F_UNINSTRUMENTED" -o -n "$F_OATPP_SWAGGER" ]; then build_oatpp_swagger fi +if [ -n "$F_UNINSTRUMENTED" -o -n "$F_JWT_CPP" ]; then + build_jwt_cpp +fi + restore_env # If we're on macOS best to exit here, otherwise single dependency builds will try to diff --git a/thirdparty/download-thirdparty.sh b/thirdparty/download-thirdparty.sh index aa095ed10a..b35aa01f05 100755 --- a/thirdparty/download-thirdparty.sh +++ b/thirdparty/download-thirdparty.sh @@ -476,6 +476,11 @@ fetch_and_patch \ $OATPP_SWAGGER_PATCHLEVEL \ "patch -p1 < $TP_DIR/patches/oatpp-swagger-remove-version-from-path.patch" +JWT_CPP_PATCHLEVEL=0 +fetch_and_patch \ + $JWT_CPP_NAME.tar.gz \ + $JWT_CPP_SOURCE \ + $JWT_CPP_PATCHLEVEL echo "---------------" echo "Thirdparty dependencies downloaded successfully" diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh index 6aaa73cf97..4e94419f3a 100644 --- a/thirdparty/vars.sh +++ b/thirdparty/vars.sh @@ -266,3 +266,8 @@ OATPP_SOURCE=$TP_SOURCE_DIR/$OATPP_NAME OATPP_SWAGGER_VERSION=1.2.5 OATPP_SWAGGER_NAME=oatpp-swagger-$OATPP_SWAGGER_VERSION OATPP_SWAGGER_SOURCE=$TP_SOURCE_DIR/$OATPP_SWAGGER_NAME + +JWT_CPP_VERSION=3bd600762a70faccc7ec1c2dacb999cba6c6ef5e +JWT_CPP=jwt-cpp +JWT_CPP_NAME=$JWT_CPP-$JWT_CPP_VERSION +JWT_CPP_SOURCE=$TP_SOURCE_DIR/$JWT_CPP_NAME