[opencc] De-vendor marisa (#29997)

* Add feature marisa

* update

* remove useless code

* add pkgconf

* update
This commit is contained in:
Mengna Li 2023-03-14 03:04:42 +08:00 committed by GitHub
parent 28e440beea
commit ac4f80ae9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 2 deletions

View File

@ -1,7 +1,41 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ee08591..c8c6b61 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -185,12 +185,14 @@ if(NOT USE_SYSTEM_MARISA)
message(STATUS "Use bundled marisa library.")
add_subdirectory(deps/marisa-0.2.6)
else()
- find_library(LIBMARISA NAMES marisa)
- if (LIBMARISA)
- message(STATUS "libmarisa found: ${LIBMARISA}")
- else()
- message(FATAL_ERROR "libmarisa not found.")
- endif()
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(marisa REQUIRED IMPORTED_TARGET marisa)
+ # find_library(LIBMARISA NAMES marisa)
+ # if (LIBMARISA)
+ # message(STATUS "libmarisa found: ${LIBMARISA}")
+ # else()
+ # message(FATAL_ERROR "libmarisa not found.")
+ # endif()
endif()
######## Subdirectories
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c0a0b10..19f7cbb 100644
index c0a0b10..91b4037 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -114,7 +114,7 @@ configure_file(
add_library(libopencc ${LIBOPENCC_SOURCES} ${LIBOPENCC_HEADERS})
set_target_properties(libopencc PROPERTIES POSITION_INDEPENDENT_CODE ON)
source_group(libopencc FILES ${LIBOPENCC_SOURCES} ${LIBOPENCC_HEADERS})
-target_link_libraries(libopencc marisa)
+target_link_libraries(libopencc PkgConfig::marisa)
GENERATE_EXPORT_HEADER(
libopencc
@@ -137,6 +137,21 @@ set_target_properties(
${OPENCC_VERSION_MAJOR}.${OPENCC_VERSION_MINOR}
)

View File

@ -20,6 +20,8 @@ vcpkg_cmake_configure(
-DUSE_SYSTEM_RAPIDJSON=ON
-DUSE_SYSTEM_TCLAP=ON
-DUSE_SYSTEM_DARTS=ON
-DUSE_SYSTEM_MARISA=ON
-DPKG_CONFIG_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/pkgconf/pkgconf
)
vcpkg_cmake_install(

View File

@ -1,12 +1,18 @@
{
"name": "opencc",
"version": "1.1.6",
"port-version": 1,
"description": "A project for conversions between Traditional Chinese, Simplified Chinese and Japanese Kanji (Shinjitai)",
"homepage": "https://github.com/BYVoid/OpenCC",
"license": "Apache-2.0",
"supports": "!(arm | uwp)",
"dependencies": [
"darts-clone",
"marisa-trie",
{
"name": "pkgconf",
"host": true
},
"rapidjson",
"tclap",
{

View File

@ -5686,7 +5686,7 @@
},
"opencc": {
"baseline": "1.1.6",
"port-version": 0
"port-version": 1
},
"opencensus-cpp": {
"baseline": "2021-08-26",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "85a9b30209f5cd7460d2be2c8e1cc206fab66aaa",
"version": "1.1.6",
"port-version": 1
},
{
"git-tree": "246c0e831df06a5235e750d5af71b7cd9b2cc904",
"version": "1.1.6",