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


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