diff --git a/.gitignore b/.gitignore index 5504786..759e66d 100644 --- a/.gitignore +++ b/.gitignore @@ -1041,4 +1041,5 @@ dkms.conf # VKAPI include/Config.hpp +include/nlohmann* src/main.cpp \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index e69de29..6d12152 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "submodules/json"] + path = submodules/json + url = https://github.com/nlohmann/json diff --git a/CMakeLists.txt b/CMakeLists.txt index f8c61b5..0db77ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,26 +7,28 @@ include(GNUInstallDirs) set(VKAPI_MAJOR_VERSION 0) set(VKAPI_MINOR_VERSION 0) -set(VKAPI_PATCH_VERSION 5) +set(VKAPI_PATCH_VERSION 8) set(VKAPI_VERSION_STRING "${VKAPI_MAJOR_VERSION}.${VKAPI_MINOR_VERSION}.${VKAPI_PATCH_VERSION}") -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/Config.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/include/Config.hpp @ONLY) - set(CMAKE_INCLUDE_CURRENT_DIR ON) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(MACOSX TRUE) endif() -set(NLOHMANN_JSON_PATH "${PROJECT_SOURCE_DIR}/include") +# set(NLOHMANN_JSON_PATH "${PROJECT_SOURCE_DIR}/include") set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}) option(BUILD_LIBRARY "Determines that, as a result, we get" ON) option(BUILD_EXAMPLES "Determines whether examples should be performed" ON) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/Config.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/include/Config.hpp @ONLY) + file(GLOB TARGET_SRC "./src/*.cpp") file(GLOB TARGET_HEADERS "./include/*.hpp") +include(submodules/install.cmake) + if(BUILD_LIBRARY) add_library(${PROJECT_NAME} STATIC ${TARGET_SRC} ${TARGET_HEADERS}) else() @@ -37,10 +39,11 @@ else() add_executable(${PROJECT_NAME} ${TARGET_SRC} ${TARGET_HEADERS}) endif() +# Include headers target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_INSTALL_INCLUDEDIR}) -# Include json -target_link_directories(${PROJECT_NAME} PUBLIC ${NLOHMANN_JSON_PATH}) +# Link nlohmann_json +target_link_libraries(${PROJECT_NAME} PUBLIC nlohmann_json) # Link curl if(UNIX) @@ -48,7 +51,6 @@ if(UNIX) target_link_directories(${PROJECT_NAME} PUBLIC ${CURL_INCLUDE_DIR}) else() include(FindPkgConfig) - # find_package(CURL REQUIRED) pkg_check_modules(CURL libcurl REQUIRED) endif() diff --git a/VKAPIConfig.cmake.in b/VKAPIConfig.cmake.in index 80ee4b0..9699401 100644 --- a/VKAPIConfig.cmake.in +++ b/VKAPIConfig.cmake.in @@ -1,4 +1,5 @@ include(CMakeFindDependencyMacro) + find_dependency(CURL REQUIRED) @PACKAGE_INIT@ diff --git a/examples/1/main.cpp b/examples/1/main.cpp index 957e205..853337f 100644 --- a/examples/1/main.cpp +++ b/examples/1/main.cpp @@ -15,7 +15,7 @@ int main(int argc, const char** argv) } else { std::cout << "Auth is failed!" << std::endl; } - } catch (std::exception ex) { + } catch (std::exception& ex) { std::cout << ex.what() << std::endl; } diff --git a/examples/2/main.cpp b/examples/2/main.cpp index d0c8388..631f8c3 100644 --- a/examples/2/main.cpp +++ b/examples/2/main.cpp @@ -23,7 +23,7 @@ int main(int argc, const char** argv) } else { // The further behaviour } - } catch (std::exception ex) { + } catch (std::exception& ex) { std::cout << ex.what() << std::endl; } diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index da7a51a..4b93793 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -3,7 +3,7 @@ project(VKAPI_TESTS LANGUAGES CXX) set(VKAPI_MAJOR_VERSION 0) set(VKAPI_MINOR_VERSION 0) -set(VKAPI_PATCH_VERSION 5) +set(VKAPI_PATCH_VERSION 8) set(MODULES 1 2) diff --git a/include/BotBase.hpp b/include/BotBase.hpp index c3fbba3..b19fab3 100644 --- a/include/BotBase.hpp +++ b/include/BotBase.hpp @@ -2,7 +2,7 @@ * Contains the class for working with vkbot. * @file BotBase.hpp * @author qucals - * @version 0.0.7 24/08/21 + * @version 0.0.8 24/08/21 */ #ifndef VKAPI_BOTBASE_HPP @@ -19,7 +19,7 @@ namespace base namespace bot { -constexpr const char* DEFAULT_TIME_WAIT = "25"; +_VKAPI_CONSTEXPR const char* DEFAULT_TIME_WAIT = "25"; /** * @brief The class for working from bots by Long Poll Server. @@ -160,7 +160,6 @@ class BotBase : public ClientBase * * @retval a string (URL) of this method. */ - _VKAPI_COMPLEXITY_FUNCTION _VKAPI_STATIC std::string MethodToString(METHODS method); /** @@ -226,7 +225,6 @@ class BotBase : public ClientBase * * @retval the type of event in enum (EVENTS). */ - _VKAPI_COMPLEXITY_FUNCTION _VKAPI_STATIC EVENTS GetTypeEvent(const std::string& typeEvent); private: @@ -269,6 +267,8 @@ class BotBase : public ClientBase std::string m_timeStamp; std::string m_timeWait; + + }; } // namespace bot diff --git a/include/ClientBase.hpp b/include/ClientBase.hpp index f37dfd7..69dcb69 100644 --- a/include/ClientBase.hpp +++ b/include/ClientBase.hpp @@ -2,7 +2,7 @@ * Contains general objects for working with VK API. * @file ClientBase.hpp * @author qucals - * @version 0.0.7 24/08/21 + * @version 0.0.8 24/08/21 */ #ifndef VKAPI_CLIENTBASE_HPP @@ -14,6 +14,7 @@ #include "Utilities.hpp" // ConvertStrToUrlCode #include "Exceptions.hpp" // already_connected, not_connected, empty_argument #include "Defines.hpp" +#include "Types.hpp" #ifdef __VKAPI_VERSION_ADDED_OPTIONAL #if __VKAPI_COMPILED_VERSION >= __VKAPI_VERSION_ADDED_OPTIONAL @@ -39,22 +40,14 @@ namespace vk namespace base { -#ifndef VKAPI_OPTIONAL_HPP -typedef nlohmann::json JsonType; - -typedef long long int IdType; -typedef unsigned long long UIdType; -typedef bool IndicatorType; -#endif // VKAPI_OPTIONAL_HPP - #define VKAPI_INVALID_REQUEST "invalid_request" #define VKAPI_NEED_CAPTCHA "need_captcha" -constexpr const char* VKAPI_API_URL = "https://api.vk.com/method/"; -constexpr const char* VKAPI_AUTH_URL = "https://oauth.vk.com/token?"; -constexpr const char* VKAPI_OAUTH_URL = "https://oauth.vk.com/authorize?"; -constexpr const char* VKAPI_OAUTH_URL_SECOND = "https://oauth.vk.com/access_token?"; -constexpr const char* VKAPI_API_VERSION = "5.120"; +_VKAPI_CONSTEXPR const char* VKAPI_API_URL = "https://api.vk.com/method/"; +_VKAPI_CONSTEXPR const char* VKAPI_AUTH_URL = "https://oauth.vk.com/token?"; +_VKAPI_CONSTEXPR const char* VKAPI_OAUTH_URL = "https://oauth.vk.com/authorize?"; +_VKAPI_CONSTEXPR const char* VKAPI_OAUTH_URL_SECOND = "https://oauth.vk.com/access_token?"; +_VKAPI_CONSTEXPR const char* VKAPI_API_VERSION = "5.120"; // The types of error which the VK server can return. // You can see the description of these on https://vk.com/dev/errors diff --git a/include/Defines.hpp b/include/Defines.hpp index cf5f02a..3e14d55 100644 --- a/include/Defines.hpp +++ b/include/Defines.hpp @@ -2,7 +2,7 @@ * Contains general defines about the language. * @file Defines.hpp * @author qucals - * @version 0.0.7 24/08/21 + * @version 0.0.8 24/08/21 */ #ifndef VKAPI_DEFINES_HPP @@ -35,65 +35,37 @@ #endif // (__cplusplus >= 202002L) #ifdef __CPLUSPLUS_OVER_11 -#ifndef _VKAPI_OVERRIDE -#define _VKAPI_OVERRIDE override -#endif // _VKAPI_OVERRIDE +#define _VKAPI_OVERRIDE override +#define _VKAPI_FINAL final +#define _VKAPI_NOEXCEPT noexcept +#define _VKAPI_EXPLICIT explicit +#define _VKAPI_CONSTEXPR constexpr -#ifndef _VKAPI_FINAL -#define _VKAPI_FINAL final -#endif // _VKAPI_FINAL - -#ifndef _VKAPI_NOEXCEPT -#define _VKAPI_NOEXCEPT noexcept -#endif // _VKAPI_NOEXCEPT - -#ifndef _VKAPI_EXPLICIT -#define _VKAPI_EXPLICIT explicit -#endif // _VKAPI_EXPLICIT - -#ifndef _VKAPI_MOVE #include -#define _VKAPI_MOVE(x) std::move(x) -#endif // _VKAPI_MOVE(x) +#define _VKAPI_MOVE(x) std::move(x) #else -#ifndef _VKAPI_OVERRIDE #define _VKAPI_OVERRIDE -#endif // _VKAPI_OVERRIDE - -#ifndef _VKAPI_FINAL #define _VKAPI_FINAL -#endif // _VKAPI_FINAL - -#ifndef _VKAPI_NOEXCEPT #define _VKAPI_NOEXCEPT -#endif // _VKAPI_NOEXCEPT - -#ifndef _VKAPI_EXPLICIT #define _VKAPI_EXPLICIT -#endif // _VKAPI_EXPLICIT - -#ifndef _VKAPI_MOVE -#define _VKAPI_MOVE(x) x -#endif // _VKAPI_MOVE +#define _VKAPI_CONSTEXPR +#define _VKAPI_MOVE(x) x #endif -#ifndef _VKAPI_VIRTUAL -#define _VKAPI_VIRTUAL virtual -#endif // _VKAPI_VIRTUAL +#define _VKAPI_VIRTUAL virtual +#define _VKAPI_INLINE inline -#ifndef _VKAPI_INLINE -#define _VKAPI_INLINE inline -#endif // _VKAPI_INLINE - -#ifndef _VKAPI_UNUSED #define _VKAPI_UNUSED(x) (void)(x) -#endif // _VKAPI_UNUSED #if defined(_MSC_VER) +#define _VKAPI_MSVC 1 + #define __DISABLE_WARNING_PUSH __pragma(warning(push)) #define __DISABLE_WARNING_POP __pragma(warning(pop)) #define __DISABLE_WARNING(warningNumber) __pragma(warning(disable : warningNumber)) #elif defined(__GNUC__) || defined(__clang__) +#define _VKAPI_CLANG 1 + #define __DO_PRAGMA(X) _Pragma(#X) #define __DISABLE_WARNING_PUSH __DO_PRAGMA("GCC diagnostic push") #define __DISABLE_WARNING_POP __DO_PRAGMA("GCC diagnostic pop") @@ -104,11 +76,32 @@ #define __DISABLE_WARNING #endif +#ifndef _VKAPI_MSVC +#define _VKAPI_MSVC 0 +#endif // _VKAPI_MSVC + +#ifndef _VKAPI_CLANG +#define _VKAPI_CLANG 0 +#endif // _VKAPI_CLANG + +#if _VKAPI_MSVC +#define _VKAPI_UNUSED_FOR_ANALYZER +#elif _VKAPI_CLANG +#define _VKAPI_UNUSED_FOR_ANALYZER __attribute__((unused)) +#endif + +#ifndef _VKAPI_DEBUG_PRINT +#if __DEBUG__ +#define _VKAPI_DEBUG_STDCERR(x) (std::cerr << (x)) +#define _VKAPI_DEBUG_STDCOUT(x) (std::cout << (x)) +#else +#define _VKAPI_DEBUG_STDCERR(x) +#define _VKAPI_DEBUG_STDCOUT(x) +#endif // __DEBUG__ +#endif // _VKAPI_DEBUG_PRINT + #ifndef __VKAPI_VERSION_ADDED_OPTIONAL #define __VKAPI_VERSION_ADDED_OPTIONAL __VKAPI_VERSION_NUM(0, 0, 7) #endif // __VKAPI_VERSION_ADDED_OPTIONAL -// TODO(#14): Write defines for disable complexity warnings -#define _VKAPI_COMPLEXITY_FUNCTION - #endif //VKAPI_DEFINES_HPP diff --git a/include/Exceptions.hpp b/include/Exceptions.hpp index 75b6a62..0aa6cb6 100644 --- a/include/Exceptions.hpp +++ b/include/Exceptions.hpp @@ -2,9 +2,11 @@ * Contains exceptions and information about them of this library. * @file Exceptions.hpp * @author qucals - * @version 0.0.7 24/08/21 + * @version 0.0.8 24/08/21 */ +// TODO (#17): Add comments about exceptions + #ifndef VKAPI_EXCEPTIONS_HPP #define VKAPI_EXCEPTIONS_HPP @@ -40,7 +42,7 @@ class BaseException : _VKAPI_VIRTUAL public std::exception class AlreadyConnectedException : _VKAPI_VIRTUAL public BaseException { public: - explicit AlreadyConnectedException() + _VKAPI_EXPLICIT AlreadyConnectedException() : BaseException("The client is already connected to Long Poll Server!") {} }; @@ -48,7 +50,7 @@ class AlreadyConnectedException : _VKAPI_VIRTUAL public BaseException class NotConnectedException : _VKAPI_VIRTUAL public BaseException { public: - explicit NotConnectedException() + _VKAPI_EXPLICIT NotConnectedException() : BaseException("The client is not already connected to Long Poll Server!") {} }; @@ -56,7 +58,7 @@ class NotConnectedException : _VKAPI_VIRTUAL public BaseException class EmptyArgumentException : _VKAPI_VIRTUAL public BaseException { public: - explicit EmptyArgumentException() + _VKAPI_EXPLICIT EmptyArgumentException() : BaseException("The size of argument's symbols cannot equal zero!") {} }; @@ -64,11 +66,19 @@ class EmptyArgumentException : _VKAPI_VIRTUAL public BaseException class RequestError : _VKAPI_VIRTUAL public BaseException { public: - explicit RequestError() + _VKAPI_EXPLICIT RequestError() : BaseException("Request returned unknown errors!") {} }; +class AuthFailed : _VKAPI_VIRTUAL public BaseException +{ +public: + _VKAPI_EXPLICIT AuthFailed() + : BaseException("Authorization completed with an error!") + {} +}; + } // namespace ex } // namespace vk diff --git a/include/Optional.hpp b/include/Optional.hpp index b49d51d..32b63fa 100644 --- a/include/Optional.hpp +++ b/include/Optional.hpp @@ -2,7 +2,7 @@ * Describes optional class. * @file Optional.hpp * @author qucals - * @version 0.0.7 24/08/21 + * @version 0.0.8 24/08/21 */ #ifndef VKAPI_OPTIONAL_HPP @@ -11,6 +11,8 @@ #include #include "Defines.hpp" +#include "Types.hpp" + #include "nlohmann/json.hpp" namespace vk @@ -56,7 +58,7 @@ class BasicOptional m_isSet = true; } - const _Type& Get() const& _VKAPI_NOEXCEPT + _VKAPI_INLINE const _Type& Get() const& _VKAPI_NOEXCEPT { return m_val; } void Clear() @@ -94,12 +96,6 @@ class Optional : public BasicOptional #endif // defined(__CPLUSPLUS_OVER_17) -typedef long long int IdType; -typedef unsigned long long UIdType; -typedef bool IndicatorType; - -typedef nlohmann::json JsonType; - typedef Optional Opt_IdType; typedef Optional Opt_UIdType; typedef Optional Opt_StrType; diff --git a/include/Request.hpp b/include/Request.hpp index cf40a7f..dbc100f 100644 --- a/include/Request.hpp +++ b/include/Request.hpp @@ -2,7 +2,7 @@ * Describes the class for working with CURL. * @file Request.hpp * @author qucals - * @version 0.0.7 24/08/21 + * @version 0.0.8 24/08/21 */ #ifndef VKAPI_REQUEST_HPP @@ -20,10 +20,10 @@ namespace vk namespace base { -constexpr long APPLY_CURLOPT = 1L; -constexpr long NO_APPLY_CURLOPT = 0L; -constexpr long MAXREGIDS = 50L; -constexpr const char* USERAGENT = "VKAPI Client"; +_VKAPI_UNUSED_FOR_ANALYZER _VKAPI_CONSTEXPR long APPLY_CURLOPT = 1L; +_VKAPI_CONSTEXPR long NO_APPLY_CURLOPT = 0L; +_VKAPI_CONSTEXPR long MAXREGIDS = 50L; +_VKAPI_CONSTEXPR const char* USERAGENT = "VKAPI Client"; /** * @brief The class for working with request. diff --git a/include/Types.hpp b/include/Types.hpp new file mode 100644 index 0000000..7020e0b --- /dev/null +++ b/include/Types.hpp @@ -0,0 +1,43 @@ +/** + * Contains defined types. + * @file Types.hpp + * @author qucals + * @version 0.0.8 1/09/21 + */ + +#ifndef VKAPI_TYPES_HPP +#define VKAPI_TYPES_HPP + +#include "Defines.hpp" + +#ifndef __CPLUSPLUS_OVER_11 +typedef signed char int8_t; +typedef short int16_t; +typedef int int32_t; +typedef long long int64_t; +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; +#endif // __CPLUSPLUS_OVER_11 + +#include "nlohmann/json.hpp" // nlohmann::json + +namespace vk +{ + +namespace base +{ + +typedef long long int IdType; +typedef unsigned long long UIdType; +typedef bool IndicatorType; + +typedef nlohmann::json JsonType; + + +} // namespace base + +} // namespace vk + +#endif //VKAPI_TYPES_HPP diff --git a/include/UserBase.hpp b/include/UserBase.hpp index 188fd20..66af3bd 100644 --- a/include/UserBase.hpp +++ b/include/UserBase.hpp @@ -2,7 +2,7 @@ * Describes the class for working with VK account. * @file UserBase.hpp * @author qucals - * @version 0.0.7 24/08/21 + * @version 0.0.8 24/08/21 */ #ifndef VKAPI_USERBASE_HPP @@ -484,7 +484,6 @@ class UserBase : public ClientBase * * @retval a string of this method in URL format. */ - _VKAPI_COMPLEXITY_FUNCTION _VKAPI_STATIC std::string MethodToString(METHODS method); /** diff --git a/src/BotBase.cpp b/src/BotBase.cpp index f3cd4f6..ab93c9d 100644 --- a/src/BotBase.cpp +++ b/src/BotBase.cpp @@ -2,7 +2,7 @@ * Contains the class for working with vkbot. * @file BotBase.cpp * @author qucals - * @version 0.0.7 24/08/21 + * @version 0.0.8 24/08/21 */ #include "BotBase.hpp" @@ -39,8 +39,7 @@ bool BotBase::Auth(const std::string& accessToken) JsonType response = JsonType::parse(Request::Send(url, ConvertParametersDataToURL(parametersData))); if (response.find("error") != response.end()) { - throw ex::RequestError(); - // TODO (#12): Add error handling when BotBase::Auth failed + throw ex::AuthFailed(); } else { JsonType answerDataStr = response["response"]; @@ -74,10 +73,9 @@ BotBase::Event BotBase::WaitForEvent() JsonType updates = response.at("updates")[0]; std::string eventStr = updates.at("type").get(); - return Event(GetTypeEvent(eventStr), updates); + return Event(GetTypeEvent(eventStr), updates); // NOLINT(modernize-return-braced-init-list) } -_VKAPI_COMPLEXITY_FUNCTION std::string BotBase::MethodToString(const METHODS method) { switch (method) { @@ -247,7 +245,6 @@ JsonType BotBase::CheckValidationParameters(const JsonType& parametersData) return cParametersData; } -_VKAPI_COMPLEXITY_FUNCTION BotBase::EVENTS BotBase::GetTypeEvent(const std::string& typeEvent) { if (typeEvent == "message_new") { diff --git a/src/ClientBase.cpp b/src/ClientBase.cpp index 626f05f..3eb0b27 100644 --- a/src/ClientBase.cpp +++ b/src/ClientBase.cpp @@ -2,7 +2,7 @@ * Contains general objects for working with VK API. * @file ClientBase.hpp * @author qucals - * @version 0.0.7 24/08/21 + * @version 0.0.8 24/08/21 */ #include "ClientBase.hpp" @@ -72,15 +72,19 @@ uint32_t ClientBase::GetRandomId() VK_REQUEST_ERROR_TYPES ClientBase::GetRequestErrorType(const std::string& errorStr) { - using VK_ERROR = VK_REQUEST_ERROR_TYPES; - - // TODO (#13): Add all VK_ERRORS if (errorStr == VKAPI_INVALID_REQUEST) { - return VK_ERROR::INVALID_REQUEST; + return VK_REQUEST_ERROR_TYPES::INVALID_REQUEST; } else if (errorStr == VKAPI_NEED_CAPTCHA) { - return VK_ERROR::NEED_CAPTCHA; + return VK_REQUEST_ERROR_TYPES::NEED_CAPTCHA; } else { - return VK_ERROR::UNKNOWN_ERROR; + try { + VK_REQUEST_ERROR_TYPES __e = static_cast( + std::stoi(errorStr)); + return __e; + } catch (std::exception& ex) { + _VKAPI_DEBUG_STDCERR(ex.what()); + } + return VK_REQUEST_ERROR_TYPES::UNKNOWN_ERROR; } } diff --git a/src/UserBase.cpp b/src/UserBase.cpp index feb120d..37657ed 100644 --- a/src/UserBase.cpp +++ b/src/UserBase.cpp @@ -2,7 +2,7 @@ * Describes the class for working with VK account. * @file UserBase.hpp * @author qucals - * @version 0.0.7 24/08/21 + * @version 0.0.8 24/08/21 */ #include "UserBase.hpp" @@ -70,9 +70,7 @@ bool UserBase::Auth(std::string& login, std::string& password) std::cin >> captchaKey; parametersData.push_back({ "captcha_key", captchaKey }); - std::string answer = Request::Send(VKAPI_AUTH_URL, ConvertParametersDataToURL(parametersData)); - - // TODO (#11): Add further processing + response = Request::Send(VKAPI_AUTH_URL, ConvertParametersDataToURL(parametersData)); } VALIDATION_TYPES validationType = GetValidationType(response.at("validation_type")); @@ -218,7 +216,6 @@ JsonType UserBase::SendRequest(const std::string& method, const JsonType& parame return response; } -_VKAPI_COMPLEXITY_FUNCTION std::string UserBase::MethodToString(METHODS method) { switch (method) { diff --git a/submodules/install.cmake b/submodules/install.cmake new file mode 100644 index 0000000..433b376 --- /dev/null +++ b/submodules/install.cmake @@ -0,0 +1,26 @@ +if((NOT NLOHMANN_JSON_INCLUDE_DIR) OR (NOT EXISTS ${NLOHMANN_JSON_INCLUDE_DIR})) + message("Unable to find nlohmann/json, cloning...") + + execute_process(COMMAND git submodule update --init -- submodules/json + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + + set(NLOHMANN_JSON_SOURCE_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/submodules/json/ + CACHE PATH "nlohmann/json include directory") + + install(FILES ${NLOHMANN_JSON_SOURCE_DIR}/single_include/nlohmann/json.hpp DESTINATION ${CMAKE_INSTALL_BINDIR}/include/vkapi/nlohmann) + + # Setup a target + add_library(nlohmann_json INTERFACE) + target_include_directories(nlohmann_json INTERFACE + $ + $) + + install(TARGETS nlohmann_json EXPORT nlohmann_json DESTINATION ${CMAKE_INSTALL_BINDIR}/include/vkapi/nlohmann) + install( + EXPORT nlohmann_json + FILE nlohmann_jsonTargets.cmake + # NAMESPACE nlohmann_json:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ + ) +endif() \ No newline at end of file diff --git a/submodules/json b/submodules/json new file mode 160000 index 0000000..1fd2213 --- /dev/null +++ b/submodules/json @@ -0,0 +1 @@ +Subproject commit 1fd2213fd206d12a818cd5c60dd0138445534133