Spec-Zone .ru
спецификации, руководства, описания, API
|
The only compiler formally supported for Windows is Microsoft Visual Studio 2003 and above.
The basic steps for building the connector on Windows are the same as for Unix. It is important to use CMake 2.6.2 or newer to generate build files for your compiler and to invoke the compiler.
On Windows, mysql_config
is not present, so CMake attempts to retrieve the location of MySQL from the
environment variable $ENV{MYSQL_DIR}
. If MYSQL_DIR
is not set, CMake then proceeds to check for MySQL in the
following locations: $ENV{ProgramFiles}/MySQL/*/include
, and $ENV{SystemDrive}/MySQL/*/include
.
CMake makes it easy for you to try other compilers. However, you may experience compile warnings, compile errors or linking issues not detected by Visual Studio. Patches are gratefully accepted to fix issues with other compilers.
Consult the CMake manual or check cmake
--help
to find out which build systems are supported by your CMake
version:
C:\>cmake --help
cmake version 2.6-patch 2Usage[...]GeneratorsThe following generators are available on this platform: Borland Makefiles = Generates Borland makefiles. MSYS Makefiles = Generates MSYS makefiles. MinGW Makefiles = Generates a make file for use with mingw32-make. NMake Makefiles = Generates NMake makefiles. Unix Makefiles = Generates standard UNIX makefiles. Visual Studio 6 = Generates Visual Studio 6 project files. Visual Studio 7 = Generates Visual Studio .NET 2002 project files. Visual Studio 7 .NET 2003 = Generates Visual Studio .NET 2003 project files. Visual Studio 8 2005 = Generates Visual Studio .NET 2005 project files. Visual Studio 8 2005 Win64 = Generates Visual Studio .NET 2005 Win64 project files. Visual Studio 9 2008 = Generates Visual Studio 9 2008 project fil Visual Studio 9 2008 Win64 = Generates Visual Studio 9 2008 Win64 proje files.[...]
It is likely that your CMake binary supports more compilers, known by CMake as generators, than can actually be used to build MySQL Connector/C++. We have built the connector using the following generators:
Microsoft Visual Studio 8 (Visual Studio 2005)
Microsoft Visual Studio 9 (Visual Studio 2008, Visual Studio 2008 Express)
NMake
Please see the building instructions for Unix, Solaris and Mac OS X for troubleshooting and configuration hints.
Use these steps to build the connector:
Change location to the top-level directory of the source distribution:
shell> cd C:\path_to_mysql_cpp
Run CMake to generate build files for your generator:
Visual Studio
C:\>cmake -G "Visual Studio 9 2008"
-- Check for working C compiler: cl-- Check for working C compiler: cl -- works-- Detecting C compiler ABI info-- Detecting C compiler ABI info - done-- Check for working CXX compiler: cl-- Check for working CXX compiler: cl -- works-- Detecting CXX compiler ABI info-- Detecting CXX compiler ABI info - done-- ENV{MYSQL_DIR} =-- MySQL Include dir: C:/Programme/MySQL/MySQL Server 5.5/include-- MySQL Library : C:/Programs/MySQL/MySQL Server 5.5/lib/opt/mysqlclient.lib-- MySQL Library dir: C:/Programs/MySQL/MySQL Server 5.5/lib/opt-- MySQL CFLAGS:-- MySQL Link flags:-- MySQL Include dir: C:/Programs/MySQL/MySQL Server 5.5/include-- MySQL Library dir: C:/Programs/MySQL/MySQL Server 5.5/lib/opt-- MySQL CFLAGS:-- MySQL Link flags:-- Configuring cppconn-- Configuring test cases-- Looking for isinf-- Looking for isinf - not found-- Looking for isinf-- Looking for isinf - not found.-- Looking for finite-- Looking for finite - not found.-- Configuring C/J junit tests port-- Configuring examples-- Configuring done-- Generating done-- Build files have been written to: C:\path_to_mysql_cpp
C:\>dir *.sln *.vcproj
[...]19.11.2008 12:16 23.332 MYSQLCPPCONN.sln[...]19.11.2008 12:16 27.564 ALL_BUILD.vcproj19.11.2008 12:16 27.869 INSTALL.vcproj19.11.2008 12:16 28.073 PACKAGE.vcproj19.11.2008 12:16 27.495 ZERO_CHECK.vcproj
NMake
C:\>cmake -G "NMake Makefiles"
-- The C compiler identification is MSVC-- The CXX compiler identification is MSVC[...]-- Build files have been written to: C:\path_to_mysql_cpp
Use your compiler to build MySQL Connector/C++.
Visual Studio - GUI
Open the newly generated project files in the Visual Studio GUI or use a Visual Studio command line to build the driver. The project files contain a variety of different configurations, debug and nondebug versions among them.
Visual Studio - NMake
C:\>nmake
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01Copyright (C) Microsoft Corporation. All rights reserved.Scanning dependencies of target mysqlcppconn[ 2%] Building CXX object driver/CMakeFiles/mysqlcppconn.dir/mysql_connection.objmysql_connection.cpp[...]Linking CXX executable statement.exe[100%] Built target statement