pineapple-src/externals/vcpkg/ports/antlr4/fixed_build.patch

116 lines
3.8 KiB
Diff
Raw Normal View History

2022-07-23 01:01:36 +00:00
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index c8b16c6..53b47dd 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -21,10 +21,13 @@ file(GLOB libantlrcpp_SRC
"${PROJECT_SOURCE_DIR}/runtime/src/tree/xpath/*.cpp"
)
+if(BUILD_SHARED_LIBS)
add_library(antlr4_shared SHARED ${libantlrcpp_SRC})
+else()
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.
@@ -32,16 +35,22 @@ add_custom_target(make_lib_output_dir ALL
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIB_OUTPUT_DIR}
)
+if(BUILD_SHARED_LIBS)
add_dependencies(antlr4_shared make_lib_output_dir)
+else()
add_dependencies(antlr4_static make_lib_output_dir)
+endif()
find_package(utf8cpp QUIET)
set(INSTALL_utf8cpp FALSE)
if (utf8cpp_FOUND)
+ if(BUILD_SHARED_LIBS)
target_link_libraries(antlr4_shared utf8cpp)
+ else()
target_link_libraries(antlr4_static utf8cpp)
+ endif()
else()
# older utf8cpp doesn't define the package above
@@ -51,7 +60,7 @@ else()
if (utf8cpp_HEADER)
include_directories(${utf8cpp_HEADER})
- else()
+ elseif(0)
include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
set(THIRDPARTY_DIR ${CMAKE_BINARY_DIR}/runtime/thirdparty)
set(UTFCPP_DIR ${THIRDPARTY_DIR}/utfcpp)
@@ -76,11 +85,17 @@ else()
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(BUILD_SHARED_LIBS)
target_link_libraries(antlr4_shared ${COREFOUNDATION_LIBRARY})
+ else()
target_link_libraries(antlr4_static ${COREFOUNDATION_LIBRARY})
+ endif()
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
@@ -102,7 +117,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>")
@@ -122,6 +137,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(extra_static_compile_flags "-DANTLR4CPP_STATIC -MP")
endif()
+if(BUILD_SHARED_LIBS)
set_target_properties(antlr4_shared
PROPERTIES VERSION ${ANTLR_VERSION}
SOVERSION ${ANTLR_VERSION}
@@ -132,20 +148,25 @@ set_target_properties(antlr4_shared
RUNTIME_OUTPUT_DIRECTORY ${LIB_OUTPUT_DIR}
ARCHIVE_OUTPUT_DIRECTORY ${LIB_OUTPUT_DIR}
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_FLAGS "${disabled_compile_warnings} ${extra_static_compile_flags}")
+endif()
-install(TARGETS antlr4_shared
+if(BUILD_SHARED_LIBS)
+install(TARGETS antlr4_shared EXPORT antlr4-targets
DESTINATION lib
- EXPORT antlr4-targets)
+ RUNTIME DESTINATION bin
+ )
+else()
install(TARGETS antlr4_static
DESTINATION lib
EXPORT antlr4-targets)
+endif()
install(DIRECTORY "${PROJECT_SOURCE_DIR}/runtime/src/"
DESTINATION "include/antlr4-runtime"