[antlr4] initial commit

This commit is contained in:
flysha 2016-12-25 18:44:20 +08:00
parent 692a363701
commit 91f51a084f
4 changed files with 125 additions and 0 deletions

3
ports/antlr4/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: antlr4
Version: 4.6
Description: ANother Tool for Language Recognition

36
ports/antlr4/crt_mt.patch Normal file
View File

@ -0,0 +1,36 @@
diff --git a/runtime/antlr4cpp-vs2015.vcxproj b/runtime/antlr4cpp-vs2015.vcxproj
index 85fa3da..540f031 100644
--- a/runtime/antlr4cpp-vs2015.vcxproj
+++ b/runtime/antlr4cpp-vs2015.vcxproj
@@ -201,6 +201,7 @@
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -239,6 +240,7 @@
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -281,6 +283,7 @@
</ForcedIncludeFiles>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -325,6 +328,7 @@
</ForcedIncludeFiles>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@ -0,0 +1,74 @@
include(vcpkg_common_functions)
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"
SHA512 e123c2227e41ce80da5a3758725a018690ed70a4e10c23da26c966259e6bdafa192f4363f5a7e1181ef9a47bf3cc50d6b0ca7b26c8dd2b19222a7edf54de8de2
)
vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches(
SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src
PATCHES ${CMAKE_CURRENT_LIST_DIR}/crt_mt.patch
)
if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static)
set(DEBUG_CONFIG "Debug Static")
set(RELEASE_CONFIG "Release Static")
else()
set(DEBUG_CONFIG "Debug DLL")
set(RELEASE_CONFIG "Release DLL")
endif()
vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/antlr4cpp-vs2015.vcxproj
DEBUG_CONFIGURATION ${DEBUG_CONFIG}
RELEASE_CONFIGURATION ${RELEASE_CONFIG}
)
file (MAKE_DIRECTORY
${CURRENT_PACKAGES_DIR}/include)
FILE(COPY ${SOURCE_PATH}/src/
DESTINATION ${CURRENT_PACKAGES_DIR}/include
FILES_MATCHING PATTERN "*.h")
file (MAKE_DIRECTORY
${CURRENT_PACKAGES_DIR}/lib
${CURRENT_PACKAGES_DIR}/debug/lib)
file(COPY ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${DEBUG_CONFIG}/antlr4-runtime.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(COPY ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${RELEASE_CONFIG}/antlr4-runtime.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static)
vcpkg_apply_patches(
SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
PATCHES ${CMAKE_CURRENT_LIST_DIR}/static.patch
)
else()
file (MAKE_DIRECTORY
${CURRENT_PACKAGES_DIR}/bin
${CURRENT_PACKAGES_DIR}/debug/bin)
file(COPY
${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${DEBUG_CONFIG}/antlr4-runtime.dll
${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${DEBUG_CONFIG}/antlr4-runtime.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
file(COPY
${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${RELEASE_CONFIG}/antlr4-runtime.dll
${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${RELEASE_CONFIG}/antlr4-runtime.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
endif()
# license not exist in antlr folder.
vcpkg_download_distfile(LICENSE
URLS https://raw.githubusercontent.com/antlr/antlr4/master/LICENSE.txt
FILENAME "antlr4-copyright"
SHA512 c72ae3d5c9f3f07160405b5ca44f01116a9602d82291d6cd218fcc5ec6e8baf985e4baa2acf3d621079585385708bd171c96ef44dd808e60c40a48bc1f56c9ae
)
file(INSTALL ${LICENSE} DESTINATION ${CURRENT_PACKAGES_DIR}/share/antlr4 RENAME copyright)
message(STATUS "Installing done")

12
ports/antlr4/static.patch Normal file
View File

@ -0,0 +1,12 @@
diff --git a/antlr4-common.h b/antlr4-common.h
index 197fd6d..34a62c8 100644
--- a/antlr4-common.h
+++ b/antlr4-common.h
@@ -34,6 +34,7 @@
#include <bitset>
#include <condition_variable>
+#define ANTLR4CPP_STATIC
// Defines for the Guid class and other platform dependent stuff.
#ifdef _WIN32
#pragma warning (disable: 4250) // Class inherits by dominance.