List:MySQL++« Previous MessageNext Message »
From:<Alex.Burton Date:January 6 2014 6:45am
Subject:scons build on windows
View as plain text  

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
                env['LIBS'] = ['C:/Program Files (x86)/MySQL/Connector C
                env['CPPPATH'] = ['C:/Program Files/MySQL/Connector C 6.0.2/include']
                env['LIBS'] = ['C:/Program Files/MySQL/Connector C

        env['LIBS'] += ['WSock32']
        if build == 'Debug':
            env['CCFLAGS'] = [
                            , '/EHsc'
                            , '/MDd'
#                            , '/Gm'
                            , '/GR'
                            , '/nologo'
                            , '/RTC1'
            #                , '/W2'

            env["CPPDEFINES"] = ['_DEBUG','MYSQLPP_MAKING_DLL','_WIN32']
            env['LINKFLAGS'] = [ '/DEBUG' , '/INCREMENTAL' ]
            env['CCFLAGS'] = [
                            , '/EHsc'
                            , '/MD'
                            , '/GL'
                            , '/GR'
                            , '/nologo'
            env["CPPDEFINES"] = ['MYSQLPP_MAKING_DLL','_WIN32']
            env['LINKFLAGS'] += ['/RELEASE' , '/LTCG' , '/INCREMENTAL:NO' , '/NOLOGO']

        buildDir = "lib/" + build + "_" + arch

        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

scons build on windowsAlex.Burton6 Jan
  • Re: scons build on windowsMickael Wolff6 Jan
    • Re: scons build on windowsWarren Young6 Jan
      • Re: scons build on windowsMickael Wolff7 Jan
        • Re: scons build on windowsWarren Young7 Jan
  • Re: scons build on windowsWarren Young6 Jan
  • RE: scons build on windowsAlex.Burton7 Jan