depot/third_party/nixpkgs/pkgs/development/python-modules/afdko/use-dynamic-system-antlr4-runtime.patch
Default email a6d62be0d1 Project import generated by Copybara.
GitOrigin-RevId: ac169ec6371f0d835542db654a65e0f2feb07838
2021-12-26 18:43:05 +01:00

43 lines
1.8 KiB
Diff

commit 105daa26f09034af58eb13ac7c5c4ff5420c1724
Author: sternenseemann <sternenseemann@systemli.org>
Date: Tue Oct 5 18:16:10 2021 +0200
Link against system antlr4 runtime, dynamically
Instead of cloning a antlr4 version from git, use the system one. Also
don't link it statically, but dynamically by default (the library is
called antlr4-runtime, not antlr4_static).
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d7f86fb6..c43c4456 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,13 +36,13 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# https://www.antlr.org/download/antlr4-cpp-runtime-4.9.2-source.zip
# set(ANTLR4_ZIP_REPOSITORY "/path_to_antlr4_archive/a4.zip")
-add_definitions(-DANTLR4CPP_STATIC)
set(ANTLR4_WITH_STATIC_CRT OFF)
# Use slightly more recent commit than 4.9.2 to deal with utfcpp test
# compilation problems
# set(ANTLR4_TAG tags/4.9.2)
set(ANTLR4_TAG 916f03366edf15bf8b50010b11d479c189bf9f96)
-include(ExternalAntlr4Cpp)
+find_path(ANTLR4_HEADER antlr4-runtime.h PATH_SUFFIXES antlr4-runtime)
+set(ANTLR4_INCLUDE_DIRS ${ANTLR4_HEADER})
# sanitizer support
# work around https://github.com/pypa/setuptools/issues/1928 with environment
diff --git a/c/makeotf/lib/hotconv/CMakeLists.txt b/c/makeotf/lib/hotconv/CMakeLists.txt
index 82257bf2..02eb2e30 100644
--- a/c/makeotf/lib/hotconv/CMakeLists.txt
+++ b/c/makeotf/lib/hotconv/CMakeLists.txt
@@ -69,7 +69,7 @@ add_library(hotconv STATIC
set_property(TARGET hotconv PROPERTY C_STANDARD 99)
target_include_directories(hotconv PRIVATE AFTER $<$<COMPILE_LANGUAGE:CXX>:${ANTLR4_INCLUDE_DIRS}>)
-target_link_libraries(hotconv PUBLIC antlr4_static)
+target_link_libraries(hotconv PUBLIC antlr4-runtime)
if ( CMAKE_COMPILER_IS_GNUCC )
target_compile_options(hotconv PRIVATE -Wall -Wno-attributes)