mysql/CMakeLists.txt
Anarthal (Rubén Pérez) 303b9f0b59
Added benchmarks against the official drivers
Added one_small_row, one_big_row, many_rows, stmt_params benchmarks against libmysqlclient and libmariadb
Added a CI build to compile and run benchmarks
Added a Python script to run the benchmarks
Refactored the connection_pool benchmark to be use data independent from examples

close #458
2025-04-02 11:32:43 +02:00

96 lines
2.8 KiB
CMake

#
# Copyright (c) 2019-2025 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
cmake_minimum_required(VERSION 3.8...3.22)
# Project
project(boost_mysql VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
# Library
add_library(boost_mysql INTERFACE)
add_library(Boost::mysql ALIAS boost_mysql)
# Dependencies. If non-Boost dependencies are not found, we just bail out
find_package(Threads)
if(NOT Threads_FOUND)
message(STATUS "Boost.MySQL has been disabled, because the required package Threads hasn't been found")
return()
endif()
find_package(OpenSSL)
if(NOT OpenSSL_FOUND)
message(STATUS "Boost.MySQL has been disabled, because the required package OpenSSL hasn't been found")
return()
endif()
# This is generated by boostdep.
# Note that Boost::pfr is not listed because it's a peer dependency
target_link_libraries(
boost_mysql
INTERFACE
Boost::asio
Boost::assert
Boost::charconv
Boost::compat
Boost::config
Boost::core
Boost::describe
Boost::endian
Boost::intrusive
Boost::mp11
Boost::optional
Boost::system
Boost::throw_exception
Boost::variant2
Threads::Threads
OpenSSL::Crypto
OpenSSL::SSL
)
# Includes & features
target_include_directories(boost_mysql INTERFACE include)
target_compile_features(boost_mysql INTERFACE cxx_std_11)
# Don't run integration testing unless explicitly requested, since these require a running MySQL server
option(BOOST_MYSQL_INTEGRATION_TESTS OFF "Whether to build and run integration tests or not")
mark_as_advanced(BOOST_MYSQL_INTEGRATION_TESTS)
# List of server features that the CI DB server does not support.
# Disables running some integration tests and examples
set(BOOST_MYSQL_DISABLED_SERVER_FEATURES "" CACHE STRING
"A CMake list of server features not supported by the CI server, for integration tests"
)
mark_as_advanced(BOOST_MYSQL_DISABLED_SERVER_FEATURES)
# Don't build benchmarks unless explicitly requested, since these require the official
# MySQL and MariaDB client libraries
option(BOOST_MYSQL_BENCH OFF "Whether to build the benchmarks")
mark_as_advanced(BOOST_MYSQL_BENCH)
# Examples and tests
if(BUILD_TESTING)
# Contains some functions to share code between examples and tests
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake)
# Custom target tests; required by the Boost superproject
if(NOT TARGET tests)
add_custom_target(tests)
endif()
# Tests
add_subdirectory(test)
# All examples require a real server to run
if (BOOST_MYSQL_INTEGRATION_TESTS)
add_subdirectory(example)
endif()
endif()
if (BOOST_MYSQL_BENCH)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake)
add_subdirectory(bench)
endif()