Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-33490 Add vcpkg support for antlr3 dependency #19554

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "esp/src/dgrid"]
path = esp/src/dgrid
url = https://github.com/hpcc-systems/dgrid.git
[submodule "esp/services/ws_sql/libantlr3c"]
path = esp/services/ws_sql/libantlr3c
url = https://github.com/hpcc-systems/libantlr3c.git
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/hpcc-systems/vcpkg.git
18 changes: 12 additions & 6 deletions cmake_modules/FindANTLR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,24 @@
# ANTLR_FOUND - ANTLR found in local system
# ANTLR_BUILDTIME_JAR - The jar needed to build/generate ANTLR Lexers and Parsers
# ANTLR_RUNTIME_JAR - The jar needed to build/generate ANTLR Lexers and Parsers
# ANTLR_LIB - The runtime library needed by the generated ANTLR Lexers and Parsers
################################################################################

include(UseJava)

set(ANTLR_BUILDTIME_DEP "antlr-3.4-complete" CACHE STRING "ANTLR buildtime jar file name.")
set(ANTLR_RUNTIME_DEP "antlr-runtime-3.4" CACHE STRING "ANTLR runtime jar file name.")
set(ANTLR_PATH "${HPCC_SOURCE_DIR}/esp/services/ws_sql/libantlr3c" CACHE PATH "Location of ANTLR jar files.")
set(ANTLR_PKG_FIND_ERROR_MSG "Could not locate jars.\nPlease run `git submodule update --init --recursive`\n")
set(ANTLR_PKG_FIND_ERROR_MSG "Could not locate jars.\nPlease check vcpkg configure completed without issue.\n")

find_library(ANTLR_LIB NAMES antlr3c
PATHS ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}
)

find_jar(ANTLR_BUILDTIME_JAR ${ANTLR_BUILDTIME_DEP} PATHS ${ANTLR_PATH})
find_jar(ANTLR_RUNTIME_JAR ${ANTLR_RUNTIME_DEP} PATHS ${ANTLR_PATH})
find_file(ANTLR_BUILDTIME_JAR "share/antlr3/antlr-3.4-complete.jar"
PATHS ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}
)

find_file(ANTLR_RUNTIME_JAR "share/antlr3/antlr-runtime-3.4.jar"
PATHS ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
Expand Down
5 changes: 5 additions & 0 deletions cmake_modules/plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ if (USE_PARQUET)
endif()

# vcpkg.json options ---
set(VCPKG_ANTLR3 "${VCPKG_SUPPRESS}")
if (WSSQL_SERVICE)
set(VCPKG_ANTLR3 "${VCPKG_INCLUDE}")
endif()

set(VCPKG_APR "${VCPKG_SUPPRESS}")
if (USE_APR)
set(VCPKG_APR "${VCPKG_INCLUDE}")
Expand Down
10 changes: 4 additions & 6 deletions esp/services/ws_sql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ if(WSSQL_SERVICE)
include(${HPCC_SOURCE_DIR}/esp/scm/smcscm.cmake)
include(${HPCC_SOURCE_DIR}/esp/scm/espscm.cmake)

include(antlr3c.cmake)

antlr_target(sql2ecl
GRAMMAR_PREFIX HPCCSQL
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}"
GRAMMAR_FILES "${CMAKE_CURRENT_SOURCE_DIR}/SQL2ECL/ANTLR3c/HPCCSQL.g"
)
)

set(SRCS
${CMAKE_CURRENT_SOURCE_DIR}/ws_sqlPlugin.cpp
Expand Down Expand Up @@ -95,7 +93,6 @@ if(WSSQL_SERVICE)
${HPCC_SOURCE_DIR}/common/dllserver
${HPCC_SOURCE_DIR}/common/deftype
${HPCC_SOURCE_DIR}/ecl/hql
${libantlr3c_includes}
${ESPSCM_GENERATED_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/SQL2ECL
${HPCC_SOURCE_DIR}/common/thorhelper
Expand All @@ -120,7 +117,7 @@ if(WSSQL_SERVICE)
xmllib
esphttp
dalibase
libantlr3c
${ANTLR_LIB}
wuwebview
${COMMON_ESP_SERVICE_LIBS}
)
Expand All @@ -137,5 +134,6 @@ ENDIF()
RUNTIME DESTINATION ${EXEC_DIR}
LIBRARY DESTINATION ${LIB_DIR}
COMPONENT Runtime
)
CALC_DEPS
)
endif()
68 changes: 0 additions & 68 deletions esp/services/ws_sql/antlr3c.cmake

This file was deleted.

1 change: 0 additions & 1 deletion esp/services/ws_sql/libantlr3c
Submodule libantlr3c deleted from bfd2e5
4 changes: 4 additions & 0 deletions vcpkg.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"name": "hpcc-platform",
"version": "9.10.0",
"dependencies": [
{
"name": "antlr3",
"platform": "@VCPKG_ANTLR3@"
},
{
"name": "apr",
"platform": "@VCPKG_APR@"
Expand Down
35 changes: 35 additions & 0 deletions vcpkg_overlays/antlr3/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
vcpkg_download_distfile(LIB_C
URLS "https://github.com/antlr/website-antlr3/raw/refs/heads/gh-pages/download/C/libantlr3c-${VERSION}.tar.gz"
FILENAME "libantlr3c-${VERSION}.tar.gz"
SHA512 8edb243d745ff5bf3b15940f124d1255a9ca965cb656a73a558aed7fa07effcd7620f23dc692e5d5169a03200254836dd57af3ce444ba225281a5b721497e211
)
vcpkg_extract_source_archive(SOURCE_PATH
ARCHIVE "${LIB_C}"
)
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
COPY_SOURCE
OPTIONS
--enable-64bit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

./configure will need prompting for certain architectures. linux-arm64 in particular needs to have this added as an option:

--build=aarch64-unknown-linux

I suspect macOS (arm64/aarch64) is in the same boat.

)
vcpkg_install_make()
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()

vcpkg_download_distfile(COMPLETE_JAR
URLS "https://github.com/antlr/website-antlr3/raw/refs/heads/gh-pages/download/antlr-${VERSION}-complete.jar"
FILENAME "antlr-${VERSION}-complete.jar"
SHA512 04be4dfba3a21f3ab9d9e439a64958bd8e844a9f151b798383bd9e0dd6ebc416783ae7cb1d1dbb27fb7288ab9756b13b8338cdb8ceb41a10949c852ad45ab1f2
)
vcpkg_download_distfile(RUNTIME_JAR
URLS "https://github.com/antlr/website-antlr3/raw/refs/heads/gh-pages/download/antlr-runtime-${VERSION}.jar"
FILENAME "antlr-runtime-${VERSION}.jar"
SHA512 1786aff2df4664483adcb319e64be7b69b643ac9508c3f11796b5aa45b9072b46f53f0a21b2ff7291162afe81506de16161746273e4532ebad75adbd81203f0d
)
file(INSTALL
DESTINATION "${CURRENT_PACKAGES_DIR}/share/antlr3"
TYPE FILE
FILES ${COMPLETE_JAR} ${RUNTIME_JAR}
)

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
10 changes: 10 additions & 0 deletions vcpkg_overlays/antlr3/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "antlr3",
"version": "3.4",
"port-version": 0,
"description": "ANother Tool for Language Recognition",
"homepage": "https://www.antlr.org",
"license": "BSD-3-Clause",
"supports": "!uwp",
"dependencies": []
}
Loading