Skip to content

Commit

Permalink
Make compilation of YACC parsers optional
Browse files Browse the repository at this point in the history
The compilation of YACC parsers is now optional, this is controlled
using the WITH_YACC_PARSER cmake variable.

Currently compilation is disabled.

Change-Id: I83618386a7a1416a4c0526a0f95f97113c3c0375
  • Loading branch information
Paweł Andruszkiewicz committed Sep 13, 2024
1 parent dce7339 commit 411c829
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 7 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,9 @@ MYSQL_CHECK_SSL()
SET(OPENSSL_VERSION_ID "${OPENSSL_VERSION_MAJOR}${OPENSSL_VERSION_MINOR}${OPENSSL_FIX_VERSION}")
ADD_DEFINITIONS(-DOPENSSL_VERSION_ID=${OPENSSL_VERSION_ID})

INCLUDE(bison)
if(WITH_YACC_PARSER)
INCLUDE(bison)
endif()

if(NOT BUILD_SOURCE_PACKAGE)
if(BUNDLED_ANTLR_DIR)
Expand Down
15 changes: 11 additions & 4 deletions mysqlshdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ ADD_SUBDIRECTORY(libs/oci)
ADD_SUBDIRECTORY(libs/azure)
ADD_SUBDIRECTORY(libs/ssh)
ADD_SUBDIRECTORY(libs/aws)
ADD_SUBDIRECTORY(libs/yparser)
ADD_SUBDIRECTORY(scripting)
ADD_SUBDIRECTORY(shellcore)

if(WITH_YACC_PARSER)
ADD_SUBDIRECTORY(libs/yparser)
endif()

#TODO: ADD_VERSION_INFO
#merge_libraries(mysqlshdk SHARED
Expand All @@ -58,7 +60,7 @@ ADD_SUBDIRECTORY(shellcore)
# scripting
# shellcore)

merge_convenience_libraries(mysqlshdk-static
set(mysqlshdk_LIBS
utils
db
shellssh
Expand All @@ -75,8 +77,13 @@ merge_convenience_libraries(mysqlshdk-static
azure
aws
tinyxml2
yparser
SKIP_INSTALL)
)

if(WITH_YACC_PARSER)
list(APPEND mysqlshdk_LIBS yparser)
endif()

merge_convenience_libraries(mysqlshdk-static ${mysqlshdk_LIBS} SKIP_INSTALL)

#target_link_libraries(mysqlshdk
# ${V8_LINK_LIST}
Expand Down
12 changes: 11 additions & 1 deletion packaging/debian/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ else()
list(APPEND DEB_BUILD_DEPS "libantlr4-runtime-dev (<<4.11)")
endif()

if(WITH_YACC_PARSER)
list(APPEND EXTRA_CMAKE_OPTS "-DWITH_YACC_PARSER=1")
endif()

string(REPLACE ";" " " EXTRA_CMAKE_OPTS "${EXTRA_CMAKE_OPTS}")
string(REPLACE ";" ", " DEB_BUILD_DEPS "${DEB_BUILD_DEPS}")
string(REPLACE ";" ", " DEB_DEPS "${DEB_DEPS}")
Expand Down Expand Up @@ -258,7 +262,6 @@ usr/share/mysqlsh/adminapi-metadata/* usr/share/mysqlsh/adminapi-metadata
usr/share/mysqlsh/upgrade_checker.msg
usr/lib/mysqlsh/plugins
usr/lib/mysqlsh/python-packages
usr/lib/mysqlsh/yparser
usr/share/man/man1/mysqlsh.1
")

Expand Down Expand Up @@ -308,3 +311,10 @@ file(APPEND "${DEST_DIR}/mysql-shell${PRODUCT_SUFFIX}.install"
usr/lib/mysqlsh/libantlr4-runtime*.so*
")
endif()

if (WITH_YACC_PARSER)
file(APPEND "${DEST_DIR}/mysql-shell${PRODUCT_SUFFIX}.install"
"
usr/lib/mysqlsh/yparser
")
endif()
5 changes: 5 additions & 0 deletions packaging/rpm/mysql-shell.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ cmake .. \
%endif
%if 0%{?bundled_antlr:1}
-DBUNDLED_ANTLR_DIR="%{bundled_antlr}" \
%endif
%if 0%{?with_yacc_parser:1}
-DWITH_YACC_PARSER=1 \
%endif
-DHAVE_PYTHON=1 \
-DLIBEXECDIR=`basename %{_libexecdir}`
Expand Down Expand Up @@ -302,7 +305,9 @@ rm -f %{buildroot}%{_datadir}/mysqlsh/{LICENSE,README}
%endif
%{_prefix}/lib/mysqlsh/plugins/*
%{_prefix}/lib/mysqlsh/python-packages/*
%if 0%{?with_yacc_parser:1}
%{_prefix}/lib/mysqlsh/yparser/*
%endif
%{_mandir}/man1/mysqlsh.1*

%changelog
Expand Down
5 changes: 4 additions & 1 deletion unittest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ if(WITH_TESTS)
"${PROJECT_SOURCE_DIR}/unittest/mysqlshdk/libs/innodbcluster/*.cc"
"${PROJECT_SOURCE_DIR}/unittest/mysqlshdk/libs/ssh/*.cc"
"${PROJECT_SOURCE_DIR}/unittest/mysqlshdk/libs/parser/mysql_parser_utils_t.cc"
"${PROJECT_SOURCE_DIR}/unittest/mysqlshdk/libs/yparser/parser_t.cc"
"${PROJECT_SOURCE_DIR}/unittest/mysqlshdk/scripting/*.cc"
"${CMAKE_SOURCE_DIR}/unittest/*_t.cc"
"${CMAKE_SOURCE_DIR}/unittest/test_utils/*.cc"
Expand Down Expand Up @@ -104,6 +103,10 @@ if(WITH_TESTS)
"${CMAKE_SOURCE_DIR}/unittest/shell_script_tester.cc"
)

if(WITH_YACC_PARSER)
list(APPEND mysqlsh_tests_SRC "${CMAKE_SOURCE_DIR}/unittest/mysqlshdk/libs/yparser/parser_t.cc")
endif()

if(NOT HAVE_PROTOBUF)
list(REMOVE_ITEM mysqlsh_tests_SRC "${CMAKE_SOURCE_DIR}/unittest/mod_mysqlx_t.cc")
endif()
Expand Down

0 comments on commit 411c829

Please sign in to comment.