mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 18:31:15 +08:00
[antlr4] Update antlr4 to v4.11.1 (#27720)
* Update antlr4 to version 4.11.1 and use GitHub instead of website downloads * Remove unused patch files * Run x-add-version * Remove single-use variable and enforce vcpkg version * x-add-version * Use VERSION variable which is generated by vcpkg from vcpkg.json * Add quotes, remove variable-used-once. * Minimize patch. * Update version database. Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
This commit is contained in:
parent
d51b969a7d
commit
2ef381ddf7
@ -1,50 +0,0 @@
|
||||
diff --git a/runtime/src/misc/MurmurHash.cpp b/runtime/src/misc/MurmurHash.cpp
|
||||
index 73562cd..57aa3bf 100644
|
||||
--- a/runtime/src/misc/MurmurHash.cpp
|
||||
+++ b/runtime/src/misc/MurmurHash.cpp
|
||||
@@ -63,23 +63,6 @@ size_t MurmurHash::update(size_t hash, size_t value) {
|
||||
return hash;
|
||||
}
|
||||
|
||||
-size_t MurmurHash::update(size_t hash, const void *data, size_t size) {
|
||||
- size_t value;
|
||||
- const uint8_t *bytes = static_cast<const uint8_t*>(data);
|
||||
- while (size >= sizeof(size_t)) {
|
||||
- std::memcpy(&value, bytes, sizeof(size_t));
|
||||
- hash = update(hash, value);
|
||||
- bytes += sizeof(size_t);
|
||||
- size -= sizeof(size_t);
|
||||
- }
|
||||
- if (size != 0) {
|
||||
- value = 0;
|
||||
- std::memcpy(&value, bytes, size);
|
||||
- hash = update(hash, value);
|
||||
- }
|
||||
- return hash;
|
||||
-}
|
||||
-
|
||||
size_t MurmurHash::finish(size_t hash, size_t entryCount) {
|
||||
hash ^= entryCount * 8;
|
||||
hash ^= hash >> 33;
|
||||
@@ -118,3 +101,20 @@ size_t MurmurHash::finish(size_t hash, size_t entryCount) {
|
||||
#else
|
||||
#error "Expected sizeof(size_t) to be 4 or 8."
|
||||
#endif
|
||||
+
|
||||
+size_t MurmurHash::update(size_t hash, const void *data, size_t size) {
|
||||
+ size_t value;
|
||||
+ const uint8_t *bytes = static_cast<const uint8_t*>(data);
|
||||
+ while (size >= sizeof(size_t)) {
|
||||
+ std::memcpy(&value, bytes, sizeof(size_t));
|
||||
+ hash = update(hash, value);
|
||||
+ bytes += sizeof(size_t);
|
||||
+ size -= sizeof(size_t);
|
||||
+ }
|
||||
+ if (size != 0) {
|
||||
+ value = 0;
|
||||
+ std::memcpy(&value, bytes, size);
|
||||
+ hash = update(hash, value);
|
||||
+ }
|
||||
+ return hash;
|
||||
+}
|
||||
\ No newline at end of file
|
@ -1,8 +1,8 @@
|
||||
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
|
||||
index baf46ca..80fa49a 100644
|
||||
--- a/runtime/CMakeLists.txt
|
||||
+++ b/runtime/CMakeLists.txt
|
||||
@@ -23,10 +23,13 @@ file(GLOB libantlrcpp_SRC
|
||||
diff --git a/runtime/Cpp/runtime/CMakeLists.txt b/runtime/Cpp/runtime/CMakeLists.txt
|
||||
index a4e4d1c..19cc21c 100644
|
||||
--- a/runtime/Cpp/runtime/CMakeLists.txt
|
||||
+++ b/runtime/Cpp/runtime/CMakeLists.txt
|
||||
@@ -25,15 +25,21 @@ file(GLOB libantlrcpp_SRC
|
||||
"${PROJECT_SOURCE_DIR}/runtime/src/tree/xpath/*.cpp"
|
||||
)
|
||||
|
||||
@ -12,33 +12,22 @@ index baf46ca..80fa49a 100644
|
||||
add_library(antlr4_static STATIC ${libantlrcpp_SRC})
|
||||
+endif()
|
||||
|
||||
-set(LIB_OUTPUT_DIR "${CMAKE_HOME_DIRECTORY}/dist") # put generated libraries here.
|
||||
+#set(LIB_OUTPUT_DIR "${CMAKE_HOME_DIRECTORY}/dist") # put generated libraries here.
|
||||
message(STATUS "Output libraries to ${LIB_OUTPUT_DIR}")
|
||||
|
||||
# make sure 'make' works fine even if ${LIB_OUTPUT_DIR} is deleted.
|
||||
@@ -34,8 +37,11 @@ add_custom_target(make_lib_output_dir ALL
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIB_OUTPUT_DIR}
|
||||
)
|
||||
|
||||
# Make sure to link against threads (pthreads) library in order to be able to
|
||||
# make use of std::call_once in the code without producing runtime errors
|
||||
# (see also https://github.com/antlr/antlr4/issues/3708 and/or https://stackoverflow.com/q/51584960).
|
||||
find_package(Threads REQUIRED)
|
||||
+if(BUILD_SHARED_LIBS)
|
||||
add_dependencies(antlr4_shared make_lib_output_dir)
|
||||
target_link_libraries(antlr4_shared Threads::Threads)
|
||||
+else()
|
||||
add_dependencies(antlr4_static make_lib_output_dir)
|
||||
target_link_libraries(antlr4_static Threads::Threads)
|
||||
+endif()
|
||||
|
||||
if (ANTLR_BUILD_CPP_TESTS)
|
||||
include(FetchContent)
|
||||
@@ -70,11 +76,17 @@ if (ANTLR_BUILD_CPP_TESTS)
|
||||
@@ -70,8 +76,11 @@ if (ANTLR_BUILD_CPP_TESTS)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
+ if(BUILD_SHARED_LIBS)
|
||||
target_link_libraries(antlr4_shared ${UUID_LIBRARIES})
|
||||
+ else()
|
||||
target_link_libraries(antlr4_static ${UUID_LIBRARIES})
|
||||
+ endif()
|
||||
elseif(APPLE)
|
||||
if(APPLE)
|
||||
+ if(BUILD_SHARED_LIBS)
|
||||
target_link_libraries(antlr4_shared ${COREFOUNDATION_LIBRARY})
|
||||
+ else()
|
||||
@ -47,51 +36,58 @@ index baf46ca..80fa49a 100644
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
@@ -96,7 +108,7 @@ if(WIN32)
|
||||
set(extra_share_compile_flags "-DANTLR4CPP_EXPORTS")
|
||||
set(extra_static_compile_flags "-DANTLR4CPP_STATIC")
|
||||
endif(WIN32)
|
||||
-if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
+if(0)
|
||||
if(WITH_STATIC_CRT)
|
||||
target_compile_options(antlr4_shared PRIVATE "/MT$<$<CONFIG:Debug>:d>")
|
||||
target_compile_options(antlr4_static PRIVATE "/MT$<$<CONFIG:Debug>:d>")
|
||||
@@ -116,6 +128,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
set(extra_static_compile_flags "-DANTLR4CPP_STATIC -MP")
|
||||
@@ -93,26 +102,32 @@ set(static_lib_suffix "")
|
||||
|
||||
if (WIN32)
|
||||
set(static_lib_suffix "-static")
|
||||
+ if(BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(antlr4_shared PUBLIC ANTLR4CPP_EXPORTS)
|
||||
+ else()
|
||||
target_compile_definitions(antlr4_static PUBLIC ANTLR4CPP_STATIC)
|
||||
+ endif()
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
set(extra_share_compile_flags "-MP /wd4251")
|
||||
set(extra_static_compile_flags "-MP")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
+if(BUILD_SHARED_LIBS)
|
||||
set_target_properties(antlr4_shared
|
||||
PROPERTIES VERSION ${ANTLR_VERSION}
|
||||
SOVERSION ${ANTLR_VERSION}
|
||||
@@ -126,25 +139,27 @@ set_target_properties(antlr4_shared
|
||||
RUNTIME_OUTPUT_DIRECTORY ${LIB_OUTPUT_DIR}
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${LIB_OUTPUT_DIR}
|
||||
OUTPUT_NAME antlr4-runtime
|
||||
COMPILE_FLAGS "${disabled_compile_warnings} ${extra_share_compile_flags}")
|
||||
-
|
||||
|
||||
+else()
|
||||
set_target_properties(antlr4_static
|
||||
PROPERTIES VERSION ${ANTLR_VERSION}
|
||||
SOVERSION ${ANTLR_VERSION}
|
||||
OUTPUT_NAME "antlr4-runtime${static_lib_suffix}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${LIB_OUTPUT_DIR}
|
||||
COMPILE_PDB_NAME "antlr4-runtime${static_lib_suffix}"
|
||||
COMPILE_FLAGS "${disabled_compile_warnings} ${extra_static_compile_flags}")
|
||||
-
|
||||
+endif()
|
||||
|
||||
if (ANTLR_BUILD_CPP_TESTS)
|
||||
# Copy the generated binaries to dist folder (required by test suite)
|
||||
@@ -130,18 +145,21 @@ if (ANTLR_BUILD_CPP_TESTS)
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:antlr4_static> ${CMAKE_HOME_DIRECTORY}/dist)
|
||||
endif()
|
||||
|
||||
+if(BUILD_SHARED_LIBS)
|
||||
install(TARGETS antlr4_shared
|
||||
EXPORT antlr4-targets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
-
|
||||
|
||||
+else()
|
||||
install(TARGETS antlr4_static
|
||||
EXPORT antlr4-targets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
+endif()
|
||||
|
||||
+endif()
|
||||
install(DIRECTORY "${PROJECT_SOURCE_DIR}/runtime/src/"
|
||||
DESTINATION "include/antlr4-runtime"
|
||||
COMPONENT dev
|
@ -1,36 +1,28 @@
|
||||
set(VERSION 4.10.1)
|
||||
vcpkg_minimum_required(VERSION 2022-10-12)
|
||||
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "https://www.antlr.org/download/antlr4-cpp-runtime-${VERSION}-source.zip"
|
||||
FILENAME "antlr4-cpp-runtime-${VERSION}-source.zip"
|
||||
SHA512 f4926987946d17bf51b2d8a31ac06cf16eea7fb49ce535abb2d4759c9e6113d173c4504ffe4c8d2f9a58d845507dfdedaaba3dde70cc09c03c6bd6a2afe892a6
|
||||
)
|
||||
|
||||
# license not exist in antlr folder.
|
||||
vcpkg_download_distfile(LICENSE
|
||||
URLS https://raw.githubusercontent.com/antlr/antlr4/${VERSION}/LICENSE.txt
|
||||
FILENAME "antlr4-copyright-${VERSION}"
|
||||
SHA512 1e8414de5fdc211e3188a8ec3276c6b3c55235f5edaf48522045ae18fa79fd9049719cb8924d25145016f223ac9a178defada1eeb983ccff598a08b0c0f67a3b
|
||||
)
|
||||
|
||||
vcpkg_extract_source_archive_ex(
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
ARCHIVE ${ARCHIVE}
|
||||
NO_REMOVE_ONE_LEVEL
|
||||
REF ${VERSION}
|
||||
REPO antlr/antlr4
|
||||
HEAD_REF master
|
||||
REF "v${VERSION}"
|
||||
SHA512 a52356410c95ec6d7128b856dcf4c20a17cdd041270d2c4d700ef02ea715c87a00a87c2ad560277424b300435c6e9b196c8bc9c9f50ae5b6804d8214b4d397d0
|
||||
PATCHES
|
||||
fixed_build.patch
|
||||
uuid_discovery_fix.patch
|
||||
fix_LNK2001.patch #The related upstream issue https://github.com/antlr/antlr4/issues/3674
|
||||
fix_build_4.11.1.patch
|
||||
)
|
||||
|
||||
set(RUNTIME_PATH "${SOURCE_PATH}/runtime/Cpp")
|
||||
|
||||
message(INFO "Configure at '${RUNTIME_PATH}'")
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
SOURCE_PATH "${RUNTIME_PATH}"
|
||||
OPTIONS
|
||||
-DANTLR4_INSTALL=ON
|
||||
-DANTLR_BUILD_CPP_TESTS=OFF
|
||||
OPTIONS_DEBUG -DLIB_OUTPUT_DIR=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/dist
|
||||
OPTIONS_RELEASE -DLIB_OUTPUT_DIR=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/dist
|
||||
OPTIONS_DEBUG
|
||||
"-DLIB_OUTPUT_DIR=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/dist"
|
||||
OPTIONS_RELEASE
|
||||
"-DLIB_OUTPUT_DIR=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/dist"
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
@ -41,4 +33,4 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(INSTALL "${LICENSE}" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
|
@ -1,16 +0,0 @@
|
||||
diff -urN a/CMakeLists.txt b/CMakeLists.txt
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -42,8 +42,10 @@ if(CMAKE_VERSION VERSION_EQUAL "3.3.0" OR
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
- find_package(PkgConfig REQUIRED)
|
||||
- pkg_check_modules(UUID REQUIRED uuid)
|
||||
+ find_path(UUID_INCLUDE_DIR uuid/uuid.h)
|
||||
+ find_library(UUID_LIBRARY NAMES uuid)
|
||||
+ include_directories(${UUID_INCLUDE_DIR})
|
||||
+ link_libraries(${UUID_LIBRARY})
|
||||
endif()
|
||||
if(APPLE)
|
||||
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "antlr4",
|
||||
"version": "4.10.1",
|
||||
"version": "4.11.1",
|
||||
"description": "ANother Tool for Language Recognition",
|
||||
"homepage": "https://www.antlr.org",
|
||||
"license": "BSD-3-Clause",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "adff4448fb67cdc7d7a478d5f5f3e973ad65a386",
|
||||
"version": "4.11.1",
|
||||
"port-version": 0
|
||||
},
|
||||
{
|
||||
"git-tree": "77ce1d5e7b1ea96943b3917086e1b75d50ae903c",
|
||||
"version": "4.10.1",
|
||||
|
@ -105,7 +105,7 @@
|
||||
"port-version": 6
|
||||
},
|
||||
"antlr4": {
|
||||
"baseline": "4.10.1",
|
||||
"baseline": "4.11.1",
|
||||
"port-version": 0
|
||||
},
|
||||
"any-lite": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user