Build independently with EchoionApi SDK

This commit is contained in:
faumaray committed 2026-07-28 22:45:55 +03:00
1 parent fca26fd066
commit 71f97b8453
2 files changed
+43 -8

No files matched your search

+40 -7
View File
@@ -1,17 +1,50 @@
set(_external_sources
"${CMAKE_CURRENT_SOURCE_DIR}/../common/src/Common.cpp"
src/ExternalShortener.cpp)
cmake_minimum_required(VERSION 4.0.0)
if(NOT DEFINED ECHOION_PRODUCT_VERSION)
set(ECHOION_PRODUCT_VERSION 2.0.0)
endif()
project(EchoionPluginUrlShortenerExternal
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(Boost REQUIRED COMPONENTS url)
find_package(Threads REQUIRED)
set(ECHOION_URL_SHORTENER_EXTERNAL_VERSION "${PROJECT_VERSION}")
set(_external_sources src/ExternalShortener.cpp)
add_library(EchoionUrlShortenerExternalPlugin MODULE
${_external_sources}
src/Plugin.cpp)
target_include_directories(EchoionUrlShortenerExternalPlugin PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/../common/include")
"${CMAKE_CURRENT_SOURCE_DIR}/include")
target_compile_features(EchoionUrlShortenerExternalPlugin PRIVATE cxx_std_26)
target_link_libraries(EchoionUrlShortenerExternalPlugin PRIVATE
Echoion::ApiPlugin
Echoion::ApiConfig
Echoion::ApiPluginSdk
Void::ShortUrl
Void::Data
Void::Net
@@ -47,11 +80,11 @@ if(BUILD_TESTS)
${_external_sources}
tests/ExternalShortenerTests.cpp)
target_include_directories(echoion_url_shortener_external_tests PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/../common/include")
"${CMAKE_CURRENT_SOURCE_DIR}/include")
target_compile_features(echoion_url_shortener_external_tests PRIVATE
cxx_std_26)
target_link_libraries(echoion_url_shortener_external_tests PRIVATE
Echoion::ApiPluginSdk
Void::ShortUrl Void::Data Void::Net Void::Text Boost::url Threads::Threads)
add_test(NAME echoion_url_shortener_external_tests
COMMAND echoion_url_shortener_external_tests)
+3 -1
View File
@@ -1,5 +1,5 @@
#include <echoion/plugins/short_url/ExternalShortener.hpp>
#include <echoion/plugins/short_url/Common.hpp>
#include <echoion/api/plugin/ShortUrlSupport.hpp>
#include <Void/Data/Json.hpp>
#include <Void/Net/Url.hpp>
@@ -29,6 +29,8 @@
namespace Echoion::Plugins::ShortUrl
{
using namespace Echoion::Api::Plugin::ShortUrl;
namespace
{
constexpr std::string_view kDefaultUrlField{"url"};