Build independently with EchoionApi SDK
This commit is contained in:
1 parent
9044e4a9d4
commit
16d94a174a
3 files changed
+46
-9
No files matched your search
+40
-7
@@ -1,17 +1,50 @@
|
||||
set(_internal_sources
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../common/src/Common.cpp"
|
||||
src/InternalStore.cpp)
|
||||
cmake_minimum_required(VERSION 4.0.0)
|
||||
if(NOT DEFINED ECHOION_PRODUCT_VERSION)
|
||||
set(ECHOION_PRODUCT_VERSION 2.0.0)
|
||||
endif()
|
||||
project(EchoionPluginUrlShortenerInternal
|
||||
VERSION "${ECHOION_PRODUCT_VERSION}" LANGUAGES CXX)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
file(DOWNLOAD
|
||||
https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.40.8/CPM.cmake
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake"
|
||||
EXPECTED_HASH
|
||||
SHA256=78ba32abdf798bc616bab7c73aac32a17bbd7b06ad9e26a6add69de8f3ae4791)
|
||||
include("${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake")
|
||||
CPMAddPackage(
|
||||
NAME Void
|
||||
GIT_REPOSITORY https://git.faumaray.ru/void/voidlibrary.git
|
||||
GIT_TAG main
|
||||
OPTIONS "VOID_ENABLE_TESTING OFF")
|
||||
CPMAddPackage(
|
||||
NAME EchoionApi
|
||||
GIT_REPOSITORY https://git.faumaray.ru/void/echoionapi.git
|
||||
GIT_TAG main)
|
||||
option(BUILD_TESTS "Build component tests" ON)
|
||||
if(BUILD_TESTS)
|
||||
enable_testing()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(OpenSSL REQUIRED COMPONENTS Crypto)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
set(ECHOION_URL_SHORTENER_INTERNAL_VERSION "${PROJECT_VERSION}")
|
||||
set(_internal_sources src/InternalStore.cpp)
|
||||
|
||||
add_library(EchoionUrlShortenerInternalPlugin MODULE
|
||||
${_internal_sources}
|
||||
src/Plugin.cpp)
|
||||
target_include_directories(EchoionUrlShortenerInternalPlugin PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../common/include")
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
target_compile_features(EchoionUrlShortenerInternalPlugin PRIVATE cxx_std_26)
|
||||
target_link_libraries(EchoionUrlShortenerInternalPlugin PRIVATE
|
||||
Echoion::ApiPlugin
|
||||
Echoion::ApiConfig
|
||||
Echoion::ApiPluginSdk
|
||||
Void::ShortUrl
|
||||
Void::Data
|
||||
Void::Net
|
||||
@@ -48,11 +81,11 @@ if(BUILD_TESTS)
|
||||
${_internal_sources}
|
||||
tests/InternalStoreTests.cpp)
|
||||
target_include_directories(echoion_url_shortener_internal_tests PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../common/include")
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
target_compile_features(echoion_url_shortener_internal_tests PRIVATE
|
||||
cxx_std_26)
|
||||
target_link_libraries(echoion_url_shortener_internal_tests PRIVATE
|
||||
Echoion::ApiPluginSdk
|
||||
Void::Data Void::Net Void::Text Void::Sqlite Void::Crypto
|
||||
OpenSSL::Crypto Threads::Threads)
|
||||
add_test(NAME echoion_url_shortener_internal_tests
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <echoion/plugins/short_url/InternalStore.hpp>
|
||||
#include <echoion/plugins/short_url/Common.hpp>
|
||||
#include <echoion/api/plugin/ShortUrlSupport.hpp>
|
||||
|
||||
#include <openssl/rand.h>
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
namespace Echoion::Plugins::ShortUrl
|
||||
{
|
||||
using namespace Echoion::Api::Plugin::ShortUrl;
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr std::string_view kAlphabet =
|
||||
|
||||
+3
-1
@@ -1,4 +1,4 @@
|
||||
#include <echoion/plugins/short_url/Common.hpp>
|
||||
#include <echoion/api/plugin/ShortUrlSupport.hpp>
|
||||
#include <echoion/plugins/short_url/InternalStore.hpp>
|
||||
|
||||
#include <ExtensionPlugin.hpp>
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
namespace Echoion::Plugins::ShortUrl
|
||||
{
|
||||
using namespace Echoion::Api::Plugin::ShortUrl;
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr std::string_view kPluginId{"url-shortener-internal"};
|
||||
|
||||
Reference in new issue
Block a user