diff options
author | starkos <none@none> | 2009-04-24 17:40:28 +0400 |
---|---|---|
committer | starkos <none@none> | 2009-04-24 17:40:28 +0400 |
commit | 11064958511f31fe4b87be240de5b420db5ed322 (patch) | |
tree | 54ee1171fc5dca6b2e66c3eef449248f48ddb1c9 | |
parent | 31a56ddc04ebcfea219985e86755a74da206bdcf (diff) |
Added platform support to CodeLite
-rw-r--r-- | premake4.lua | 2 | ||||
-rw-r--r-- | src/actions/codelite/codelite_project.lua | 174 | ||||
-rw-r--r-- | src/actions/codelite/codelite_workspace.lua | 21 |
3 files changed, 110 insertions, 87 deletions
diff --git a/premake4.lua b/premake4.lua index 7bbb202..fcf4d6b 100644 --- a/premake4.lua +++ b/premake4.lua @@ -44,7 +44,7 @@ end files { - "src/**.h", "src/**.c", "src/**.lua", "src/**.tmpl", + "src/**.h", "src/**.c", "src/**.lua", "tests/**.lua" } diff --git a/src/actions/codelite/codelite_project.lua b/src/actions/codelite/codelite_project.lua index 8098487..204e713 100644 --- a/src/actions/codelite/codelite_project.lua +++ b/src/actions/codelite/codelite_project.lua @@ -18,95 +18,109 @@ } _p(' <Settings Type="%s">', types[prj.kind]) - for cfg in premake.eachconfig(prj) do - local name = premake.esc(cfg.name) - local compiler = iif(cfg.language == "C", "gcc", "g++") - _p(' <Configuration Name="%s" CompilerType="gnu %s" DebuggerType="GNU gdb debugger" Type="%s">', name, compiler, types[cfg.kind]) - - local fname = premake.esc(cfg.buildtarget.fullpath) - local objdir = premake.esc(cfg.objectsdir) - local runcmd = cfg.buildtarget.name - local rundir = cfg.buildtarget.directory - local pause = iif(cfg.kind == "WindowedApp", "no", "yes") - _p(' <General OutputFile="%s" IntermediateDirectory="%s" Command="./%s" CommandArguments="" WorkingDirectory="%s" PauseExecWhenProcTerminates="%s"/>', fname, objdir, runcmd, rundir, pause) - - -- begin compiler block -- - local flags = premake.esc(table.join(premake.gcc.getcflags(cfg), premake.gcc.getcxxflags(cfg), cfg.buildoptions)) - _p(' <Compiler Required="yes" Options="%s">', table.concat(flags, ";")) - for _,v in ipairs(cfg.includedirs) do - _p(' <IncludePath Value="%s"/>', premake.esc(v)) - end - for _,v in ipairs(cfg.defines) do - _p(' <Preprocessor Value="%s"/>', premake.esc(v)) - end - _p(' </Compiler>') - -- end compiler block -- - - -- begin linker block -- - flags = premake.esc(table.join(premake.gcc.getldflags(cfg), cfg.linkoptions)) - _p(' <Linker Required="yes" Options="%s">', table.concat(flags, ";")) - for _,v in ipairs(premake.getlinks(cfg, "all", "directory")) do - _p(' <LibraryPath Value="%s" />', premake.esc(v)) - end - for _,v in ipairs(premake.getlinks(cfg, "all", "basename")) do - _p(' <Library Value="%s" />', premake.esc(v)) - end - _p(' </Linker>') - -- end linker block -- + -- build a list of supported target platforms that also includes a generic build + local platforms = premake.filterplatforms(prj.solution, premake.gcc.platforms, "Native") + + for _, platform in ipairs(platforms) do + for cfg in premake.eachconfig(prj) do + local name = premake.esc(cfg.name) + if platform ~= "Native" then + name = name .. "|" .. platform + end + local compiler = iif(cfg.language == "C", "gcc", "g++") + _p(' <Configuration Name="%s" CompilerType="gnu %s" DebuggerType="GNU gdb debugger" Type="%s">', name, compiler, types[cfg.kind]) - -- begin resource compiler block -- - if premake.findfile(cfg, ".rc") then - local defines = table.implode(table.join(cfg.defines, cfg.resdefines), "-D", ";", "") - local options = table.concat(cfg.resoptions, ";") - _p(' <ResourceCompiler Required="yes" Options="%s%s">', defines, options) - for _,v in ipairs(table.join(cfg.includedirs, cfg.resincludedirs)) do + local fname = premake.esc(cfg.buildtarget.fullpath) + local objdir = premake.esc(cfg.objectsdir) + local runcmd = cfg.buildtarget.name + local rundir = cfg.buildtarget.directory + local pause = iif(cfg.kind == "WindowedApp", "no", "yes") + _p(' <General OutputFile="%s" IntermediateDirectory="%s" Command="./%s" CommandArguments="" WorkingDirectory="%s" PauseExecWhenProcTerminates="%s"/>', fname, objdir, runcmd, rundir, pause) + + -- begin compiler block -- + local flags = premake.esc(table.join(premake.gcc.getcflags(cfg), premake.gcc.getcxxflags(cfg), cfg.buildoptions)) + _p(' <Compiler Required="yes" Options="%s">', table.concat(flags, ";")) + for _,v in ipairs(cfg.includedirs) do _p(' <IncludePath Value="%s"/>', premake.esc(v)) end - _p(' </ResourceCompiler>') - else - _p(' <ResourceCompiler Required="no" Options=""/>') - end - -- end resource compiler block -- - - -- begin build steps -- - if #cfg.prebuildcommands > 0 then - _p(' <PreBuild>') - for _,v in ipairs(cfg.prebuildcommands) do - _p(' <Command Enabled="yes">%s</Command>', premake.esc(v)) + for _,v in ipairs(cfg.defines) do + _p(' <Preprocessor Value="%s"/>', premake.esc(v)) end - _p(' </PreBuild>') - end - if #cfg.postbuildcommands > 0 then - _p(' <PostBuild>') - for _,v in ipairs(cfg.postbuildcommands) do - _p(' <Command Enabled="yes">%s</Command>', premake.esc(v)) + _p(' </Compiler>') + -- end compiler block -- + + -- begin linker block -- + flags = premake.esc(table.join(premake.gcc.getldflags(cfg), cfg.linkoptions)) + _p(' <Linker Required="yes" Options="%s">', table.concat(flags, ";")) + for _,v in ipairs(premake.getlinks(cfg, "all", "directory")) do + _p(' <LibraryPath Value="%s" />', premake.esc(v)) + end + for _,v in ipairs(premake.getlinks(cfg, "all", "basename")) do + _p(' <Library Value="%s" />', premake.esc(v)) + end + _p(' </Linker>') + -- end linker block -- + + -- begin resource compiler block -- + if premake.findfile(cfg, ".rc") then + local defines = table.implode(table.join(cfg.defines, cfg.resdefines), "-D", ";", "") + local options = table.concat(cfg.resoptions, ";") + _p(' <ResourceCompiler Required="yes" Options="%s%s">', defines, options) + for _,v in ipairs(table.join(cfg.includedirs, cfg.resincludedirs)) do + _p(' <IncludePath Value="%s"/>', premake.esc(v)) + end + _p(' </ResourceCompiler>') + else + _p(' <ResourceCompiler Required="no" Options=""/>') + end + -- end resource compiler block -- + + -- begin build steps -- + if #cfg.prebuildcommands > 0 then + _p(' <PreBuild>') + for _,v in ipairs(cfg.prebuildcommands) do + _p(' <Command Enabled="yes">%s</Command>', premake.esc(v)) + end + _p(' </PreBuild>') + end + if #cfg.postbuildcommands > 0 then + _p(' <PostBuild>') + for _,v in ipairs(cfg.postbuildcommands) do + _p(' <Command Enabled="yes">%s</Command>', premake.esc(v)) + end + _p(' </PostBuild>') end - _p(' </PostBuild>') + -- end build steps -- + + _p(' <CustomBuild Enabled="no">') + _p(' <CleanCommand></CleanCommand>') + _p(' <BuildCommand></BuildCommand>') + _p(' <SingleFileCommand></SingleFileCommand>') + _p(' <MakefileGenerationCommand></MakefileGenerationCommand>') + _p(' <ThirdPartyToolName>None</ThirdPartyToolName>') + _p(' <WorkingDirectory></WorkingDirectory>') + _p(' </CustomBuild>') + _p(' <AdditionalRules>') + _p(' <CustomPostBuild></CustomPostBuild>') + _p(' <CustomPreBuild></CustomPreBuild>') + _p(' </AdditionalRules>') + _p(' </Configuration>') end - -- end build steps -- - - _p(' <CustomBuild Enabled="no">') - _p(' <CleanCommand></CleanCommand>') - _p(' <BuildCommand></BuildCommand>') - _p(' <SingleFileCommand></SingleFileCommand>') - _p(' <MakefileGenerationCommand></MakefileGenerationCommand>') - _p(' <ThirdPartyToolName>None</ThirdPartyToolName>') - _p(' <WorkingDirectory></WorkingDirectory>') - _p(' </CustomBuild>') - _p(' <AdditionalRules>') - _p(' <CustomPostBuild></CustomPostBuild>') - _p(' <CustomPreBuild></CustomPreBuild>') - _p(' </AdditionalRules>') - _p(' </Configuration>') end _p(' </Settings>') - - for _,cfgname in ipairs(prj.configurations) do - _p(' <Dependencies name="%s">', cfgname) - for _,dep in ipairs(premake.getdependencies(prj)) do - _p(' <Project Name="%s"/>', dep.name) + + for _, platform in ipairs(platforms) do + for _,cfgname in ipairs(prj.configurations) do + local name = premake.esc(cfgname) + if platform ~= "Native" then + name = name .. "|" .. platform + end + _p(' <Dependencies name="%s">', name) + for _,dep in ipairs(premake.getdependencies(prj)) do + _p(' <Project Name="%s"/>', dep.name) + end + _p(' </Dependencies>') end - _p(' </Dependencies>') end _p('</CodeLite_Project>') diff --git a/src/actions/codelite/codelite_workspace.lua b/src/actions/codelite/codelite_workspace.lua index 8aafb25..1fae0a6 100644 --- a/src/actions/codelite/codelite_workspace.lua +++ b/src/actions/codelite/codelite_workspace.lua @@ -15,15 +15,24 @@ _p(' <Project Name="%s" Path="%s.project" Active="%s" />', name, fname, active) end + -- build a list of supported target platforms that also includes a generic build + local platforms = premake.filterplatforms(sln, premake[_OPTIONS.cc].platforms, "Native") + _p(' <BuildMatrix>') - for _, cfgname in ipairs(sln.configurations) do - _p(' <WorkspaceConfiguration Name="%s" Selected="yes">', cfgname) + for _, platform in ipairs(platforms) do + for _, cfgname in ipairs(sln.configurations) do + local name = cfgname + if platform ~= "Native" then + name = name .. "|" .. platform + end + _p(' <WorkspaceConfiguration Name="%s" Selected="yes">', name) - for _,prj in ipairs(sln.projects) do - _p(' <Project Name="%s" ConfigName="%s"/>', prj.name, cfgname) - end + for _,prj in ipairs(sln.projects) do + _p(' <Project Name="%s" ConfigName="%s"/>', prj.name, name) + end - _p(' </WorkspaceConfiguration>') + _p(' </WorkspaceConfiguration>') + end end _p(' </BuildMatrix>') _p('</CodeLite_Workspace>') |