#3317: Data::MySQL MySQL headers and library search paths

This commit is contained in:
Günter Obiltschnig
2021-06-17 14:21:22 +02:00
parent 65fd5f8f18
commit 08ef4dbf32
17 changed files with 125 additions and 63 deletions

View File

@@ -6,8 +6,9 @@
include $(POCO_BASE)/build/rules/global
SYSLIBS += -L/usr/local/lib -L/usr/local/lib$(LIB64SUFFIX)/mysql -L/usr/lib$(LIB64SUFFIX)/mysql -L/usr/mysql/lib$(LIB64SUFFIX) -L/usr/mysql/lib$(LIB64SUFFIX)/mysql -L/usr/local/mysql/lib$(LIB64SUFFIX) -L/usr/local/opt/mysql-client/lib -lmysqlclient
INCLUDE += -I/usr/local/include/mysql/ -I/usr/include/mysql/ -I/usr/mysql/include/mysql -I/usr/local/mysql/include -I/usr/local/opt/mysql-client/include/mysql
include MySQL.make
SYSLIBS += -lmysqlclient
SYSFLAGS += -DTHREADSAFE -DNO_TCL
objects = Binder Extractor SessionImpl Connector \

40
Data/MySQL/MySQL.make Normal file
View File

@@ -0,0 +1,40 @@
#
# MySQL.make
#
# Makefile fragment for finding MySQL library
#
ifndef POCO_MYSQL_INCLUDE
ifeq (0, $(shell test -d /usr/local/include/mysql; echo $$?))
POCO_MYSQL_INCLUDE = /usr/local/include
else
ifeq (0, $(shell test -d /usr/local/opt/mysql-client; echo $$?))
POCO_MYSQL_INCLUDE = /usr/local/opt/mysql-client/include
else
ifeq (0, $(shell test -d /usr/local/opt/mysql; echo $$?))
POCO_MYSQL_INCLUDE = /usr/local/opt/mysql/include
endif
endif
endif
endif
ifndef POCO_MYSQL_LIB
ifeq (0, $(shell test -d /usr/local/include/mysql; echo $$?))
POCO_MYSQL_LIB = /usr/local/lib
else
ifeq (0, $(shell test -d /usr/local/opt/mysql-client/lib; echo $$?))
POCO_MYSQL_INCLUDE = /usr/local/opt/mysql-client/lib
else
ifeq (0, $(shell test -d /usr/local/opt/mysql/lib; echo $$?))
POCO_MYSQL_INCLUDE = /usr/local/opt/mysql/lib
endif
endif
endif
endif
ifdef POCO_MYSQL_INCLUDE
INCLUDE += -I$(POCO_MYSQL_INCLUDE)
endif
ifdef POCO_MYSQL_LIB
SYSLIBS += -L$(POCO_MYSQL_LIB)
endif

View File

@@ -22,7 +22,7 @@
#include "Poco/Data/AbstractBinder.h"
#include "Poco/Data/LOB.h"
#include "Poco/Data/MySQL/MySQLException.h"
#include <mysql.h>
#include <mysql/mysql.h>
namespace Poco {

View File

@@ -20,9 +20,9 @@
#include "Poco/Data/MySQL/MySQL.h"
#include "Poco/Data/DataException.h"
#include <mysql/mysql.h>
#include <typeinfo>
#include <string>
#include <mysql.h>
namespace Poco {

View File

@@ -18,9 +18,9 @@
#define Data_MySQL_ResultMetadata_INCLUDED
#include <mysql.h>
#include <vector>
#include "Poco/Data/MetaColumn.h"
#include <mysql/mysql.h>
#include <vector>
#if LIBMYSQL_VERSION_ID >= 80000

View File

@@ -18,8 +18,8 @@
#define Data_MySQL_SessionHandle_INCLUDED
#include <mysql.h>
#include "Poco/Data/MySQL/MySQLException.h"
#include <mysql/mysql.h>
namespace Poco {

View File

@@ -18,8 +18,8 @@
#define Data_MySQL_StatementHandle_INCLUDED
#include <mysql.h>
#include "Poco/Data/MySQL/MySQLException.h"
#include <mysql/mysql.h>
namespace Poco {

View File

@@ -20,7 +20,7 @@
#include "Poco/Data/MySQL/MySQL.h"
#include "Poco/Data/Session.h"
#include <mysql.h>
#include <mysql/mysql.h>
namespace Poco {

View File

@@ -16,7 +16,7 @@
#include "Poco/Data/MySQL/SessionImpl.h"
#include "Poco/Data/SessionFactory.h"
#include "Poco/Exception.h"
#include <mysql.h>
#include <mysql/mysql.h>
namespace Poco {

View File

@@ -13,7 +13,7 @@
#include "Poco/Data/MySQL/MySQLException.h"
#include <mysql.h>
#include <mysql/mysql.h>
#include <stdio.h>

View File

@@ -12,9 +12,9 @@
//
#include <mysql.h>
#include "Poco/Data/MySQL/StatementExecutor.h"
#include "Poco/Format.h"
#include <mysql/mysql.h>
namespace Poco {

View File

@@ -15,7 +15,7 @@
#include "Poco/Data/MySQL/Utility.h"
#include <mysql.h>
#include <mysql/mysql.h>
namespace Poco {

View File

@@ -6,10 +6,10 @@
include $(POCO_BASE)/build/rules/global
INCLUDE += -I./../include -I/usr/local/include/mysql -I/usr/include/mysql/ -I/usr/mysql/include/mysql -I/usr/local/mysql/include -I/usr/local/opt/mysql-client/include/mysql
include $(POCO_BASE)/Data/MySQL/MySQL.make
# Note: linking order is important, do not change it.
SYSLIBS += -L/usr/local/lib -L/usr/local/lib$(LIB64SUFFIX)/mysql -L/usr/lib$(LIB64SUFFIX)/mysql -L/usr/mysql/lib$(LIB64SUFFIX) -L/usr/mysql/lib$(LIB64SUFFIX)/mysql -L/usr/local/mysql/lib$(LIB64SUFFIX) -L/usr/local/opt/mysql-client/lib -lmysqlclient -lz -lpthread -ldl
SYSLIBS += -lmysqlclient -lz -lpthread -ldl
objects = MySQLTestSuite Driver MySQLTest SQLExecutor

View File

@@ -45,7 +45,9 @@ Poco::SharedPtr<SQLExecutor> MySQLTest::_pExecutor = 0;
#define MYSQL_USER "pocotest"
#define MYSQL_PWD "pocotest"
#define MYSQL_HOST "127.0.0.1"
#ifndef MYSQL_PORT
#define MYSQL_PORT 3306
#endif
#define MYSQL_DB "pocotest"
//

View File

@@ -11,6 +11,7 @@
#include "MySQLTestSuite.h"
#include "MySQLTest.h"
CppUnit::Test* MySQLTestSuite::suite()
{
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("MySQLTestSuite");

View File

@@ -29,7 +29,7 @@
#include <Winsock2.h>
#endif
#include <mysql.h>
#include <mysql/mysql.h>
#include <iostream>
#include <limits>

18
configure vendored
View File

@@ -102,6 +102,12 @@ Options:
--odbc-include=<path>
Specify the directory where ODBC header files are located.
--mysql-lib=<path>
Specify the directory where MySQL library is located.
--mysql-include=<path>
Specify the directory where MySQL header files are located.
--cflags=<flags>
Pass additional flags to compiler.
Example: --cflags=-wall
@@ -178,6 +184,12 @@ while [ $# -ge 1 ]; do
--odbc-include=*)
odbcinclude="`echo ${1} | awk '{print substr($0,16)}'`" ;;
--mysql-lib=*)
mysqllib="`echo ${1} | awk '{print substr($0,13)}'`" ;;
--mysql-include=*)
mysqlinclude="`echo ${1} | awk '{print substr($0,17)}'`" ;;
--cflags=*)
flags="$flags `echo ${1} | awk '{print substr($0,10)}'`" ;;
@@ -315,6 +327,12 @@ fi
if [ -n "$odbcinclude" ] ; then
echo "POCO_ODBC_INCLUDE = $odbcinclude" >>$build/config.make
fi
if [ -n "$mysqllib" ] ; then
echo "POCO_MYSQL_LIB = $mysqllib" >>$build/config.make
fi
if [ -n "$mysqlinclude" ] ; then
echo "POCO_MYSQL_INCLUDE = $mysqlinclude" >>$build/config.make
fi
if [ -n "$unbundled" ] ; then
echo "POCO_UNBUNDLED = 1" >>$build/config.make
fi