mirror of
https://github.com/SOCI/soci.git
synced 2026-04-27 23:02:52 -05:00
Build shared and static libs separately
This commit is contained in:
+26
-43
@@ -22,52 +22,40 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.runner || 'ubuntu-22.04' }}
|
||||
container: ${{ matrix.container }}
|
||||
name: ${{ matrix.name }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
lib_type: [shared, static]
|
||||
# Can't test DB2 as required db2exc package is no longer available after Ubuntu 14.04
|
||||
backend: [sqlite3, postgresql, mysql, firebird, oracle, odbc, empty, valgrind]
|
||||
runner: [ubuntu-22.04]
|
||||
cxxstd: [14]
|
||||
test_release_package: [false]
|
||||
build_examples: [false]
|
||||
include:
|
||||
# Note: the jobs are ordered in the order of decreasing running
|
||||
# time, as this should minimize the total run-time of all jobs.
|
||||
- backend: empty
|
||||
runner: macos-12
|
||||
- backend: postgresql
|
||||
runner: macos-12
|
||||
name: PostgreSQL macOS
|
||||
- backend: sqlite3
|
||||
runner: macos-12
|
||||
- backend: oracle
|
||||
name: Oracle 11
|
||||
no_boost: true
|
||||
- backend: valgrind
|
||||
name: Valgrind
|
||||
- backend: odbc
|
||||
name: ODBC
|
||||
- backend: firebird
|
||||
name: Firebird
|
||||
- backend: postgresql
|
||||
name: PostgreSQL Linux
|
||||
- backend: mysql
|
||||
name: MySQL
|
||||
- backend: sqlite3
|
||||
runner: macos-12
|
||||
name: SQLite3 macOS
|
||||
- backend: sqlite3
|
||||
name: SQLite3 C++17
|
||||
runner: ubuntu-22.04
|
||||
- name: SQLite3 Cxx17
|
||||
backend: sqlite3
|
||||
cxxstd: 17
|
||||
- backend: sqlite3
|
||||
name: SQLite3
|
||||
- backend: empty
|
||||
runner: macos-12
|
||||
name: Empty macOS
|
||||
- backend: empty
|
||||
name: Empty
|
||||
runner: ubuntu-22.04
|
||||
- name: Release package
|
||||
backend: empty
|
||||
test_release_package: true
|
||||
# Unsupported: db2exc package is only available in Ubuntu 14.04 not
|
||||
# supported by GitHub Actions any longer, we'd need to run it in
|
||||
# Docker container if we really need it.
|
||||
# backend: db2
|
||||
- backend: empty
|
||||
name: Examples
|
||||
runner: ubuntu-22.04
|
||||
- name: Examples
|
||||
backend: empty
|
||||
build_examples: true
|
||||
runner: ubuntu-22.04
|
||||
|
||||
runs-on: ${{ matrix.runner }}
|
||||
|
||||
env:
|
||||
SOCI_CI: true
|
||||
@@ -118,14 +106,6 @@ jobs:
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${{matrix.container}}" in
|
||||
ubuntu:18.04)
|
||||
# We need to use this option as GitHub certificate is not recognized by
|
||||
# wget in this old container otherwise.
|
||||
set_env_var SOCI_WGET_OPTIONS --no-check-certificate
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "${{matrix.cxxstd}}" ]; then
|
||||
set_env_var SOCI_CXXSTD ${{matrix.cxxstd}}
|
||||
fi
|
||||
@@ -138,6 +118,9 @@ jobs:
|
||||
if [ "${{matrix.build_examples}}" = true ]; then
|
||||
set_env_var BUILD_EXAMPLES YES
|
||||
fi
|
||||
if [ "${{matrix.lib_type}}" = "static" ]; then
|
||||
set_env_var SOCI_BUILD_STATIC YES
|
||||
fi
|
||||
|
||||
- name: Install dependencies under Linux
|
||||
if: runner.os == 'Linux'
|
||||
|
||||
+11
-7
@@ -27,8 +27,13 @@ include(CheckCXXCompilerFlag)
|
||||
|
||||
check_ipo_supported(RESULT LTO_AVAILABLE)
|
||||
|
||||
option(SOCI_SHARED "Enable building SOCI as a shared library" ON)
|
||||
option(SOCI_STATIC "Enable building SOCI as a static library" ON)
|
||||
if (SOCI_STATIC)
|
||||
set(SHARED_DEFAULT OFF)
|
||||
else()
|
||||
set(SHARED_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
option(SOCI_SHARED "Enable building SOCI as a shared library" ${SHARED_DEFAULT})
|
||||
option(SOCI_TESTS "Enable building SOCI test cases" ${PROJECT_IS_TOP_LEVEL})
|
||||
option(SOCI_ASAN "Enable building SOCI with enabled address sanitizers" OFF)
|
||||
cmake_dependent_option(SOCI_LTO "Enable link time optimizations in release builds" ON "LTO_AVAILABLE" OFF)
|
||||
@@ -61,11 +66,10 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
# We need a dummy source file to add as sources for libs that otherwise
|
||||
# only consist of object libraries (otherwise some toolchains may complain)
|
||||
set(SOCI_CXX_DUMMY_SOURCE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp")
|
||||
if (NOT EXISTS "${SOCI_CXX_DUMMY_SOURCE}")
|
||||
file(TOUCH "${SOCI_CXX_DUMMY_SOURCE}")
|
||||
if (SOCI_SHARED)
|
||||
set(SOCI_LIB_TYPE "SHARED")
|
||||
else()
|
||||
set(SOCI_LIB_TYPE "STATIC")
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
@@ -63,6 +63,10 @@ if [ -n "${WITH_BOOST}" ]; then
|
||||
SOCI_COMMON_CMAKE_OPTIONS="$SOCI_COMMON_CMAKE_OPTIONS -DWITH_BOOST=${WITH_BOOST}"
|
||||
fi
|
||||
|
||||
if [ -n "${SOCI_BUILD_STATIC}" ]; then
|
||||
SOCI_COMMON_CMAKE_OPTIONS="${SOCI_COMMON_CMAKE_OPTIONS} -DSOCI_SHARED=OFF"
|
||||
fi
|
||||
|
||||
# These options are defaults and used by most builds, but not Valgrind one.
|
||||
SOCI_DEFAULT_CMAKE_OPTIONS="${SOCI_COMMON_CMAKE_OPTIONS}
|
||||
-DSOCI_ASAN=ON
|
||||
|
||||
@@ -1,24 +1,5 @@
|
||||
add_library(soci_shared_interface INTERFACE)
|
||||
add_library(SOCI::shared::soci ALIAS soci_shared_interface)
|
||||
|
||||
add_library(soci_static_interface INTERFACE)
|
||||
add_library(SOCI::static::soci ALIAS soci_static_interface)
|
||||
|
||||
add_library(soci_interface INTERFACE)
|
||||
add_library(SOCI::soci ALIAS soci_interface)
|
||||
|
||||
if (SOCI_STATIC AND SOCI_SHARED)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
target_link_libraries(soci_interface INTERFACE SOCI::shared::soci)
|
||||
else()
|
||||
target_link_libraries(soci_interface INTERFACE SOCI::static::soci)
|
||||
endif()
|
||||
elseif(SOCI_STATIC)
|
||||
target_link_libraries(soci_interface INTERFACE SOCI::static::soci)
|
||||
else()
|
||||
target_link_libraries(soci_interface INTERFACE SOCI::shared::soci)
|
||||
endif()
|
||||
|
||||
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(backends)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
include(soci_utils)
|
||||
|
||||
set(SOCI_EMPTY ${PROJECT_IS_TOP_LEVEL} CACHE STRING "Include the 'empty' backend. Can be bool-valued or one of 'Enabled', 'Disabled' and 'AsAvailable'")
|
||||
|
||||
set(SOCI_DB2 "AsAvailable" CACHE STRING "Include the 'DB2' backend. Can be bool-valued or one of 'Enabled', 'Disabled' and 'AsAvailable'")
|
||||
@@ -11,45 +9,6 @@ set(SOCI_POSTGRESQL "AsAvailable" CACHE STRING "Include the 'Postgresql' backend
|
||||
set(SOCI_SQLITE3 "AsAvailable" CACHE STRING "Include the 'SQLite3' backend. Can be bool-valued or one of 'Enabled', 'Disabled' and 'AsAvailable'")
|
||||
|
||||
|
||||
function(soci_backend_objects_to_lib)
|
||||
set(FLAGS "")
|
||||
set(ONE_VAL_OPTIONS "OBJECT_LIB" "SHARED_TARGET_NAME" "STATIC_TARGET_NAME" "ALIAS_NAME")
|
||||
set(MULTI_VAL_OPTIONS "SHARED_DEPS" "STATIC_DEPS")
|
||||
cmake_parse_arguments(SOCI_BACKEND_LIB "${FLAGS}" "${ONE_VAL_OPTIONS}" "${MULTI_VAL_OPTIONS}" ${ARGV})
|
||||
soci_verify_parsed_arguments(
|
||||
PREFIX "SOCI_BACKEND_LIB"
|
||||
FUNCTION_NAME "soci_backend_objects_to_lib"
|
||||
REQUIRED "OBJECT_LIB" "SHARED_TARGET_NAME" "STATIC_TARGET_NAME" "ALIAS_NAME"
|
||||
)
|
||||
|
||||
if (SOCI_SHARED)
|
||||
add_library(${SOCI_BACKEND_LIB_SHARED_TARGET_NAME} SHARED "${SOCI_CXX_DUMMY_SOURCE}")
|
||||
target_link_libraries(${SOCI_BACKEND_LIB_SHARED_TARGET_NAME}
|
||||
PUBLIC
|
||||
${SOCI_BACKEND_LIB_OBJECT_LIB}
|
||||
${SOCI_BACKEND_LIB_SHARED_DEPS}
|
||||
)
|
||||
|
||||
add_library(SOCI::shared::${SOCI_BACKEND_LIB_ALIAS_NAME} ALIAS ${SOCI_BACKEND_LIB_SHARED_TARGET_NAME})
|
||||
|
||||
target_link_libraries(soci_shared_interface INTERFACE SOCI::shared::${SOCI_BACKEND_LIB_ALIAS_NAME})
|
||||
endif()
|
||||
|
||||
if (SOCI_STATIC)
|
||||
add_library(${SOCI_BACKEND_LIB_STATIC_TARGET_NAME} STATIC "${SOCI_CXX_DUMMY_SOURCE}")
|
||||
target_link_libraries(${SOCI_BACKEND_LIB_STATIC_TARGET_NAME}
|
||||
PUBLIC
|
||||
${SOCI_BACKEND_LIB_OBJECT_LIB}
|
||||
${SOCI_BACKEND_LIB_STATIC_DEPS}
|
||||
)
|
||||
|
||||
add_library(SOCI::static::${SOCI_BACKEND_LIB_ALIAS_NAME} ALIAS ${SOCI_BACKEND_LIB_STATIC_TARGET_NAME})
|
||||
|
||||
target_link_libraries(soci_static_interface INTERFACE SOCI::static::${SOCI_BACKEND_LIB_ALIAS_NAME})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
foreach(CURRENT IN ITEMS "db2" "empty" "firebird" "mysql" "odbc" "oracle" "postgresql" "sqlite3")
|
||||
string(TOUPPER "${CURRENT}" CURRENT_UPPER)
|
||||
|
||||
|
||||
@@ -12,34 +12,31 @@ if (NOT DB2_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(soci_db2_interface INTERFACE)
|
||||
target_link_libraries(soci_db2_interface INTERFACE DB2::DB2 soci_core_interface)
|
||||
|
||||
add_library(soci_db2_objects OBJECT
|
||||
"blob.cpp"
|
||||
"factory.cpp"
|
||||
"row-id.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
add_library(soci_db2
|
||||
${SOCI_LIB_TYPE}
|
||||
"blob.cpp"
|
||||
"factory.cpp"
|
||||
"row-id.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
)
|
||||
|
||||
target_link_libraries(soci_db2_objects PUBLIC soci_db2_interface)
|
||||
target_link_libraries(soci_db2
|
||||
PUBLIC
|
||||
DB2::DB2
|
||||
SOCI::Core
|
||||
)
|
||||
|
||||
target_include_directories(soci_db2_objects
|
||||
target_include_directories(soci_db2
|
||||
PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/include/private"
|
||||
"${PROJECT_SOURCE_DIR}/include/soci"
|
||||
)
|
||||
|
||||
soci_backend_objects_to_lib(
|
||||
OBJECT_LIB soci_db2_objects
|
||||
SHARED_TARGET_NAME soci_db2
|
||||
STATIC_TARGET_NAME soci_db2_static
|
||||
ALIAS_NAME DB2
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
add_library(SOCI::DB2 ALIAS soci_db2)
|
||||
|
||||
target_link_libraries(soci_interface INTERFACE SOCI::DB2)
|
||||
|
||||
@@ -1,31 +1,25 @@
|
||||
add_library(soci_empty_interface INTERFACE)
|
||||
target_link_libraries(soci_empty_interface INTERFACE soci_core_interface)
|
||||
|
||||
add_library(soci_empty_objects OBJECT
|
||||
"blob.cpp"
|
||||
"factory.cpp"
|
||||
"row-id.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
add_library(soci_empty
|
||||
${SOCI_LIB_TYPE}
|
||||
"blob.cpp"
|
||||
"factory.cpp"
|
||||
"row-id.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
)
|
||||
|
||||
target_link_libraries(soci_empty_objects PUBLIC soci_empty_interface)
|
||||
target_link_libraries(soci_empty PUBLIC SOCI::Core)
|
||||
|
||||
target_include_directories(soci_empty_objects
|
||||
target_include_directories(soci_empty
|
||||
PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/include/private"
|
||||
"${PROJECT_SOURCE_DIR}/include/soci"
|
||||
)
|
||||
|
||||
soci_backend_objects_to_lib(
|
||||
OBJECT_LIB soci_empty_objects
|
||||
SHARED_TARGET_NAME soci_empty
|
||||
STATIC_TARGET_NAME soci_empty_static
|
||||
ALIAS_NAME Empty
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
add_library(SOCI::Empty ALIAS soci_empty)
|
||||
|
||||
target_link_libraries(soci_interface INTERFACE SOCI::Empty)
|
||||
|
||||
@@ -18,35 +18,32 @@ if (NOT Firebird_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(soci_firebird_interface INTERFACE)
|
||||
target_link_libraries(soci_firebird_interface INTERFACE Firebird::Firebird soci_core_interface)
|
||||
|
||||
add_library(soci_firebird_objects OBJECT
|
||||
"blob.cpp"
|
||||
"common.cpp"
|
||||
"error-firebird.cpp"
|
||||
"factory.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
add_library(soci_firebird
|
||||
${SOCI_LIB_TYPE}
|
||||
"blob.cpp"
|
||||
"common.cpp"
|
||||
"error-firebird.cpp"
|
||||
"factory.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
)
|
||||
|
||||
target_link_libraries(soci_firebird_objects PUBLIC Firebird::Firebird soci_firebird_interface)
|
||||
target_link_libraries(soci_firebird
|
||||
PUBLIC
|
||||
Firebird::Firebird
|
||||
SOCI::Core
|
||||
)
|
||||
|
||||
target_include_directories(soci_firebird_objects
|
||||
target_include_directories(soci_firebird
|
||||
PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/include/private"
|
||||
"${PROJECT_SOURCE_DIR}/include/soci"
|
||||
)
|
||||
|
||||
soci_backend_objects_to_lib(
|
||||
OBJECT_LIB soci_firebird_objects
|
||||
SHARED_TARGET_NAME soci_firebird
|
||||
STATIC_TARGET_NAME soci_firebird_static
|
||||
ALIAS_NAME Firebird
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
add_library(SOCI::Firebird ALIAS soci_firebird)
|
||||
|
||||
target_link_libraries(soci_interface INTERFACE SOCI::Firebird)
|
||||
|
||||
@@ -12,35 +12,32 @@ if (NOT MySQL_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(soci_mysql_interface INTERFACE)
|
||||
target_link_libraries(soci_mysql_interface INTERFACE MySQL::MySQL soci_core_interface)
|
||||
|
||||
add_library(soci_mysql_objects OBJECT
|
||||
"blob.cpp"
|
||||
"common.cpp"
|
||||
"factory.cpp"
|
||||
"row-id.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
add_library(soci_mysql
|
||||
${SOCI_LIB_TYPE}
|
||||
"blob.cpp"
|
||||
"common.cpp"
|
||||
"factory.cpp"
|
||||
"row-id.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
)
|
||||
|
||||
target_link_libraries(soci_mysql_objects PUBLIC soci_mysql_interface)
|
||||
target_link_libraries(soci_mysql
|
||||
PUBLIC
|
||||
MySQL::MySQL
|
||||
SOCI::Core
|
||||
)
|
||||
|
||||
target_include_directories(soci_mysql_objects
|
||||
target_include_directories(soci_mysql
|
||||
PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/include/private"
|
||||
"${PROJECT_SOURCE_DIR}/include/soci"
|
||||
)
|
||||
|
||||
soci_backend_objects_to_lib(
|
||||
OBJECT_LIB soci_mysql_objects
|
||||
SHARED_TARGET_NAME soci_mysql
|
||||
STATIC_TARGET_NAME soci_mysql_static
|
||||
ALIAS_NAME MySQL
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
add_library(SOCI::MySQL ALIAS soci_mysql)
|
||||
|
||||
target_link_libraries(soci_interface INTERFACE SOCI::MySQL)
|
||||
|
||||
@@ -12,34 +12,31 @@ if (NOT ODBC_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(soci_odbc_interface INTERFACE)
|
||||
target_link_libraries(soci_odbc_interface INTERFACE ODBC::ODBC soci_core_interface)
|
||||
|
||||
add_library(soci_odbc_objects OBJECT
|
||||
"blob.cpp"
|
||||
"factory.cpp"
|
||||
"row-id.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
add_library(soci_odbc
|
||||
${SOCI_LIB_TYPE}
|
||||
"blob.cpp"
|
||||
"factory.cpp"
|
||||
"row-id.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
)
|
||||
|
||||
target_link_libraries(soci_odbc_objects PUBLIC soci_odbc_interface)
|
||||
target_link_libraries(soci_odbc
|
||||
PUBLIC
|
||||
ODBC::ODBC
|
||||
SOCI::Core
|
||||
)
|
||||
|
||||
target_include_directories(soci_odbc_objects
|
||||
target_include_directories(soci_odbc
|
||||
PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/include/private"
|
||||
"${PROJECT_SOURCE_DIR}/include/soci"
|
||||
)
|
||||
|
||||
soci_backend_objects_to_lib(
|
||||
OBJECT_LIB soci_odbc_objects
|
||||
SHARED_TARGET_NAME soci_odbc
|
||||
STATIC_TARGET_NAME soci_odbc_static
|
||||
ALIAS_NAME ODBC
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
add_library(SOCI::ODBC ALIAS soci_odbc)
|
||||
|
||||
target_link_libraries(soci_interface INTERFACE SOCI::ODBC)
|
||||
|
||||
@@ -12,35 +12,31 @@ if (NOT Oracle_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(soci_oracle_interface INTERFACE)
|
||||
target_link_libraries(soci_oracle_interface INTERFACE Oracle::Oracle soci_core_interface)
|
||||
|
||||
add_library(soci_oracle_objects OBJECT
|
||||
"blob.cpp"
|
||||
"error.cpp"
|
||||
"factory.cpp"
|
||||
"row-id.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
add_library(soci_oracle
|
||||
${SOCI_LIB_TYPE}
|
||||
"blob.cpp"
|
||||
"error.cpp"
|
||||
"factory.cpp"
|
||||
"row-id.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
)
|
||||
target_link_libraries(soci_oracle
|
||||
PUBLIC
|
||||
Oracle::Oracle
|
||||
SOCI::Core
|
||||
)
|
||||
|
||||
target_link_libraries(soci_oracle_objects PUBLIC soci_oracle_interface)
|
||||
|
||||
target_include_directories(soci_oracle_objects
|
||||
target_include_directories(soci_oracle
|
||||
PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/include/private"
|
||||
"${PROJECT_SOURCE_DIR}/include/soci"
|
||||
)
|
||||
|
||||
soci_backend_objects_to_lib(
|
||||
OBJECT_LIB soci_oracle_objects
|
||||
SHARED_TARGET_NAME soci_oracle
|
||||
STATIC_TARGET_NAME soci_oracle_static
|
||||
ALIAS_NAME Oracle
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
add_library(SOCI::Oracle ALIAS soci_oracle)
|
||||
|
||||
target_link_libraries(soci_interface INTERFACE SOCI::Oracle)
|
||||
|
||||
@@ -20,39 +20,35 @@ if (POSTGRESQL_VERSION VERSION_LESS "9.3.0")
|
||||
set(SOCI_POSTGRESQL_NO_LO64 ON CACHE BOOL "Avoid using lo_xxx64() functions" FORCE)
|
||||
endif()
|
||||
|
||||
add_library(soci_postgresql_interface INTERFACE)
|
||||
target_link_libraries(soci_postgresql_interface INTERFACE PostgreSQL::PostgreSQL soci_core_interface)
|
||||
|
||||
add_library(soci_postgresql_objects OBJECT
|
||||
"blob.cpp"
|
||||
"error.cpp"
|
||||
"factory.cpp"
|
||||
"row-id.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
add_library(soci_postgresql
|
||||
${SOCI_LIB_TYPE}
|
||||
"blob.cpp"
|
||||
"error.cpp"
|
||||
"factory.cpp"
|
||||
"row-id.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
)
|
||||
|
||||
target_link_libraries(soci_postgresql_objects PUBLIC soci_postgresql_interface)
|
||||
target_link_libraries(soci_postgresql
|
||||
PUBLIC
|
||||
PostgreSQL::PostgreSQL
|
||||
SOCI::Core
|
||||
)
|
||||
|
||||
target_include_directories(soci_postgresql_objects
|
||||
target_include_directories(soci_postgresql
|
||||
PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/include/private"
|
||||
"${PROJECT_SOURCE_DIR}/include/soci"
|
||||
)
|
||||
|
||||
soci_backend_objects_to_lib(
|
||||
OBJECT_LIB soci_postgresql_objects
|
||||
SHARED_TARGET_NAME soci_postgresql
|
||||
STATIC_TARGET_NAME soci_postgresql_static
|
||||
ALIAS_NAME PostgreSQL
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
if (SOCI_POSTGRESQL_NO_LO64)
|
||||
target_compile_definitions(soci_postgresql INTERFACE SOCI_POSTGRESQL_NO_LO64)
|
||||
target_compile_definitions(soci_postgresql_static INTERFACE SOCI_POSTGRESQL_NO_LO64)
|
||||
endif()
|
||||
target_compile_definitions(soci_postgresql INTERFACE SOCI_POSTGRESQL_NO_LO64)
|
||||
|
||||
add_library(SOCI::PostgreSQL ALIAS soci_postgresql)
|
||||
|
||||
target_link_libraries(soci_interface INTERFACE SOCI::PostgreSQL)
|
||||
|
||||
|
||||
@@ -12,35 +12,31 @@ if (NOT SQLite3_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(soci_sqlite3_interface INTERFACE)
|
||||
target_link_libraries(soci_sqlite3_interface INTERFACE SQLite::SQLite3 soci_core_interface)
|
||||
|
||||
add_library(soci_sqlite3_objects OBJECT
|
||||
"blob.cpp"
|
||||
"error.cpp"
|
||||
"factory.cpp"
|
||||
"row-id.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
add_library(soci_sqlite3
|
||||
${SOCI_LIB_TYPE}
|
||||
"blob.cpp"
|
||||
"error.cpp"
|
||||
"factory.cpp"
|
||||
"row-id.cpp"
|
||||
"session.cpp"
|
||||
"standard-into-type.cpp"
|
||||
"standard-use-type.cpp"
|
||||
"statement.cpp"
|
||||
"vector-into-type.cpp"
|
||||
"vector-use-type.cpp"
|
||||
)
|
||||
|
||||
target_link_libraries(soci_sqlite3_objects PUBLIC soci_sqlite3_interface)
|
||||
target_link_libraries(soci_sqlite3
|
||||
PUBLIC
|
||||
SQLite::SQLite3 SOCI::Core
|
||||
)
|
||||
|
||||
target_include_directories(soci_sqlite3_objects
|
||||
target_include_directories(soci_sqlite3
|
||||
PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/include/private"
|
||||
"${PROJECT_SOURCE_DIR}/include/soci"
|
||||
)
|
||||
|
||||
soci_backend_objects_to_lib(
|
||||
OBJECT_LIB soci_sqlite3_objects
|
||||
SHARED_TARGET_NAME soci_sqlite3
|
||||
STATIC_TARGET_NAME soci_sqlite3_static
|
||||
ALIAS_NAME SQLite3
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
add_library(SOCI::SQLite3 ALIAS soci_sqlite3)
|
||||
|
||||
target_link_libraries(soci_interface INTERFACE SOCI::SQLite3)
|
||||
|
||||
+48
-61
@@ -14,74 +14,73 @@ check_cxx_source_compiles(
|
||||
# TODO: Actually populate this config file with something useful
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/soci-config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/include/soci/soci-config.h")
|
||||
|
||||
add_library(soci_core_interface INTERFACE)
|
||||
target_include_directories(soci_core_interface
|
||||
INTERFACE
|
||||
add_library(soci_core
|
||||
${SOCI_LIB_TYPE}
|
||||
"backend-loader.cpp"
|
||||
"blob.cpp"
|
||||
"common.cpp"
|
||||
"connection-parameters.cpp"
|
||||
"connection-pool.cpp"
|
||||
"error.cpp"
|
||||
"into-type.cpp"
|
||||
"logger.cpp"
|
||||
"once-temp-type.cpp"
|
||||
"prepare-temp-type.cpp"
|
||||
"procedure.cpp"
|
||||
"ref-counted-prepare-info.cpp"
|
||||
"ref-counted-statement.cpp"
|
||||
"row.cpp"
|
||||
"rowid.cpp"
|
||||
"session.cpp"
|
||||
"soci-simple.cpp"
|
||||
"statement.cpp"
|
||||
"transaction.cpp"
|
||||
"use-type.cpp"
|
||||
"values.cpp"
|
||||
)
|
||||
add_library(SOCI::Core ALIAS soci_core)
|
||||
|
||||
target_include_directories(soci_core
|
||||
PUBLIC
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/include"
|
||||
"${PROJECT_SOURCE_DIR}/include"
|
||||
)
|
||||
target_compile_definitions(soci_core_interface
|
||||
INTERFACE
|
||||
# Define the macro SOCI_DLL on Windows
|
||||
$<IF:$<PLATFORM_ID:Windows>,SOCI_DLL,>
|
||||
PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/include/soci"
|
||||
"${PROJECT_SOURCE_DIR}/include/private"
|
||||
)
|
||||
|
||||
if (SOCI_VISIBILITY AND SOCI_VISIBILITY_ATTRIBUTE_SUPPORTED)
|
||||
target_compile_definitions(soci_core_interface
|
||||
INTERFACE
|
||||
if (SOCI_SHARED)
|
||||
target_compile_definitions(soci_core
|
||||
PUBLIC
|
||||
# Define the macro SOCI_DLL on Windows
|
||||
$<IF:$<PLATFORM_ID:Windows>,SOCI_DLL,>
|
||||
)
|
||||
endif()
|
||||
|
||||
if (SOCI_SHARED AND SOCI_VISIBILITY AND SOCI_VISIBILITY_ATTRIBUTE_SUPPORTED)
|
||||
target_compile_definitions(soci_core
|
||||
PUBLIC
|
||||
SOCI_HAVE_VISIBILITY_SUPPORT
|
||||
)
|
||||
endif()
|
||||
|
||||
if (SOCI_BOOST)
|
||||
find_package(Boost REQUIRED)
|
||||
target_link_libraries(soci_core_interface INTERFACE Boost::boost)
|
||||
target_compile_definitions(soci_core_interface INTERFACE SOCI_HAVE_BOOST)
|
||||
target_link_libraries(soci_core PUBLIC Boost::boost)
|
||||
target_compile_definitions(soci_core PUBLIC SOCI_HAVE_BOOST)
|
||||
|
||||
if (TARGET Boost::date_time)
|
||||
target_link_libraries(soci_core_interface INTERFACE Boost::date_time)
|
||||
target_compile_definitions(soci_core_interface INTERFACE SOCI_HAVE_BOOST_DATE_TIME)
|
||||
target_link_libraries(soci_core PUBLIC Boost::date_time)
|
||||
target_compile_definitions(soci_core PUBLIC SOCI_HAVE_BOOST_DATE_TIME)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(soci_core_objects OBJECT
|
||||
"backend-loader.cpp"
|
||||
"blob.cpp"
|
||||
"common.cpp"
|
||||
"connection-parameters.cpp"
|
||||
"connection-pool.cpp"
|
||||
"error.cpp"
|
||||
"into-type.cpp"
|
||||
"logger.cpp"
|
||||
"once-temp-type.cpp"
|
||||
"prepare-temp-type.cpp"
|
||||
"procedure.cpp"
|
||||
"ref-counted-prepare-info.cpp"
|
||||
"ref-counted-statement.cpp"
|
||||
"row.cpp"
|
||||
"rowid.cpp"
|
||||
"session.cpp"
|
||||
"soci-simple.cpp"
|
||||
"statement.cpp"
|
||||
"transaction.cpp"
|
||||
"use-type.cpp"
|
||||
"values.cpp"
|
||||
)
|
||||
|
||||
target_link_libraries(soci_core_objects
|
||||
PUBLIC
|
||||
soci_core_interface
|
||||
target_link_libraries(soci_core
|
||||
PRIVATE
|
||||
Threads::Threads
|
||||
)
|
||||
|
||||
target_include_directories(soci_core_objects
|
||||
PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/include/soci"
|
||||
"${PROJECT_SOURCE_DIR}/include/private"
|
||||
)
|
||||
|
||||
target_compile_definitions(soci_core_objects
|
||||
target_compile_definitions(soci_core
|
||||
PRIVATE
|
||||
DEFAULT_BACKENDS_PATH="${CMAKE_INSTALL_FULL_LIBDIR}"
|
||||
# TODO: Configure prefix and suffix properly
|
||||
@@ -89,15 +88,3 @@ target_compile_definitions(soci_core_objects
|
||||
SOCI_LIB_SUFFIX=""
|
||||
)
|
||||
|
||||
if (SOCI_SHARED)
|
||||
add_library(soci_core SHARED)
|
||||
target_link_libraries(soci_core PUBLIC soci_core_objects)
|
||||
add_library(SOCI::shared::Core ALIAS soci_core)
|
||||
target_link_libraries(soci_shared_interface INTERFACE SOCI::shared::core)
|
||||
endif()
|
||||
if (SOCI_STATIC)
|
||||
add_library(soci_core_static STATIC)
|
||||
target_link_libraries(soci_core_static PUBLIC soci_core_objects)
|
||||
add_library(SOCI::static::Core ALIAS soci_core_static)
|
||||
target_link_libraries(soci_static_interface INTERFACE SOCI::static::core)
|
||||
endif()
|
||||
|
||||
+1
-45
@@ -1,55 +1,11 @@
|
||||
include(soci_utils)
|
||||
|
||||
add_library(soci_common_tests STATIC common-tests.cpp)
|
||||
target_include_directories(soci_common_tests
|
||||
PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
)
|
||||
target_link_libraries(soci_common_tests PUBLIC soci_core_interface)
|
||||
target_link_libraries(soci_common_tests PUBLIC SOCI::Core)
|
||||
target_include_directories(soci_common_tests PUBLIC "${PROJECT_SOURCE_DIR}/include/private/")
|
||||
|
||||
|
||||
function(soci_make_tests)
|
||||
set(FLAGS "")
|
||||
set(ONE_VAL_OPTIONS "CONNECTION_STRING" "OBJECT_LIB" "SOCI_DEP_ALIAS" "SHARED_NAME" "STATIC_NAME")
|
||||
set(MULTI_VAL_OPTIONS "")
|
||||
cmake_parse_arguments(SOCI_MAKE_TESTS "${FLAGS}" "${ONE_VAL_OPTIONS}" "${MULTI_VAL_OPTIONS}" ${ARGV})
|
||||
soci_verify_parsed_arguments(
|
||||
PREFIX "SOCI_MAKE_TESTS"
|
||||
FUNCTION_NAME "soci_make_tests"
|
||||
REQUIRED "CONNECTION_STRING" "OBJECT_LIB" "SHARED_NAME" "STATIC_NAME"
|
||||
)
|
||||
|
||||
set(CREATED_TESTS "")
|
||||
|
||||
if (SOCI_SHARED)
|
||||
add_executable(${SOCI_MAKE_TESTS_SHARED_NAME} "${SOCI_CXX_DUMMY_SOURCE}")
|
||||
target_link_libraries(${SOCI_MAKE_TESTS_SHARED_NAME} PRIVATE ${SOCI_MAKE_TESTS_OBJECT_LIB})
|
||||
if (SOCI_MAKE_TESTS_SOCI_DEP_ALIAS)
|
||||
target_link_libraries(${SOCI_MAKE_TESTS_SHARED_NAME} PRIVATE SOCI::shared::${SOCI_MAKE_TESTS_SOCI_DEP_ALIAS})
|
||||
endif()
|
||||
|
||||
list(APPEND CREATED_TESTS "${SOCI_MAKE_TESTS_SHARED_NAME}")
|
||||
endif()
|
||||
|
||||
if (SOCI_STATIC)
|
||||
add_executable(${SOCI_MAKE_TESTS_STATIC_NAME} "${SOCI_CXX_DUMMY_SOURCE}")
|
||||
target_link_libraries(${SOCI_MAKE_TESTS_STATIC_NAME} PRIVATE ${SOCI_MAKE_TESTS_OBJECT_LIB})
|
||||
if (SOCI_MAKE_TESTS_SOCI_DEP_ALIAS)
|
||||
target_link_libraries(${SOCI_MAKE_TESTS_STATIC_NAME} PRIVATE SOCI::static::${SOCI_MAKE_TESTS_SOCI_DEP_ALIAS})
|
||||
endif()
|
||||
|
||||
list(APPEND CREATED_TESTS "${SOCI_MAKE_TESTS_STATIC_NAME}")
|
||||
endif()
|
||||
|
||||
foreach (CURRENT IN LISTS CREATED_TESTS)
|
||||
add_test(
|
||||
NAME "${CURRENT}"
|
||||
COMMAND "${CURRENT}" "${SOCI_MAKE_TESTS_CONNECTION_STRING}" "--invisibles"
|
||||
)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
foreach (CURRENT_BACKEND IN ITEMS "db2" "empty" "firebird" "mysql" "odbc" "oracle" "postgresql" "sqlite3")
|
||||
string(TOUPPER "${CURRENT_BACKEND}" CURRENT_BACKEND_UPPER)
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
add_library(db2_tests OBJECT db2_tests.cpp)
|
||||
target_link_libraries(db2_tests PUBLIC soci_common_tests soci_db2_interface)
|
||||
add_executable(soci_db2_tests OBJECT db2_tests.cpp)
|
||||
target_link_libraries(soci_db2_tests PRIVATE soci_common_tests soci_db2_interface)
|
||||
|
||||
set(SOCI_DB2_TEST_CONNSTR "DSN=SAMPLE;Uid=db2inst1;Pwd=db2inst1;autocommit=off" CACHE STRING "The connection string to use for DB2 tests")
|
||||
|
||||
soci_make_tests(
|
||||
OBJECT_LIB db2_tests
|
||||
CONNECTION_STRING "${SOCI_DB2_TEST_CONNSTR}"
|
||||
SHARED_NAME "soci_db2_test"
|
||||
STATIC_NAME "soci_db2_test_static"
|
||||
SOCI_DEP_ALIAS "DB2"
|
||||
add_test(
|
||||
NAME soci_db2_tests
|
||||
COMMAND soci_db2_tests "${SOCI_DB2_TEST_CONNSTR}" "--invisibles"
|
||||
)
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
add_library(empty_tests OBJECT empty_tests.cpp)
|
||||
target_link_libraries(empty_tests PUBLIC soci_empty_interface)
|
||||
target_include_directories(empty_tests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../")
|
||||
add_executable(soci_empty_tests empty_tests.cpp)
|
||||
target_link_libraries(soci_empty_tests PRIVATE SOCI::Empty)
|
||||
target_include_directories(soci_empty_tests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../")
|
||||
|
||||
soci_make_tests(
|
||||
OBJECT_LIB empty_tests
|
||||
CONNECTION_STRING "dummy"
|
||||
SHARED_NAME "soci_empty_test"
|
||||
STATIC_NAME "soci_empty_test_static"
|
||||
SOCI_DEP_ALIAS "Empty"
|
||||
add_test(
|
||||
NAME soci_empty_tests
|
||||
COMMAND soci_empty_tests "--invisibles"
|
||||
)
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
add_library(firebird_tests OBJECT firebird_tests.cpp)
|
||||
target_link_libraries(firebird_tests PUBLIC soci_common_tests soci_firebird_interface)
|
||||
add_executable(soci_firebird_tests firebird_tests.cpp)
|
||||
target_link_libraries(soci_firebird_tests PRIVATE soci_common_tests SOCI::Firebird)
|
||||
|
||||
set(SOCI_FIREBIRD_TEST_CONNSTR "service=/tmp/soci_test.fdb user=SYSDBA password=masterkey" CACHE STRING "The connection string to use for Firebird tests")
|
||||
|
||||
soci_make_tests(
|
||||
OBJECT_LIB firebird_tests
|
||||
CONNECTION_STRING "${SOCI_FIREBIRD_TEST_CONNSTR}"
|
||||
SHARED_NAME "soci_firebird_test"
|
||||
STATIC_NAME "soci_firebird_test_static"
|
||||
SOCI_DEP_ALIAS "Firebird"
|
||||
add_test(
|
||||
NAME soci_firebird_tests
|
||||
COMMAND soci_firebird_tests "${SOCI_FIREBIRD_TEST_CONNSTR}" "--invisibles"
|
||||
)
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
add_library(mysql_tests OBJECT mysql_tests.cpp)
|
||||
target_link_libraries(mysql_tests PUBLIC soci_common_tests soci_mysql_interface)
|
||||
add_executable(soci_mysql_tests mysql_tests.cpp)
|
||||
target_link_libraries(soci_mysql_tests PRIVATE soci_common_tests SOCI::MySQL)
|
||||
|
||||
set(SOCI_MYSQL_TEST_CONNSTR "db=soci_test" CACHE STRING "The connection string to use for MySQL tests")
|
||||
|
||||
soci_make_tests(
|
||||
OBJECT_LIB mysql_tests
|
||||
CONNECTION_STRING "${SOCI_MYSQL_TEST_CONNSTR}"
|
||||
SHARED_NAME "soci_mysql_test"
|
||||
STATIC_NAME "soci_mysql_test_static"
|
||||
SOCI_DEP_ALIAS "MySQL"
|
||||
add_test(
|
||||
NAME soci_mysql_tests
|
||||
COMMAND soci_mysql_tests "${SOCI_MYSQL_TEST_CONNSTR}" "--invisibles"
|
||||
)
|
||||
|
||||
+27
-41
@@ -7,47 +7,38 @@ configure_file("test-mssql.dsn.in" "${CMAKE_CURRENT_BINARY_DIR}/test-mssql.dsn"
|
||||
|
||||
|
||||
if (WIN32)
|
||||
add_library(odbc_ms_access_tests OBJECT odbc_ms_access_tests.cpp)
|
||||
target_link_libraries(odbc_ms_access_tests PUBLIC soci_common_tests soci_odbc_interface)
|
||||
add_executable(soci_odbc_ms_access_tests odbc_ms_access_tests.cpp)
|
||||
target_link_libraries(soci_odbc_ms_access_tests PRIVATE soci_common_tests SOCI::ODBC)
|
||||
|
||||
set(SOCI_ODBC_TEST_ACCESS_CONNSTR "FILEDSN=${CMAKE_CURRENT_BINARY_DIR}/test-access.dsn" CACHE STRING "Connection string for the ODBC MS Access test")
|
||||
|
||||
soci_make_tests(
|
||||
OBJECT_LIB odbc_ms_access_tests
|
||||
CONNECTION_STRING "${SOCI_ODBC_TEST_ACCESS_CONNSTR}"
|
||||
SHARED_NAME "soci_odbc_ms_access_test"
|
||||
STATIC_NAME "soci_odbc_ms_access_test_static"
|
||||
SOCI_DEP_ALIAS "ODBC"
|
||||
add_test(
|
||||
NAME soci_odbc_ms_access_tests
|
||||
COMMAND soci_odbc_ms_access_tests "${SOCI_ODBC_TEST_ACCESS_CONNSTR}" "--invisibles"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
add_library(odbc_mssql_tests OBJECT odbc_mssql_tests.cpp)
|
||||
target_link_libraries(odbc_mssql_tests PUBLIC soci_common_tests soci_odbc_interface)
|
||||
add_executable(soci_odbc_mssql_tests odbc_mssql_tests.cpp)
|
||||
target_link_libraries(soci_odbc_mssql_tests PRIVATE soci_common_tests SOCI::ODBC)
|
||||
|
||||
set(SOCI_ODBC_TEST_MSSQL_CONNSTR "FILEDSN=${CMAKE_CURRENT_BINARY_DIR}/test-access.dsn" CACHE STRING "Connection string for the ODBC MSSQL test")
|
||||
|
||||
soci_make_tests(
|
||||
OBJECT_LIB odbc_mssql_tests
|
||||
CONNECTION_STRING "${SOCI_ODBC_TEST_MSSQL_CONNSTR}"
|
||||
SHARED_NAME "soci_odbc_mssql_test"
|
||||
STATIC_NAME "soci_odbc_mssql_test_static"
|
||||
SOCI_DEP_ALIAS "ODBC"
|
||||
add_test(
|
||||
NAME soci_odbc_mssql_tests
|
||||
COMMAND soci_odbc_mssql_tests "${SOCI_ODBC_TEST_MSSQL_CONNSTR}" "--invisibles"
|
||||
)
|
||||
|
||||
|
||||
add_library(odbc_mysql_tests OBJECT odbc_mysql_tests.cpp)
|
||||
target_link_libraries(odbc_mysql_tests PUBLIC soci_common_tests soci_odbc_interface)
|
||||
target_include_directories(odbc_mysql_tests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../")
|
||||
add_executable(soci_odbc_mysql_tests odbc_mysql_tests.cpp)
|
||||
target_link_libraries(soci_odbc_mysql_tests PRIVATE soci_common_tests SOCI::ODBC)
|
||||
target_include_directories(soci_odbc_mysql_tests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../")
|
||||
|
||||
set(SOCI_ODBC_TEST_MYSQL_CONNSTR "FILEDSN=${CMAKE_CURRENT_SOURCE_DIR}/test-mysql.dsn" CACHE STRING "Connection string for the ODBC MySQL test")
|
||||
|
||||
soci_make_tests(
|
||||
OBJECT_LIB odbc_mysql_tests
|
||||
CONNECTION_STRING "${SOCI_ODBC_TEST_MYSQL_CONNSTR}"
|
||||
SHARED_NAME "soci_odbc_mysql_test"
|
||||
STATIC_NAME "soci_odbc_mysql_test_static"
|
||||
SOCI_DEP_ALIAS "ODBC"
|
||||
add_test(
|
||||
NAME soci_odbc_mysql_tests
|
||||
COMMAND soci_odbc_mysql_tests "${SOCI_ODBC_TEST_MYSQL_CONNSTR}" "--invisibles"
|
||||
)
|
||||
|
||||
|
||||
@@ -57,34 +48,29 @@ else()
|
||||
set(TEST_PGSQL_DSN "test-postgresql.dsn")
|
||||
endif()
|
||||
|
||||
add_library(odbc_postgresql_tests OBJECT odbc_postgresql_tests.cpp)
|
||||
target_link_libraries(odbc_postgresql_tests PUBLIC soci_common_tests soci_odbc_interface)
|
||||
add_executable(soci_odbc_postgresql_tests odbc_postgresql_tests.cpp)
|
||||
target_link_libraries(soci_odbc_postgresql_tests PRIVATE soci_common_tests SOCI::ODBC)
|
||||
|
||||
set(SOCI_ODBC_TEST_POSTGRESQL_CONNSTR "FILEDSN=${CMAKE_CURRENT_SOURCE_DIR}/${TEST_PGSQL_DSN}" CACHE STRING "Connection string for the ODBC PostgreSQL test")
|
||||
|
||||
soci_make_tests(
|
||||
OBJECT_LIB odbc_postgresql_tests
|
||||
CONNECTION_STRING "${SOCI_ODBC_TEST_POSTGRESQL_CONNSTR}"
|
||||
SHARED_NAME "soci_odbc_postgresql_test"
|
||||
STATIC_NAME "soci_odbc_postgresql_test_static"
|
||||
SOCI_DEP_ALIAS "ODBC"
|
||||
add_test(
|
||||
NAME soci_odbc_postgresql_tests
|
||||
COMMAND soci_odbc_postgresql_tests "${SOCI_ODBC_TEST_POSTGRESQL_CONNSTR}" "--invisibles"
|
||||
)
|
||||
|
||||
|
||||
# TODO: DB2 backend is tested by Travis CI on dedicated VM, separate from ODBC,
|
||||
# in order to test DB2 with ODBC, it would be best to install DB2 driver only.
|
||||
# if (NOT $ENV{TRAVIS})
|
||||
option(WITH_ODBC_TEST_DB2 "Build ODBC DB2 test" OFF)
|
||||
if (WITH_ODBC_TEST_DB2)
|
||||
add_library(odbc_db2_tests OBJECT odbc_db2_tests.cpp)
|
||||
target_link_libraries(odbc_db2_tests PUBLIC soci_common_tests soci_odbc_interface)
|
||||
add_executable(soci_odbc_db2_tests odbc_db2_tests.cpp)
|
||||
target_link_libraries(osoci_dbc_db2_tests PRIVATE soci_common_tests SOCI::ODBC)
|
||||
|
||||
set(SOCI_ODBC_TEST_DB2_CONNSTR "FILEDSN=${CMAKE_CURRENT_SOURCE_DIR}/test-db2.dsn" CACHE STRING "Connection string for the ODBC DB2 test")
|
||||
|
||||
soci_make_tests(
|
||||
OBJECT_LIB odbc_db2_tests
|
||||
CONNECTION_STRING "${SOCI_ODBC_TEST_DB2_CONNSTR}"
|
||||
SHARED_NAME "soci_odbc_db2_test"
|
||||
STATIC_NAME "soci_odbc_db2_test_static"
|
||||
SOCI_DEP_ALIAS "ODBC"
|
||||
add_test(
|
||||
NAME soci_odbc_db2_tests
|
||||
COMMAND soci_odbc_db2_tests "${SOCI_ODBC_TEST_DB2_CONNSTR}" "--invisibles"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
add_library(oracle_tests OBJECT oracle_tests.cpp)
|
||||
target_link_libraries(oracle_tests PUBLIC soci_common_tests soci_oracle_interface)
|
||||
add_executable(soci_oracle_tests oracle_tests.cpp)
|
||||
target_link_libraries(soci_oracle_tests PRIVATE soci_common_tests SOCI::Oracle)
|
||||
|
||||
set(SOCI_ORACLE_TEST_CONNSTR "service=orcl user=scott password=tiger" CACHE STRING "The connection string to use for Oracle tests")
|
||||
|
||||
soci_make_tests(
|
||||
OBJECT_LIB oracle_tests
|
||||
CONNECTION_STRING "${SOCI_ORACLE_TEST_CONNSTR}"
|
||||
SHARED_NAME "soci_oracle_test"
|
||||
STATIC_NAME "soci_oracle_test_static"
|
||||
SOCI_DEP_ALIAS "Oracle"
|
||||
add_test(
|
||||
NAME soci_oracle_tests
|
||||
COMMAND soci_oracle_tests "${SOCI_ORACLE_TEST_CONNSTR}" "--invisibles"
|
||||
)
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
add_library(postgresql_tests OBJECT postgresql_tests.cpp)
|
||||
target_link_libraries(postgresql_tests PUBLIC soci_common_tests soci_postgresql_interface)
|
||||
add_executable(soci_postgresql_tests postgresql_tests.cpp)
|
||||
target_link_libraries(soci_postgresql_tests PRIVATE soci_common_tests SOCI::PostgreSQL)
|
||||
|
||||
set(SOCI_POSTGRESQL_TEST_CONNSTR "dbname=soci_test" CACHE STRING "The connection string to use for PostgreSQL tests")
|
||||
|
||||
soci_make_tests(
|
||||
OBJECT_LIB postgresql_tests
|
||||
CONNECTION_STRING "${SOCI_POSTGRESQL_TEST_CONNSTR}"
|
||||
SHARED_NAME "soci_postgresql_test"
|
||||
STATIC_NAME "soci_postgresql_test_static"
|
||||
SOCI_DEP_ALIAS "PostgreSQL"
|
||||
add_test(
|
||||
NAME soci_postgresql_tests
|
||||
COMMAND soci_postgresql_tests "${SOCI_POSTGRESQL_TEST_CONNSTR}" "--invisibles"
|
||||
)
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
add_library(sqlite_tests OBJECT sqlite3_tests.cpp)
|
||||
target_link_libraries(sqlite_tests PUBLIC soci_common_tests soci_sqlite3_interface)
|
||||
add_executable(soci_sqlite3_tests sqlite3_tests.cpp)
|
||||
target_link_libraries(soci_sqlite3_tests PRIVATE soci_common_tests SOCI::SQLite3)
|
||||
|
||||
set(SOCI_SQLITE3_TEST_CONNSTR ":memory:" CACHE STRING "The connection string to use for SQLite3 tests")
|
||||
|
||||
soci_make_tests(
|
||||
OBJECT_LIB sqlite_tests
|
||||
CONNECTION_STRING "${SOCI_SQLITE3_TEST_CONNSTR}"
|
||||
SHARED_NAME "soci_sqlite3_test"
|
||||
STATIC_NAME "soci_sqlite3_test_static"
|
||||
SOCI_DEP_ALIAS "SQLite3"
|
||||
add_test(
|
||||
NAME soci_sqlite3_tests
|
||||
COMMAND soci_sqlite3_tests "${SOCI_SQLITE3_TEST_CONNSTR}" "--invisibles"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user