diff options
-rw-r--r-- | src/_manifest.lua | 15 | ||||
-rw-r--r-- | src/actions/codeblocks/_codeblocks.lua | 4 | ||||
-rw-r--r-- | src/actions/codeblocks/codeblocks_cbp.lua | 121 | ||||
-rw-r--r-- | src/actions/codeblocks/codeblocks_cbp.tmpl | 89 | ||||
-rw-r--r-- | src/actions/codeblocks/codeblocks_workspace.lua | 27 | ||||
-rw-r--r-- | src/actions/codeblocks/codeblocks_workspace.tmpl | 12 | ||||
-rw-r--r-- | src/actions/codelite/_codelite.lua | 44 | ||||
-rw-r--r-- | src/actions/codelite/codelite_project.lua | 134 | ||||
-rw-r--r-- | src/actions/codelite/codelite_project.tmpl | 69 | ||||
-rw-r--r-- | src/actions/codelite/codelite_workspace.lua | 31 | ||||
-rw-r--r-- | src/actions/codelite/codelite_workspace.tmpl | 15 | ||||
-rw-r--r-- | src/tools/gcc.lua | 5 | ||||
-rw-r--r-- | tests/test_gmake_cpp.lua | 2 |
13 files changed, 322 insertions, 246 deletions
diff --git a/src/_manifest.lua b/src/_manifest.lua index 7f0516b..763e5f9 100644 --- a/src/_manifest.lua +++ b/src/_manifest.lua @@ -26,6 +26,10 @@ "tools/ow.lua", "base/validate.lua", "base/help.lua", + "actions/codeblocks/codeblocks_workspace.lua", + "actions/codeblocks/codeblocks_cbp.lua", + "actions/codelite/codelite_workspace.lua", + "actions/codelite/codelite_project.lua", "actions/make/make_solution.lua", "actions/make/make_cpp.lua", "actions/make/make_csharp.lua", @@ -40,17 +44,6 @@ } --- The list of templates - - local templates = - { - "actions/codeblocks/codeblocks_workspace.tmpl", - "actions/codeblocks/codeblocks_cbp.tmpl", - "actions/codelite/codelite_workspace.tmpl", - "actions/codelite/codelite_project.tmpl", - } - - -- The list of built in actions local actions = diff --git a/src/actions/codeblocks/_codeblocks.lua b/src/actions/codeblocks/_codeblocks.lua index efcd5b1..03d9ad6 100644 --- a/src/actions/codeblocks/_codeblocks.lua +++ b/src/actions/codeblocks/_codeblocks.lua @@ -19,11 +19,11 @@ }, solutiontemplates = { - { ".workspace", _TEMPLATES.codeblocks_workspace }, + { ".workspace", premake.codeblocks_workspace }, }, projecttemplates = { - { ".cbp", _TEMPLATES.codeblocks_cbp }, + { ".cbp", premake.codeblocks_cbp }, }, onclean = function(solutions, projects, targets) diff --git a/src/actions/codeblocks/codeblocks_cbp.lua b/src/actions/codeblocks/codeblocks_cbp.lua new file mode 100644 index 0000000..ef52a13 --- /dev/null +++ b/src/actions/codeblocks/codeblocks_cbp.lua @@ -0,0 +1,121 @@ +-- +-- codeblocks_cbp.lua +-- Generate a Code::Blocks C/C++ project. +-- Copyright (c) 2009 Jason Perkins and the Premake project +-- + + function premake.codeblocks_cbp(prj) + -- alias the C/C++ compiler interface + local cc = premake[_OPTIONS.cc] + + _p('<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>') + _p('<CodeBlocks_project_file>') + _p('\t<FileVersion major="1" minor="6" />') + + -- write project block header + _p('\t<Project>') + _p('\t\t<Option title="%s" />', premake.esc(prj.name)) + _p('\t\t<Option pch_mode="2" />') + _p('\t\t<Option compiler="%s" />', _OPTIONS.cc) + + -- write configuration blocks + _p('\t\t<Build>') + for cfg in premake.eachconfig(prj) do + _p('\t\t\t<Target title="%s">', premake.esc(cfg.name)) + + _p('\t\t\t\t<Option output="%s" prefix_auto="0" extension_auto="0" />', premake.esc(cfg.buildtarget.fullpath)) + _p('\t\t\t\t<Option object_output="%s" />', premake.esc(cfg.objectsdir)) + + -- identify the type of binary + local types = { WindowedApp = 0, ConsoleApp = 1, StaticLib = 2, SharedLib = 3 } + _p('\t\t\t\t<Option type="%d" />', types[cfg.kind]) + + _p('\t\t\t\t<Option compiler="%s" />', _OPTIONS.cc) + + if (cfg.kind == "SharedLib") then + _p('\t\t\t\t<Option createDefFile="0" />') + _p('\t\t\t\t<Option createStaticLib="%s" />', iif(cfg.flags.NoImportLib, 0, 1)) + end + + -- begin compiler block -- + _p('\t\t\t\t<Compiler>') + for _,flag in ipairs(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cc.getdefines(cfg.defines), cfg.buildoptions)) do + _p('\t\t\t\t\t<Add option="%s" />', premake.esc(flag)) + end + if not cfg.flags.NoPCH and cfg.pchheader then + _p('\t\t\t\t\t<Add option="-Winvalid-pch" />') + _p('\t\t\t\t\t<Add option="-include "%s"" />', premake.esc(cfg.pchheader)) + end + for _,v in ipairs(cfg.includedirs) do + _p('\t\t\t\t\t<Add directory="%s" />', premake.esc(v)) + end + _p('\t\t\t\t</Compiler>') + -- end compiler block -- + + -- begin linker block -- + _p('\t\t\t\t<Linker>') + for _,flag in ipairs(table.join(cc.getldflags(cfg), cfg.linkoptions)) do + _p('\t\t\t\t\t<Add option="%s" />', premake.esc(flag)) + end + for _,v in ipairs(premake.getlinks(cfg, "all", "directory")) do + _p('\t\t\t\t\t<Add directory="%s" />', premake.esc(v)) + end + for _,v in ipairs(premake.getlinks(cfg, "all", "basename")) do + _p('\t\t\t\t\t<Add library="%s" />', premake.esc(v)) + end + _p('\t\t\t\t</Linker>') + -- end linker block -- + + -- begin resource compiler block -- + if premake.findfile(cfg, ".rc") then + _p('\t\t\t\t<ResourceCompiler>') + for _,v in ipairs(cfg.includedirs) do + _p('\t\t\t\t\t<Add directory="%s" />', premake.esc(v)) + end + for _,v in ipairs(cfg.resincludedirs) do + _p('\t\t\t\t\t<Add directory="%s" />', premake.esc(v)) + end + _p('\t\t\t\t</ResourceCompiler>') + end + -- end resource compiler block -- + + -- begin build steps -- + if #cfg.prebuildcommands > 0 or #cfg.postbuildcommands > 0 then + _p('\t\t\t\t<ExtraCommands>') + for _,v in ipairs(cfg.prebuildcommands) do + _p('\t\t\t\t\t<Add before="%s" />', premake.esc(v)) + end + for _,v in ipairs(cfg.postbuildcommands) do + _p('\t\t\t\t\t<Add after="%s" />', premake.esc(v)) + end + + _p('\t\t\t\t</ExtraCommands>') + end + -- end build steps -- + + _p('\t\t\t</Target>') + end + _p('\t\t</Build>') + + -- begin files block -- + for _,fname in ipairs(prj.files) do + _p('\t\t<Unit filename="%s">', premake.esc(fname)) + if path.getextension(fname) == ".rc" then + _p('\t\t\t<Option compilerVar="WINDRES" />') + elseif path.iscppfile(fname) then + _p('\t\t\t<Option compilerVar="%s" />', iif(prj.language == "C", "CC", "CPP")) + if (not prj.flags.NoPCH and fname == prj.pchheader) then + _p('\t\t\t<Option compile="1" />') + _p('\t\t\t<Option weight="0" />') + end + end + _p('\t\t</Unit>') + end + -- end files block -- + + _p('\t\t<Extensions />') + _p('\t</Project>') + _p('</CodeBlocks_project_file>') + _p('') + + end diff --git a/src/actions/codeblocks/codeblocks_cbp.tmpl b/src/actions/codeblocks/codeblocks_cbp.tmpl deleted file mode 100644 index ee966a9..0000000 --- a/src/actions/codeblocks/codeblocks_cbp.tmpl +++ /dev/null @@ -1,89 +0,0 @@ -<% local cc = premake[_OPTIONS.cc] %>
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="<%= premake.esc(this.name) %>" />
- <Option pch_mode="2" />
- <Option compiler="<%= _OPTIONS.cc %>" />
- <Build>
- <% for cfg in premake.eachconfig(this) do %>
- <Target title="<%= premake.esc(cfg.name) %>">
- <Option output="<%= premake.esc(cfg.buildtarget.fullpath) %>" prefix_auto="0" extension_auto="0" />
- <Option object_output="<%= premake.esc(cfg.objectsdir) %>" />
- <% if (cfg.kind == "WindowedApp") then %>
- <Option type="0" />
- <% elseif (cfg.kind == "ConsoleApp") then %>
- <Option type="1" />
- <% elseif (cfg.kind == "StaticLib") then %>
- <Option type="2" />
- <% elseif (cfg.kind == "SharedLib") then %>
- <Option type="3" />
- <% end %>
- <Option compiler="<%= _OPTIONS.cc %>" />
- <% if (cfg.kind == "SharedLib") then %>
- <Option createDefFile="0" />
- <Option createStaticLib="<%= iif(cfg.flags.NoImportLib, 0, 1) %>" />
- <% end %>
- <Compiler>
- <% for _,flag in ipairs(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cc.getdefines(cfg.defines), cfg.buildoptions)) do %>
- <Add option="<%= premake.esc(flag) %>" />
- <% end %>
- <% if not cfg.flags.NoPCH and cfg.pchheader then %>
- <Add option="-Winvalid-pch" />
- <Add option="-include "<%= premake.esc(cfg.pchheader) %>"" />
- <% end %>
- <% for _,v in ipairs(cfg.includedirs) do %>
- <Add directory="<%= premake.esc(v) %>" />
- <% end %>
- </Compiler>
- <Linker>
- <% for _,flag in ipairs(table.join(cc.getldflags(cfg), cfg.linkoptions)) do %>
- <Add option="<%= premake.esc(flag) %>" />
- <% end %>
- <% for _,v in ipairs(premake.getlinks(cfg, "all", "directory")) do %>
- <Add directory="<%= premake.esc(v) %>" />
- <% end %>
- <% for _,v in ipairs(premake.getlinks(cfg, "all", "basename")) do %>
- <Add library="<%= premake.esc(v) %>" />
- <% end %>
- </Linker>
- <% if premake.findfile(cfg, ".rc") then %>
- <ResourceCompiler>
- <% for _,v in ipairs(cfg.includedirs) do %>
- <Add directory="<%= premake.esc(v) %>" />
- <% end %>
- <% for _,v in ipairs(cfg.resincludedirs) do %>
- <Add directory="<%= premake.esc(v) %>" />
- <% end %>
- </ResourceCompiler>
- <% end %>
- <% if #cfg.prebuildcommands > 0 or #cfg.postbuildcommands > 0 then %>
- <ExtraCommands>
- <% for _,v in ipairs(cfg.prebuildcommands) do %>
- <Add before="<%= premake.esc(v) %>" />
- <% end %>
- <% for _,v in ipairs(cfg.postbuildcommands) do %>
- <Add after="<%= premake.esc(v) %>" />
- <% end %>
- </ExtraCommands>
- <% end %>
- </Target>
- <% end %>
- </Build>
- <% for _,fname in ipairs(this.files) do %>
- <Unit filename="<%= premake.esc(fname) %>">
- <% if path.getextension(fname) == ".rc" then %>
- <Option compilerVar="WINDRES" />
- <% elseif path.iscppfile(fname) then %>
- <Option compilerVar="<%= iif(this.language == "C", "CC", "CPP") %>" />
- <% if (not this.flags.NoPCH and fname == this.pchheader) then %>
- <Option compile="1" />
- <Option weight="0" />
- <% end %>
- <% end %>
- </Unit>
- <% end %>
- <Extensions />
- </Project>
-</CodeBlocks_project_file>
diff --git a/src/actions/codeblocks/codeblocks_workspace.lua b/src/actions/codeblocks/codeblocks_workspace.lua new file mode 100644 index 0000000..51dce74 --- /dev/null +++ b/src/actions/codeblocks/codeblocks_workspace.lua @@ -0,0 +1,27 @@ +-- +-- codeblocks_workspace.lua +-- Generate a Code::Blocks workspace. +-- Copyright (c) 2009 Jason Perkins and the Premake project +-- + + function premake.codeblocks_workspace(sln) + _p('<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>') + _p('<CodeBlocks_workspace_file>') + _p('\t<Workspace title="%s">', sln.name) + + for prj in premake.eachproject(sln) do + local fname = path.join(path.getrelative(sln.location, prj.location), prj.name) + local active = iif(prj.project == sln.projects[1], ' active="1"', '') + + _p('\t\t<Project filename="%s.cbp"%s>', fname, active) + for _,dep in ipairs(premake.getdependencies(prj)) do + _p('\t\t\t<Depends filename="%s.cbp" />', path.join(path.getrelative(sln.location, dep.location), dep.name)) + end + + _p('\t\t</Project>') + end + + _p('\t</Workspace>') + _p('</CodeBlocks_workspace_file>') + end + diff --git a/src/actions/codeblocks/codeblocks_workspace.tmpl b/src/actions/codeblocks/codeblocks_workspace.tmpl deleted file mode 100644 index 7c8d320..0000000 --- a/src/actions/codeblocks/codeblocks_workspace.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_workspace_file>
- <Workspace title="<%= this.name %>">
- <% for prj in premake.eachproject(this) do %>
- <Project filename="<%= path.join(path.getrelative(this.location, prj.location), prj.name) %>.cbp"<%= iif(prj.project==this.projects[1], ' active="1"', '') %>>
- <% for _,dep in ipairs(premake.getdependencies(prj)) do %>
- <Depends filename="<%= path.join(path.getrelative(this.location, dep.location), dep.name) %>.cbp" />
- <% end %>
- </Project>
- <% end %>
- </Workspace>
-</CodeBlocks_workspace_file>
diff --git a/src/actions/codelite/_codelite.lua b/src/actions/codelite/_codelite.lua index a9461e7..8dd5a7c 100644 --- a/src/actions/codelite/_codelite.lua +++ b/src/actions/codelite/_codelite.lua @@ -4,46 +4,6 @@ -- Copyright (c) 2008 Jason Perkins and the Premake project -- - _CODELITE = { } - - --- --- Translate Premake kind values into CodeLite kind values. --- - - function _CODELITE.kind(value) - if (value == "ConsoleApp" or value == "WindowedApp") then - return "Executable" - elseif (value == "StaticLib") then - return "Static Library" - elseif (value == "SharedLib") then - return "Dynamic Library" - end - end - - - --- --- Write out entries for the files element; called from premake.walksources(). --- - - function _CODELITE.files(prj, fname, state, nestlevel) - local indent = string.rep(" ", nestlevel + 1) - - if (state == "GroupStart") then - io.write(indent .. '<VirtualDirectory Name="' .. path.getname(fname) .. '">\n') - elseif (state == "GroupEnd") then - io.write(indent .. '</VirtualDirectory>\n') - else - io.write(indent .. '<File Name="' .. fname .. '"/>\n') - end - end - - - --- --- The CodeLite action --- newaction { trigger = "codelite", shortname = "CodeLite", @@ -59,11 +19,11 @@ }, solutiontemplates = { - { ".workspace", _TEMPLATES.codelite_workspace }, + { ".workspace", premake.codelite_workspace }, }, projecttemplates = { - { ".project", _TEMPLATES.codelite_project }, + { ".project", premake.codelite_project }, }, onclean = function(solutions, projects, targets) diff --git a/src/actions/codelite/codelite_project.lua b/src/actions/codelite/codelite_project.lua new file mode 100644 index 0000000..8098487 --- /dev/null +++ b/src/actions/codelite/codelite_project.lua @@ -0,0 +1,134 @@ +-- +-- codelite_project.lua +-- Generate a CodeLite C/C++ project file. +-- Copyright (c) 2009 Jason Perkins and the Premake project +-- + + function premake.codelite_project(prj) + _p('<?xml version="1.0" encoding="utf-8"?>') + _p('<CodeLite_Project Name="%s">', premake.esc(prj.name)) + + premake.walksources(prj, prj.files, premake.codelite_files) + + local types = { + ConsoleApp = "Executable", + WindowedApp = "Executable", + StaticLib = "Static Library", + SharedLib = "Dynamic Library", + } + _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 -- + + -- 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 + -- 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) + end + _p(' </Dependencies>') + end + + _p('</CodeLite_Project>') + end + + + +-- +-- Write out entries for the files element; called from premake.walksources(). +-- + + function premake.codelite_files(prj, fname, state, nestlevel) + local indent = string.rep(" ", nestlevel + 1) + + if (state == "GroupStart") then + io.write(indent .. '<VirtualDirectory Name="' .. path.getname(fname) .. '">\n') + elseif (state == "GroupEnd") then + io.write(indent .. '</VirtualDirectory>\n') + else + io.write(indent .. '<File Name="' .. fname .. '"/>\n') + end + end + + + diff --git a/src/actions/codelite/codelite_project.tmpl b/src/actions/codelite/codelite_project.tmpl deleted file mode 100644 index 765c5dd..0000000 --- a/src/actions/codelite/codelite_project.tmpl +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<CodeLite_Project Name="<%= premake.esc(this.name) %>">
- <% premake.walksources(this, this.files, _CODELITE.files) %>
- <Settings Type="<%= _CODELITE.kind(this.kind) %>">
- <% for cfg in premake.eachconfig(this) do %>
- <Configuration Name="<%= premake.esc(cfg.name) %>" CompilerType="gnu <%= iif(cfg.language == "C", "gcc", "g++") %>" DebuggerType="GNU gdb debugger" Type="<%= _CODELITE.kind(cfg.kind) %>">
- <General OutputFile="<%= premake.esc(cfg.buildtarget.fullpath) %>" IntermediateDirectory="<%= premake.esc(cfg.objectsdir) %>" Command="./<%= cfg.buildtarget.name %>" CommandArguments="" WorkingDirectory="<%= cfg.buildtarget.directory %>" PauseExecWhenProcTerminates="<%= iif(cfg.kind == "WindowedApp", "no", "yes") %>"/>
- <Compiler Required="yes" Options="<%= table.concat(table.join(premake.gcc.getcflags(cfg), premake.gcc.getcxxflags(cfg), cfg.buildoptions), ";") %>">
- <% for _,v in ipairs(cfg.includedirs) do %>
- <IncludePath Value="<%= premake.esc(v) %>"/>
- <% end %>
- <% for _,v in ipairs(cfg.defines) do %>
- <Preprocessor Value="<%= premake.esc(v) %>"/>
- <% end %>
- </Compiler>
- <Linker Required="yes" Options="<%= table.concat(premake.esc(table.join(premake.gcc.getldflags(cfg), cfg.linkoptions)), ";") %>">
- <% for _,v in ipairs(premake.getlinks(cfg, "all", "directory")) do %>
- <LibraryPath Value="<%= premake.esc(v) %>" />
- <% end %>
- <% for _,v in ipairs(premake.getlinks(cfg, "all", "basename")) do %>
- <Library Value="<%= premake.esc(v) %>" />
- <% end %>
- </Linker>
- <% if premake.findfile(cfg, ".rc") then %>
- <ResourceCompiler Required="yes" Options="<%= table.implode(table.join(cfg.defines,cfg.resdefines), "-D", ";", "") %><%= table.concat(cfg.resoptions, ";") %>">
- <% for _,v in ipairs(table.join(cfg.includedirs, cfg.resincludedirs)) do %>
- <IncludePath Value="<%= premake.esc(v) %>"/>
- <% end %>
- </ResourceCompiler>
- <% else %>
- <ResourceCompiler Required="no" Options=""/>
- <% end %>
- <% if #cfg.prebuildcommands > 0 then %>
- <PreBuild>
- <% for _,v in ipairs(cfg.prebuildcommands) do %>
- <Command Enabled="yes"><%= premake.esc(v) %></Command>
- <% end %>
- </PreBuild>
- <% end %>
- <% if #cfg.postbuildcommands > 0 then %>
- <PostBuild>
- <% for _,v in ipairs(cfg.postbuildcommands) do %>
- <Command Enabled="yes"><%= premake.esc(v) %></Command>
- <% end %>
- </PostBuild>
- <% end %>
- <CustomBuild Enabled="no">
- <CleanCommand></CleanCommand>
- <BuildCommand></BuildCommand>
- <SingleFileCommand></SingleFileCommand>
- <MakefileGenerationCommand></MakefileGenerationCommand>
- <ThirdPartyToolName>None</ThirdPartyToolName>
- <WorkingDirectory></WorkingDirectory>
- </CustomBuild>
- <AdditionalRules>
- <CustomPostBuild></CustomPostBuild>
- <CustomPreBuild></CustomPreBuild>
- </AdditionalRules>
- </Configuration>
- <%end %>
- </Settings>
- <% for _,cfgname in ipairs(this.configurations) do %>
- <Dependencies name="<%= cfgname %>">
- <% for _,dep in ipairs(premake.getdependencies(this)) do %>
- <Project Name="<%= dep.name %>"/>
- <% end %>
- </Dependencies>
- <% end %>
-</CodeLite_Project>
diff --git a/src/actions/codelite/codelite_workspace.lua b/src/actions/codelite/codelite_workspace.lua new file mode 100644 index 0000000..8aafb25 --- /dev/null +++ b/src/actions/codelite/codelite_workspace.lua @@ -0,0 +1,31 @@ +-- +-- codelite_workspace.lua +-- Generate a CodeLite workspace file. +-- Copyright (c) 2009 Jason Perkins and the Premake project +-- + + function premake.codelite_workspace(sln) + _p('<?xml version="1.0" encoding="utf-8"?>') + _p('<CodeLite_Workspace Name="%s" Database="./%s.tags">', premake.esc(sln.name), premake.esc(sln.name)) + + for i,prj in ipairs(sln.projects) do + local name = premake.esc(prj.name) + local fname = path.join(path.getrelative(sln.location, prj.location), prj.name) + local active = iif(i==1, "Yes", "No") + _p(' <Project Name="%s" Path="%s.project" Active="%s" />', name, fname, active) + end + + _p(' <BuildMatrix>') + for _, cfgname in ipairs(sln.configurations) do + _p(' <WorkspaceConfiguration Name="%s" Selected="yes">', cfgname) + + for _,prj in ipairs(sln.projects) do + _p(' <Project Name="%s" ConfigName="%s"/>', prj.name, cfgname) + end + + _p(' </WorkspaceConfiguration>') + end + _p(' </BuildMatrix>') + _p('</CodeLite_Workspace>') + end + diff --git a/src/actions/codelite/codelite_workspace.tmpl b/src/actions/codelite/codelite_workspace.tmpl deleted file mode 100644 index 92206f1..0000000 --- a/src/actions/codelite/codelite_workspace.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<CodeLite_Workspace Name="<%= premake.esc(this.name) %>" Database="./<%= premake.esc(this.name) %>.tags">
-<% for i,prj in ipairs(this.projects) do %>
- <Project Name="<%= premake.esc(prj.name) %>" Path="<%= path.join(path.getrelative(this.location, prj.location), prj.name) %>.project" Active="<%= iif(i==1, "Yes", "No") %>" />
-<% end %>
- <BuildMatrix>
- <% for _, cfgname in ipairs(this.configurations) do %>
- <WorkspaceConfiguration Name="<%= cfgname %>" Selected="yes">
- <% for _,prj in ipairs(this.projects) do %>
- <Project Name="<%= prj.name %>" ConfigName="<%= cfgname %>"/>
- <% end %>
- </WorkspaceConfiguration>
- <% end %>
- </BuildMatrix>
-</CodeLite_Workspace>
diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua index b5a9d50..6e3387a 100644 --- a/src/tools/gcc.lua +++ b/src/tools/gcc.lua @@ -40,8 +40,6 @@ Native = { suffix = "", cppflags = "-MMD", - flags = "" , - ldflags = "", }, x32 = { suffix = "32", @@ -59,19 +57,16 @@ suffix = "univ", cppflags = "", flags = "-arch i386 -arch x86_64 -arch ppc -arch ppc64", - ldflags = "", }, Universal32 = { suffix = "univ32", cppflags = "", flags = "-arch i386 -arch ppc", - ldflags = "", }, Universal64 = { suffix = "univ64", cppflags = "", flags = "-arch x86_64 -arch ppc64", - ldflags = "", }, } diff --git a/tests/test_gmake_cpp.lua b/tests/test_gmake_cpp.lua index 70417d2..91a4fbf 100644 --- a/tests/test_gmake_cpp.lua +++ b/tests/test_gmake_cpp.lua @@ -46,7 +46,7 @@ ifeq ($(config),debug) CPPFLAGS += -MMD $(DEFINES) $(INCLUDES) CFLAGS += $(CPPFLAGS) $(ARCH) CXXFLAGS += $(CFLAGS) - LDFLAGS += -s + LDFLAGS += -s RESFLAGS += $(DEFINES) $(INCLUDES) LDDEPS += LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) |