[cld3] Fix unofficial config (#36399)

* bump port version

* version db

* fix config name

* version db

* fix exports

* fix unofficial config

* version db

* fix config line ending

* version db

* Shrink unofficial-export.patch by using if(0) to disable the unit tests rather than deleting them.

* Billy forgot version DB.

---------

Co-authored-by: Javier Matos <javiermatos@Javiers-Laptop.local>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
This commit is contained in:
Javier Matos Denizac 2024-01-26 16:44:50 -08:00 committed by GitHub
parent 5786fcb0cb
commit a3a0fc0eae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 63 additions and 73 deletions

View File

@ -1,39 +0,0 @@
if(TARGET cld3)
return()
endif()
include(CMakeFindDependencyMacro)
find_dependency(Protobuf)
# Traditional find module variables (vcpkg polyfill)
set(cld3_INCLUDE_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
set(cld3_INCLUDE_DIRS "${cld3_INCLUDE_DIR}")
set(cld3_DIR "${cld3_INCLUDE_DIR}")
get_filename_component(_cld3_root "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_cld3_root "${_cld3_root}" PATH)
get_filename_component(_cld3_root "${_cld3_root}" PATH)
find_library(_cld_lib NAMES cld3)
if (EXISTS "${_cld_lib}")
add_library(cld3 INTERFACE IMPORTED GLOBAL)
add_library(cld3::cld3 ALIAS cld3)
target_include_directories(cld3 INTERFACE ${_cld3_root}/include)
set(cld3_LIBRARIES "${_cld_lib}")
target_link_libraries(cld3 INTERFACE ${cld3_LIBRARIES})
target_link_libraries(cld3 INTERFACE ${Protobuf_LITE_LIBRARIES})
set_property(TARGET cld3 APPEND PROPERTY IMPORTED_CONFIGURATIONS)
set(cld3_FOUND TRUE)
else()
set(cld3_FOUND FALSE)
endif()
unset(_cld_lib)
unset(_cld3_root)

View File

@ -1,27 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2fa3908..f6d26cb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,7 +21,7 @@ my_protobuf_generate_cpp(cld_3/protos PROTO_SRCS PROTO_HDRS src/feature_extracto
message(STATUS "PROTO_HDRS= ${PROTO_HDRS}")
add_definitions(-fPIC) # Position Independant Code
-add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
+#add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
add_definitions(-std=c++11) # Needed for std::to_string(), ...
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${Protobuf_INCLUDE_DIRS}) # needed to include generated pb headers
@@ -58,6 +58,13 @@ add_library(${PROJECT_NAME}
src/script_span/fixunicodevalue.cc
)
+if (MSVC)
+ add_compile_definitions(COMPILER_MSVC)
+endif()
+
+install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
+return()
+
# unit tests exec:
add_executable(language_identifier_main src/language_identifier_main.cc)
target_link_libraries(language_identifier_main cld3 ${Protobuf_LITE_LIBRARIES})

View File

@ -9,18 +9,18 @@ vcpkg_from_github(
SHA512 c3650ffbf5855aaf04d03930f01c6efd76e1f2b2d47365348721f16531a14653ae5b3aff8fefa8e5fa1c769fdf1a9b441a88bc687f97f8c579b84f17c6984c9e
HEAD_REF master
PATCHES
fix-build.patch
unofficial-export.patch
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS ${FEATURE_OPTIONS}
-DINSTALL_LIB_DIR:STRING=lib
)
vcpkg_cmake_install()
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()
file(COPY "${CMAKE_CURRENT_LIST_DIR}/unofficial-cld3Config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-cld3")
vcpkg_cmake_config_fixup(CONFIG_PATH share/unofficial-cld3 PACKAGE_NAME unofficial-cld3)
file(GLOB PUBLIC_HEADER_FILES LIST_DIRECTORIES false "${SOURCE_PATH}/src/*.h")
file(INSTALL ${PUBLIC_HEADER_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/include/cld3")
@ -31,7 +31,4 @@ file(INSTALL ${HEADERS_SCRIPT_SPAN_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/i
file(GLOB HEADERS_PROTO_FILES LIST_DIRECTORIES false "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/cld_3/protos/*.h")
file(INSTALL ${HEADERS_PROTO_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/include/cld_3/protos")
configure_file("${CMAKE_CURRENT_LIST_DIR}/cld3Config.cmake.in"
"${CURRENT_PACKAGES_DIR}/share/${PORT}/cld3Config.cmake" @ONLY)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View File

@ -0,0 +1,4 @@
include(CMakeFindDependencyMacro)
find_dependency(Protobuf)
include("${CMAKE_CURRENT_LIST_DIR}/unofficial-cld3-targets.cmake")

View File

@ -0,0 +1,45 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2fa3908..d776dd1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,7 +21,6 @@ my_protobuf_generate_cpp(cld_3/protos PROTO_SRCS PROTO_HDRS src/feature_extracto
message(STATUS "PROTO_HDRS= ${PROTO_HDRS}")
add_definitions(-fPIC) # Position Independant Code
-add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
add_definitions(-std=c++11) # Needed for std::to_string(), ...
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${Protobuf_INCLUDE_DIRS}) # needed to include generated pb headers
@@ -58,6 +57,7 @@ add_library(${PROJECT_NAME}
src/script_span/fixunicodevalue.cc
)
+if (0) # Disable unit tests
# unit tests exec:
add_executable(language_identifier_main src/language_identifier_main.cc)
target_link_libraries(language_identifier_main cld3 ${Protobuf_LITE_LIBRARIES})
@@ -67,3 +67,24 @@ target_link_libraries(getonescriptspan_test cld3 ${Protobuf_LITE_LIBRARIES})
add_executable(language_identifier_features_test src/language_identifier_features_test.cc)
target_link_libraries(language_identifier_features_test cld3 ${Protobuf_LITE_LIBRARIES})
+endif()
+
+if (MSVC)
+ add_compile_definitions(COMPILER_MSVC)
+endif()
+
+target_link_libraries(${PROJECT_NAME} PUBLIC protobuf::libprotobuf-lite)
+
+target_include_directories(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
+
+install(TARGETS ${PROJECT_NAME}
+ EXPORT unofficial-cld3-targets
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
+
+install(EXPORT unofficial-cld3-targets
+ NAMESPACE unofficial::cld3::
+ DESTINATION share/unofficial-cld3
+)

View File

@ -1,6 +1,7 @@
{
"name": "cld3",
"version": "3.0.14",
"port-version": 1,
"description": "Compact Language Detector v3",
"homepage": "https://github.com/google/cld3",
"license": "Apache-2.0",
@ -9,6 +10,10 @@
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -1634,7 +1634,7 @@
},
"cld3": {
"baseline": "3.0.14",
"port-version": 0
"port-version": 1
},
"clfft": {
"baseline": "2.12.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a9553fd0c6e8053c54c83a51d8e93bdfab419c8e",
"version": "3.0.14",
"port-version": 1
},
{
"git-tree": "188a3b8fe8c84224f44d3d88b4e74ca34363cf9b",
"version": "3.0.14",