Static Library for Microsoft Visual Studio
- Goto https://downloads.mysql.com/archives/community/ and Download Desire Version. Sample is Version 5.7.28
- For build from source, you must need openssl static build so you can download from https://www.openssl.org/source/. You can use any desire version. In sample choose 1.1.1l
- Need to build openssl, so follow https://github.com/RayMarmAung/openssl-1.1.1k_vs_static
- Extract mysql-5.7.28 to desired directory. For example C:\sql\mysql-5.7.28
- Need CMake, download from https://cmake.org/download/ , install and set environment path to this
- Launch Developer Command Prompt for VS 2017 as admin, you can use any VS version
- Change to mysql src directory
- Type CMake command like this
cmake -Bc:\mysql -DBUILD_SHARED_LIBS=OFF -DLINK_STATIC_RUNTIME_LIBRARIES=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST="C:\Boost" -DWITH_SSL="C:\openssl32_msvc" -G "Visual Studio 15 2017"
-B is build path, -DWITH_SSL is your previous built openssl path, -G is compilar, if need 64 bit, type "Visual Studio 15 2017 Win64" And wait a while to finish
- After finished, goto cmake build path and find MySQL.sln (for example- c:\mysql\MySQL.sln). and open it with visual studio
- Then Build ALL_BUILD with RelWithDebInfo
- After finish, you will find mysqlclient.lib in cmake build in archive_output_directory\RelWithDebInfo directory
P.S - this library links with these standard libs
- advapi32
- user32
- crypt32
- gdi32
These libraries are necessary to declare when you build Qt Static Build