aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-03-21 20:53:26 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-03-21 20:53:26 -0700
commit5f3597927266a0b40172ba73c583fb0da5d3404e (patch)
treea0164517d8ff582225032ba17b8790027b818ed3
parent162a46bac9f7691782f0e6fd60f4268ba9f3e6fb (diff)
downloadvcpkg-5f3597927266a0b40172ba73c583fb0da5d3404e.tar.gz
vcpkg-5f3597927266a0b40172ba73c583fb0da5d3404e.zip
[antlr4] Fix building with Visual Studio 2017. Resolves #804
-rw-r--r--ports/antlr4/CONTROL2
-rw-r--r--ports/antlr4/Fix-building-in-Visual-Studio-2017.patch52
-rw-r--r--ports/antlr4/portfile.cmake7
3 files changed, 58 insertions, 3 deletions
diff --git a/ports/antlr4/CONTROL b/ports/antlr4/CONTROL
index dbcf5219c..03877e495 100644
--- a/ports/antlr4/CONTROL
+++ b/ports/antlr4/CONTROL
@@ -1,3 +1,3 @@
Source: antlr4
-Version: 4.6
+Version: 4.6-1
Description: ANother Tool for Language Recognition \ No newline at end of file
diff --git a/ports/antlr4/Fix-building-in-Visual-Studio-2017.patch b/ports/antlr4/Fix-building-in-Visual-Studio-2017.patch
new file mode 100644
index 000000000..64e483599
--- /dev/null
+++ b/ports/antlr4/Fix-building-in-Visual-Studio-2017.patch
@@ -0,0 +1,52 @@
+diff --git a/runtime/src/ANTLRInputStream.h b/runtime/src/ANTLRInputStream.h
+index 3d85bed..813451c 100644
+--- a/runtime/src/ANTLRInputStream.h
++++ b/runtime/src/ANTLRInputStream.h
+@@ -16,7 +16,7 @@ namespace antlr4 {
+ protected:
+ /// The data being scanned.
+ // UTF-32
+-#if defined(_MSC_VER) && _MSC_VER == 1900
++#if defined(_MSC_VER) && _MSC_VER >= 1900
+ i32string _data; // Custom type for VS 2015.
+ #else
+ std::u32string _data;
+diff --git a/runtime/src/UnbufferedCharStream.h b/runtime/src/UnbufferedCharStream.h
+index b489f18..295804c 100644
+--- a/runtime/src/UnbufferedCharStream.h
++++ b/runtime/src/UnbufferedCharStream.h
+@@ -52,7 +52,7 @@ namespace antlr4 {
+ /// we keep adding to buffer. Otherwise, <seealso cref="#consume consume()"/> resets so
+ /// we start filling at index 0 again.
+ // UTF-32 encoded.
+-#if defined(_MSC_VER) && _MSC_VER == 1900
++#if defined(_MSC_VER) && _MSC_VER >= 1900
+ i32string _data; // Custom type for VS 2015.
+ #else
+ std::u32string _data;
+diff --git a/runtime/src/antlr4-common.h b/runtime/src/antlr4-common.h
+index 197fd6d..8357b3e 100644
+--- a/runtime/src/antlr4-common.h
++++ b/runtime/src/antlr4-common.h
+@@ -52,7 +52,7 @@
+ typedef __int32 ssize_t;
+ #endif
+
+- #if _MSC_VER == 1900
++ #if _MSC_VER >= 1900
+ // VS 2015 has a known bug when using std::codecvt_utf8<char32_t>
+ // so we have to temporarily use __int32 instead.
+ // https://connect.microsoft.com/VisualStudio/feedback/details/1403302/unresolved-external-when-using-codecvt-utf8
+diff --git a/runtime/src/support/StringUtils.h b/runtime/src/support/StringUtils.h
+index cb751a7..be14bbb 100644
+--- a/runtime/src/support/StringUtils.h
++++ b/runtime/src/support/StringUtils.h
+@@ -10,7 +10,7 @@
+ namespace antlrcpp {
+ // For all conversions utf8 <-> utf32.
+ // VS 2015 has a bug in std::codecvt_utf8<char32_t> (VS 2013 works fine).
+-#if defined(_MSC_VER) && _MSC_VER == 1900
++#if defined(_MSC_VER) && _MSC_VER >= 1900
+ static std::wstring_convert<std::codecvt_utf8<__int32>, __int32> utfConverter;
+ #else
+ static std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> utfConverter;
diff --git a/ports/antlr4/portfile.cmake b/ports/antlr4/portfile.cmake
index d10513064..78266b6eb 100644
--- a/ports/antlr4/portfile.cmake
+++ b/ports/antlr4/portfile.cmake
@@ -1,15 +1,17 @@
include(vcpkg_common_functions)
+
+set(VERSION 4.6)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/runtime)
vcpkg_download_distfile(ARCHIVE
URLS "http://www.antlr.org/download/antlr4-cpp-runtime-4.6-source.zip"
- FILENAME "antlr4-cpp-runtime-4.6-source.zip"
+ FILENAME "antlr4-cpp-runtime-${VERSION}-source.zip"
SHA512 e123c2227e41ce80da5a3758725a018690ed70a4e10c23da26c966259e6bdafa192f4363f5a7e1181ef9a47bf3cc50d6b0ca7b26c8dd2b19222a7edf54de8de2
)
# license not exist in antlr folder.
vcpkg_download_distfile(LICENSE
- URLS https://raw.githubusercontent.com/antlr/antlr4/4.6/LICENSE.txt
+ URLS https://raw.githubusercontent.com/antlr/antlr4/${VERSION}/LICENSE.txt
FILENAME "antlr4-copyright"
SHA512 c72ae3d5c9f3f07160405b5ca44f01116a9602d82291d6cd218fcc5ec6e8baf985e4baa2acf3d621079585385708bd171c96ef44dd808e60c40a48bc1f56c9ae
)
@@ -19,6 +21,7 @@ vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches(
SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src
PATCHES ${CMAKE_CURRENT_LIST_DIR}/crt_mt.patch
+ ${CMAKE_CURRENT_LIST_DIR}/Fix-building-in-Visual-Studio-2017.patch
)
if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static)