From a3a0fc0eae2eac4c5da2dbd34263ed7d086377e8 Mon Sep 17 00:00:00 2001 From: Javier Matos Denizac Date: Fri, 26 Jan 2024 16:44:50 -0800 Subject: [PATCH] [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 Co-authored-by: Billy Robert O'Neal III --- ports/cld3/cld3Config.cmake.in | 39 ---------------------- ports/cld3/fix-build.patch | 27 ---------------- ports/cld3/portfile.cmake | 9 ++---- ports/cld3/unofficial-cld3Config.cmake | 4 +++ ports/cld3/unofficial-export.patch | 45 ++++++++++++++++++++++++++ ports/cld3/vcpkg.json | 5 +++ versions/baseline.json | 2 +- versions/c-/cld3.json | 5 +++ 8 files changed, 63 insertions(+), 73 deletions(-) delete mode 100644 ports/cld3/cld3Config.cmake.in delete mode 100644 ports/cld3/fix-build.patch create mode 100644 ports/cld3/unofficial-cld3Config.cmake create mode 100644 ports/cld3/unofficial-export.patch diff --git a/ports/cld3/cld3Config.cmake.in b/ports/cld3/cld3Config.cmake.in deleted file mode 100644 index 3be9b9ce3a..0000000000 --- a/ports/cld3/cld3Config.cmake.in +++ /dev/null @@ -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) diff --git a/ports/cld3/fix-build.patch b/ports/cld3/fix-build.patch deleted file mode 100644 index dd47e1039f..0000000000 --- a/ports/cld3/fix-build.patch +++ /dev/null @@ -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}) diff --git a/ports/cld3/portfile.cmake b/ports/cld3/portfile.cmake index 331cc08f2a..a6057fc221 100644 --- a/ports/cld3/portfile.cmake +++ b/ports/cld3/portfile.cmake @@ -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") diff --git a/ports/cld3/unofficial-cld3Config.cmake b/ports/cld3/unofficial-cld3Config.cmake new file mode 100644 index 0000000000..4a87abeef7 --- /dev/null +++ b/ports/cld3/unofficial-cld3Config.cmake @@ -0,0 +1,4 @@ +include(CMakeFindDependencyMacro) +find_dependency(Protobuf) + +include("${CMAKE_CURRENT_LIST_DIR}/unofficial-cld3-targets.cmake") diff --git a/ports/cld3/unofficial-export.patch b/ports/cld3/unofficial-export.patch new file mode 100644 index 0000000000..1f4474627e --- /dev/null +++ b/ports/cld3/unofficial-export.patch @@ -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(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 ++) diff --git a/ports/cld3/vcpkg.json b/ports/cld3/vcpkg.json index a43bb255a6..c8b367387b 100644 --- a/ports/cld3/vcpkg.json +++ b/ports/cld3/vcpkg.json @@ -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 } ] } diff --git a/versions/baseline.json b/versions/baseline.json index 88ca49d588..6421de3ba6 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -1634,7 +1634,7 @@ }, "cld3": { "baseline": "3.0.14", - "port-version": 0 + "port-version": 1 }, "clfft": { "baseline": "2.12.2", diff --git a/versions/c-/cld3.json b/versions/c-/cld3.json index 50a4734d1c..2342205404 100644 --- a/versions/c-/cld3.json +++ b/versions/c-/cld3.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "a9553fd0c6e8053c54c83a51d8e93bdfab419c8e", + "version": "3.0.14", + "port-version": 1 + }, { "git-tree": "188a3b8fe8c84224f44d3d88b4e74ca34363cf9b", "version": "3.0.14",