diff -Naur bakefile-0.2.2.org/Makefile.in bakefile-0.2.2/Makefile.in --- bakefile-0.2.2.org/Makefile.in 2007-02-12 01:38:34.000000000 +0100 +++ bakefile-0.2.2/Makefile.in 2007-04-26 02:15:51.000000000 +0200 @@ -268,6 +268,8 @@ output/msvc-opts.empy \ output/msvc_common.py \ output/msvc6prj.py \ + output/msvs2005_wince.py \ + output/msvs2005.py \ output/msevc4prj.py \ output/msvs2005prj.py \ output/gnumake.empy \ @@ -310,6 +312,9 @@ rules/msvc_prj_dsp_common.bkl \ rules/msvc_prj_vcproj_common.bkl \ rules/msvc6prj.bkl \ + rules/msvs2005_common.bkl \ + rules/msvs2005_wince.bkl \ + rules/msvs2005.bkl \ rules/msevc4prj.bkl \ rules/msvs2005prj.bkl \ rules/mingw.bkl \ diff -Naur bakefile-0.2.2.org/output/._msvs2005.py bakefile-0.2.2/output/._msvs2005.py --- bakefile-0.2.2.org/output/._msvs2005.py 1970-01-01 01:00:00.000000000 +0100 +++ bakefile-0.2.2/output/._msvs2005.py 2007-04-26 02:15:51.000000000 +0200 @@ -0,0 +1 @@ +Mac OS X  2 RTEXT \ No newline at end of file diff -Naur bakefile-0.2.2.org/output/msvs2005.py bakefile-0.2.2/output/msvs2005.py --- bakefile-0.2.2.org/output/msvs2005.py 1970-01-01 01:00:00.000000000 +0100 +++ bakefile-0.2.2/output/msvs2005.py 2007-04-26 02:15:51.000000000 +0200 @@ -0,0 +1,677 @@ +# MS Visual C++ projects generator script +# $Id: msvc6prj.py,v 1.31 2005/06/16 09:19:33 vaclavslavik Exp $ + +import fnmatch, re, os, os.path +import errors, utils +from xml.dom.minidom import getDOMImplementation +import pdb + +# ------------------------------------------------------------------------ +# helpers +# ------------------------------------------------------------------------ + +def sortedKeys(dic): + l = [] + for c in configs_order: + if c in dic: + l.append(c) + # in VC++ IDE, the last config is the default one, i.e. what you would + # logically expect to be the first one => reverse the order: + l.reverse() + return l + +def filterGroups(groups, groupDefs, files): + """Returns dictionary with files sorted into groups (key: group name). + Groups are given in 'groups' list of names and 'groupDefs' directory + as ;-separated wildcards.""" + ret = {} + used = {} + for g in groups: + ret[g] = [] + wildcards = groupDefs[g].split() + for w in wildcards: + for f in files: + if f in used: continue + if fnmatch.fnmatch(f, w): + used[f] = 1 + ret[g].append(f) + ret[None] = [] + for f in files: + if f in used: continue + ret[None].append(f) + return ret + +def fixFlagsQuoting(text): + """Replaces e.g. /DFOO with /D "FOO" and /DFOO=X with /D FOO=X.""" + return re.sub(r'\/([DIid]) ([^ \"=]+)([ $])', r'/\1 "\2"\3', + re.sub(r'\/([DIid]) ([^ \"=]+)=([^ \"]*)([ $])', r'/\1 \2=\3\4', text)) + + +def sortByBasename(files): + def __sort(x1, x2): + f1 = x1.split('\\')[-1] + f2 = x2.split('\\')[-1] + if f1 == f2: return 0 + elif f1 < f2: return -1 + else: return 1 + files.sort(__sort) + +# ------------------ +# Stuff to emulate MS GUIDs (mostly stolen from the web) +# ------------------ +import time, random, md5 + + +# this particular string seems to be special, no clue why, though +magic_guid = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}" + +# we want to have the GUID strings be repeatable +# so, generate them from a repeatable seed +def msuuid(seed): + + str_uuid = str(md5.md5(seed).hexdigest()) + return '{' + str_uuid[0:8] + '-' + str_uuid[8:12] + '-' + str_uuid[12:16] + '-' + str_uuid[16:20] + '-' + str_uuid[20:32] + '}' + + +# ------------------------------------------------------------------------ +# Generator class +# ------------------------------------------------------------------------ + +class ProjectGeneratorMsvc9: + + app_type_code = { 'console' : '1', 'gui' : '2' } + + def __init__(self): + self.basename = os.path.splitext(os.path.basename(FILE))[0] + self.dirname = os.path.dirname(FILE) + + # -------------------------------------------------------------------- + # basic configuration + # -------------------------------------------------------------------- + + def getDswExtension(self): + return 'sln' + def getDspExtension(self): + return 'vcproj' + def getMakefileExtension(self): + return 'mak' + + # -------------------------------------------------------------------- + # helpers + # -------------------------------------------------------------------- + + def mkConfigName(self, target, config): + return '%s|%s' % (config, self.getPlatform()) + + def getPlatform(self): + return "Win32" + + # -------------------------------------------------------------------- + # DSW file + # -------------------------------------------------------------------- + + def makeDswHeader(self): + return """\ +Microsoft Visual Studio Solution File, Format Version 9.00 +""" + + def genDSW(self, dsw_targets, dsp_list, deps_translation): + dsw = self.makeDswHeader() + prj_base_string = 'Project("%s") = "%s", "%s", "%s"\n%sEndProject\n' + projects_section = "" #this string will hold the projects + globals_section = "" #this string will hold the globals section + + if len(dsw_targets) == 0: + return + + default_cfg = sortedKeys(dsw_targets[-1].configs)[-1] + default_cfg_name = self.mkConfigName("", default_cfg) + + globals_section_header = "Global\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\t%s = %s\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n" % (default_cfg_name, default_cfg_name) + globals_section_footer = "\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n" + + + globals_section_pcp = "" + + ## loop over the targets and assign everyone a guid + guid_dict = {} + for t in dsw_targets: + guid_dict[t.id] = msuuid(t.id) + + ## stolen from msvc6 impl (what does it do?) + single_target = (len(dsw_targets) == 1) + for t in dsw_targets: + deps = '' + if single_target: + dsp_name = self.basename + else: + dsp_name = '%s_%s' % (self.basename, t.id) + deplist = t._deps.split() + + # add external dsp dependencies: + for d in t._dsp_deps.split(): + if not d._kind == "action": + deplist.append(d.split(':')[0]) + + # write dependencies: + deps_str = "" + if len(deplist) != 0: + deps_str = "\tProjectSection(ProjectDependencies) = postProject\n" + + for d in deplist: + if d in deps_translation: + d2 = deps_translation[d] + else: + d2 = d + + if guid_dict.has_key(d): + guid = guid_dict[d] + deps_str += "\t\t%s = %s\n" % (guid, guid) + deps_str += "\tEndProjectSection\n" + + guid = guid_dict[t.id] + + #build the projects section + prj_str = prj_base_string % (magic_guid, t.id, dsp_name + '.' + self.getDspExtension(), guid, deps_str) + dsw += prj_str + + #things get mentioned again in the globals section + pcp_str = self.build_sln_pcp_str(t, guid, default_cfg_name) + globals_section_pcp += pcp_str + + dspfile = (t, + os.path.join(self.dirname, + dsp_name + '.' + self.getDspExtension()), + dsp_name, guid) + + if dspfile not in dsp_list: + dsp_list.append(dspfile) + + ##end of stolen section + + + dsw += globals_section_header + globals_section_pcp + globals_section_footer + + writer.writeFile('%s.%s' % ( + os.path.join(self.dirname, self.basename), + self.getDswExtension() + ), dsw) + + + def build_sln_pcp_str(self, t, guid, default_cfg_name): + globals_section_pcp_base = '\t\t%s.%s.ActiveCfg = %s\n\t\t%s.%s.Build.0 = %s\n' + return globals_section_pcp_base % (guid, default_cfg_name, default_cfg_name, guid, default_cfg_name, default_cfg_name) + + def genWorkspaces(self): + dsp_list = [] + + # find all projects. Beware ugly hack here: MSVC6PRJ_MERGED_TARGETS is + # used to create fake targets as a merge of two (mutually exclusive) + # targets. This is sometimes useful, e.g. when you want to build both + # DLL and static lib of something. + deps_translation = {} + projects = [t for t in targets if t._kind == 'project'] + for mergeInfo in MSVC6PRJ_MERGED_TARGETS.split(): + split1 = mergeInfo.split('=') + split2 = split1[1].split('+') + tgR = split1[0] + tg1 = split2[0] + tg2 = split2[1] + + # the targets may be disabled by some (weak) condition: + if tg1 not in targets and tg2 not in targets: + continue + + t = targets[tg1] + for c in targets[tg2].configs: + t.configs[c] = targets[tg2].configs[c] + t.id = tgR + projects.remove(targets[tg2]) + targets.append(tgR, t) + del targets[tg1] + del targets[tg2] + deps_translation[tg1] = tgR + deps_translation[tg2] = tgR + + self.genDSW(projects, dsp_list, deps_translation) + for t, filename, prjname, guid in dsp_list: + self.genDSP(t, filename, prjname, guid) + + # warn about targets that we can't handle (yet): + for t in [t for t in targets if t._kind == 'action']: + print "warning: ignoring action target '%s'" % t.id + + + # ------------------------------------------------------------------------ + # DSP files + # ------------------------------------------------------------------------ + + def mapRTTI(self, val): + if val == 'on': + return 'true' + else : + return false + + + #some helpers to build parts of the DSP file that change if you are doing PC vs WinCE + def buildConfElement(self, doc, cfg, c, t): + conf_name = self.mkConfigName(t.id, c) + conf_el = doc.createElement("Configuration") + conf_el.setAttribute("Name", conf_name) + conf_el.setAttribute("OutputDirectory", ".\\%s" % cfg._targetdir[:-1]) + conf_el.setAttribute("IntermediateDirectory", ".\\%s\\%s" % (cfg._builddir, t.id) ) + conf_el.setAttribute("ConfigurationType", "%s" % cfg._type_code) + conf_el.setAttribute("UseOfMFC", "0") + conf_el.setAttribute("ATLMinimizesCRunTimeLibraryUsage", "false") + conf_el.setAttribute("InheritedPropertySheets", "$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops") + return conf_el + + def buildIDLToolElement(self, doc, cfg, t): + t5 = doc.createElement("Tool") + t5.setAttribute("Name", "VCIDLTool") + return t5 + + def buildCompilerToolElement(self, doc, cfg, c, t): + warnings_map = { 'no':'0', 'default':'1', 'max':'4'} + t6 = doc.createElement("Tool") + t6.setAttribute("Name", "VCCLCompilerTool") + + t6.setAttribute("Optimization", cfg._optimize) + t6.setAttribute("InlineFunctionExpansion", "1") + t6.setAttribute("AdditionalIncludeDirectories", ",".join(cfg._include_paths.split(" ")) ) + + ## KLP -- this seems to cause wierd build behavior, omitting for now + #t6.setAttribute("MinimalRebuild", "true") + + if cfg._cxx_exceptions == 'on': + t6.setAttribute("ExceptionHandling","1") + else: + t6.setAttribute("ExceptionHandling", "0") + + try: + t6.setAttribute("EnableIntrinsicFunctions", cfg._intrinsic_functions) + except: + pass #prolly a name error, no big deal + + #handle the run time library -- note that only multi thread is supported + rtl = '3' # default to dll/debug + cfg._defines += " _MT" + rtl_opt = ' /MTd' + if cfg._rtl_type == 'dynamic': + cfg._defines += " _DLL" + if cfg._rtl_dbg == 'on': + rtl = '3' + rtl_opt = ' /MDd' + elif cfg._rtl_dbg == 'off': + rtl = '2' + rtl_opt = ' /MD' + elif cfg._rtl_type == 'static': + if cfg._rtl_dbg == 'on': + rtl = '1' + rtl_opt = ' /MTd' + elif cfg._rtl_dbg == 'off': + rtl = '0' + rtl_opt = ' /MT' + + t6.setAttribute("AdditionalOptions", cfg._cppflags + rtl_opt) + t6.setAttribute("RuntimeLibrary", rtl) + + t6.setAttribute("PreprocessorDefinitions", ";".join(cfg._defines.split(" "))) + + if cfg._debug == '1': + t6.setAttribute("BasicRuntimeChecks", "3") + t6.setAttribute("DebugInformationFormat", "3") + else: + t6.setAttribute("BasicRuntimeChecks", "0") + t6.setAttribute("DebugInformationFormat", "0") + t6.setAttribute("BufferSecurityCheck","false") + + t6.setAttribute("RuntimeTypeInfo", self.mapRTTI(cfg._cxx_rtti)) + + if cfg._pch_use_pch == '1': + t6.setAttribute("UsePrecompiledHeader","2") + t6.setAttribute("PrecompiledHeaderThrough", cfg._pch_header) + t6.setAttribute("PrecompiledHeaderFile", cfg._pch_file) + + t6.setAttribute("AssemblerListingLocation", ".\\%s\\%s\\" % (cfg._builddir, t.id) ) + t6.setAttribute("ObjectFile", ".\\%s\\%s\\" % (cfg._builddir, t.id) ) + t6.setAttribute("ProgramDataBaseFileName", cfg._pdbfile) + if warnings_map.has_key(cfg._warnings): + t6.setAttribute("WarningLevel", warnings_map[cfg._warnings]) + else: + t6.setAttribute("WarningLevel", "1") + t6.setAttribute("SuppressStartupBanner", "true") + + return t6 + + def buildLinkerToolElement(self, doc, cfg, t): + t10 = doc.createElement("Tool") + t10.setAttribute("Name", "VCLinkerTool") + t10.setAttribute("AdditionalDependencies", cfg._ldlibs) + t10.setAttribute("AdditionalOptions", cfg._ldflags) + t10.setAttribute("OutputFile", "%s%s" % (cfg._targetdir, cfg._targetname)) + + if t.type == 'exe': + t10.setAttribute("LinkIncremental", "2") + t10.setAttribute("SubSystem", "%s" % self.app_type_code[cfg._type_nick] ) + elif t.type == 'dll': + t10.setAttribute("LinkIncremental", "1") + if cfg._importlib != "": + t10.setAttribute("ImportLibrary", ".\\%s\\%s" % (cfg._builddir, cfg._importlib) ) + else: + t10.setAttribute("ImportLibrary", ".\\%s\\%s" % (cfg._builddir, cfg._targetname.replace('.dll', '.lib'))) + + t10.setAttribute("SuppressStartupBanner", "true") + t10.setAttribute("AdditionalLibraryDirectories", ",".join(cfg._lib_paths.split(" "))) + t10.setAttribute("GenerateManifest", "true") + + if cfg._debug == '1': + t10.setAttribute("GenerateDebugInformation", "true") + + t10.setAttribute("ProgramDatabaseFile", cfg._pdbfile) + t10.setAttribute("TargetMachine", "1") + return t10 + + def buildLibrarianToolElement(self, doc, cfg, t): + t10 = doc.createElement("Tool") + t10.setAttribute("Name", "VCLibrarianTool") + t10.setAttribute("OutputFile","%s%s" % (cfg._targetdir, cfg._targetname) ) + t10.setAttribute("SuppressStartupBanner", "true") + return t10 + + def buildResourceCompilerToolElement(self, doc, cfg, t): + t8 = doc.createElement("Tool") + t8.setAttribute("Name", "VCResourceCompilerTool") + t8.setAttribute("Culture", "1033") + return t8 + + def buildPlatformsElement(self,doc): + #Platforms Node + plats_el = doc.createElement("Platforms") + plat_el = doc.createElement("Platform") + plat_el.setAttribute("Name", self.getPlatform()) + plats_el.appendChild(plat_el) + return plats_el + + def buildToolFilesElement(self, doc): + #ToolFiles Node + tf_el = doc.createElement("ToolFiles") + tf_el.appendChild(doc.createTextNode("")) + return tf_el + + def buildAllConfigurations(self, doc, prjname, t): + #Configurations Node + confs_el = doc.createElement("Configurations") + for c in sortedKeys(t.configs): + cfg = t.configs[c] + confs_el.appendChild(self.buildSingleConfiguration(doc, prjname, cfg, c, t)) + return confs_el + + def buildSingleConfiguration(self, doc, prjname, cfg, c, t): + conf_el = self.buildConfElement(doc, cfg, c, t) + #add all the tools + t1 = doc.createElement("Tool") + t1.setAttribute("Name", "VCPreBuildEventTool") + + # find the pre-build target if one exists and add the commands + # to PreLink_Cmds + prebuild_cmd = "" + for myt in targets: + if myt.id == t._prebuild_target: + numLines = len(myt._command.splitlines()) + curLine = 1 + for line in myt._command.splitlines(): + # DOS uses && for multiple commands on one line + prebuild_cmd += line.replace(";", "&&") + if not curLine == numLines: + curLine += 1 + prebuild_cmd += " " + t1.setAttribute("Description", "Executing Pre-build tasks...") + t1.setAttribute("CommandLine", prebuild_cmd) + + conf_el.appendChild(t1) + + t2 = doc.createElement("Tool") + t2.setAttribute("Name", "VCCustomBuildTool") + conf_el.appendChild(t2) + + t3 = doc.createElement("Tool") + t3.setAttribute("Name", "VCXMLDataGeneratorTool") + conf_el.appendChild(t3) + + t4 = doc.createElement("Tool") + t4.setAttribute("Name", "VCWebServiceProxyGeneratorTool") + conf_el.appendChild(t4) + + t5 = self.buildIDLToolElement(doc, cfg, t) + conf_el.appendChild(t5) + + t6 = self.buildCompilerToolElement(doc, cfg, c, t) + + conf_el.appendChild(t6) + + t7 = doc.createElement("Tool") + t7.setAttribute("Name", "VCManagedResourceCompilerTool") + conf_el.appendChild(t7) + + t8 = self.buildResourceCompilerToolElement(doc, cfg, t) + conf_el.appendChild(t8) + + t9 = doc.createElement("Tool") + t9.setAttribute("Name", "VCPreLinkEventTool") + conf_el.appendChild(t9) + + if (t.type == 'lib'): + t10 = self.buildLibrarianToolElement(doc, cfg, t) + conf_el.appendChild(t10) + elif ( (t.type == 'exe') or (t.type == 'dll') ): + t10 = self.buildLinkerToolElement(doc, cfg, t) + conf_el.appendChild(t10) + + t11 = doc.createElement("Tool") + t11.setAttribute("Name", "VCALinkTool") + conf_el.appendChild(t11) + + t12 = doc.createElement("Tool") + t12.setAttribute("Name", "VCXDCMakeTool") + conf_el.appendChild(t12) + + t13 = doc.createElement("Tool") + t13.setAttribute("Name", "VCBscMakeTool") + t13.setAttribute("OutputFile", ".\\%s%s.bsc" % (cfg._targetdir, prjname)) + t13.setAttribute("SuppressStartupBanner", "true") + conf_el.appendChild(t13) + + t14 = doc.createElement("Tool") + t14.setAttribute("Name", "VCFxCopTool") + conf_el.appendChild(t14) + + if(t.type == 'exe'): + t16 = doc.createElement("Tool") + t16.setAttribute("Name", "VCAppVerifierTool") + conf_el.appendChild(t16) + t17 = doc.createElement("Tool") + t17.setAttribute("Name", "VCWebDeploymentTool") + conf_el.appendChild(t17) + + t15 = doc.createElement("Tool") + t15.setAttribute("Name", "VCPostBuildEventTool") + conf_el.appendChild(t15) + + #additional tools + for ad_t in self.additionalTools(doc, cfg, t): + conf_el.appendChild(ad_t) + + return conf_el + + #this is just for derived classes that may want to add more tools to the config + def additionalTools(self, doc, cfg, t): + return [] + + def get_default_groups(self): + return ['Source Files', 'Header Files', 'Resource Files'] + + def get_group_defs(self): + return { + 'Source Files' : '*.cpp *.c *.cxx *.def *.r *.odl *.idl *.hpj *.bat', + 'Header Files' : '*.h *.hpp *.hxx *.hm *.inl', + 'Resource Files' : '*.ico *.cur *.bmp *.dlg *.rc *.rc2 *.rct *.bin *.rgs *.gif *.jpg *.jpeg *.jpe', + } + + def genDSP(self, t, filename, prjname, guid): + #start a new xml document + impl = getDOMImplementation() + doc = impl.createDocument(None, "VisualStudioProject", None) + top_el = doc.documentElement + + #fill in the attributes of the top element + top_el.setAttribute("ProjectType", "Visual C++") + top_el.setAttribute("Version", "8.00") + top_el.setAttribute("Name", t.id) + top_el.setAttribute("ProjectGUID", "%s" % guid) + + top_el.appendChild(self.buildPlatformsElement(doc)) + + top_el.appendChild(self.buildToolFilesElement(doc)) + + top_el.appendChild(self.buildAllConfigurations(doc, prjname, t)) + + refs_el = doc.createElement("References") + refs_el.appendChild(doc.createTextNode("")) + top_el.appendChild(refs_el) + + files_el = doc.createElement("Files") + + #munge the source files around so we can write them to the file + ## stolen wholesale from msvc6prj.py + + # (find files from all configs, identify files not in all configs) + sources = {} + for c in sortedKeys(t.configs): + for s in t.configs[c]._sources.split(): + snat = utils.nativePaths(s) + if snat not in sources: + sources[snat] = [c] + else: + sources[snat].append(c) + for s in sources: + if len(sources[s]) == len(t.configs): + sources[s] = None + # make copy of the sources specified using , so that we include + # them even when they don't match any file group (see below): + realSources = sources.keys() + + # Add more files that are part of the project but are not built (e.g. + # headers, READMEs etc.). They are included unconditionally to save some + # space. + for c in sortedKeys(t.configs): + for s in t.configs[c]._more_files.split(): + snat = utils.nativePaths(s) + if snat not in sources: + sources[snat] = None + + # Find files with custom build associated with them and retrieve + # custom build's code + filesWithCustomBuild = {} + for c in sortedKeys(t.configs): + cbf = t.configs[c]._custom_build_files + if len(cbf) == 0 or cbf.isspace(): continue + for f in cbf.split(): + filesWithCustomBuild[f] = {} + for f in filesWithCustomBuild: + fname = f.replace('.','_').replace('\\','_') + for c in sortedKeys(t.configs): + filesWithCustomBuild[f][c] = \ + eval ('t.configs[c]._custom_build_%s' % fname) + + # (sort the files into groups) + groups = [] + groups_default= self.get_default_groups() + group_defs = self.get_group_defs() + + if t._file_groups != '' and not t._file_groups.isspace(): + for gr in t._file_groups.split('\n'): + grdef = gr.split(':') + groups.append(grdef[0]) + group_defs[grdef[0]] = grdef[1] + groups += groups_default + + files = filterGroups(groups, group_defs, sources.keys()) + # files that didn't match any group and were specified using + # should be added to 'Source Files' group: + for sf in files[None]: + if sf in realSources: + files['Source Files'].append(sf) + + ##End stolen bit + + + ##define a local helper function for building the files area + def makeFileConfig(t,cfg, c, src, group): + conf_name = self.mkConfigName(t.id, c) + file_conf_el = doc.createElement("FileConfiguration") + file_conf_el.setAttribute("Name", conf_name) + tool_el = doc.createElement("Tool") + if src in filesWithCustomBuild.keys() and c in filesWithCustomBuild[src].keys(): + #custom build for this file for this config + + strs = filesWithCustomBuild[src][c].split('|||') + tool_el.setAttribute("Name", "VCCustomBuildTool") + try: + tool_el.setAttribute('Description', strs[0]) + tool_el.setAttribute('CommandLine', strs[1]) + tool_el.setAttribute('Outputs', strs[2]) + except: + #keep going, even if we didn't set up the whole thing + pass + else: + if group == 'Source Files': + tool_el.setAttribute("Name", "VCCLCompilerTool") + elif group == 'Resource Files': + tool_el.setAttribute("Name", "VCResourceCompilerTool") + tool_el.setAttribute("AddidtionalIncludeDirectories", "") + tool_el.setAttribute("PreprocessorDefinitions", "") + file_conf_el.appendChild(tool_el) + return file_conf_el + + for group in [g for g in groups if g in files]: + lst = files[group] + sortByBasename(lst) + if len(lst) == 0: continue + + filt_el = doc.createElement("Filter") + filt_el.setAttribute("Name", group) + + for src in lst: + file_el = doc.createElement("File") + file_el.setAttribute("RelativePath", "%s\\%s" % (SRCDIR, src)) + if group == 'Source Files' or group == 'Resource Files': + + for c in sortedKeys(t.configs): + if sources[src] != None and c not in sources[src]: + continue + cfg = t.configs[c] + file_conf_el = makeFileConfig(t, cfg, c, src, group) + file_el.appendChild(file_conf_el) + + else : #not a source file + file_el.appendChild(doc.createTextNode("")) + + filt_el.appendChild(file_el) + + files_el.appendChild(filt_el) + + top_el.appendChild(files_el) + + globals_el = doc.createElement("Globals") + globals_el.appendChild(doc.createTextNode("")) + top_el.appendChild(globals_el) + + #write all that junk to a string + dsp = doc.toprettyxml() + + writer.writeFile(filename, dsp) + +def run(): + generator = ProjectGeneratorMsvc9() + generator.genWorkspaces() diff -Naur bakefile-0.2.2.org/output/msvs2005_wince.py bakefile-0.2.2/output/msvs2005_wince.py --- bakefile-0.2.2.org/output/msvs2005_wince.py 1970-01-01 01:00:00.000000000 +0100 +++ bakefile-0.2.2/output/msvs2005_wince.py 2007-04-26 02:15:51.000000000 +0200 @@ -0,0 +1,124 @@ +# MS eMbedded Visual C++ projects generator script +# $Id: msevc4prj.py,v 1.2 2004/03/30 12:32:22 vaclavslavik Exp $ + +import msvs2005 +from msvs2005 import ProjectGeneratorMsvc9 + +import pdb + +class ProjectGeneratorMsvc9_wince(ProjectGeneratorMsvc9): + compiler_defines = { + 'ARMV4' : ('_WIN32_WCE=$(CEVER)','UNDER_CE','$(PLATFORMDEFINES)','WINCE','_WINDOWS','$(ARCHFAM)','$(_ARCHFAM_)','_UNICODE','UNICODE','POCKETPC2003_UI_MODEL') + } + + resource_defines = { + 'ARMV4' : ('_WIN32_WCE=$(CEVER)','UNDER_CE','$(PLATFORMDEFINES)') + } + + linker_opts = { + 'ARMV4' : ('/subsystem:windowsce,4.20', '/machine:ARM', '/ARMPADCODE') + } + + # -------------------------------------------------------------------- + # helpers + # -------------------------------------------------------------------- + + def mkConfigName(self, target, config): + return '%s|%s' % (config, self.getPlatform()) + + def getPlatform(self): + #FIXME -- this needs to use the CPU info from the bakefile + #FIXME -- the SDK should also come from the bakefile + return WINCE_PLATFORM + + def build_sln_pcp_str(self, t, guid, default_cfg_name): + globals_section_pcp_base_lib = '\t\t%s.%s.ActiveCfg = %s\n\t\t%s.%s.Build.0 = %s\n' + globals_section_pcp_base_exe = '\t\t%s.%s.ActiveCfg = %s\n\t\t%s.%s.Build.0 = %s\n\t\t%s.%s,Deploy.0 = %s\n' + + if t.type == 'exe' or t.type == 'dll': + return globals_section_pcp_base_exe % (guid, default_cfg_name, default_cfg_name, guid, default_cfg_name, default_cfg_name, guid, default_cfg_name, default_cfg_name) + else: + return globals_section_pcp_base_lib % (guid, default_cfg_name, default_cfg_name, guid, default_cfg_name, default_cfg_name) + + # ------------------------------------------------------------------------ + # DSP files + # ------------------------------------------------------------------------ + + def buildConfElement(self, doc, cfg, c, t): + conf_name = self.mkConfigName(t.id, c) + conf_el = doc.createElement("Configuration") + conf_el.setAttribute("Name", conf_name) + conf_el.setAttribute("OutputDirectory", ".\\%s" % cfg._targetdir[:-1]) + conf_el.setAttribute("IntermediateDirectory", ".\\%s\\%s" % (cfg._builddir, t.id) ) + conf_el.setAttribute("ConfigurationType", "%s" % cfg._type_code) + conf_el.setAttribute("CharacterSet", "1") #FIXME -- this should be configurable, too + return conf_el + + def buildCompilerToolElement(self, doc, cfg, c, t): + comp_el = ProjectGeneratorMsvc9.buildCompilerToolElement(self,doc, cfg, c, t) + comp_el.setAttribute("ExecutionBucket","7") + old_defs = comp_el.getAttribute("PreprocessorDefinitions") + try: + comp_el.setAttribute("PreprocessorDefinitions", ";".join( self.compiler_defines[cfg._CPU] ) + old_defs) + except: + pass + return comp_el + + def buildResourceCompilerToolElement(self, doc, cfg, t): + res_el = ProjectGeneratorMsvc9.buildResourceCompilerToolElement(self,doc, cfg, t) + old_defs = res_el.getAttribute("PreprocessorDefinitions") + try: + res_el.setAttribute("PreprocessorDefinitions", ";".join( self.resource_defines[cfg._CPU] ) + old_defs) + except: + pass + res_el.setAttribute("AdditionalIncludeDirectories", '$(IntDir)') + return res_el + + def buildLinkerToolElement(self, doc, cfg, t): + link_el = ProjectGeneratorMsvc9.buildLinkerToolElement(self,doc, cfg, t) + try: + link_el.setAttribute("AdditionalOptions", " ".join( self.linker_opts[cfg._CPU] )) + except: + pass + link_el.setAttribute("GenerateManifest", "false") #override this setting from the base + link_el.setAttribute("DelayLoadDLLs", '$(NOINHERIT)') + if cfg._debug == '1': + link_el.setAttribute("SubSystem","0") + else: + link_el.setAttribute("SubSystem","0") + + link_el.setAttribute("OptimizeReferences","2") + link_el.setAttribute("EnableCOMDATFolding","2") + link_el.setAttribute("TargetMachine", "3") + return link_el + + def additionalTools(self, doc, cfg, t): + deployment_tool_el = doc.createElement("DeploymentTool") + deployment_tool_el.setAttribute("ForceDirty","-1") + deployment_tool_el.setAttribute("RemoteDirectory","") + deployment_tool_el.setAttribute("RegisterOutput","0") + deployment_tool_el.setAttribute("AdditionalFiles","") + + debugger_tool_el = doc.createElement("DebuggerTool") + #debugger_tool_el.appendChild(doc.createTextNode("")) + + return (deployment_tool_el, debugger_tool_el) + + def get_group_defs(self): + return { + 'Source Files' : '*.cpp *.c *.cc *.cxx *.def *.odl *.idl *.hpj *.bat *.asm *.asmx', + 'Header Files' : '*.h *.hpp *.hxx *.hm *.inl *.inc *.xsd', + 'Resource Files' : '*.ico *.cur *.bmp *.dlg *.rc *.rc2 *.rct *.bin *.rgs *.gif *.jpg *.jpeg *.jpe', + } + + #def buildToolFilesElement(self, doc): + # tf_el = doc.createElement("ToolFiles") + # dtf = doc.createElement("DefaultToolFile") + # dtf.setAttribute("FileName", "armasm.rules") + # tf_el.appendChild(dtf) + # return tf_el + +def run(): + msvs2005.__dict__.update(globals()) + generator = ProjectGeneratorMsvc9_wince() + generator.genWorkspaces() diff -Naur bakefile-0.2.2.org/rules/FORMATS.bkmanifest bakefile-0.2.2/rules/FORMATS.bkmanifest --- bakefile-0.2.2.org/rules/FORMATS.bkmanifest 2007-02-12 01:29:10.000000000 +0100 +++ bakefile-0.2.2/rules/FORMATS.bkmanifest 2007-04-26 02:17:43.000000000 +0200 @@ -107,5 +107,20 @@ Symbian development files bld.inf + + + MS VS 2005 (PC target) + $(os.path.splitext(os.path.basename(INPUT_FILE))[0]).sln + + + + MS VS 2005 (WinCE target) + $(os.path.splitext(os.path.basename(INPUT_FILE))[0]).sln + + + + ARM develoer suite gmake files + ADSMakefile + diff -Naur bakefile-0.2.2.org/rules/._makefile.bkl bakefile-0.2.2/rules/._makefile.bkl --- bakefile-0.2.2.org/rules/._makefile.bkl 1970-01-01 01:00:00.000000000 +0100 +++ bakefile-0.2.2/rules/._makefile.bkl 2007-04-26 02:15:51.000000000 +0200 @@ -0,0 +1 @@ +Mac OS X  2 RTEXT \ No newline at end of file diff -Naur bakefile-0.2.2.org/rules/makefile.bkl bakefile-0.2.2/rules/makefile.bkl --- bakefile-0.2.2.org/rules/makefile.bkl 2007-02-12 01:29:10.000000000 +0100 +++ bakefile-0.2.2/rules/makefile.bkl 2007-04-26 02:15:51.000000000 +0200 @@ -262,6 +262,10 @@ $(substitute(value, lambda x: ref('__depname', x), 'DEP')) + + + $(value) + diff -Naur bakefile-0.2.2.org/rules/makefile.bkl.orig bakefile-0.2.2/rules/makefile.bkl.orig --- bakefile-0.2.2.org/rules/makefile.bkl.orig 1970-01-01 01:00:00.000000000 +0100 +++ bakefile-0.2.2/rules/makefile.bkl.orig 2007-02-12 01:29:10.000000000 +0100 @@ -0,0 +1,766 @@ + + + + + + 1 + + + + $(' '.join(['%s="$(DOLLAR)(%s)"' % (x,x) for x in OPTIONS.split()])) + + $(__MAKEARGS) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(substitute(value, lambda x: ref('__depname', x), 'DEP')) + + + + $(nativePaths(value)) + + + + $(id) + + + + + $(RM) $(value) + + + $('\n'.join([('-if exist %s del %s' % (x, x)) for x in safeSplit(value)])) + + + + + + $(value)$(LF) + + + + + + + + + + + + + + $(addPrefixIfNotEmpty(__DEFINE_ARG,value)) + + + + + $(addPrefixIfNotEmpty(__DEFINE_ARG,value.replace('"', '\\"'))) + + + $(value) + + + + $(addPrefixIfNotEmpty(__INCLUDE_ARG,nativePaths(value))) + $(value) + + + + + $(formatIfNotEmpty(__LIB_ARG,value)) + + + + + + $(__LIBDIR_ARG)$(nativePaths(value)) + + + + + + $(value) + + + $(value) + + + $(value) + + + $(value) + + + $(value) + + + + + $(substitute(value, lambda x: ref('__depname', x), 'DEP')) + + + + + + $(sources2objects(value, id, OBJEXT)) + + $(__objtmp) + + + + $(nativePaths(value)) + + + + $(value) + + + + $(substitute(value, + lambda x: ref('__targetdir',x)+ref('__linkname', x), + 'LIBR')) + + + + + + $(nativePaths(value)) + $(__targetdir_dironly)$(DIRSEP) + + + + + $(substituteFromDict(value, + {'off':__FLAG_OPTIMIZE_OFF, + 'speed':__FLAG_OPTIMIZE_SPEED, + 'size':__FLAG_OPTIMIZE_SIZE})) + + + + + + $(substituteFromDict(value, + {'i386':__FLAG_ARCH_I386, + 'i486':__FLAG_ARCH_I486, + 'i586':__FLAG_ARCH_I586, + 'i686':__FLAG_ARCH_I686, + })) + + + + + + $(substituteFromDict(value, + {'on':PIC_CFLAGS, + 'off':''})) + + $(__picflag) + $(__picflag) + + + + + $(substituteFromDict(value, + {'on':__FLAG_DEBUG_ON, + 'off':__FLAG_DEBUG_OFF})) + + + $(substituteFromDict(value, + {'on':__FLAG_DEBUG_ON_LINKER, + 'off':__FLAG_DEBUG_OFF_LINKER})) + + + + + + $(substituteFromDict(value, + {'multi':__FLAG_MULTI_THREADING_LD, + 'single':__FLAG_SINGLE_THREADING_LD})) + + + $(substituteFromDict(value, + {'multi':__FLAG_MULTI_THREADING_CPP, + 'single':__FLAG_SINGLE_THREADING_CPP})) + + + + + + $(substituteFromDict(value, + {'no':__FLAG_WARNINGS_NO, + 'default':__FLAG_WARNINGS_DEFAULT, + 'max':__FLAG_WARNINGS_MAX})) + + + + + + $(substituteFromDict(value, + {'on':__FLAG_RTTI_ON, + 'off':__FLAG_RTTI_OFF})) + + + + + + $(substituteFromDict(value, + {'on':__FLAG_EXCEPTIONS_ON, + 'off':__FLAG_EXCEPTIONS_OFF})) + + + + + + + + + + + + + + + + + + + + $(ref('__targetdir',id))$(ref('__targetname',id)) + + + + + $(value)$(LF) + + + + + + + + + + $(substituteFromDict(value, + {'console':__FLAG_EXE_CONSOLE, + 'gui':__FLAG_EXE_GUI})) + + + + + $(value) + + + + + + + + $(value) + + + + + + + $(value) + + + + + + + + + + $(value) + + + + + + + + + + + + <__command>$(value) + + + 1 + + + + + + +