Revert "MDEV-31230: Fix CONNECT_JDBC in CMake"

This reverts commit 1d0e3d80d8.
This commit is contained in:
Sergei Golubchik 2023-06-02 09:02:09 +02:00
parent bd1eb89d7f
commit dc9498beb6
3 changed files with 53 additions and 26 deletions

13
cmake/FindJNI.cmake Normal file
View file

@ -0,0 +1,13 @@
if(JAVA_AWT_LIBRARY AND JAVA_INCLUDE_PATH)
set(JNI_FOUND TRUE)
return()
endif()
if(DEFINED JAVA_AWT_LIBRARY)
set(JNI_FOUND FALSE)
return()
endif()
set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
unset(CMAKE_MODULE_PATH)
include(FindJNI)
set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH})

13
cmake/FindJava.cmake Normal file
View file

@ -0,0 +1,13 @@
if(Java_JAVA_EXECUTABLE)
set(JAVA_FOUND TRUE)
return()
endif()
if(DEFINED Java_JAVA_EXECUTABLE)
set(JAVA_FOUND FALSE)
return()
endif()
set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
unset(CMAKE_MODULE_PATH)
include(FindJava)
set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH})

View file

@ -270,39 +270,40 @@ ADD_FEATURE_INFO(CONNECT_ODBC ODBC_LIBRARY "Support for ODBC in the CONNECT stor
#
# JDBC with MongoDB Java Driver included but disabled if without MONGO
#
OPTION(CONNECT_WITH_MONGO "Compile CONNECT storage engine with MONGO support" ON)
OPTION(CONNECT_WITH_JDBC "Compile CONNECT storage engine with JDBC support" ON)
IF(CONNECT_WITH_JDBC)
SET(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
UNSET(CMAKE_MODULE_PATH)
FIND_PACKAGE(Java 1.6 REQUIRED)
FIND_PACKAGE(Java 1.6)
SET_PACKAGE_PROPERTIES(Java PROPERTIES TYPE OPTIONAL)
FIND_PACKAGE(JNI REQUIRED)
FIND_PACKAGE(JNI)
SET_PACKAGE_PROPERTIES(JNI PROPERTIES TYPE OPTIONAL)
INCLUDE(UseJava)
INCLUDE_DIRECTORIES(${JAVA_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${JAVA_INCLUDE_PATH2})
# SET(JDBC_LIBRARY ${JAVA_JVM_LIBRARY}) will be dynamically linked
SET(CONNECT_SOURCES ${CONNECT_SOURCES}
javaconn.cpp jdbconn.cpp tabjdbc.cpp
jmgfam.cpp jmgoconn.cpp mongo.cpp tabjmg.cpp
jdbccat.h javaconn.h jdbconn.h tabjdbc.h
jmgfam.h jmgoconn.h mongo.h tabjmg.h
JdbcInterface.java ApacheInterface.java MariadbInterface.java
MysqlInterface.java OracleInterface.java PostgresqlInterface.java
Mongo2Interface.java Mongo3Interface.java
mysql-test/connect/std_data/JavaWrappers.jar)
add_definitions(-DJAVA_SUPPORT)
IF(CONNECT_WITH_MONGO)
IF (JAVA_FOUND AND JNI_FOUND)
INCLUDE(UseJava)
INCLUDE_DIRECTORIES(${JAVA_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${JAVA_INCLUDE_PATH2})
# SET(JDBC_LIBRARY ${JAVA_JVM_LIBRARY}) will be dynamically linked
SET(CONNECT_SOURCES ${CONNECT_SOURCES}
mysql-test/connect/std_data/Mongo2.jar
mysql-test/connect/std_data/Mongo3.jar)
add_definitions(-DMONGO_SUPPORT)
ENDIF(CONNECT_WITH_MONGO)
SET(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH})
ADD_FEATURE_INFO(CONNECT_JDBC "ON" "Support for JDBC in the CONNECT storage engine")
javaconn.cpp jdbconn.cpp tabjdbc.cpp
jmgfam.cpp jmgoconn.cpp mongo.cpp tabjmg.cpp
jdbccat.h javaconn.h jdbconn.h tabjdbc.h
jmgfam.h jmgoconn.h mongo.h tabjmg.h
JdbcInterface.java ApacheInterface.java MariadbInterface.java
MysqlInterface.java OracleInterface.java PostgresqlInterface.java
Mongo2Interface.java Mongo3Interface.java
mysql-test/connect/std_data/JavaWrappers.jar)
add_definitions(-DJAVA_SUPPORT)
ADD_FEATURE_INFO(CONNECT_JDBC "ON" "Support for JDBC in the CONNECT storage engine")
IF(CONNECT_WITH_MONGO)
SET(CONNECT_SOURCES ${CONNECT_SOURCES}
mysql-test/connect/std_data/Mongo2.jar
mysql-test/connect/std_data/Mongo3.jar)
add_definitions(-DMONGO_SUPPORT)
ENDIF()
ELSE()
SET(JDBC_LIBRARY "")
ADD_FEATURE_INFO(CONNECT_JDBC "OFF" "Support for JDBC in the CONNECT storage engine")
ENDIF()
ELSE(CONNECT_WITH_JDBC)
ADD_FEATURE_INFO(CONNECT_JDBC "OFF" "Support for JDBC in the CONNECT storage engine")
ENDIF(CONNECT_WITH_JDBC)