Hi Warren,
Attached is a more maintainable version which also builds the examples and tests.


From: Burton, Alex (DET, Newcastle)
Sent: Monday, January 06, 2014 5:45 PM
To: plusplus@lists.mysql.com
Subject: scons build on windows

Hi,

Below is a build script to build various versions of the mysqlpp dll on windows, I found it easier to write this than get the visual studio project files to work.
I have been using mysqlpp for many years but the project files must be too old for the current visual studio.

This build script works with SCons which i recommend. On linux I just use the distribution version of mysqlpp so I don't have to build it but this script could be easily modified to work on unix.

Please consider adding this script so that people can build mysqlpp easier on windows, or update your build system to scons, or throw away in disgust if you like.

import glob
import os.path

for build in ['Debug','Release']:
    for arch in ['x86','amd64']:
        env = Environment(HOST_ARCH='x86',TARGET_ARCH=arch)
        if arch == 'x86':
                env['CPPPATH'] = ['C:/Program Files (x86)/MySQL/Connector C 6.0.2/include']
                env['LIBS'] = ['C:/Program Files (x86)/MySQL/Connector C 6.0.2/lib/opt/libmysql']
        else:
                env['CPPPATH'] = ['C:/Program Files/MySQL/Connector C 6.0.2/include']
                env['LIBS'] = ['C:/Program Files/MySQL/Connector C 6.0.2/lib/opt/libmysql']
       
        env['LIBS'] += ['WSock32']
        if build == 'Debug':
            env['CCFLAGS'] = [
                             '/Od'
                            , '/EHsc'
                            , '/MDd'
#                            , '/Gm'
                            ,'/Zi'
                            , '/GR'
                            , '/nologo'
                            , '/RTC1'
            #                , '/W2'
                            ]
                           
            env["CPPDEFINES"] = ['_DEBUG','MYSQLPP_MAKING_DLL','_WIN32']
            env['LINKFLAGS'] = [ '/DEBUG' , '/INCREMENTAL' ]
        else:
            env['CCFLAGS'] = [
                             '/Ox'
                            , '/EHsc'
                            , '/MD'
                            , '/GL'
                            , '/GR'
                            , '/nologo'
                            ]
            env["CPPDEFINES"] = ['MYSQLPP_MAKING_DLL','_WIN32']
            env['LINKFLAGS'] += ['/RELEASE' , '/LTCG' , '/INCREMENTAL:NO' , '/NOLOGO']
           

        buildDir = "lib/" + build + "_" + arch
        env.VariantDir(buildDir,'lib')

        srcpaths = [buildDir + "/" + os.path.basename(x) for x in glob.glob('lib/*.cpp')]

        env.SharedLibrary(target=buildDir + "/mysqlpp",source=srcpaths)


Alex Burton
Research Engineer - Solar Thermal - Energy Technology - CSIRO
+61 2 4960 6110
+61 416 594 752