[bext-text] add new port (#40824)

This commit is contained in:
Jia Yue Hua 2024-09-09 02:32:11 +08:00 committed by GitHub
parent 5d4fbf376d
commit 5cd9e6b7ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 134 additions and 0 deletions

View File

@ -0,0 +1,82 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b7b03d6..1228484f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.5)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
project(boost_text LANGUAGES CXX)
+include(CMakePackageConfigHelpers)
##################################################
# C++ standard version selection
##################################################
@@ -85,7 +86,7 @@ target_include_directories(text
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
-target_include_directories(text PRIVATE ${Boost_INCLUDE_DIR})
+target_link_libraries(text PRIVATE Boost::boost)
set_property(TARGET text PROPERTY CXX_STANDARD ${CXX_STD})
target_compile_options(text PRIVATE -DBOOST_TEXT_SOURCE)
if (link_flags)
@@ -106,13 +107,22 @@ install(EXPORT text_export
NAMESPACE Boost::
DESTINATION lib/cmake/text)
+
+configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/text-config.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/cmake/text-config.cmake"
+ INSTALL_DESTINATION "lib/cmake/text"
+ NO_SET_AND_CHECK_MACRO
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
+ )
+
install(FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/cmake/text-config.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/cmake/text-config.cmake
DESTINATION "lib/cmake/text")
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/boost
DESTINATION "include")
+if(0)
# If Boost was not found, make text depend on boost_clone, so that we clone
# Boost from Github repos. However, we don't want a permanent text ->
# boost_clone dependency, so make this CMakeLists.txt file dirty by touching
@@ -140,4 +150,5 @@ endif ()
add_subdirectory(test)
add_subdirectory(perf)
add_subdirectory(example)
+endif()
diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake
index 1e25c825..bcec1bc5 100644
--- a/cmake/dependencies.cmake
+++ b/cmake/dependencies.cmake
@@ -7,7 +7,8 @@
# Boost
###############################################################################
set(Boost_USE_STATIC_LIBS ON)
-find_package(Boost 1.71.0 COMPONENTS ${boost_components})
+find_package(Boost REQUIRED COMPONENTS ${boost_components})
+if(0)
if (Boost_INCLUDE_DIR)
add_library(boost INTERFACE)
target_include_directories(boost INTERFACE ${Boost_INCLUDE_DIR})
@@ -108,3 +109,4 @@ if (MSVC)
else()
find_package(ICU 60 COMPONENTS i18n data uc)
endif()
+endif()
diff --git a/cmake/text-config.cmake b/cmake/text-config.cmake.in
similarity index 70%
rename from cmake/text-config.cmake
rename to cmake/text-config.cmake.in
index b7071ff5..b9c8be91 100644
--- a/cmake/text-config.cmake
+++ b/cmake/text-config.cmake.in
@@ -1,2 +1,4 @@
+@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
+find_dependency(Boost)
include("${CMAKE_CURRENT_LIST_DIR}/text-targets.cmake")

View File

@ -0,0 +1,21 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO tzlaine/text
REF dd2959e7143fde3f62b24d87a6573b5b96b6ea46
SHA512 6897d6aac64f16ebf7c0fc4623d5b773844e6714d7c4feef69fad338657e7e7f845a0120b1ffb7b36e8b29f42afde470d0883e65bbcd7adb9466f07306ed64d5
HEAD_REF master
PATCHES fix-boost-dependency.patch
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME text CONFIG_PATH "lib/cmake/text")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE_1_0.txt")

View File

@ -0,0 +1,18 @@
{
"name": "bext-text",
"version-date": "2024-01-19",
"description": "What a c++ standard Unicode library might look like.",
"homepage": "https://tzlaine.github.io/text/doc/html/index.html",
"license": "BSL-1.0",
"dependencies": [
"boost",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "e7d3b13182249822322514dfc1157853d1202bfb",
"version-date": "2024-01-19",
"port-version": 0
}
]
}

View File

@ -612,6 +612,10 @@
"baseline": "2.0.0", "baseline": "2.0.0",
"port-version": 0 "port-version": 0
}, },
"bext-text": {
"baseline": "2024-01-19",
"port-version": 0
},
"bext-ut": { "bext-ut": {
"baseline": "2.0.1", "baseline": "2.0.1",
"port-version": 0 "port-version": 0