mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 10:13:51 +01:00
fix(Data):
adjust make and CMake for SQLParser and DataTest lib separate samples from tests in CMake remove unused StatementImpl from Data testsuite
This commit is contained in:
parent
a7a6f869c1
commit
81d7307fa7
2
.vscode/c_cpp_properties.json
vendored
2
.vscode/c_cpp_properties.json
vendored
@ -24,7 +24,7 @@
|
||||
"${POCO_BASE}/MongoDB/include",
|
||||
"${POCO_BASE}/ApacheConnector/include",
|
||||
"${POCO_BASE}/Data/src",
|
||||
"${POCO_BASE}/Data/testsuite/include"
|
||||
"${POCO_BASE}/Data/testsuite/DataTest/include"
|
||||
]
|
||||
},
|
||||
"configurations": [
|
||||
|
@ -21,6 +21,6 @@ target_include_directories(mod_poco
|
||||
)
|
||||
target_link_libraries(mod_poco PUBLIC Poco::Util Poco::Net Apache::Apr Apache::Aprutil)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
if(ENABLE_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
@ -204,7 +204,10 @@ if(ENABLE_ACTIVERECORD AND NOT ENABLE_XML)
|
||||
endif()
|
||||
|
||||
option(ENABLE_TESTS
|
||||
"Set to OFF|ON (default is OFF) to control build of POCO tests & samples" OFF)
|
||||
"Set to OFF|ON (default is OFF) to control build of POCO tests" OFF)
|
||||
|
||||
option(ENABLE_SAMPLES
|
||||
"Set to OFF|ON (default is OFF) to control build of POCO samples" OFF)
|
||||
|
||||
option(POCO_UNBUNDLED
|
||||
"Set to OFF|ON (default is OFF) to control linking dependencies as external" OFF)
|
||||
@ -393,7 +396,13 @@ if(OPENSSL_FOUND)
|
||||
endif()
|
||||
endif(OPENSSL_FOUND)
|
||||
|
||||
|
||||
option(POCO_DATA_NO_SQL_PARSER "Disable SQL parser" OFF)
|
||||
|
||||
if(EXISTS ${PROJECT_SOURCE_DIR}/Data AND ENABLE_DATA)
|
||||
if(POCO_DATA_NO_SQL_PARSER)
|
||||
add_definitions(-DPOCO_DATA_NO_SQL_PARSER=1)
|
||||
endif()
|
||||
add_subdirectory(Data)
|
||||
list(APPEND Poco_COMPONENTS "Data")
|
||||
endif()
|
||||
|
@ -38,3 +38,6 @@ elseif(MINGW)
|
||||
PUBLIC
|
||||
_DLL)
|
||||
endif()
|
||||
|
||||
POCO_INSTALL(CppUnit)
|
||||
POCO_GENERATE_PACKAGE(CppUnit)
|
||||
|
@ -11,6 +11,6 @@ objects = CppUnitException TestDecorator TestResult TestSuite \
|
||||
|
||||
target = CppUnit
|
||||
target_version = 1
|
||||
target_libs =
|
||||
target_libs = PocoFoundation
|
||||
|
||||
include $(POCO_BASE)/build/rules/lib
|
||||
|
3
CppUnit/cmake/CppUnitConfig.cmake
Normal file
3
CppUnit/cmake/CppUnitConfig.cmake
Normal file
@ -0,0 +1,3 @@
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(PocoFoundation)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/PocoDataTargets.cmake")
|
1
CppUnit/dependencies
Normal file
1
CppUnit/dependencies
Normal file
@ -0,0 +1 @@
|
||||
Foundation
|
@ -40,7 +40,10 @@ endif()
|
||||
POCO_INSTALL(Crypto)
|
||||
POCO_GENERATE_PACKAGE(Crypto)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
if(ENABLE_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
@ -1,6 +1,11 @@
|
||||
# Sources
|
||||
file(GLOB SRCS_G "src/*.cpp")
|
||||
POCO_SOURCES_AUTO(SRCS ${SRCS_G})
|
||||
if (NOT POCO_DATA_NO_SQL_PARSER)
|
||||
file(GLOB_RECURSE SRCS_PARSER "src/sql-parser/src/*.cpp")
|
||||
LIST(REMOVE_ITEM SRCS_PARSER "${CMAKE_CURRENT_SOURCE_DIR}/src/sql-parser/src/parser/conflict_test.cpp")
|
||||
POCO_SOURCES_AUTO(SRCS ${SRCS_PARSER})
|
||||
endif()
|
||||
|
||||
# Headers
|
||||
file(GLOB_RECURSE HDRS_G "include/*.h")
|
||||
@ -30,6 +35,7 @@ target_link_libraries(Data PUBLIC Poco::Foundation)
|
||||
target_include_directories(Data
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
@ -37,6 +43,10 @@ target_include_directories(Data
|
||||
POCO_INSTALL(Data)
|
||||
POCO_GENERATE_PACKAGE(Data)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
||||
if(ENABLE_DATA_SQLITE)
|
||||
# SQlite3 is built in any case
|
||||
message(STATUS "SQLite Support Enabled")
|
||||
@ -66,7 +76,6 @@ else()
|
||||
message(STATUS "ODBC Support Disabled")
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
if(ENABLE_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
@ -25,4 +25,5 @@ else()
|
||||
)
|
||||
set_tests_properties(DataMySQL PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
||||
endif()
|
||||
target_link_libraries(DataMySQL-testrunner PUBLIC Poco::DataMySQL CppUnit)
|
||||
target_link_libraries(DataMySQL-testrunner PUBLIC Poco::DataMySQL Poco::DataTest CppUnit)
|
||||
target_include_directories(DataMySQL-testrunner PUBLIC ${CMAKE_SOURCE_DIR}/Data/testsuite/DataTest/include/)
|
||||
|
@ -25,4 +25,6 @@ else()
|
||||
)
|
||||
set_tests_properties(DataODBC PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
||||
endif()
|
||||
target_link_libraries(DataODBC-testrunner PUBLIC Poco::DataODBC CppUnit)
|
||||
|
||||
target_link_libraries(DataODBC-testrunner PUBLIC Poco::DataTest Poco::DataODBC Poco::Data CppUnit)
|
||||
target_include_directories(DataODBC-testrunner PUBLIC ${CMAKE_SOURCE_DIR}/Data/testsuite/DataTest/include/)
|
||||
|
@ -35,13 +35,13 @@ ifeq ($(POCO_CONFIG),MinGW)
|
||||
objects += ODBCAccessTest
|
||||
endif
|
||||
|
||||
target_includes = $(POCO_BASE)/Data/testsuite/include
|
||||
ifndef POCO_DATA_NO_SQL_PARSER
|
||||
target_includes += $(POCO_BASE)/Data/src
|
||||
endif
|
||||
|
||||
target = testrunner
|
||||
target_version = 1
|
||||
target_libs = PocoDataODBC PocoDataTest PocoData PocoFoundation CppUnit
|
||||
target = testrunner
|
||||
target_version = 1
|
||||
target_libs = PocoDataODBC PocoDataTest PocoData PocoFoundation CppUnit
|
||||
target_includes += $(POCO_BASE)/Data/testsuite/DataTest/include
|
||||
|
||||
include $(POCO_BASE)/build/rules/exec
|
||||
|
@ -17,4 +17,5 @@ add_test(
|
||||
COMMAND DataPostgreSQL-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all
|
||||
)
|
||||
set_tests_properties(DataPostgreSQL PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
||||
target_link_libraries(DataPostgreSQL-testrunner PUBLIC Poco::DataPostgreSQL CppUnit)
|
||||
target_link_libraries(DataPostgreSQL-testrunner PUBLIC Poco::DataPostgreSQL Poco::DataTest CppUnit)
|
||||
target_include_directories(DataPostgreSQL-testrunner PUBLIC ${CMAKE_SOURCE_DIR}/Data/testsuite/DataTest/include/)
|
||||
|
@ -4,7 +4,8 @@ POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G})
|
||||
|
||||
# Headers
|
||||
file(GLOB_RECURSE HDRS_G "src/*.h")
|
||||
POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G})
|
||||
file(GLOB HDRS_E ${CMAKE_SOURCE_DIR}/Data/testsuite/DataTest/include/*.h)
|
||||
POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_E})
|
||||
|
||||
POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF
|
||||
src/WinDriver.cpp
|
||||
@ -29,4 +30,6 @@ else()
|
||||
)
|
||||
set_tests_properties(DataSQLite PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
||||
endif()
|
||||
target_link_libraries(DataSQLite-testrunner PUBLIC Poco::DataSQLite CppUnit)
|
||||
|
||||
target_link_libraries(DataSQLite-testrunner PUBLIC Poco::DataSQLite Poco::DataTest CppUnit)
|
||||
target_include_directories(DataSQLite-testrunner PUBLIC ${CMAKE_SOURCE_DIR}/Data/testsuite/DataTest/include/)
|
||||
|
@ -544,7 +544,7 @@ private:
|
||||
/// Returns true if the statement is of the argument type.
|
||||
|
||||
Poco::SharedPtr<Parser::SQLParserResult> _pParseResult;
|
||||
|
||||
std::string _parseError;
|
||||
#endif // POCO_DATA_NO_SQL_PARSER
|
||||
|
||||
StatementImpl::Ptr _pImpl;
|
||||
@ -557,7 +557,6 @@ private:
|
||||
std::vector<Any> _arguments;
|
||||
RowFormatter::Ptr _pRowFormatter;
|
||||
mutable std::string _stmtString;
|
||||
std::string _parseError;
|
||||
};
|
||||
|
||||
//
|
||||
@ -571,7 +570,12 @@ inline std::size_t Statement::subTotalRowCount(int dataSet) const
|
||||
|
||||
inline const std::string& Statement::parseError()
|
||||
{
|
||||
#ifdef POCO_DATA_NO_SQL_PARSER
|
||||
static std::string empty;
|
||||
return empty;
|
||||
#else
|
||||
return _parseError;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,6 +48,7 @@ Statement::Statement(Session& session):
|
||||
Statement::Statement(const Statement& stmt):
|
||||
#ifndef POCO_DATA_NO_SQL_PARSER
|
||||
_pParseResult(stmt._pParseResult),
|
||||
_parseError(stmt._parseError),
|
||||
#endif
|
||||
_pImpl(stmt._pImpl),
|
||||
_async(stmt._async),
|
||||
@ -55,8 +56,7 @@ Statement::Statement(const Statement& stmt):
|
||||
_pAsyncExec(stmt._pAsyncExec),
|
||||
_arguments(stmt._arguments),
|
||||
_pRowFormatter(stmt._pRowFormatter),
|
||||
_stmtString(stmt._stmtString),
|
||||
_parseError(stmt._parseError)
|
||||
_stmtString(stmt._stmtString)
|
||||
{
|
||||
}
|
||||
|
||||
@ -64,6 +64,7 @@ Statement::Statement(const Statement& stmt):
|
||||
Statement::Statement(Statement&& stmt) noexcept:
|
||||
#ifndef POCO_DATA_NO_SQL_PARSER
|
||||
_pParseResult(std::move(stmt._pParseResult)),
|
||||
_parseError(std::move(stmt._parseError)),
|
||||
#endif
|
||||
_pImpl(std::move(stmt._pImpl)),
|
||||
_async(std::move(stmt._async)),
|
||||
@ -71,8 +72,7 @@ Statement::Statement(Statement&& stmt) noexcept:
|
||||
_pAsyncExec(std::move(stmt._pAsyncExec)),
|
||||
_arguments(std::move(stmt._arguments)),
|
||||
_pRowFormatter(std::move(stmt._pRowFormatter)),
|
||||
_stmtString(std::move(stmt._stmtString)),
|
||||
_parseError(std::move(stmt._parseError))
|
||||
_stmtString(std::move(stmt._stmtString))
|
||||
{
|
||||
stmt._pImpl = nullptr;
|
||||
stmt._async = false;
|
||||
@ -81,7 +81,9 @@ Statement::Statement(Statement&& stmt) noexcept:
|
||||
stmt._arguments.clear();
|
||||
stmt._pRowFormatter = nullptr;
|
||||
_stmtString.clear();
|
||||
#ifndef POCO_DATA_NO_SQL_PARSER
|
||||
_parseError.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -102,6 +104,8 @@ Statement& Statement::operator = (Statement&& stmt) noexcept
|
||||
{
|
||||
#ifndef POCO_DATA_NO_SQL_PARSER
|
||||
_pParseResult = std::move(stmt._pParseResult);
|
||||
_parseError = std::move(stmt._parseError);
|
||||
_parseError.clear();
|
||||
#endif
|
||||
_pImpl = std::move(stmt._pImpl);
|
||||
stmt._pImpl = nullptr;
|
||||
@ -117,8 +121,6 @@ Statement& Statement::operator = (Statement&& stmt) noexcept
|
||||
stmt._pRowFormatter = nullptr;
|
||||
_stmtString = std::move(stmt._stmtString);
|
||||
_stmtString.clear();
|
||||
_parseError = std::move(stmt._parseError);
|
||||
_parseError.clear();
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -128,6 +130,7 @@ void Statement::swap(Statement& other) noexcept
|
||||
using std::swap;
|
||||
#ifndef POCO_DATA_NO_SQL_PARSER
|
||||
swap(_pParseResult, other._pParseResult);
|
||||
swap(_parseError, other._parseError);
|
||||
#endif
|
||||
swap(_pImpl, other._pImpl);
|
||||
swap(_async, other._async);
|
||||
@ -136,7 +139,6 @@ void Statement::swap(Statement& other) noexcept
|
||||
_arguments.swap(other._arguments);
|
||||
swap(_pRowFormatter, other._pRowFormatter);
|
||||
swap(_stmtString, other._stmtString);
|
||||
swap(_parseError, other._parseError);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
# Sources
|
||||
file(GLOB SRCS_G "src/*.cpp")
|
||||
LIST(REMOVE_ITEM SRCS_G "${CMAKE_CURRENT_SOURCE_DIR}/src/SQLExecutor.cpp")
|
||||
POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G})
|
||||
|
||||
# Headers
|
||||
file(GLOB_RECURSE HDRS_G "src/*.h")
|
||||
file(GLOB HDRS_G "src/*.h")
|
||||
POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G})
|
||||
|
||||
POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF
|
||||
@ -14,11 +15,6 @@ POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE
|
||||
src/WinCEDriver.cpp
|
||||
)
|
||||
|
||||
#TODO: Why is this file there? It doesn't compile if it is include in the sources
|
||||
POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF
|
||||
src/StatementImpl.cpp
|
||||
)
|
||||
|
||||
add_executable(Data-testrunner ${TEST_SRCS})
|
||||
if(ANDROID)
|
||||
add_test(
|
||||
@ -35,3 +31,5 @@ else()
|
||||
set_tests_properties(Data PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
||||
endif()
|
||||
target_link_libraries(Data-testrunner PUBLIC Poco::Data CppUnit)
|
||||
|
||||
add_subdirectory(DataTest)
|
||||
|
34
Data/testsuite/DataTest/CMakeLists.txt
Normal file
34
Data/testsuite/DataTest/CMakeLists.txt
Normal file
@ -0,0 +1,34 @@
|
||||
# Sources
|
||||
file(GLOB SRCS_G ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
||||
POCO_SOURCES_AUTO(DATA_TEST_LIB_SRCS ${SRCS_G})
|
||||
|
||||
# Headers
|
||||
file(GLOB HDRS_G ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h)
|
||||
POCO_HEADERS_AUTO(DATA_TEST_LIB_SRCS ${HDRS_G})
|
||||
|
||||
# Version Resource
|
||||
if(MSVC AND BUILD_SHARED_LIBS)
|
||||
source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc)
|
||||
list(APPEND DATA_TEST_LIB_SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc)
|
||||
endif()
|
||||
|
||||
add_library(DataTest ${DATA_TEST_LIB_SRCS})
|
||||
add_library(Poco::DataTest ALIAS DataTest)
|
||||
set_target_properties(DataTest
|
||||
PROPERTIES
|
||||
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
|
||||
OUTPUT_NAME PocoDataTest
|
||||
DEFINE_SYMBOL DataTest_EXPORTS
|
||||
)
|
||||
|
||||
target_link_libraries(DataTest PUBLIC Poco::Data CppUnit)
|
||||
target_include_directories(DataTest
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/Data/include>
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/Data/src>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
POCO_INSTALL(DataTest)
|
||||
POCO_GENERATE_PACKAGE(DataTest)
|
16
Data/testsuite/DataTest/Makefile
Normal file
16
Data/testsuite/DataTest/Makefile
Normal file
@ -0,0 +1,16 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# Makefile for Poco Data testsuite library
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
objects = SQLExecutor
|
||||
|
||||
target = PocoDataTest
|
||||
target_version = 1
|
||||
target_libs = PocoData PocoFoundation CppUnit
|
||||
target_includes = $(POCO_BASE)/Data/src $(POCO_BASE)/Data/testsuite/DataTest/include
|
||||
|
||||
include $(POCO_BASE)/build/rules/lib
|
5
Data/testsuite/DataTest/cmake/PocoDataTestConfig.cmake
Normal file
5
Data/testsuite/DataTest/cmake/PocoDataTestConfig.cmake
Normal file
@ -0,0 +1,5 @@
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(PocoFoundation)
|
||||
find_dependency(PocoData)
|
||||
find_dependency(CppUnit)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/PocoDataTestTargets.cmake")
|
2
Data/testsuite/DataTest/dependencies
Normal file
2
Data/testsuite/DataTest/dependencies
Normal file
@ -0,0 +1,2 @@
|
||||
Foundation
|
||||
Data
|
62
Data/testsuite/DataTest/include/Poco/Data/Test/DataTest.h
Normal file
62
Data/testsuite/DataTest/include/Poco/Data/Test/DataTest.h
Normal file
@ -0,0 +1,62 @@
|
||||
//
|
||||
// DataTest.h
|
||||
//
|
||||
// Library: DataTest
|
||||
// Package: DataTestCore
|
||||
// Module: DataTest
|
||||
//
|
||||
// Basic definitions for the Poco DataTest library.
|
||||
// This file must be the first file included by every other DataTest
|
||||
// header file.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.,
|
||||
// Aleph ONE Software Engineering d.o.o., and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef DataTest_DataTest_INCLUDED
|
||||
#define DataTest_DataTest_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
|
||||
|
||||
//
|
||||
// The following block is the standard way of creating macros which make exporting
|
||||
// from a DLL simpler. All files within this DLL are compiled with the DataTest_EXPORTS
|
||||
// symbol defined on the command line. this symbol should not be defined on any project
|
||||
// that uses this DLL. This way any other project whose source files include this file see
|
||||
// DataTest_API functions as being imported from a DLL, wheras this DLL sees symbols
|
||||
// defined with this macro as being exported.
|
||||
//
|
||||
#if defined(_WIN32) && defined(POCO_DLL)
|
||||
#if defined(DataTest_EXPORTS)
|
||||
#define DataTest_API __declspec(dllexport)
|
||||
#else
|
||||
#define DataTest_API __declspec(dllimport)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(DataTest_API)
|
||||
#if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4)
|
||||
#define DataTest_API __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
#define DataTest_API
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Automatically link DataTest library.
|
||||
//
|
||||
#if defined(_MSC_VER)
|
||||
#if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(DataTest_EXPORTS)
|
||||
#pragma comment(lib, "PocoDataTest" POCO_LIB_SUFFIX)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif // DataTest_DataTest_INCLUDED
|
@ -3,18 +3,18 @@
|
||||
//
|
||||
// Definition of the SQLExecutor class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.,
|
||||
// Aleph ONE Software Engineering d.o.o., and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef Data_SQLExecutor_INCLUDED
|
||||
#define Data_SQLExecutor_INCLUDED
|
||||
#ifndef DataTest_SQLExecutor_INCLUDED
|
||||
#define DataTest_SQLExecutor_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/Data.h"
|
||||
#include "Poco/Data/Test/DataTest.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/Data/BulkExtraction.h"
|
||||
#include "Poco/Data/BulkBinding.h"
|
||||
@ -24,6 +24,11 @@
|
||||
#include <iostream>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Test {
|
||||
|
||||
|
||||
#define poco_data_using_keywords using Poco::Data::Keywords::now; \
|
||||
using Poco::Data::Keywords::into; \
|
||||
using Poco::Data::Keywords::use; \
|
||||
@ -33,12 +38,7 @@
|
||||
using Poco::Data::CLOB;
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Test {
|
||||
|
||||
|
||||
class SQLExecutor: public CppUnit::TestCase
|
||||
class DataTest_API SQLExecutor: public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
enum DataBinding
|
||||
@ -238,4 +238,4 @@ private:
|
||||
} } } // Poco::Data::Test
|
||||
|
||||
|
||||
#endif // Data_SQLExecutor_INCLUDED
|
||||
#endif // DataTest_SQLExecutor_INCLUDED
|
@ -8,4 +8,4 @@
|
||||
clean distclean all: projects
|
||||
projects:
|
||||
$(MAKE) -f Makefile-testrunner $(MAKECMDGOALS)
|
||||
$(MAKE) -f Makefile-library $(MAKECMDGOALS)
|
||||
$(MAKE) -C DataTest $(MAKECMDGOALS)
|
||||
|
@ -1,21 +0,0 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# Makefile for Poco Data testsuite library
|
||||
#
|
||||
|
||||
include $(POCO_BASE)/build/rules/global
|
||||
|
||||
objects = SQLExecutor
|
||||
|
||||
target_includes = $(POCO_BASE)/Data/testsuite/include
|
||||
ifndef POCO_DATA_NO_SQL_PARSER
|
||||
objects += SQLParserTest
|
||||
target_includes += $(POCO_BASE)/Data/src
|
||||
endif
|
||||
|
||||
target = PocoDataTest
|
||||
target_version = 1
|
||||
target_libs = PocoData PocoFoundation CppUnit
|
||||
|
||||
include $(POCO_BASE)/build/rules/lib
|
@ -1504,6 +1504,8 @@ void DataTest::testSQLParse()
|
||||
assertTrue (!stmt.isDelete().isSpecified());
|
||||
assertTrue (!stmt.hasDelete().isSpecified());
|
||||
|
||||
#else
|
||||
std::cout << "[NOT ENABLED]";
|
||||
#endif // POCO_DATA_NO_SQL_PARSER
|
||||
}
|
||||
|
||||
|
@ -1,82 +0,0 @@
|
||||
//
|
||||
// StatementImpl.cpp
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "StatementImpl.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Test {
|
||||
|
||||
|
||||
StatementImpl::StatementImpl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
StatementImpl::~StatementImpl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void StatementImpl::compileImpl()
|
||||
{
|
||||
// prepare binding
|
||||
_ptrBinder = new Binder;
|
||||
_ptrExtractor = new Extractor;
|
||||
_ptrPrepare = new Preparation();
|
||||
}
|
||||
|
||||
|
||||
bool StatementImpl::canBind() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void StatementImpl::bindImpl()
|
||||
{
|
||||
// bind
|
||||
typedef Poco::Data::AbstractBindingVec Bindings;
|
||||
Bindings& binds = bindings();
|
||||
if (binds.empty())
|
||||
return;
|
||||
|
||||
Bindings::iterator it = binds.begin();
|
||||
Bindings::iterator itEnd = binds.end();
|
||||
std::size_t pos = 0;
|
||||
for (; it != itEnd && (*it)->canBind(); ++it)
|
||||
{
|
||||
(*it)->bind(pos);
|
||||
pos += (*it)->numOfColumnsHandled();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool StatementImpl::hasNext()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void StatementImpl::next()
|
||||
{
|
||||
Poco::Data::AbstractExtractionVec::iterator it = extractions().begin();
|
||||
Poco::Data::AbstractExtractionVec::iterator itEnd = extractions().end();
|
||||
std::size_t pos = 0;
|
||||
for (; it != itEnd; ++it)
|
||||
{
|
||||
(*it)->extract(pos);
|
||||
pos += (*it)->numOfColumnsHandled();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::Test
|
@ -1,91 +0,0 @@
|
||||
//
|
||||
// StatementImpl.h
|
||||
//
|
||||
// Definition of the StatementImpl class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef Data_Test_StatementImpl_INCLUDED
|
||||
#define Data_Test_StatementImpl_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/StatementImpl.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Binder.h"
|
||||
#include "Extractor.h"
|
||||
#include "Preparator.h"
|
||||
|
||||
|
||||
struct sqlite3;
|
||||
struct sqlite3_stmt;
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace Test {
|
||||
|
||||
|
||||
class StatementImpl: public Poco::Data::StatementImpl
|
||||
/// A no-op implementation of StatementImpl for testing.
|
||||
{
|
||||
public:
|
||||
StatementImpl();
|
||||
/// Creates the StatementImpl.
|
||||
|
||||
~StatementImpl();
|
||||
/// Destroys the StatementImpl.
|
||||
|
||||
protected:
|
||||
bool hasNext();
|
||||
/// Returns true if a call to next() will return data.
|
||||
|
||||
void next();
|
||||
/// Retrieves the next row from the resultset.
|
||||
/// Will throw, if the resultset is empty.
|
||||
|
||||
bool canBind() const;
|
||||
/// Returns true if a valid statement is set and we can bind.
|
||||
|
||||
void compileImpl();
|
||||
/// Compiles the statement, doesn't bind yet
|
||||
|
||||
void bindImpl();
|
||||
/// Binds parameters
|
||||
|
||||
AbstractExtractor& extractor();
|
||||
/// Returns the concrete extractor used by the statement.
|
||||
|
||||
AbstractBinder& binder();
|
||||
/// Returns the concrete binder used by the statement.
|
||||
|
||||
private:
|
||||
Poco::SharedPtr<Binder> _ptrBinder;
|
||||
Poco::SharedPtr<Extractor> _ptrExtractor;
|
||||
Poco::SharedPtr<Preparation> _ptrPrepare;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline AbstractExtractor& StatementImpl::extractor()
|
||||
{
|
||||
return *_ptrExtractor;
|
||||
}
|
||||
|
||||
|
||||
inline AbstractBinder& StatementImpl::binder()
|
||||
{
|
||||
return *_ptrBinder;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::Test
|
||||
|
||||
|
||||
#endif // Data_Test_StatementImpl_INCLUDED
|
33
Data/testsuite/testsuite.cmake
Normal file
33
Data/testsuite/testsuite.cmake
Normal file
@ -0,0 +1,33 @@
|
||||
# Sources
|
||||
file(GLOB SRCS_G "src/*.cpp")
|
||||
LIST(REMOVE_ITEM SRCS_G "${CMAKE_CURRENT_SOURCE_DIR}/src/SQLExecutor.cpp")
|
||||
POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G})
|
||||
|
||||
# Headers
|
||||
file(GLOB HDRS_G "src/*.h")
|
||||
POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G})
|
||||
|
||||
POCO_SOURCES_AUTO_PLAT(TEST_SRCS WIN
|
||||
src/WinDriver.cpp
|
||||
)
|
||||
|
||||
POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE
|
||||
src/WinCEDriver.cpp
|
||||
)
|
||||
|
||||
add_executable(Data-testrunner ${TEST_SRCS})
|
||||
if(ANDROID)
|
||||
add_test(
|
||||
NAME Data
|
||||
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||
COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Data-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake
|
||||
)
|
||||
else()
|
||||
add_test(
|
||||
NAME Data
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMAND Data-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all
|
||||
)
|
||||
set_tests_properties(Data PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
||||
endif()
|
||||
target_link_libraries(Data-testrunner PUBLIC Poco::Data CppUnit)
|
@ -32,7 +32,10 @@ target_include_directories(Encodings
|
||||
POCO_INSTALL(Encodings)
|
||||
POCO_GENERATE_PACKAGE(Encodings)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
if(ENABLE_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
@ -234,10 +234,13 @@ endif()
|
||||
POCO_INSTALL(Foundation)
|
||||
POCO_GENERATE_PACKAGE(Foundation)
|
||||
|
||||
if(ENABLE_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
set_property(TARGET Foundation PROPERTY POSITION_INDEPENDENT_CODE ON) # This is needed to build TestLibrary.so as shared.
|
||||
endif()
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
@ -41,7 +41,10 @@ endif()
|
||||
POCO_INSTALL(JSON)
|
||||
POCO_GENERATE_PACKAGE(JSON)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
if(ENABLE_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
@ -32,8 +32,11 @@ target_include_directories(MongoDB
|
||||
POCO_INSTALL(MongoDB)
|
||||
POCO_GENERATE_PACKAGE(MongoDB)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
if(ENABLE_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
||||
|
@ -46,8 +46,11 @@ target_include_directories(Net
|
||||
POCO_INSTALL(Net)
|
||||
POCO_GENERATE_PACKAGE(Net)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
if(ENABLE_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
||||
|
@ -36,8 +36,11 @@ endif()
|
||||
POCO_INSTALL(NetSSL)
|
||||
POCO_GENERATE_PACKAGE(NetSSL)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
if(ENABLE_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
||||
|
@ -32,9 +32,12 @@ target_include_directories(NetSSLWin
|
||||
POCO_INSTALL(NetSSLWin)
|
||||
POCO_GENERATE_PACKAGE(NetSSLWin)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
if(ENABLE_SAMPLES)
|
||||
#TODO: Looks like the samples use crypto somehow?
|
||||
#add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
#add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
||||
|
@ -146,8 +146,11 @@ target_include_directories(PDF
|
||||
POCO_INSTALL(PDF)
|
||||
POCO_GENERATE_PACKAGE(PDF)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
if(ENABLE_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
||||
|
@ -32,8 +32,11 @@ target_include_directories(Prometheus
|
||||
POCO_INSTALL(Prometheus)
|
||||
POCO_GENERATE_PACKAGE(Prometheus)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
if(ENABLE_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
||||
|
@ -34,6 +34,5 @@ POCO_GENERATE_PACKAGE(Redis)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
# add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
|
@ -75,7 +75,5 @@ POCO_GENERATE_PACKAGE(SevenZip)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(samples)
|
||||
# TODO: Add tests
|
||||
#add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
||||
|
@ -49,7 +49,10 @@ target_include_directories(Util
|
||||
POCO_INSTALL(Util)
|
||||
POCO_GENERATE_PACKAGE(Util)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
if(ENABLE_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
@ -65,8 +65,11 @@ endif()
|
||||
POCO_INSTALL(XML)
|
||||
POCO_GENERATE_PACKAGE(XML)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
if(ENABLE_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
||||
|
@ -32,8 +32,11 @@ target_include_directories(Zip
|
||||
POCO_INSTALL(Zip)
|
||||
POCO_GENERATE_PACKAGE(Zip)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
if(ENABLE_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
endif()
|
||||
|
||||
|
@ -53,155 +53,155 @@ endif(WIN32)
|
||||
# Macros for Source file management
|
||||
#
|
||||
# POCO_SOURCES_PLAT - Adds a list of files to the sources of a components
|
||||
# Usage: POCO_SOURCES_PLAT( out name platform sources)
|
||||
# INPUT:
|
||||
# out the variable the sources are added to
|
||||
# name: the name of the components
|
||||
# platform: the platform this sources are for (ON = All, OFF = None, WIN32, UNIX ...)
|
||||
# sources: a list of files to add to ${out}
|
||||
# Example: POCO_SOURCES_PLAT( SRCS Foundation ON src/Foundation.cpp )
|
||||
# Usage: POCO_SOURCES_PLAT( out name platform sources)
|
||||
# INPUT:
|
||||
# out the variable the sources are added to
|
||||
# name: the name of the components
|
||||
# platform: the platform this sources are for (ON = All, OFF = None, WIN32, UNIX ...)
|
||||
# sources: a list of files to add to ${out}
|
||||
# Example: POCO_SOURCES_PLAT( SRCS Foundation ON src/Foundation.cpp )
|
||||
#
|
||||
# POCO_SOURCES - Like POCO_SOURCES_PLAT with platform = ON (Built on all platforms)
|
||||
# Usage: POCO_SOURCES( out name sources)
|
||||
# Example: POCO_SOURCES( SRCS Foundation src/Foundation.cpp)
|
||||
# Usage: POCO_SOURCES( out name sources)
|
||||
# Example: POCO_SOURCES( SRCS Foundation src/Foundation.cpp)
|
||||
#
|
||||
# POCO_SOURCES_AUTO - Like POCO_SOURCES but the name is read from the file header // Package: X
|
||||
# Usage: POCO_SOURCES_AUTO( out sources)
|
||||
# Example: POCO_SOURCES_AUTO( SRCS src/Foundation.cpp)
|
||||
# Usage: POCO_SOURCES_AUTO( out sources)
|
||||
# Example: POCO_SOURCES_AUTO( SRCS src/Foundation.cpp)
|
||||
#
|
||||
# POCO_SOURCES_AUTO_PLAT - Like POCO_SOURCES_PLAT but the name is read from the file header // Package: X
|
||||
# Usage: POCO_SOURCES_AUTO_PLAT(out platform sources)
|
||||
# Example: POCO_SOURCES_AUTO_PLAT( SRCS WIN32 src/Foundation.cpp)
|
||||
# Usage: POCO_SOURCES_AUTO_PLAT(out platform sources)
|
||||
# Example: POCO_SOURCES_AUTO_PLAT( SRCS WIN32 src/Foundation.cpp)
|
||||
#
|
||||
#
|
||||
# POCO_HEADERS - Adds a list of files to the headers of a components
|
||||
# Usage: POCO_HEADERS( out name headers)
|
||||
# INPUT:
|
||||
# out the variable the headers are added to
|
||||
# name: the name of the components
|
||||
# headers: a list of files to add to HDRSt
|
||||
# Example: POCO_HEADERS( HDRS Foundation include/Poco/Foundation.h )
|
||||
# Usage: POCO_HEADERS( out name headers)
|
||||
# INPUT:
|
||||
# out the variable the headers are added to
|
||||
# name: the name of the components
|
||||
# headers: a list of files to add to HDRSt
|
||||
# Example: POCO_HEADERS( HDRS Foundation include/Poco/Foundation.h )
|
||||
#
|
||||
# POCO_HEADERS_AUTO - Like POCO_HEADERS but the name is read from the file header // Package: X
|
||||
# Usage: POCO_HEADERS_AUTO( out headers)
|
||||
# Example: POCO_HEADERS_AUTO( HDRS src/Foundation.cpp)
|
||||
# Usage: POCO_HEADERS_AUTO( out headers)
|
||||
# Example: POCO_HEADERS_AUTO( HDRS src/Foundation.cpp)
|
||||
#
|
||||
#
|
||||
# POCO_MESSAGES - Adds a list of files to the messages of a components
|
||||
# and adds the generated headers to the header list of the component.
|
||||
# On platforms other then Windows this does nothing
|
||||
# Usage: POCO_MESSAGES( out name messages)
|
||||
# INPUT:
|
||||
# out the variable the message and the resulting headers are added to
|
||||
# name: the name of the components
|
||||
# messages: a list of files to add to MSGS
|
||||
# Example: POCO_MESSAGES( HDRS Foundation include/Poco/Foundation.mc )
|
||||
# and adds the generated headers to the header list of the component.
|
||||
# On platforms other then Windows this does nothing
|
||||
# Usage: POCO_MESSAGES( out name messages)
|
||||
# INPUT:
|
||||
# out the variable the message and the resulting headers are added to
|
||||
# name: the name of the components
|
||||
# messages: a list of files to add to MSGS
|
||||
# Example: POCO_MESSAGES( HDRS Foundation include/Poco/Foundation.mc )
|
||||
#
|
||||
|
||||
macro(POCO_SOURCES_PLAT out name platform)
|
||||
source_group("${name}\\Source Files" FILES ${ARGN})
|
||||
list(APPEND ${out} ${ARGN})
|
||||
if(NOT(${platform}))
|
||||
set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endif()
|
||||
source_group("${name}\\Source Files" FILES ${ARGN})
|
||||
list(APPEND ${out} ${ARGN})
|
||||
if(NOT(${platform}))
|
||||
set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(POCO_SOURCES out name)
|
||||
POCO_SOURCES_PLAT( ${out} ${name} ON ${ARGN})
|
||||
POCO_SOURCES_PLAT( ${out} ${name} ON ${ARGN})
|
||||
endmacro()
|
||||
|
||||
macro(POCO_SOURCES_AUTO out)
|
||||
POCO_SOURCES_AUTO_PLAT( ${out} ON ${ARGN})
|
||||
POCO_SOURCES_AUTO_PLAT( ${out} ON ${ARGN})
|
||||
endmacro()
|
||||
|
||||
macro(POCO_SOURCES_AUTO_PLAT out platform)
|
||||
foreach(f ${ARGN})
|
||||
get_filename_component(fname ${f} NAME)
|
||||
foreach(f ${ARGN})
|
||||
get_filename_component(fname ${f} NAME)
|
||||
|
||||
# Read the package name from the source file
|
||||
file(STRINGS ${f} package REGEX "// Package: (.*)")
|
||||
if(package)
|
||||
string(REGEX REPLACE ".*: (.*)" "\\1" name ${package})
|
||||
# Read the package name from the source file
|
||||
file(STRINGS ${f} package REGEX "// Package: (.*)")
|
||||
if(package)
|
||||
string(REGEX REPLACE ".*: (.*)" "\\1" name ${package})
|
||||
|
||||
# Files of the Form X_UNIX.cpp are treated as headers
|
||||
if(${fname} MATCHES ".*_.*\\..*")
|
||||
#message(STATUS "Platform: ${name} ${f} ${platform}")
|
||||
POCO_SOURCES_PLAT( ${out} ${name} OFF ${f})
|
||||
else()
|
||||
#message(STATUS "Source: ${name} ${f} ${platform}")
|
||||
POCO_SOURCES_PLAT( ${out} ${name} ${platform} ${f})
|
||||
endif()
|
||||
else()
|
||||
#message(STATUS "Source: Unknown ${f} ${platform}")
|
||||
POCO_SOURCES_PLAT( ${out} Unknown ${platform} ${f})
|
||||
endif()
|
||||
endforeach()
|
||||
# Files of the Form X_UNIX.cpp are treated as headers
|
||||
if(${fname} MATCHES ".*_.*\\..*")
|
||||
#message(STATUS "Platform: ${name} ${f} ${platform}")
|
||||
POCO_SOURCES_PLAT( ${out} ${name} OFF ${f})
|
||||
else()
|
||||
#message(STATUS "Source: ${name} ${f} ${platform}")
|
||||
POCO_SOURCES_PLAT( ${out} ${name} ${platform} ${f})
|
||||
endif()
|
||||
else()
|
||||
#message(STATUS "Source: Unknown ${f} ${platform}")
|
||||
POCO_SOURCES_PLAT( ${out} Unknown ${platform} ${f})
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
macro(POCO_HEADERS_AUTO out)
|
||||
foreach(f ${ARGN})
|
||||
get_filename_component(fname ${f} NAME)
|
||||
foreach(f ${ARGN})
|
||||
get_filename_component(fname ${f} NAME)
|
||||
|
||||
# Read the package name from the source file
|
||||
file(STRINGS ${f} package REGEX "// Package: (.*)")
|
||||
if(package)
|
||||
string(REGEX REPLACE ".*: (.*)" "\\1" name ${package})
|
||||
#message(STATUS "Header: ${name} ${f}")
|
||||
POCO_HEADERS( ${out} ${name} ${f})
|
||||
else()
|
||||
#message(STATUS "Header: Unknown ${f}")
|
||||
POCO_HEADERS( ${out} Unknown ${f})
|
||||
endif()
|
||||
endforeach()
|
||||
# Read the package name from the source file
|
||||
file(STRINGS ${f} package REGEX "// Package: (.*)")
|
||||
if(package)
|
||||
string(REGEX REPLACE ".*: (.*)" "\\1" name ${package})
|
||||
#message(STATUS "Header: ${name} ${f}")
|
||||
POCO_HEADERS( ${out} ${name} ${f})
|
||||
else()
|
||||
#message(STATUS "Header: Unknown ${f}")
|
||||
POCO_HEADERS( ${out} Unknown ${f})
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
macro(POCO_HEADERS out name)
|
||||
set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
source_group("${name}\\Header Files" FILES ${ARGN})
|
||||
list(APPEND ${out} ${ARGN})
|
||||
set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
source_group("${name}\\Header Files" FILES ${ARGN})
|
||||
list(APPEND ${out} ${ARGN})
|
||||
endmacro()
|
||||
|
||||
macro(POCO_MESSAGES out name)
|
||||
if(WIN32)
|
||||
foreach(msg ${ARGN})
|
||||
get_filename_component(msg_name ${msg} NAME)
|
||||
get_filename_component(msg_path ${msg} ABSOLUTE)
|
||||
string(REPLACE ".mc" ".h" hdr ${msg_name})
|
||||
set_source_files_properties(${hdr} PROPERTIES GENERATED TRUE)
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${hdr}
|
||||
DEPENDS ${msg}
|
||||
COMMAND ${CMAKE_MC_COMPILER}
|
||||
ARGS
|
||||
-h ${CMAKE_CURRENT_BINARY_DIR}
|
||||
-r ${CMAKE_CURRENT_BINARY_DIR}
|
||||
${msg_path}
|
||||
VERBATIM # recommended: p260
|
||||
)
|
||||
if(WIN32)
|
||||
foreach(msg ${ARGN})
|
||||
get_filename_component(msg_name ${msg} NAME)
|
||||
get_filename_component(msg_path ${msg} ABSOLUTE)
|
||||
string(REPLACE ".mc" ".h" hdr ${msg_name})
|
||||
set_source_files_properties(${hdr} PROPERTIES GENERATED TRUE)
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${hdr}
|
||||
DEPENDS ${msg}
|
||||
COMMAND ${CMAKE_MC_COMPILER}
|
||||
ARGS
|
||||
-h ${CMAKE_CURRENT_BINARY_DIR}
|
||||
-r ${CMAKE_CURRENT_BINARY_DIR}
|
||||
${msg_path}
|
||||
VERBATIM # recommended: p260
|
||||
)
|
||||
|
||||
# Add the generated file to the include directory
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
# Add the generated file to the include directory
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
# Add the generated headers to POCO_HEADERS of the component
|
||||
POCO_HEADERS( ${out} ${name} ${CMAKE_CURRENT_BINARY_DIR}/${hdr})
|
||||
# Add the generated headers to POCO_HEADERS of the component
|
||||
POCO_HEADERS( ${out} ${name} ${CMAKE_CURRENT_BINARY_DIR}/${hdr})
|
||||
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
source_group("${name}\\Message Files" FILES ${ARGN})
|
||||
list(APPEND ${out} ${ARGN})
|
||||
set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
source_group("${name}\\Message Files" FILES ${ARGN})
|
||||
list(APPEND ${out} ${ARGN})
|
||||
|
||||
endif(WIN32)
|
||||
endif(WIN32)
|
||||
endmacro()
|
||||
|
||||
#===============================================================================
|
||||
# Macros for Package generation
|
||||
#
|
||||
# POCO_GENERATE_PACKAGE - Generates *Config.cmake
|
||||
# Usage: POCO_GENERATE_PACKAGE(target_name)
|
||||
# INPUT:
|
||||
# target_name the name of the target. e.g. Foundation for PocoFoundation
|
||||
# Example: POCO_GENERATE_PACKAGE(Foundation)
|
||||
# Usage: POCO_GENERATE_PACKAGE(target_name)
|
||||
# INPUT:
|
||||
# target_name the name of the target. e.g. Foundation for PocoFoundation
|
||||
# Example: POCO_GENERATE_PACKAGE(Foundation)
|
||||
macro(POCO_GENERATE_PACKAGE target_name)
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
@ -214,18 +214,25 @@ if("${CMAKE_VERSION}" VERSION_LESS "3.0.0")
|
||||
export(TARGETS "${target_name}" APPEND
|
||||
FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake"
|
||||
NAMESPACE "${PROJECT_NAME}::"
|
||||
)
|
||||
endif()
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
export(EXPORT "${target_name}Targets"
|
||||
FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake"
|
||||
NAMESPACE "${PROJECT_NAME}::"
|
||||
)
|
||||
)
|
||||
endif()
|
||||
configure_file("cmake/Poco${target_name}Config.cmake"
|
||||
if("${target_name}" STREQUAL "CppUnit")
|
||||
configure_file("cmake/${target_name}Config.cmake"
|
||||
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake"
|
||||
@ONLY
|
||||
)
|
||||
)
|
||||
else()
|
||||
configure_file("cmake/Poco${target_name}Config.cmake"
|
||||
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake"
|
||||
@ONLY
|
||||
)
|
||||
endif()
|
||||
|
||||
# Set config script install location in a location that find_package() will
|
||||
# look for, which is different on MS Windows than for UNIX
|
||||
@ -237,18 +244,18 @@ else()
|
||||
endif()
|
||||
|
||||
install(
|
||||
EXPORT "${target_name}Targets"
|
||||
FILE "${PROJECT_NAME}${target_name}Targets.cmake"
|
||||
NAMESPACE "${PROJECT_NAME}::"
|
||||
DESTINATION "${PocoConfigPackageLocation}"
|
||||
EXPORT "${target_name}Targets"
|
||||
FILE "${PROJECT_NAME}${target_name}Targets.cmake"
|
||||
NAMESPACE "${PROJECT_NAME}::"
|
||||
DESTINATION "${PocoConfigPackageLocation}"
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake"
|
||||
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}ConfigVersion.cmake"
|
||||
DESTINATION "${PocoConfigPackageLocation}"
|
||||
COMPONENT Devel
|
||||
FILES
|
||||
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake"
|
||||
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}ConfigVersion.cmake"
|
||||
DESTINATION "${PocoConfigPackageLocation}"
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
endmacro()
|
||||
@ -257,25 +264,25 @@ endmacro()
|
||||
# Macros for simplified installation
|
||||
#
|
||||
# POCO_INSTALL - Install the given target
|
||||
# Usage: POCO_INSTALL(target_name)
|
||||
# INPUT:
|
||||
# target_name the name of the target. e.g. Foundation for PocoFoundation
|
||||
# Example: POCO_INSTALL(Foundation)
|
||||
# Usage: POCO_INSTALL(target_name)
|
||||
# INPUT:
|
||||
# target_name the name of the target. e.g. Foundation for PocoFoundation
|
||||
# Example: POCO_INSTALL(Foundation)
|
||||
macro(POCO_INSTALL target_name)
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${target_name}" EXPORT "${target_name}Targets"
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
TARGETS "${target_name}" EXPORT "${target_name}Targets"
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
@ -286,20 +293,20 @@ endif()
|
||||
endmacro()
|
||||
|
||||
# POCO_INSTALL_PDB - Install the given target's companion pdb file (if present)
|
||||
# Usage: POCO_INSTALL_PDB(target_name)
|
||||
# INPUT:
|
||||
# target_name the name of the target. e.g. Foundation for PocoFoundation
|
||||
# Example: POCO_INSTALL_PDB(Foundation)
|
||||
# Usage: POCO_INSTALL_PDB(target_name)
|
||||
# INPUT:
|
||||
# target_name the name of the target. e.g. Foundation for PocoFoundation
|
||||
# Example: POCO_INSTALL_PDB(Foundation)
|
||||
#
|
||||
# This is an internal macro meant only to be used by POCO_INSTALL.
|
||||
# This is an internal macro meant only to be used by POCO_INSTALL.
|
||||
macro(POCO_INSTALL_PDB target_name)
|
||||
get_property(type TARGET ${target_name} PROPERTY TYPE)
|
||||
if("${type}" STREQUAL "SHARED_LIBRARY" OR "${type}" STREQUAL "EXECUTABLE")
|
||||
install(
|
||||
FILES $<TARGET_PDB_FILE:${target_name}>
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT Devel
|
||||
OPTIONAL
|
||||
)
|
||||
get_property(type TARGET ${target_name} PROPERTY TYPE)
|
||||
if("${type}" STREQUAL "SHARED_LIBRARY" OR "${type}" STREQUAL "EXECUTABLE")
|
||||
install(
|
||||
FILES $<TARGET_PDB_FILE:${target_name}>
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT Devel
|
||||
OPTIONAL
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
||||
|
@ -389,6 +389,7 @@ Here an overview of POCO build options:
|
||||
* ENABLE_PAGECOMPILER_FILE2PAGE Set to OFF|ON (default is ON) to build File2Page
|
||||
* ENABLE_POCODOC Set to OFF|ON (default is OFF) to build Poco Documentation Generator
|
||||
* ENABLE_TESTS Set to OFF|ON (default is OFF) to build Unit tests
|
||||
* ENABLE_SAMPLES Set to OFF|ON (default is OFF) to build samples
|
||||
* ENABLE_LONG_RUNNING_TESTS Set to OFF|ON (default is ON) to use long running test
|
||||
* POCO_UNBUNDLED Set to OFF|ON (default is OFF) to control linking dependencies as external
|
||||
|
||||
|
@ -1,20 +1,32 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Script to rebuild a library and dependencies
|
||||
# Script to rebuild libraries and dependencies
|
||||
# (with or without a sanitizer) and run the tests.
|
||||
# Currently works only for top-level libs
|
||||
# dependent on Foundation only.
|
||||
#
|
||||
# Usage: ./runLibTests.sh library [address | undefined | thread ]
|
||||
# The use case of the script is mainly for development purposes -
|
||||
# to clean and rebuild a single library, with all of its dependencies,
|
||||
# and run the tests.
|
||||
#
|
||||
# Usage: ./runLibTests.sh library [address | undefined | thread ]
|
||||
#
|
||||
# Example: ./runLibTests.sh Data/SQLite address
|
||||
# (distcleans, rebuilds and runs tests for Data/SQLite with address sanitizer)
|
||||
#
|
||||
|
||||
library=$1
|
||||
if [ -z "${library}" ]; then
|
||||
# g++ does not like empty quoted arguments, but
|
||||
# the shellcheck wants them quoted to remain quiet
|
||||
# shellcheck disable=SC2086
|
||||
|
||||
path=$1
|
||||
if [ -z "${path}" ]; then
|
||||
echo "Library not specified"
|
||||
echo "Usage: $0 library [address | undefined | thread ]"
|
||||
echo "Usage: $0 path [address | undefined | thread ]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
libraries=
|
||||
IFS='/' read -r -a libraries <<< "$path"
|
||||
|
||||
self="${BASH_SOURCE[0]}"
|
||||
|
||||
if [ -d "$self" ] ; then
|
||||
@ -27,30 +39,41 @@ fi
|
||||
. "$basedir"/poco_env.bash
|
||||
|
||||
flag=$2
|
||||
|
||||
make distclean -C CppUnit
|
||||
make distclean -C Foundation
|
||||
if [[ "$library" != "Foundation" ]]; then
|
||||
make distclean -C "$library"
|
||||
fi
|
||||
make distclean -C "$library"/testsuite
|
||||
|
||||
flags=
|
||||
if [ -n "${flag}" ]; then
|
||||
make -s -j4 -C "$POCO_BASE"/CppUnit SANITIZEFLAGS+=-fsanitize="$flag"
|
||||
make -s -j4 -C "$POCO_BASE"/Foundation SANITIZEFLAGS+=-fsanitize="$flag"
|
||||
if [[ "$library" != "Foundation" ]]; then
|
||||
make -s -j4 -C "$POCO_BASE"/"$library" SANITIZEFLAGS+=-fsanitize="$flag"
|
||||
fi
|
||||
make -s -j4 -C "$POCO_BASE"/"$library"/testsuite SANITIZEFLAGS+=-fsanitize="$flag"
|
||||
else
|
||||
make -s -j4 -C "$POCO_BASE"/CppUnit
|
||||
make -s -j4 -C "$POCO_BASE"/Foundation
|
||||
if [[ "$library" != "Foundation" ]]; then
|
||||
make -s -j4 -C "$POCO_BASE"/"$library"
|
||||
fi
|
||||
make -s -j4 -C "$POCO_BASE"/"$library"/testsuite
|
||||
flags=SANITIZEFLAGS+=-fsanitize="$flag"
|
||||
fi
|
||||
|
||||
cd "$basedir"/"$library"/testsuite/bin/"$OSNAME"/"$OSARCH"/ || exit
|
||||
./testrunner -all
|
||||
./testrunnerd -all
|
||||
path="$basedir"/"${libraries[0]}"
|
||||
|
||||
make distclean -C "$basedir"/Foundation
|
||||
make distclean -C "$basedir"/CppUnit
|
||||
|
||||
make -s -j4 -C "$basedir"/Foundation $flags
|
||||
make -s -j4 -C "$basedir"/CppUnit $flags
|
||||
|
||||
# Foundation requested, build/run tests and exit
|
||||
if [[ "$path" == "$basedir"/"Foundation" ]]; then
|
||||
cd "$path/testsuite/" || exit
|
||||
make -s -j4 -C ./ $flags
|
||||
cd "bin/$OSNAME/$OSARCH/" || exit
|
||||
./testrunner -all
|
||||
./testrunnerd -all
|
||||
echo "$path $flags done."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for library in "${libraries[@]}"
|
||||
do
|
||||
cd "$library" || exit
|
||||
make distclean
|
||||
make -s -j4 -C ./ $flags
|
||||
cd testsuite || exit
|
||||
make distclean
|
||||
make -s -j4 -C ./ $flags
|
||||
cd bin/"$OSNAME"/"$OSARCH"/ || exit
|
||||
./testrunner -all
|
||||
./testrunnerd -all
|
||||
echo "$1 $flags done."
|
||||
cd ../../../../ || exit
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user