makefile = open("mktemplates/template.mk", "r").read()
makefile = mkGenerator(projectInfo, makefile)
open(prjdir + "/" + os.path.basename(prjdir) + ".mk", "w").write(makefile)
+ workspace = codeliteWorkspaceGenerator(projectInfo)
+ open(directory + "/" + os.path.basename(prjdir) + ".workspace", "w").write(workspace)
+ project = codeliteProjectGenerator(projectInfo)
+ open(directory + "/" + os.path.basename(prjdir) + ".project", "w").write(project)
def mkGenerator(projectInfo, makefile):
"""
files.append(path + "/" + filename)
csrc = " \\\n\t".join(files) + " \\"
return csrc
+
+def clFiles(fileDict, directory):
+ filelist = []
+ filelist.append("<VirtualDirectory Name=\"%s\">" %os.path.basename(directory))
+ for f in fileDict[directory]["files"]:
+ filelist.append("<File Name=\"%s\"/>" %os.path.join(directory, f))
+ for d in fileDict[directory]["dirs"]:
+ filelist += clFiles(fileDict, os.path.join(directory, d))
+ filelist.append("</VirtualDirectory>")
+ return filelist
+
+def findSources(path):
+ fileDict = {}
+ for root, dirs, files in os.walk(path):
+ if root.find("svn") == -1:
+ fileDict[root] = {"dirs": [], "files": []}
+ for dir in dirs:
+ if dir.find("svn") == -1:
+ fileDict[root]["dirs"].append(dir)
+ for file in files:
+ if file.endswith(const.EXTENSION_FILTER):
+ fileDict[root]["files"].append(file)
+ return fileDict
+
+def codeliteProjectGenerator(projectInfo):
+ template = open("cltemplates/bertos.project").read()
+ filelist = "\n".join(clFiles(findSources(projectInfo.info("PROJECT_PATH")), projectInfo.info("PROJECT_PATH")))
+ while template.find("$filelist") != -1:
+ template = template.replace("$filelist", filelist)
+ return template
+
+def codeliteWorkspaceGenerator(projectInfo):
+ template = open("cltemplates/bertos.workspace").read()
+ projectName = os.path.basename(projectInfo.info("PROJECT_PATH"))
+ while template.find("$project") != -1:
+ template = template.replace("$project", projectName)
+ return template
def getSystemPath():
path = os.environ["PATH"]
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<CodeLite_Project Name="bertos" InternalType="">
+$filelist
+ <Description></Description>
+ <Dependencies/>
+ <Settings Type="Dynamic Library">
+ <Configuration Name="Debug" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library">
+ <General OutputFile="" IntermediateDirectory="./Debug" Command="" CommandArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes"/>
+ <Compiler Required="yes" Options="-g">
+ <IncludePath Value="."/>
+ </Compiler>
+ <Linker Required="yes" Options=""/>
+ <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="">
+ <PostConnectCommands></PostConnectCommands>
+ <StartupCommands></StartupCommands>
+ </Debugger>
+ <ResourceCompiler Required="no" Options=""/>
+ <PreBuild/>
+ <PostBuild/>
+ <CustomBuild Enabled="yes">
+ <CleanCommand>make clean</CleanCommand>
+ <BuildCommand>make</BuildCommand>
+ <PreprocessFileCommand></PreprocessFileCommand>
+ <SingleFileCommand></SingleFileCommand>
+ <MakefileGenerationCommand></MakefileGenerationCommand>
+ <ThirdPartyToolName>None</ThirdPartyToolName>
+ <WorkingDirectory>$(WorkspacePath)</WorkingDirectory>
+ </CustomBuild>
+ <AdditionalRules>
+ <CustomPostBuild></CustomPostBuild>
+ <CustomPreBuild></CustomPreBuild>
+ </AdditionalRules>
+ </Configuration>
+ <Configuration Name="Release" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library">
+ <General OutputFile="" IntermediateDirectory="./Release" Command="" CommandArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes"/>
+ <Compiler Required="yes" Options="">
+ <IncludePath Value="."/>
+ </Compiler>
+ <Linker Required="yes" Options="-O2"/>
+ <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="">
+ <PostConnectCommands></PostConnectCommands>
+ <StartupCommands></StartupCommands>
+ </Debugger>
+ <ResourceCompiler Required="no" Options=""/>
+ <PreBuild/>
+ <PostBuild/>
+ <CustomBuild Enabled="yes">
+ <CleanCommand>make clean</CleanCommand>
+ <BuildCommand>make</BuildCommand>
+ <PreprocessFileCommand></PreprocessFileCommand>
+ <SingleFileCommand></SingleFileCommand>
+ <MakefileGenerationCommand></MakefileGenerationCommand>
+ <ThirdPartyToolName>None</ThirdPartyToolName>
+ <WorkingDirectory>$(WorkspacePath)</WorkingDirectory>
+ </CustomBuild>
+ <AdditionalRules>
+ <CustomPostBuild></CustomPostBuild>
+ <CustomPreBuild></CustomPreBuild>
+ </AdditionalRules>
+ </Configuration>
+ </Settings>
+</CodeLite_Project>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<CodeLite_Workspace Name="$project" Database="./bertos.tags">
+ <Project Name="$project" Path="$project.project" Active="Yes"/>
+ <BuildMatrix>
+ <WorkspaceConfiguration Name="Debug" Selected="yes">
+ <Project Name="$project" ConfigName="Debug"/>
+ </WorkspaceConfiguration>
+ <WorkspaceConfiguration Name="Release" Selected="yes">
+ <Project Name="$project" ConfigName="Release"/>
+ </WorkspaceConfiguration>
+ </BuildMatrix>
+</CodeLite_Workspace>
"CPU_DESC" : []
}
-TOOLCHAIN_ITEMS = ["ld", "as"]
+TOOLCHAIN_ITEMS = ("ld", "as")
CPU_DEFINITION = "*.cdef"
MODULE_CONFIGURATION = "cfg_*.h"
-UI_LOCATION = "ui"
\ No newline at end of file
+UI_LOCATION = "ui"
+
+EXTENSION_FILTER = (
+ ".c",
+ ".cpp",
+ ".cxx",
+ ".h",
+ ".c++",
+)
\ No newline at end of file