Skip to content

Commit

Permalink
Link to charconv explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
anarthal committed Feb 11, 2024
1 parent 7c07d7b commit 3e6ad86
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ if (BOOST_MYSQL_IS_ROOT)
target_link_libraries(
boost_mysql
INTERFACE
Boost::headers
Boost::charconv
Threads::Threads
OpenSSL::Crypto
Expand Down
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ Branch | Windows/Linux Build | OSX build | Coverage | Documentation
Boost.MySQL is a C++11 client for MySQL and MariaDB database servers, based on Boost.Asio.
Boost.MySQL is part of Boost.

## Breaking changes in Boost 1.85

Boost.MySQL now requires linking with Boost.Charconv, which is a compiled library.
If you're getting link errors, link your executable to the `Boost::charconv` CMake target.
No C++ code changes are required.

## Feedback

Do you have any suggestion? Would you like to share a bad or good experience while using the library?
Expand Down Expand Up @@ -37,22 +43,24 @@ a `CMakeLists.txt` like this (replace `main` by your executable name and `main.c
```cmake
project(boost_mysql_example LANGUAGES CXX)
find_package(Boost REQUIRED COMPONENTS headers)
find_package(Boost REQUIRED COMPONENTS charconv)
find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main PRIVATE Boost::headers Threads::Threads OpenSSL::Crypto OpenSSL::SSL)
target_link_libraries(main PRIVATE Boost::charconv Threads::Threads OpenSSL::Crypto OpenSSL::SSL)
```

## Tested with

Boost.MySQL has been tested with the following compilers:

- gcc 5 to 13.
- clang 3.6 to 16.
- msvc 14.1, 14.2 and 14.3.

And with the following databases:

- MySQL v5.7.41.
- MySQL v8.0.33.
- MariaDB v11.0.
Expand All @@ -69,7 +77,6 @@ And with the following databases:
caching_sha2_password. These are the default methods in MySQL 5 and MySQL 8,
respectively.
- Encrypted connections (TLS).
- TCP and UNIX socket connections. The implementation is based on Boost.Asio
SyncStream and AsyncStream concepts, so it is generic and can be used with
any stream that fulfills these concept's requirements. There are user-friendly
typedefs and regression tests for TCP and UNIX socket streams.
- TCP and UNIX socket transports.
- (Experimental) connection pools.
- (Experimental) friendly client-side generated SQL.
21 changes: 16 additions & 5 deletions doc/qbk/02_integrating.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@
[section:integrating Integrating Boost.MySQL into your project]
[nochunk]

[note
[*Breaking change in Boost 1.85]: the compiled library Boost.Charconv is now required.
If you're upgrading and getting linker errors, link your executable to the `Boost::charconv`
CMake target.
]

[section:header_only Header-only mode]

The easiest way to start using the library is header-only mode (the default).
You will need the following:

* A C++11 compiler (like gcc >=5.4, clang >=3.6, or Visual Studio 2017 or higher).
* The Boost headers. You can obtain them following the official installation instructions
* The Boost headers and Boost.Charconv. You can obtain them following the official installation instructions
for [@boost:/more/getting_started/unix-variants.html UNIX-like systems] and for
[@boost:/more/getting_started/windows.html Windows], or from a package manager.
Note that Boost.MySQL does not work with the standalone version of __Asio__.
Expand All @@ -27,14 +33,19 @@ Use the following `CMakeLists.txt`, replacing `main.cpp` with your project's sou
```
project(boost_mysql_example LANGUAGES CXX)

find_package(Boost REQUIRED COMPONENTS headers)
find_package(Boost REQUIRED COMPONENTS charconv)
find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED)

add_executable(main main.cpp)
target_link_libraries(main PRIVATE Boost::headers Threads::Threads OpenSSL::Crypto OpenSSL::SSL)
target_link_libraries(main PRIVATE Boost::charconv Threads::Threads OpenSSL::Crypto OpenSSL::SSL)
```

[note
`Boost::charconv` is only available in Boost 1.85 and higher. If you're using
an older version, use the `Boost::headers` target, instead.
]

If you're happy with header-only mode, have a look at [link mysql.tutorial the tutorial]
or [link mysql.examples any of the examples] to learn how to use the library.

Expand Down Expand Up @@ -67,7 +78,7 @@ could look like:
```
project(boost_mysql_example LANGUAGES CXX)

find_package(Boost REQUIRED COMPONENTS headers)
find_package(Boost REQUIRED COMPONENTS charconv)
find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED)

Expand All @@ -78,7 +89,7 @@ add_executable(
# List any other .cpp your exe has here
main.cpp
)
target_link_libraries(main PRIVATE Boost::headers Threads::Threads OpenSSL::Crypto OpenSSL::SSL)
target_link_libraries(main PRIVATE Boost::charconv Threads::Threads OpenSSL::Crypto OpenSSL::SSL)

# We need to define BOOST_MYSQL_SEPARATE_COMPILATION in any code using Boost.MySQL in separate-build mode
target_compile_definitions(main PRIVATE BOOST_MYSQL_SEPARATE_COMPILATION)
Expand Down
2 changes: 1 addition & 1 deletion test/cmake_b2_separate_compilation_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ add_executable(
# List any other .cpp your exe has here
main.cpp
)
target_link_libraries(main PRIVATE Boost::headers Boost::charconv Threads::Threads OpenSSL::Crypto OpenSSL::SSL)
target_link_libraries(main PRIVATE Boost::charconv Threads::Threads OpenSSL::Crypto OpenSSL::SSL)

# We need to define BOOST_MYSQL_SEPARATE_COMPILATION in any code using Boost.MySQL in separate-build mode
target_compile_definitions(main PRIVATE BOOST_MYSQL_SEPARATE_COMPILATION)
Expand Down
2 changes: 1 addition & 1 deletion test/cmake_b2_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED)

add_executable(main main.cpp)
target_link_libraries(main PRIVATE Boost::headers Boost::charconv Threads::Threads OpenSSL::Crypto OpenSSL::SSL)
target_link_libraries(main PRIVATE Boost::charconv Threads::Threads OpenSSL::Crypto OpenSSL::SSL)

include(CTest)
add_test(NAME main COMMAND main)

0 comments on commit 3e6ad86

Please sign in to comment.