From bddb3ae30614e2ec6e27e033bcf5682a5676457d Mon Sep 17 00:00:00 2001 From: Aleksandr Orefkov Date: Sat, 15 Nov 2025 13:07:52 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20shared=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 16 ++-------------- readme.md | 2 +- tests/CMakeLists.txt | 12 +----------- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c32dfdb..8a6dc0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ include(FetchContent) project( simstr - VERSION 1.0.0 + VERSION 1.2.3 DESCRIPTION "Yet another string library" HOMEPAGE_URL "https://github.com/orefkov/simstr" LANGUAGES CXX @@ -24,12 +24,6 @@ endif() option(SIMSTR_BUILD_TESTS "Построить тесты" ON) option(SIMSTR_BENCHMARKS "Построить замеры производительности" Off) -# При OFF - строится обычная статическая библиотека. -# При On - simstr собирается как статическая библиотека, которую потом встроят в shared библиотеку, -# и она будет свои функции объявлять как экспортируемые. Потребители же будут собираться с указанием, -# что функции - импортируемые -option(SIMSTR_IN_SHARED "Функции simstr будут экспортироваться или импортироваться" Off) - add_library(simstr_simstr src/sstring.cpp src/simple_unicode.cpp @@ -90,17 +84,11 @@ add_simdutf() target_link_libraries(simstr_simstr PUBLIC simdutf::simdutf) -if(SIMSTR_IN_SHARED) +if(BUILD_SHARED_LIBS) # Всем объявляем, что мы будем в shared библиотеке add_compile_definitions(SIMSTR_IN_SHARED) # Себе объявим, что мы должны экспортировать функции target_compile_definitions(simstr_simstr PRIVATE SIMSTR_EXPORT) - # Пример построения shared библиотеки, которая включит в себя simstr. - # Как при этом создать экзешник, пользующийся этой dll - пример в tests/CMakeLists.txt - # Нельзя объявить библиотеку без исходников, добавим просто .h файл - add_library(simstr_dll SHARED include/simstr/sstring.h) - # simstr должна войти в simstr_dll целиком - target_link_libraries(simstr_dll PRIVATE "$") endif(SIMSTR_IN_SHARED) if(SIMSTR_BUILD_TESTS) diff --git a/readme.md b/readme.md index 84f8b33..ad1920d 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,7 @@ # simstr - библиотека строковых объектов и функций [![CMake on multiple platforms](https://github.com/orefkov/simstr/actions/workflows/cmake-multi-platform.yml/badge.svg)](https://github.com/orefkov/simstr/actions/workflows/cmake-multi-platform.yml) -Версия 1.0. +Версия 1.2.3. В этой библиотеке содержится реализация нескольких видов строковых объектов и различных алгоритмов для работы со строками. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2e7b302..42e6e50 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -4,17 +4,7 @@ add_executable(testStr test_str.cpp) -if (NOT SIMSTR_IN_SHARED) - target_link_libraries(testStr simstr::simstr GTest::gtest_main) -else() - # Пример создания экзешника, если simstr экспортируются из dll. - # Так как мы подключаем только simstr_dll, и входящие в неё либы не видны - # нужно вручную задать каталоги include и стандарт C++20 - target_link_libraries(testStr simstr_dll GTest::gtest_main) - get_target_property(SIMSTR_INCLUDES simstr::simstr INCLUDE_DIRECTORIES) - target_include_directories(testStr PRIVATE ${SIMSTR_INCLUDES}) - target_compile_features(testStr PUBLIC cxx_std_20) -endif() +target_link_libraries(testStr simstr::simstr GTest::gtest_main) add_test(NAME testStr COMMAND testStr)