diff --git a/ChangeLog b/ChangeLog index 10488506..04c23f0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,8 @@ VERSION 0.6.4cvs a list of message-ids separated by CFWS (used in "References:" field, for example). + * SConstruct: added 'msvc' target to generate MSVC project files. + 2005-03-25 Vincent Richard * mdn/*.{cpp|hpp}: added support for Message Disposition Notifications (MDN), diff --git a/SConstruct b/SConstruct index dfe0a7c6..6e3e4b00 100644 --- a/SConstruct +++ b/SConstruct @@ -239,6 +239,12 @@ libvmime_platforms_sources = { 'platforms/posix/posixFile.cpp', 'platforms/posix/posixFile.hpp', 'platforms/posix/posixHandler.cpp', 'platforms/posix/posixHandler.hpp', 'platforms/posix/posixSocket.cpp', 'platforms/posix/posixSocket.hpp' + ], + 'windows': + [ + 'platforms/windows/windowsFile.cpp', 'platforms/windows/windowsFile.hpp', + 'platforms/windows/windowsHandler.cpp', 'platforms/windows/windowsHandler.hpp', + 'platforms/windows/windowsSocket.cpp', 'platforms/windows/windowsSocket.hpp' ] } @@ -1600,6 +1606,7 @@ Platform handlers :$VMIME_BUILTIN_PLATFORMS return None + # Custom builder for generating autotools scripts autotoolsBuilder = Builder(action = generateAutotools) env.Append(BUILDERS = { 'GenerateAutoTools' : autotoolsBuilder }) @@ -1607,18 +1614,238 @@ env.Append(BUILDERS = { 'GenerateAutoTools' : autotoolsBuilder }) env.Alias('autotools', env.GenerateAutoTools('foo_autotools', 'SConstruct')) + +################################ +# Generate MSVC project files # +################################ + +def generateMSVC(target, source, env): + # vmime.sln + vmime_sln = open("vmime.sln", 'w') + vmime_sln.write("""Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vmime", "vmime.vcproj", "{B2B47E11-DB57-49E1-8895-F03BDF78A221}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {B2B47E11-DB57-49E1-8895-F03BDF78A221}.Debug.ActiveCfg = Debug|Win32 + {B2B47E11-DB57-49E1-8895-F03BDF78A221}.Debug.Build.0 = Debug|Win32 + {B2B47E11-DB57-49E1-8895-F03BDF78A221}.Release.ActiveCfg = Release|Win32 + {B2B47E11-DB57-49E1-8895-F03BDF78A221}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal +""") + vmime_sln.close(); + + # vmime.vcproj + vmime_vcproj = open("vmime.vcproj", 'w') + vmime_vcproj.write(""" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +""") + + # Source files + all_sources = libvmime_all_sources + + # -- Remove all platform files and re-add files for "windows" only + for i in range(len(all_sources)): + if string.find(all_sources[i], 'platforms/') != -1: + all_sources[i] = '' + + for f in libvmime_platforms_sources['windows']: + if f[-4:] == '.hpp': + all_sources.append('vmime/' + f) + else: + all_sources.append('src/' + f) + + # -- Replace '/' with '\' + for i in range(len(all_sources)): + all_sources[i] = string.replace(all_sources[i], '/', '\\') + + # -- Output files in filters + vmime_vcproj.write(""" + + +""") + + all_sources.sort() + + prevLen = 0 + prevComps = [] + + filesDone = [] + dupCounter = 1 # counter for duplicate file names + + for f in all_sources: + if len(f) != 0: + comps = re.split('\\\\', f) + l = len(comps) - 1 + + # Directory change + if l != prevLen: + if l < prevLen: + for i in range(prevLen - l): + vmime_vcproj.write('\n') + else: + for i in range(l - prevLen): + vmime_vcproj.write('\n') + else: + if comps[l - 1] != prevComps[prevLen - 1]: + vmime_vcproj.write('\n') + vmime_vcproj.write('\n') + + fn = f[string.rfind(f, '\\') + 1:] + + if fn in filesDone: + # File (duplicate filename) + vmime_vcproj.write('\n') + vmime_vcproj.write(""" + + + + + +""") + vmime_vcproj.write('') + dupCounter = dupCounter + 1 + else: + # File + vmime_vcproj.write('\n') + filesDone.append(fn) + + prevComps = comps + prevLen = l + + for i in range(prevLen): + vmime_vcproj.write('\n') + + vmime_vcproj.write(""" + + + + +""") + vmime_vcproj.close(); + + return None + + + +# Custom builder for generating MSVC project files +msvcBuilder = Builder(action = generateMSVC) +env.Append(BUILDERS = { 'GenerateMSVC' : msvcBuilder }) + +env.Alias('msvc', env.GenerateMSVC('foo_msvc', 'SConstruct')) + + + ##################### # Packaging rules # ##################### +def appendAdditionalDistFiles(): + # Generate autotools-related files + generateAutotools([], [], env) + + # Generate MSVC-related files + generateMSVC([], [], env) + + # 'tar' is not available under Windows... if not (os.name == 'win32' or os.name == 'nt'): def createPackage(target, source, env): packageFullName = packageName + '-' + packageVersion packageFile = packageFullName + '.tar.bz2' - # Generate autotools-related files - generateAutotools([], [], env) + appendAdditionalDistFiles() distFiles = [] distFilesStr = ''