mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 05:19:06 +08:00
[kenlm] Fixes and cleanup (#35907)
This commit is contained in:
parent
4a938d4240
commit
baad52570f
29
ports/kenlm/cmake-config.patch
Normal file
29
ports/kenlm/cmake-config.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
diff --git a/cmake/kenlmConfig.cmake.in b/cmake/kenlmConfig.cmake.in
|
||||||
|
index 592407d..86abd36 100644
|
||||||
|
--- a/cmake/kenlmConfig.cmake.in
|
||||||
|
+++ b/cmake/kenlmConfig.cmake.in
|
||||||
|
@@ -5,6 +5,12 @@ include(CMakeFindDependencyMacro)
|
||||||
|
find_dependency(Boost)
|
||||||
|
find_dependency(Threads)
|
||||||
|
find_dependency(double-conversion CONFIG)
|
||||||
|
+if("@ENABLE_INTERPOLATE@")
|
||||||
|
+ find_dependency(Eigen3)
|
||||||
|
+ if("@OPENMP_CXX_FOUND@")
|
||||||
|
+ find_dependency(OpenMP)
|
||||||
|
+ endif()
|
||||||
|
+endif()
|
||||||
|
|
||||||
|
# Compression libs
|
||||||
|
if (@ZLIB_FOUND@)
|
||||||
|
diff --git a/lm/interpolate/CMakeLists.txt b/lm/interpolate/CMakeLists.txt
|
||||||
|
index d23e959..26b6092 100644
|
||||||
|
--- a/lm/interpolate/CMakeLists.txt
|
||||||
|
+++ b/lm/interpolate/CMakeLists.txt
|
||||||
|
@@ -24,6 +24,7 @@ if(ENABLE_INTERPOLATE)
|
||||||
|
|
||||||
|
|
||||||
|
find_package(OpenMP)
|
||||||
|
+ set(OPENMP_CXX_FOUND "${OPENMP_CXX_FOUND}" CACHE INTERNAL "For exported config")
|
||||||
|
if (OPENMP_CXX_FOUND)
|
||||||
|
target_link_libraries(kenlm_interpolate PUBLIC OpenMP::OpenMP_CXX)
|
||||||
|
endif()
|
42
ports/kenlm/devendor.patch
Normal file
42
ports/kenlm/devendor.patch
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index fd08a48..7439ebf 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -128,7 +128,7 @@ install(EXPORT kenlmTargets
|
||||||
|
DESTINATION share/kenlm/cmake
|
||||||
|
)
|
||||||
|
|
||||||
|
-foreach(SUBDIR IN ITEMS util util/double-conversion util/stream lm lm/builder lm/common lm/filter lm/interpolate)
|
||||||
|
+foreach(SUBDIR IN ITEMS util util/stream lm lm/builder lm/common lm/filter lm/interpolate)
|
||||||
|
file(GLOB HEADERS ${CMAKE_CURRENT_LIST_DIR}/${SUBDIR}/*.h ${CMAKE_CURRENT_LIST_DIR}/${SUBDIR}/*.hh)
|
||||||
|
install(FILES ${HEADERS} DESTINATION include/kenlm/${SUBDIR} COMPONENT headers)
|
||||||
|
endforeach(SUBDIR)
|
||||||
|
diff --git a/cmake/kenlmConfig.cmake.in b/cmake/kenlmConfig.cmake.in
|
||||||
|
index 0fbf0c6..592407d 100644
|
||||||
|
--- a/cmake/kenlmConfig.cmake.in
|
||||||
|
+++ b/cmake/kenlmConfig.cmake.in
|
||||||
|
@@ -4,6 +4,7 @@ include(CMakeFindDependencyMacro)
|
||||||
|
|
||||||
|
find_dependency(Boost)
|
||||||
|
find_dependency(Threads)
|
||||||
|
+find_dependency(double-conversion CONFIG)
|
||||||
|
|
||||||
|
# Compression libs
|
||||||
|
if (@ZLIB_FOUND@)
|
||||||
|
diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
|
||||||
|
index 7a96ef5..3318d73 100644
|
||||||
|
--- a/util/CMakeLists.txt
|
||||||
|
+++ b/util/CMakeLists.txt
|
||||||
|
@@ -32,10 +32,11 @@ if (WIN32)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# This directory has children that need to be processed
|
||||||
|
-add_subdirectory(double-conversion)
|
||||||
|
+find_package(double-conversion CONFIG REQUIRED)
|
||||||
|
add_subdirectory(stream)
|
||||||
|
|
||||||
|
add_library(kenlm_util ${KENLM_UTIL_DOUBLECONVERSION_SOURCE} ${KENLM_UTIL_STREAM_SOURCE} ${KENLM_UTIL_SOURCE})
|
||||||
|
+target_link_libraries(kenlm_util PRIVATE double-conversion::double-conversion)
|
||||||
|
# Since headers are relative to `include/kenlm` at install time, not just `include`
|
||||||
|
target_include_directories(kenlm_util PUBLIC $<INSTALL_INTERFACE:include/kenlm>)
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
|
|
||||||
index 7a96ef5..0708d8a 100644
|
|
||||||
--- a/util/CMakeLists.txt
|
|
||||||
+++ b/util/CMakeLists.txt
|
|
||||||
@@ -85,7 +85,10 @@ set_target_properties(kenlm_util PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
||||||
target_link_libraries(kenlm_util
|
|
||||||
PUBLIC
|
|
||||||
# Boost is required for building binaries and tests
|
|
||||||
- "$<BUILD_INTERFACE:${Boost_LIBRARIES}>"
|
|
||||||
+ $<BUILD_INTERFACE:Boost::program_options>
|
|
||||||
+ $<BUILD_INTERFACE:Boost::system>
|
|
||||||
+ $<BUILD_INTERFACE:Boost::thread>
|
|
||||||
+ $<BUILD_INTERFACE:Boost::unit_test_framework>
|
|
||||||
PRIVATE
|
|
||||||
Threads::Threads
|
|
||||||
${RT})
|
|
||||||
diff --git a/util/stream/CMakeLists.txt b/util/stream/CMakeLists.txt
|
|
||||||
index be2fe00..a7e7df5 100644
|
|
||||||
--- a/util/stream/CMakeLists.txt
|
|
||||||
+++ b/util/stream/CMakeLists.txt
|
|
||||||
@@ -35,5 +35,11 @@ if(BUILD_TESTING)
|
|
||||||
)
|
|
||||||
|
|
||||||
AddTests(TESTS ${KENLM_BOOST_TESTS_LIST}
|
|
||||||
- LIBRARIES kenlm_util ${Boost_LIBRARIES} Threads::Threads)
|
|
||||||
+ LIBRARIES
|
|
||||||
+ kenlm_util
|
|
||||||
+ Boost::program_options
|
|
||||||
+ Boost::system
|
|
||||||
+ Boost::thread
|
|
||||||
+ Boost::unit_test_framework
|
|
||||||
+ Threads::Threads)
|
|
||||||
endif()
|
|
@ -1,12 +1,25 @@
|
|||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
index bec81d4..44fd48a 100644
|
index 3c6c863..fd08a48 100644
|
||||||
--- a/CMakeLists.txt
|
--- a/CMakeLists.txt
|
||||||
+++ b/CMakeLists.txt
|
+++ b/CMakeLists.txt
|
||||||
@@ -1,6 +1,6 @@
|
@@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.1)
|
cmake_minimum_required(VERSION 3.1)
|
||||||
|
|
||||||
-if (WIN32)
|
-if (WIN32)
|
||||||
+if (WIN32 AND BUILD_SHARED_LIBS)
|
+if (0)
|
||||||
set(Boost_USE_STATIC_LIBS OFF)
|
set(Boost_USE_STATIC_LIBS OFF)
|
||||||
# The auto-linking feature has problems with USE_STATIC_LIBS off, so we use
|
# The auto-linking feature has problems with USE_STATIC_LIBS off, so we use
|
||||||
# BOOST_ALL_NO_LIB to turn it off.
|
# BOOST_ALL_NO_LIB to turn it off.
|
||||||
|
@@ -100,6 +100,12 @@ find_package(Boost 1.41.0 REQUIRED COMPONENTS
|
||||||
|
thread
|
||||||
|
unit_test_framework
|
||||||
|
)
|
||||||
|
+set(Boost_LIBRARIES
|
||||||
|
+ Boost::program_options
|
||||||
|
+ Boost::system
|
||||||
|
+ Boost::thread
|
||||||
|
+ Boost::unit_test_framework
|
||||||
|
+)
|
||||||
|
|
||||||
|
# Define where include files live
|
||||||
|
include_directories(${Boost_INCLUDE_DIRS})
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
if(VCPKG_TARGET_IS_WINDOWS)
|
||||||
|
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||||
|
endif()
|
||||||
|
|
||||||
vcpkg_from_github(
|
vcpkg_from_github(
|
||||||
OUT_SOURCE_PATH SOURCE_PATH
|
OUT_SOURCE_PATH SOURCE_PATH
|
||||||
@ -7,11 +9,14 @@ vcpkg_from_github(
|
|||||||
SHA512 04b645d09e60b65cb1e5065a1623ad01737f0dd9415cf620288ace0db10b1c424d72f304b34c52fa08684f3fecdaad9db91088134f34ed374cb1eb9d58c635b5
|
SHA512 04b645d09e60b65cb1e5065a1623ad01737f0dd9415cf620288ace0db10b1c424d72f304b34c52fa08684f3fecdaad9db91088134f34ed374cb1eb9d58c635b5
|
||||||
HEAD_REF master
|
HEAD_REF master
|
||||||
PATCHES
|
PATCHES
|
||||||
|
devendor.patch
|
||||||
|
cmake-config.patch
|
||||||
fix-boost.patch
|
fix-boost.patch
|
||||||
fix-boost-imported-targets.patch
|
|
||||||
)
|
)
|
||||||
|
file(REMOVE_RECURSE
|
||||||
file(REMOVE "${SOURCE_PATH}/cmake/modules/FindEigen3.cmake")
|
"${SOURCE_PATH}/cmake/modules/FindEigen3.cmake"
|
||||||
|
"${SOURCE_PATH}/util/double-conversion"
|
||||||
|
)
|
||||||
|
|
||||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||||
FEATURES
|
FEATURES
|
||||||
@ -22,19 +27,20 @@ vcpkg_cmake_configure(
|
|||||||
SOURCE_PATH "${SOURCE_PATH}"
|
SOURCE_PATH "${SOURCE_PATH}"
|
||||||
OPTIONS
|
OPTIONS
|
||||||
${FEATURE_OPTIONS}
|
${FEATURE_OPTIONS}
|
||||||
-DFORCE_STATIC=OFF #already handled by vcpkg
|
-DCMAKE_CXX_STANDARD=11 # 17 removes std::binary_function
|
||||||
|
-DFORCE_STATIC=OFF # handled by vcpkg
|
||||||
-DENABLE_PYTHON=OFF # kenlm.lib(bhiksha.cc.obj) : fatal error LNK1000: Internal error during IMAGE::Pass2
|
-DENABLE_PYTHON=OFF # kenlm.lib(bhiksha.cc.obj) : fatal error LNK1000: Internal error during IMAGE::Pass2
|
||||||
-DCOMPILE_TESTS=OFF
|
-DCOMPILE_TESTS=OFF
|
||||||
)
|
)
|
||||||
vcpkg_cmake_install()
|
vcpkg_cmake_install()
|
||||||
vcpkg_cmake_config_fixup(CONFIG_PATH share/${PORT}/cmake)
|
vcpkg_cmake_config_fixup(CONFIG_PATH share/kenlm/cmake)
|
||||||
|
|
||||||
set(KENLM_TOOLS count_ngrams filter fragment kenlm_benchmark lmplz phrase_table_vocab query build_binary)
|
set(KENLM_TOOLS count_ngrams filter fragment kenlm_benchmark lmplz phrase_table_vocab query build_binary)
|
||||||
if (NOT VCPKG_TARGET_IS_WINDOWS)
|
if (NOT VCPKG_TARGET_IS_WINDOWS)
|
||||||
list(APPEND KENLM_TOOLS probing_hash_table_benchmark)
|
list(APPEND KENLM_TOOLS probing_hash_table_benchmark)
|
||||||
if ("interpolate" IN_LIST FEATURES)
|
endif()
|
||||||
list(APPEND KENLM_TOOLS interpolate)
|
if ("interpolate" IN_LIST FEATURES)
|
||||||
endif()
|
list(APPEND KENLM_TOOLS interpolate)
|
||||||
endif()
|
endif()
|
||||||
vcpkg_copy_tools(TOOL_NAMES ${KENLM_TOOLS} AUTO_CLEAN)
|
vcpkg_copy_tools(TOOL_NAMES ${KENLM_TOOLS} AUTO_CLEAN)
|
||||||
|
|
||||||
@ -43,5 +49,4 @@ vcpkg_copy_pdbs()
|
|||||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
||||||
|
|
||||||
# Copyright and License
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE" "${SOURCE_PATH}/COPYING" "${SOURCE_PATH}/LICENSE")
|
||||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING" "${SOURCE_PATH}/LICENSE")
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "kenlm",
|
"name": "kenlm",
|
||||||
"version": "20230531",
|
"version": "20230531",
|
||||||
|
"port-version": 1,
|
||||||
"description": "KenLM: Faster and Smaller Language Model Queries",
|
"description": "KenLM: Faster and Smaller Language Model Queries",
|
||||||
"license": "LGPL-2.1",
|
"license": null,
|
||||||
"supports": "!(arm64 & windows)",
|
"supports": "!(arm64 & windows)",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"boost-interprocess",
|
"boost-interprocess",
|
||||||
@ -12,6 +13,7 @@
|
|||||||
"boost-test",
|
"boost-test",
|
||||||
"boost-thread",
|
"boost-thread",
|
||||||
"bzip2",
|
"bzip2",
|
||||||
|
"double-conversion",
|
||||||
"liblzma",
|
"liblzma",
|
||||||
{
|
{
|
||||||
"name": "vcpkg-cmake",
|
"name": "vcpkg-cmake",
|
||||||
@ -28,10 +30,7 @@
|
|||||||
"description": "Build interpolation program",
|
"description": "Build interpolation program",
|
||||||
"supports": "!windows",
|
"supports": "!windows",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
{
|
"eigen3"
|
||||||
"name": "eigen3",
|
|
||||||
"platform": "!windows"
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3754,7 +3754,7 @@
|
|||||||
},
|
},
|
||||||
"kenlm": {
|
"kenlm": {
|
||||||
"baseline": "20230531",
|
"baseline": "20230531",
|
||||||
"port-version": 0
|
"port-version": 1
|
||||||
},
|
},
|
||||||
"kerbal": {
|
"kerbal": {
|
||||||
"baseline": "2023.12.1",
|
"baseline": "2023.12.1",
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
{
|
{
|
||||||
"versions": [
|
"versions": [
|
||||||
|
{
|
||||||
|
"git-tree": "3473d89b5d9e5bfc847a3b3575a5843b729b71ee",
|
||||||
|
"version": "20230531",
|
||||||
|
"port-version": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"git-tree": "bb9e0ae36b74ecd5bfb6a8855e761138eeda9185",
|
"git-tree": "bb9e0ae36b74ecd5bfb6a8855e761138eeda9185",
|
||||||
"version": "20230531",
|
"version": "20230531",
|
||||||
|
Loading…
Reference in New Issue
Block a user