diff options
Diffstat (limited to '3rdparty/genie')
-rw-r--r-- | 3rdparty/genie/README.md | 3 | ||||
-rw-r--r-- | 3rdparty/genie/src/_manifest.lua | 10 | ||||
-rw-r--r-- | 3rdparty/genie/src/actions/codeblocks/_codeblocks.lua | 39 | ||||
-rw-r--r-- | 3rdparty/genie/src/actions/codeblocks/codeblocks_cbp.lua | 191 | ||||
-rw-r--r-- | 3rdparty/genie/src/actions/codeblocks/codeblocks_workspace.lua | 27 | ||||
-rw-r--r-- | 3rdparty/genie/src/actions/codelite/_codelite.lua | 42 | ||||
-rw-r--r-- | 3rdparty/genie/src/actions/codelite/codelite_project.lua | 165 | ||||
-rw-r--r-- | 3rdparty/genie/src/actions/codelite/codelite_workspace.lua | 40 | ||||
-rw-r--r-- | 3rdparty/genie/src/actions/make/make_cpp.lua | 10 | ||||
-rw-r--r-- | 3rdparty/genie/src/base/premake.lua | 60 | ||||
-rw-r--r-- | 3rdparty/genie/src/host/scripts.c | 60 | ||||
-rw-r--r-- | 3rdparty/genie/tests/actions/codeblocks/codeblocks_files.lua | 101 | ||||
-rw-r--r-- | 3rdparty/genie/tests/actions/codeblocks/environment_variables.lua | 59 | ||||
-rw-r--r-- | 3rdparty/genie/tests/actions/codeblocks/test_filters.lua | 42 | ||||
-rw-r--r-- | 3rdparty/genie/tests/actions/codelite/codelite_files.lua | 70 | ||||
-rw-r--r-- | 3rdparty/genie/tests/premake4.lua | 8 |
16 files changed, 77 insertions, 850 deletions
diff --git a/3rdparty/genie/README.md b/3rdparty/genie/README.md index ac00fa29365..048d445a06e 100644 --- a/3rdparty/genie/README.md +++ b/3rdparty/genie/README.md @@ -21,7 +21,7 @@ Download (stable) [](https://travis-ci.org/bkaradzic/GENie) - version 696 (commit bb4e3f69372e19c355468223da218eda6516ad3c) + version 699 (commit a785b1bbb570485da7eb73d52f59c7d6e3f24bf4) Linux: https://github.com/bkaradzic/bx/raw/master/tools/bin/linux/genie @@ -112,6 +112,7 @@ intention to keep it compatible with it. - Added support for QtCreator via Qbs build tool. - Added .natvis file type support for Visual Studio. - Added Swift language support for make and ninja build generators. + - Removed CodeBlocks and CodeLite support. Debugging GENie scripts ----------------------- diff --git a/3rdparty/genie/src/_manifest.lua b/3rdparty/genie/src/_manifest.lua index d6b484e5f4f..be76916976e 100644 --- a/3rdparty/genie/src/_manifest.lua +++ b/3rdparty/genie/src/_manifest.lua @@ -40,16 +40,6 @@ "base/premake.lua", "base/iter.lua", "base/set.lua", - - -- CodeBlocks action - "actions/codeblocks/_codeblocks.lua", - "actions/codeblocks/codeblocks_workspace.lua", - "actions/codeblocks/codeblocks_cbp.lua", - - -- CodeLite action - "actions/codelite/_codelite.lua", - "actions/codelite/codelite_workspace.lua", - "actions/codelite/codelite_project.lua", -- CMake action "actions/cmake/_cmake.lua", diff --git a/3rdparty/genie/src/actions/codeblocks/_codeblocks.lua b/3rdparty/genie/src/actions/codeblocks/_codeblocks.lua deleted file mode 100644 index 1d378beaf4b..00000000000 --- a/3rdparty/genie/src/actions/codeblocks/_codeblocks.lua +++ /dev/null @@ -1,39 +0,0 @@ --- --- _codeblocks.lua --- Define the Code::Blocks action(s). --- Copyright (c) 2002-2011 Jason Perkins and the Premake project --- - - premake.codeblocks = { } - - newaction { - trigger = "codeblocks", - shortname = "Code::Blocks", - description = "Generate Code::Blocks project files", - - valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" }, - - valid_languages = { "C", "C++" }, - - valid_tools = { - cc = { "gcc", "ow" }, - }, - - onsolution = function(sln) - premake.generate(sln, "%%.workspace", premake.codeblocks.workspace) - end, - - onproject = function(prj) - premake.generate(prj, "%%.cbp", premake.codeblocks.cbp) - end, - - oncleansolution = function(sln) - premake.clean.file(sln, "%%.workspace") - end, - - oncleanproject = function(prj) - premake.clean.file(prj, "%%.cbp") - premake.clean.file(prj, "%%.depend") - premake.clean.file(prj, "%%.layout") - end - } diff --git a/3rdparty/genie/src/actions/codeblocks/codeblocks_cbp.lua b/3rdparty/genie/src/actions/codeblocks/codeblocks_cbp.lua deleted file mode 100644 index 84982fd1a85..00000000000 --- a/3rdparty/genie/src/actions/codeblocks/codeblocks_cbp.lua +++ /dev/null @@ -1,191 +0,0 @@ --- --- codeblocks_cbp.lua --- Generate a Code::Blocks C/C++ project. --- Copyright (c) 2009, 2011 Jason Perkins and the Premake project --- - - local codeblocks = premake.codeblocks - - --- --- Write out a list of the source code files in the project. --- - - function codeblocks.files(prj) - local pchheader - if (prj.pchheader) then - pchheader = path.getrelative(prj.location, prj.pchheader) - end - - for fcfg in premake.project.eachfile(prj) do - _p(2,'<Unit filename="%s">', premake.esc(fcfg.name)) - if fcfg.name ~= fcfg.vpath then - _p(3,'<Option virtualFolder="%s" />', path.getdirectory(fcfg.vpath)) - end - if path.isresourcefile(fcfg.name) then - _p(3,'<Option compilerVar="WINDRES" />') - elseif path.iscfile(fcfg.name) and prj.language == "C++" then - _p(3,'<Option compilerVar="CC" />') - end - if not prj.flags.NoPCH and fcfg.name == pchheader then - _p(3,'<Option compilerVar="%s" />', iif(prj.language == "C", "CC", "CPP")) - _p(3,'<Option compile="1" />') - _p(3,'<Option weight="0" />') - _p(3,'<Add option="-x c++-header" />') - end - _p(2,'</Unit>') - end - end - - function premake.codeblocks.debugenvs(cfg) - --Assumption: if gcc is being used then so is gdb although this section will be ignored by - --other debuggers. If using gcc and not gdb it will silently not pass the - --environment arguments to the debugger - if premake.gettool(cfg) == premake.gcc then - _p(3,'<debugger>') - _p(4,'<remote_debugging target="%s">', premake.esc(cfg.longname)) - local args = '' - local sz = #cfg.debugenvs - for idx, v in ipairs(cfg.debugenvs) do - args = args .. 'set env ' .. v - if sz ~= idx then args = args .. '
' end - end - _p(5,'<options additional_cmds_before="%s" />',args) - _p(4,'</remote_debugging>') - _p(3,'</debugger>') - else - error('Sorry at this moment there is no support for debug environment variables with this debugger and codeblocks') - end - end - --- --- The main function: write out the project file. --- - - function premake.codeblocks.cbp(prj) - -- alias the C/C++ compiler interface - local cc = premake.gettool(prj) - - _p('<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>') - _p('<CodeBlocks_project_file>') - _p(1,'<FileVersion major="1" minor="6" />') - - -- write project block header - _p(1,'<Project>') - _p(2,'<Option title="%s" />', premake.esc(prj.name)) - _p(2,'<Option pch_mode="2" />') - _p(2,'<Option compiler="%s" />', _OPTIONS.cc) - - -- build a list of supported target platforms; I don't support cross-compiling yet - local platforms = premake.filterplatforms(prj.solution, cc.platforms, "Native") - for i = #platforms, 1, -1 do - if premake.platforms[platforms[i]].iscrosscompiler then - table.remove(platforms, i) - end - end - - -- write configuration blocks - _p(2,'<Build>') - for _, platform in ipairs(platforms) do - for cfg in premake.eachconfig(prj, platform) do - local includedirs = table.join(cfg.userincludedirs, cfg.includedirs) - - _p(3,'<Target title="%s">', premake.esc(cfg.longname)) - - _p(4,'<Option output="%s" prefix_auto="0" extension_auto="0" />', premake.esc(cfg.buildtarget.fullpath)) - - if cfg.debugdir then - _p(4,'<Option working_dir="%s" />', premake.esc(cfg.debugdir)) - end - - _p(4,'<Option object_output="%s" />', premake.esc(cfg.objectsdir)) - - -- identify the type of binary - local types = { WindowedApp = 0, ConsoleApp = 1, StaticLib = 2, SharedLib = 3 } - _p(4,'<Option type="%d" />', types[cfg.kind]) - - _p(4,'<Option compiler="%s" />', _OPTIONS.cc) - - if (cfg.kind == "SharedLib") then - _p(4,'<Option createDefFile="0" />') - _p(4,'<Option createStaticLib="%s" />', iif(cfg.flags.NoImportLib, 0, 1)) - end - - -- begin compiler block -- - _p(4,'<Compiler>') - for _,flag in ipairs(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cc.getdefines(cfg.defines), cfg.buildoptions)) do - _p(5,'<Add option="%s" />', premake.esc(flag)) - end - if not cfg.flags.NoPCH and cfg.pchheader then - _p(5,'<Add option="-Winvalid-pch" />') - _p(5,'<Add option="-include "%s"" />', premake.esc(cfg.pchheader)) - end - for _,v in ipairs(includedirs) do - _p(5,'<Add directory="%s" />', premake.esc(v)) - end - _p(4,'</Compiler>') - -- end compiler block -- - - -- begin linker block -- - _p(4,'<Linker>') - for _,flag in ipairs(table.join(cc.getldflags(cfg), cfg.linkoptions)) do - _p(5,'<Add option="%s" />', premake.esc(flag)) - end - for _,v in ipairs(premake.getlinks(cfg, "all", "directory")) do - _p(5,'<Add directory="%s" />', premake.esc(v)) - end - for _,v in ipairs(premake.getlinks(cfg, "all", "basename")) do - _p(5,'<Add library="%s" />', premake.esc(v)) - end - _p(4,'</Linker>') - -- end linker block -- - - -- begin resource compiler block -- - if premake.findfile(cfg, ".rc") then - _p(4,'<ResourceCompiler>') - for _,v in ipairs(includedirs) do - _p(5,'<Add directory="%s" />', premake.esc(v)) - end - for _,v in ipairs(cfg.resincludedirs) do - _p(5,'<Add directory="%s" />', premake.esc(v)) - end - _p(4,'</ResourceCompiler>') - end - -- end resource compiler block -- - - -- begin build steps -- - if #cfg.prebuildcommands > 0 or #cfg.postbuildcommands > 0 then - _p(4,'<ExtraCommands>') - for _,v in ipairs(cfg.prebuildcommands) do - _p(5,'<Add before="%s" />', premake.esc(v)) - end - for _,v in ipairs(cfg.postbuildcommands) do - _p(5,'<Add after="%s" />', premake.esc(v)) - end - - _p(4,'</ExtraCommands>') - end - -- end build steps -- - - _p(3,'</Target>') - end - end - _p(2,'</Build>') - - codeblocks.files(prj) - - _p(2,'<Extensions>') - for _, platform in ipairs(platforms) do - for cfg in premake.eachconfig(prj, platform) do - if cfg.debugenvs and #cfg.debugenvs > 0 then - premake.codeblocks.debugenvs(cfg) - end - end - end - _p(2,'</Extensions>') - - _p(1,'</Project>') - _p('</CodeBlocks_project_file>') - _p('') - - end diff --git a/3rdparty/genie/src/actions/codeblocks/codeblocks_workspace.lua b/3rdparty/genie/src/actions/codeblocks/codeblocks_workspace.lua deleted file mode 100644 index 4a01a467b8b..00000000000 --- a/3rdparty/genie/src/actions/codeblocks/codeblocks_workspace.lua +++ /dev/null @@ -1,27 +0,0 @@ --- --- 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(1,'<Workspace title="%s">', sln.name) - - for prj in premake.solution.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(2,'<Project filename="%s.cbp"%s>', fname, active) - for _,dep in ipairs(premake.getdependencies(prj)) do - _p(3,'<Depends filename="%s.cbp" />', path.join(path.getrelative(sln.location, dep.location), dep.name)) - end - - _p(2,'</Project>') - end - - _p(1,'</Workspace>') - _p('</CodeBlocks_workspace_file>') - end - diff --git a/3rdparty/genie/src/actions/codelite/_codelite.lua b/3rdparty/genie/src/actions/codelite/_codelite.lua deleted file mode 100644 index e7da871f5a8..00000000000 --- a/3rdparty/genie/src/actions/codelite/_codelite.lua +++ /dev/null @@ -1,42 +0,0 @@ --- --- _codelite.lua --- Define the CodeLite action(s). --- Copyright (c) 2008-2009 Jason Perkins and the Premake project --- - - premake.codelite = { } - - newaction { - trigger = "codelite", - shortname = "CodeLite", - description = "Generate CodeLite project files", - - valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" }, - - valid_languages = { "C", "C++" }, - - valid_tools = { - cc = { "gcc" }, - }, - - onsolution = function(sln) - premake.generate(sln, "%%.workspace", premake.codelite.workspace) - end, - - onproject = function(prj) - premake.generate(prj, "%%.project", premake.codelite.project) - end, - - oncleansolution = function(sln) - premake.clean.file(sln, "%%.workspace") - premake.clean.file(sln, "%%_wsp.mk") - premake.clean.file(sln, "%%.tags") - end, - - oncleanproject = function(prj) - premake.clean.file(prj, "%%.project") - premake.clean.file(prj, "%%.mk") - premake.clean.file(prj, "%%.list") - premake.clean.file(prj, "%%.out") - end - } diff --git a/3rdparty/genie/src/actions/codelite/codelite_project.lua b/3rdparty/genie/src/actions/codelite/codelite_project.lua deleted file mode 100644 index c2db02b10c9..00000000000 --- a/3rdparty/genie/src/actions/codelite/codelite_project.lua +++ /dev/null @@ -1,165 +0,0 @@ --- --- codelite_project.lua --- Generate a CodeLite C/C++ project file. --- Copyright (c) 2009, 2011 Jason Perkins and the Premake project --- - - local codelite = premake.codelite - local tree = premake.tree - - --- --- Write out a list of the source code files in the project. --- - - function codelite.files(prj) - local tr = premake.project.buildsourcetree(prj) - tree.traverse(tr, { - - -- folders are handled at the internal nodes - onbranchenter = function(node, depth) - _p(depth, '<VirtualDirectory Name="%s">', node.name) - end, - - onbranchexit = function(node, depth) - _p(depth, '</VirtualDirectory>') - end, - - -- source files are handled at the leaves - onleaf = function(node, depth) - _p(depth, '<File Name="%s"/>', node.cfg.name) - end, - - }, true, 1) - end - - --- --- The main function: write out the project file. --- - - function premake.codelite.project(prj) - io.indent = " " - - _p('<?xml version="1.0" encoding="utf-8"?>') - _p('<CodeLite_Project Name="%s">', premake.esc(prj.name)) - - -- Write out the list of source code files in the project - codelite.files(prj) - - local types = { - ConsoleApp = "Executable", - WindowedApp = "Executable", - StaticLib = "Static Library", - SharedLib = "Dynamic Library", - } - _p(' <Settings Type="%s">', types[prj.kind]) - - -- build a list of supported target platforms; I don't support cross-compiling yet - local platforms = premake.filterplatforms(prj.solution, premake[_OPTIONS.cc].platforms, "Native") - for i = #platforms, 1, -1 do - if premake.platforms[platforms[i]].iscrosscompiler then - table.remove(platforms, i) - end - end - - for _, platform in ipairs(platforms) do - for cfg in premake.eachconfig(prj, platform) do - local name = premake.esc(cfg.longname):gsub("|","_") - 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.debugdir or cfg.buildtarget.directory - local runargs = table.concat(cfg.debugargs, " ") - local pause = iif(cfg.kind == "WindowedApp", "no", "yes") - local includedirs = table.join(cfg.userincludedirs, cfg.includedirs) - _p(' <General OutputFile="%s" IntermediateDirectory="%s" Command="./%s" CommandArguments="%s" WorkingDirectory="%s" PauseExecWhenProcTerminates="%s"/>', fname, objdir, runcmd, runargs, 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(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 - end - _p(' </Settings>') - - for _, platform in ipairs(platforms) do - for cfg in premake.eachconfig(prj, platform) do - _p(' <Dependencies name="%s">', cfg.longname:gsub("|","_")) - for _,dep in ipairs(premake.getdependencies(prj)) do - _p(' <Project Name="%s"/>', dep.name) - end - _p(' </Dependencies>') - end - end - - _p('</CodeLite_Project>') - end diff --git a/3rdparty/genie/src/actions/codelite/codelite_workspace.lua b/3rdparty/genie/src/actions/codelite/codelite_workspace.lua deleted file mode 100644 index 295bb0800d2..00000000000 --- a/3rdparty/genie/src/actions/codelite/codelite_workspace.lua +++ /dev/null @@ -1,40 +0,0 @@ --- --- codelite_workspace.lua --- Generate a CodeLite workspace file. --- Copyright (c) 2009, 2011 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 - - -- build a list of supported target platforms; I don't support cross-compiling yet - local platforms = premake.filterplatforms(sln, premake[_OPTIONS.cc].platforms, "Native") - for i = #platforms, 1, -1 do - if premake.platforms[platforms[i]].iscrosscompiler then - table.remove(platforms, i) - end - end - - _p(' <BuildMatrix>') - for _, platform in ipairs(platforms) do - for _, cfgname in ipairs(sln.configurations) do - local name = premake.getconfigname(cfgname, platform):gsub("|","_") - _p(' <WorkspaceConfiguration Name="%s" Selected="yes">', name) - for _,prj in ipairs(sln.projects) do - _p(' <Project Name="%s" ConfigName="%s"/>', prj.name, name) - end - _p(' </WorkspaceConfiguration>') - end - end - _p(' </BuildMatrix>') - _p('</CodeLite_Workspace>') - end - diff --git a/3rdparty/genie/src/actions/make/make_cpp.lua b/3rdparty/genie/src/actions/make/make_cpp.lua index c56bf0ccd4a..353dd15de7a 100644 --- a/3rdparty/genie/src/actions/make/make_cpp.lua +++ b/3rdparty/genie/src/actions/make/make_cpp.lua @@ -6,6 +6,8 @@ premake.make.cpp = { } premake.make.override = { } + premake.make.makefile_ignore = false + local cpp = premake.make.cpp local make = premake.make @@ -259,9 +261,11 @@ _p(' endif') _p('endif') _p('') --- --- _p('MAKEFILE = %s', _MAKE.getmakefilename(prj, true)) --- _p('') + + if (not premake.make.makefile_ignore) then + _p('MAKEFILE = %s', _MAKE.getmakefilename(prj, true)) + _p('') + end end -- diff --git a/3rdparty/genie/src/base/premake.lua b/3rdparty/genie/src/base/premake.lua index 8aa5ac1b34b..8d64d9663c1 100644 --- a/3rdparty/genie/src/base/premake.lua +++ b/3rdparty/genie/src/base/premake.lua @@ -5,6 +5,7 @@ -- premake._filelevelconfig = false + premake._checkgenerate = true -- -- Open a file for output, and call a function to actually do the writing. @@ -22,19 +23,60 @@ function premake.generate(obj, filename, callback) filename = premake.project.getfilename(obj, filename) - printf("Generating %s...", filename) - local f, err = io.open(filename, "wb") - if (not f) then - error(err, 0) - end + if (premake._checkgenerate) then + io.capture() + callback(obj) + local new = io.endcapture() + + local delta = false + + local f, err = io.open(filename, "rb") + if (not f) then + if string.find(err, "No such file or directory") then + delta = true + else + error(err, 0) + end + else + local existing = f:read("*all") + if existing ~= new then + delta = true + end + f:close() + end + + if delta then + printf("Generating %s...", filename) + local f, err = io.open(filename, "wb") + if (not f) then + error(err, 0) + end - io.output(f) - callback(obj) - f:close() - premake.stats.num_generated = premake.stats.num_generated + 1 + f:write(new) + f:close() + + premake.stats.num_generated = premake.stats.num_generated + 1 + else + -- printf("Skipping %s as its contents would not change.", filename) + premake.stats.num_skipped = premake.stats.num_skipped + 1 + end + else + printf("Generating %s...", filename) + + local f, err = io.open(filename, "wb") + if (not f) then + error(err, 0) + end + + io.output(f) + callback(obj) + f:close() + premake.stats.num_generated = premake.stats.num_generated + 1 + end end + -- -- Finds a valid premake build file in the specified directory -- Used by both the main genie process, and include commands diff --git a/3rdparty/genie/src/host/scripts.c b/3rdparty/genie/src/host/scripts.c index 87fcf702fc2..788700dcca0 100644 --- a/3rdparty/genie/src/host/scripts.c +++ b/3rdparty/genie/src/host/scripts.c @@ -180,7 +180,8 @@ const char* builtin_scripts[] = { "function premake.showhelp()\nprintf(\"\")\nprintf(\"Usage: genie [options] action [arguments]\")\nprintf(\"\")\nprintf(\"OPTIONS\")\nprintf(\"\")\nfor option in premake.option.each() do\nlocal trigger = option.trigger\nlocal description = option.description\nif (option.value) then trigger = trigger .. \"=\" .. option.value end\nif (option.allowed) then description = description .. \"; one of:\" end\nprintf(\" --%-15s %s\", trigger, description)\nif (option.allowed) then\nfor _, value in ipairs(option.allowed) do\nprintf(\" %-14s %s\", value[1], value[2])\nend\nend\nprintf(\"\")\nend\nprintf(\"ACTIONS\")\nprintf(\"\")\nfor action in premake.action.each() do\nprintf(\" %-17s %s\", action.trigger, action.description)\nend\nprintf(\"\")\nprintf(\"For additional information, see https://github.com/bkaradzic/genie\")\nend\n", /* base/premake.lua */ - "premake._filelevelconfig = false\nfunction premake.generate(obj, filename, callback)\nfilename = premake.project.getfilename(obj, filename)\nprintf(\"Generating %s...\", filename)\nlocal f, err = io.open(filename, \"wb\")\nif (not f) then\nerror(err, 0)\nend\nio.output(f)\ncallback(obj)\nf:close()\npremake.stats.num_generated = premake.stats.num_generated + 1\nend\nfunction premake.findDefaultScript(dir, search_upwards)\nsearch_upwards = search_upwards or true\nlocal last = \"\"\nwhile dir ~= last do\nfor _, name in ipairs({ \"genie.lua\", \"solution.lua\", \"premake4.lua\" }) do\nlocal script0 = dir .. \"/\" .. name\nif (os.isfile(script0)) then\nreturn dir, name\nend\nlocal script1 = dir .. \"/scripts/\" .. name\nif (os.isfile(script1)) then\nreturn dir .. \"/scripts/\", name\nend\nend\nlast = dir\ndir = path.getabsolute(dir .. \"/..\")\nif dir == \".\" or not search_upwards then break end\nend\nreturn nil, nil\nend\n", + "premake._filelevelconfig = false\npremake._checkgenerate = true\nfunction premake.generate(obj, filename, callback)\nfilename = premake.project.getfilename(obj, filename)\nif (premake._checkgenerate) then\nio.capture()\ncallback(obj)\nlocal new = io.endcapture()\nlocal delta = false\nlocal f, err = io.open(filename, \"rb\")\nif (not f) then\nif string.find(err, \"No such file or directory\") then\ndelta = true\nelse\nerror(err, 0)\nend\nelse\nlocal existing = f:read(\"*all\")\nif existing ~= new then\ndelta = true\nend\nf:close()\nend\nif delta then\nprintf(\"Generating %s...\", filename)\nlocal f, err = io.open(filename, \"wb\")\nif (not f) then\nerror(err, 0)\nend\nf:write(new)\nf:close()\npremake.stats.num_generated = premake.stats.num_generated + 1\nelse\npremake.stats.num_skipped = premake.stats.num_skipped + 1\nend\nelse\nprintf(\"Generating %s...\", filename)\nlocal f, err = io.open(filename, \"wb\")\nif (not f) then\nerror(err, 0)\nend\nio.output(f)\ncallback(obj)\nf:close()\npremake.stats.num_generate" + "d = premake.stats.num_generated + 1\nend\nend\nfunction premake.findDefaultScript(dir, search_upwards)\nsearch_upwards = search_upwards or true\nlocal last = \"\"\nwhile dir ~= last do\nfor _, name in ipairs({ \"genie.lua\", \"solution.lua\", \"premake4.lua\" }) do\nlocal script0 = dir .. \"/\" .. name\nif (os.isfile(script0)) then\nreturn dir, name\nend\nlocal script1 = dir .. \"/scripts/\" .. name\nif (os.isfile(script1)) then\nreturn dir .. \"/scripts/\", name\nend\nend\nlast = dir\ndir = path.getabsolute(dir .. \"/..\")\nif dir == \".\" or not search_upwards then break end\nend\nreturn nil, nil\nend\n", /* base/iter.lua */ "iter = {}\nfunction iter.sortByKeys(arr, f)\nlocal a = table.keys(arr)\ntable.sort(a, f)\nlocal i = 0\nreturn function()\ni = i + 1\nif a[i] ~= nil then \nreturn a[i], arr[a[i]]\nend\nend\nend\n", @@ -189,33 +190,6 @@ const char* builtin_scripts[] = { "Set_mt = {}\nfunction Set(t)\nlocal set = {}\nfor k, l in ipairs(t) do \nset[l] = true \nend\nsetmetatable(set, Set_mt)\nreturn set\nend\nfunction Set_mt.union(a, b)\nlocal res = Set{}\nfor k in pairs(a) do res[k] = true end\nfor k in pairs(b) do res[k] = true end\nreturn res\nend\nfunction Set_mt.intersection(a, b)\nlocal res = Set{}\nfor k in pairs(a) do\nres[k] = b[k]\nend\nreturn res\nend\nlocal function get_cache(a)\nif not rawget(a, \"__cache\") then\nrawset(a, \"__cache\", Set_mt.totable(a))\nend\nreturn rawget(a, \"__cache\")\nend\nfunction Set_mt.len(a)\nreturn #get_cache(a)\nend\nfunction Set_mt.implode(a, sep)\nreturn table.concat(get_cache(a), sep)\nend\nfunction Set_mt.totable(a)\nlocal res = {}\nfor k in pairs(a) do\ntable.insert(res, k)\nend\nreturn res\nend\nfunction Set_mt.difference(a, b)\nif getmetatable(b) ~= Set_mt then\nif type(b) ~= \"table\" then\nerror(type(b)..\" is not a Set or table\")\nend\nb=Set(b)\nend\nlocal res = Set{}\nfor k in pairs(a) do\nres[k] = not b[k] or nil\nend\nrawse" "t(res, \"__cache\", nil)\nreturn res\nend\nfunction Set_mt.__index(a, i)\nif type(i) == \"number\" then\nreturn get_cache(a)[i]\nend\nreturn Set_mt[i] or rawget(a, i)\nend\nSet_mt.__add = Set_mt.union\nSet_mt.__mul = Set_mt.intersection\nSet_mt.__sub = Set_mt.difference\nSet_mt.__len = Set_mt.len\nSet_mt.__concat = Set_mt.implode", - /* actions/codeblocks/_codeblocks.lua */ - "premake.codeblocks = { }\nnewaction {\ntrigger = \"codeblocks\",\nshortname = \"Code::Blocks\",\ndescription = \"Generate Code::Blocks project files\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\" },\nvalid_tools = {\ncc = { \"gcc\", \"ow\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.workspace\", premake.codeblocks.workspace)\nend,\nonproject = function(prj)\npremake.generate(prj, \"%%.cbp\", premake.codeblocks.cbp)\nend,\noncleansolution = function(sln)\npremake.clean.file(sln, \"%%.workspace\")\nend,\noncleanproject = function(prj)\npremake.clean.file(prj, \"%%.cbp\")\npremake.clean.file(prj, \"%%.depend\")\npremake.clean.file(prj, \"%%.layout\")\nend\n}\n", - - /* actions/codeblocks/codeblocks_workspace.lua */ - "function premake.codeblocks.workspace(sln)\n_p('<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>')\n_p('<CodeBlocks_workspace_file>')\n_p(1,'<Workspace title=\"%s\">', sln.name)\nfor prj in premake.solution.eachproject(sln) do\nlocal fname = path.join(path.getrelative(sln.location, prj.location), prj.name)\nlocal active = iif(prj.project == sln.projects[1], ' active=\"1\"', '')\n_p(2,'<Project filename=\"%s.cbp\"%s>', fname, active)\nfor _,dep in ipairs(premake.getdependencies(prj)) do\n_p(3,'<Depends filename=\"%s.cbp\" />', path.join(path.getrelative(sln.location, dep.location), dep.name))\nend\n_p(2,'</Project>')\nend\n_p(1,'</Workspace>')\n_p('</CodeBlocks_workspace_file>')\nend\n", - - /* actions/codeblocks/codeblocks_cbp.lua */ - "local codeblocks = premake.codeblocks\nfunction codeblocks.files(prj)\nlocal pchheader\nif (prj.pchheader) then\npchheader = path.getrelative(prj.location, prj.pchheader)\nend\nfor fcfg in premake.project.eachfile(prj) do\n_p(2,'<Unit filename=\"%s\">', premake.esc(fcfg.name))\nif fcfg.name ~= fcfg.vpath then\n_p(3,'<Option virtualFolder=\"%s\" />', path.getdirectory(fcfg.vpath))\nend\nif path.isresourcefile(fcfg.name) then\n_p(3,'<Option compilerVar=\"WINDRES\" />')\nelseif path.iscfile(fcfg.name) and prj.language == \"C++\" then\n_p(3,'<Option compilerVar=\"CC\" />')\nend\nif not prj.flags.NoPCH and fcfg.name == pchheader then\n_p(3,'<Option compilerVar=\"%s\" />', iif(prj.language == \"C\", \"CC\", \"CPP\"))\n_p(3,'<Option compile=\"1\" />')\n_p(3,'<Option weight=\"0\" />')\n_p(3,'<Add option=\"-x c++-header\" />')\nend\n_p(2,'</Unit>')\nend\nend\nfunction premake.codeblocks.debugenvs(cfg)\nif premake.gettool(cfg) == premake.gcc then\n_p(3,'<debugger>')\n_p(4,'<remote_debugging target=\"%s\">', premake.esc(" - "cfg.longname))\nlocal args = ''\nlocal sz = #cfg.debugenvs\nfor idx, v in ipairs(cfg.debugenvs) do\nargs = args .. 'set env ' .. v \nif sz ~= idx then args = args .. '
' end\nend\n_p(5,'<options additional_cmds_before=\"%s\" />',args)\n_p(4,'</remote_debugging>')\n_p(3,'</debugger>')\nelse\n error('Sorry at this moment there is no support for debug environment variables with this debugger and codeblocks')\nend\nend\nfunction premake.codeblocks.cbp(prj)\nlocal cc = premake.gettool(prj)\n_p('<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>')\n_p('<CodeBlocks_project_file>')\n_p(1,'<FileVersion major=\"1\" minor=\"6\" />')\n_p(1,'<Project>')\n_p(2,'<Option title=\"%s\" />', premake.esc(prj.name))\n_p(2,'<Option pch_mode=\"2\" />')\n_p(2,'<Option compiler=\"%s\" />', _OPTIONS.cc)\nlocal platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\nfor i = #platforms, 1, -1 do\nif premake.platforms[platforms[i]].iscrosscompiler then\ntable.remove(platforms, i)\nend\nend \n_p(2,'<Bu" - "ild>')\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\nlocal includedirs = table.join(cfg.userincludedirs, cfg.includedirs)\n_p(3,'<Target title=\"%s\">', premake.esc(cfg.longname))\n_p(4,'<Option output=\"%s\" prefix_auto=\"0\" extension_auto=\"0\" />', premake.esc(cfg.buildtarget.fullpath))\nif cfg.debugdir then\n_p(4,'<Option working_dir=\"%s\" />', premake.esc(cfg.debugdir))\nend\n_p(4,'<Option object_output=\"%s\" />', premake.esc(cfg.objectsdir))\nlocal types = { WindowedApp = 0, ConsoleApp = 1, StaticLib = 2, SharedLib = 3 }\n_p(4,'<Option type=\"%d\" />', types[cfg.kind])\n_p(4,'<Option compiler=\"%s\" />', _OPTIONS.cc)\nif (cfg.kind == \"SharedLib\") then\n_p(4,'<Option createDefFile=\"0\" />')\n_p(4,'<Option createStaticLib=\"%s\" />', iif(cfg.flags.NoImportLib, 0, 1))\nend\n_p(4,'<Compiler>')\nfor _,flag in ipairs(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cc.getdefines(cfg.defines), cfg.buildoptions)) do\n_p(5,'<Add option=\"%s\" />', premake.esc(f" - "lag))\nend\nif not cfg.flags.NoPCH and cfg.pchheader then\n_p(5,'<Add option=\"-Winvalid-pch\" />')\n_p(5,'<Add option=\"-include "%s"\" />', premake.esc(cfg.pchheader))\nend\nfor _,v in ipairs(includedirs) do\n_p(5,'<Add directory=\"%s\" />', premake.esc(v))\nend\n_p(4,'</Compiler>')\n_p(4,'<Linker>')\nfor _,flag in ipairs(table.join(cc.getldflags(cfg), cfg.linkoptions)) do\n_p(5,'<Add option=\"%s\" />', premake.esc(flag))\nend\nfor _,v in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do\n_p(5,'<Add directory=\"%s\" />', premake.esc(v))\nend\nfor _,v in ipairs(premake.getlinks(cfg, \"all\", \"basename\")) do\n_p(5,'<Add library=\"%s\" />', premake.esc(v))\nend\n_p(4,'</Linker>')\nif premake.findfile(cfg, \".rc\") then\n_p(4,'<ResourceCompiler>')\nfor _,v in ipairs(includedirs) do\n_p(5,'<Add directory=\"%s\" />', premake.esc(v))\nend\nfor _,v in ipairs(cfg.resincludedirs) do\n_p(5,'<Add directory=\"%s\" />', premake.esc(v))\nend\n_p(4,'</ResourceCompiler>')\nend\nif #cfg.prebuildcommands > 0" - " or #cfg.postbuildcommands > 0 then\n_p(4,'<ExtraCommands>')\nfor _,v in ipairs(cfg.prebuildcommands) do\n_p(5,'<Add before=\"%s\" />', premake.esc(v))\nend\nfor _,v in ipairs(cfg.postbuildcommands) do\n_p(5,'<Add after=\"%s\" />', premake.esc(v))\nend\n_p(4,'</ExtraCommands>')\nend\n_p(3,'</Target>')\nend\nend\n_p(2,'</Build>')\ncodeblocks.files(prj)\n_p(2,'<Extensions>')\n for _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\nif cfg.debugenvs and #cfg.debugenvs > 0 then\npremake.codeblocks.debugenvs(cfg)\nend\nend\nend\n_p(2,'</Extensions>')\n_p(1,'</Project>')\n_p('</CodeBlocks_project_file>')\n_p('')\nend\n", - - /* actions/codelite/_codelite.lua */ - "premake.codelite = { }\nnewaction {\ntrigger = \"codelite\",\nshortname = \"CodeLite\",\ndescription = \"Generate CodeLite project files\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\" },\nvalid_tools = {\ncc = { \"gcc\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.workspace\", premake.codelite.workspace)\nend,\nonproject = function(prj)\npremake.generate(prj, \"%%.project\", premake.codelite.project)\nend,\noncleansolution = function(sln)\npremake.clean.file(sln, \"%%.workspace\")\npremake.clean.file(sln, \"%%_wsp.mk\")\npremake.clean.file(sln, \"%%.tags\")\nend,\noncleanproject = function(prj)\npremake.clean.file(prj, \"%%.project\")\npremake.clean.file(prj, \"%%.mk\")\npremake.clean.file(prj, \"%%.list\")\npremake.clean.file(prj, \"%%.out\")\nend\n}\n", - - /* actions/codelite/codelite_workspace.lua */ - "function premake.codelite.workspace(sln)\n_p('<?xml version=\"1.0\" encoding=\"utf-8\"?>')\n_p('<CodeLite_Workspace Name=\"%s\" Database=\"./%s.tags\">', premake.esc(sln.name), premake.esc(sln.name))\nfor i,prj in ipairs(sln.projects) do\nlocal name = premake.esc(prj.name)\nlocal fname = path.join(path.getrelative(sln.location, prj.location), prj.name)\nlocal active = iif(i==1, \"Yes\", \"No\")\n_p(' <Project Name=\"%s\" Path=\"%s.project\" Active=\"%s\" />', name, fname, active)\nend\nlocal platforms = premake.filterplatforms(sln, premake[_OPTIONS.cc].platforms, \"Native\")\nfor i = #platforms, 1, -1 do\nif premake.platforms[platforms[i]].iscrosscompiler then\ntable.remove(platforms, i)\nend\nend \n_p(' <BuildMatrix>')\nfor _, platform in ipairs(platforms) do\nfor _, cfgname in ipairs(sln.configurations) do\nlocal name = premake.getconfigname(cfgname, platform):gsub(\"|\",\"_\")\n_p(' <WorkspaceConfiguration Name=\"%s\" Selected=\"yes\">', name)\nfor _,prj in ipairs(sln.projects) do\n_p(' <Project N" - "ame=\"%s\" ConfigName=\"%s\"/>', prj.name, name)\nend\n_p(' </WorkspaceConfiguration>')\nend\nend\n_p(' </BuildMatrix>')\n_p('</CodeLite_Workspace>')\nend\n", - - /* actions/codelite/codelite_project.lua */ - "local codelite = premake.codelite\nlocal tree = premake.tree\nfunction codelite.files(prj)\nlocal tr = premake.project.buildsourcetree(prj)\ntree.traverse(tr, {\nonbranchenter = function(node, depth)\n_p(depth, '<VirtualDirectory Name=\"%s\">', node.name)\nend,\nonbranchexit = function(node, depth)\n_p(depth, '</VirtualDirectory>')\nend,\nonleaf = function(node, depth)\n_p(depth, '<File Name=\"%s\"/>', node.cfg.name)\nend,\n}, true, 1)\nend\nfunction premake.codelite.project(prj)\nio.indent = \" \"\n_p('<?xml version=\"1.0\" encoding=\"utf-8\"?>')\n_p('<CodeLite_Project Name=\"%s\">', premake.esc(prj.name))\ncodelite.files(prj)\nlocal types = { \nConsoleApp = \"Executable\", \nWindowedApp = \"Executable\", \nStaticLib = \"Static Library\",\nSharedLib = \"Dynamic Library\",\n}\n_p(' <Settings Type=\"%s\">', types[prj.kind])\nlocal platforms = premake.filterplatforms(prj.solution, premake[_OPTIONS.cc].platforms, \"Native\")\nfor i = #platforms, 1, -1 do\nif premake.platforms[platforms[i]].iscrosscompiler " - "then\ntable.remove(platforms, i)\nend\nend \nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\nlocal name = premake.esc(cfg.longname):gsub(\"|\",\"_\")\nlocal compiler = iif(cfg.language == \"C\", \"gcc\", \"g++\")\n_p(' <Configuration Name=\"%s\" CompilerType=\"gnu %s\" DebuggerType=\"GNU gdb debugger\" Type=\"%s\">', name, compiler, types[cfg.kind])\nlocal fname = premake.esc(cfg.buildtarget.fullpath)\nlocal objdir = premake.esc(cfg.objectsdir)\nlocal runcmd = cfg.buildtarget.name\nlocal rundir = cfg.debugdir or cfg.buildtarget.directory\nlocal runargs = table.concat(cfg.debugargs, \" \")\nlocal pause = iif(cfg.kind == \"WindowedApp\", \"no\", \"yes\")\nlocal includedirs = table.join(cfg.userincludedirs, cfg.includedirs)\n_p(' <General OutputFile=\"%s\" IntermediateDirectory=\"%s\" Command=\"./%s\" CommandArguments=\"%s\" WorkingDirectory=\"%s\" PauseExecWhenProcTerminates=\"%s\"/>', fname, objdir, runcmd, runargs, rundir, pause)\nlocal flags = premake.esc(ta" - "ble.join(premake.gcc.getcflags(cfg), premake.gcc.getcxxflags(cfg), cfg.buildoptions))\n_p(' <Compiler Required=\"yes\" Options=\"%s\">', table.concat(flags, \";\"))\nfor _,v in ipairs(includedirs) do\n_p(' <IncludePath Value=\"%s\"/>', premake.esc(v))\nend\nfor _,v in ipairs(cfg.defines) do\n_p(' <Preprocessor Value=\"%s\"/>', premake.esc(v))\nend\n_p(' </Compiler>')\nflags = premake.esc(table.join(premake.gcc.getldflags(cfg), cfg.linkoptions))\n_p(' <Linker Required=\"yes\" Options=\"%s\">', table.concat(flags, \";\"))\nfor _,v in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do\n_p(' <LibraryPath Value=\"%s\" />', premake.esc(v))\nend\nfor _,v in ipairs(premake.getlinks(cfg, \"all\", \"basename\")) do\n_p(' <Library Value=\"%s\" />', premake.esc(v))\nend\n_p(' </Linker>')\nif premake.findfile(cfg, \".rc\") then\nlocal defines = table.implode(table.join(cfg.defines, cfg.resdefines), \"-D\", \";\", \"\")\nlocal options = table.concat(cfg.resoptions, \";\"" - ")\n_p(' <ResourceCompiler Required=\"yes\" Options=\"%s%s\">', defines, options)\nfor _,v in ipairs(table.join(cfg.includedirs, cfg.resincludedirs)) do\n_p(' <IncludePath Value=\"%s\"/>', premake.esc(v))\nend\n_p(' </ResourceCompiler>')\nelse\n_p(' <ResourceCompiler Required=\"no\" Options=\"\"/>')\nend\nif #cfg.prebuildcommands > 0 then\n_p(' <PreBuild>')\nfor _,v in ipairs(cfg.prebuildcommands) do\n_p(' <Command Enabled=\"yes\">%s</Command>', premake.esc(v))\nend\n_p(' </PreBuild>')\nend\nif #cfg.postbuildcommands > 0 then\n_p(' <PostBuild>')\nfor _,v in ipairs(cfg.postbuildcommands) do\n_p(' <Command Enabled=\"yes\">%s</Command>', premake.esc(v))\nend\n_p(' </PostBuild>')\nend\n_p(' <CustomBuild Enabled=\"no\">')\n_p(' <CleanCommand></CleanCommand>')\n_p(' <BuildCommand></BuildCommand>')\n_p(' <SingleFileCommand></SingleFileCommand>')\n_p(' <MakefileGenerationCommand></MakefileGenerationCommand>')\n_p(' <ThirdPar" - "tyToolName>None</ThirdPartyToolName>')\n_p(' <WorkingDirectory></WorkingDirectory>')\n_p(' </CustomBuild>')\n_p(' <AdditionalRules>')\n_p(' <CustomPostBuild></CustomPostBuild>')\n_p(' <CustomPreBuild></CustomPreBuild>')\n_p(' </AdditionalRules>')\n_p(' </Configuration>')\nend\nend\n_p(' </Settings>')\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\n_p(' <Dependencies name=\"%s\">', cfg.longname:gsub(\"|\",\"_\"))\nfor _,dep in ipairs(premake.getdependencies(prj)) do\n_p(' <Project Name=\"%s\"/>', dep.name)\nend\n_p(' </Dependencies>')\nend\nend\n_p('</CodeLite_Project>')\nend\n", - /* actions/cmake/_cmake.lua */ "premake.cmake = { }\nnewaction {\ntrigger = \"cmake\",\nshortname = \"CMake\",\ndescription = \"Generate CMake project files\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\" },\nvalid_languages = { \"C\", \"C++\" },\nvalid_tools = {\ncc = { \"gcc\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"CMakeLists.txt\", premake.cmake.workspace)\nend,\nonproject = function(prj)\npremake.generate(prj, \"%%/CMakeLists.txt\", premake.cmake.project)\nend,\noncleansolution = function(sln)\npremake.clean.file(sln, \"CMakeLists.txt\")\nend,\noncleanproject = function(prj)\npremake.clean.file(prj, \"%%/CMakeLists.txt\")\nend\n}\n", @@ -236,21 +210,21 @@ const char* builtin_scripts[] = { "int-directory -C %s -f %s', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true)))\n_p('')\nend\n_p('clean:')\nfor _ ,prj in ipairs(sln.projects) do\n_p('\\t@${MAKE} --no-print-directory -C %s -f %s clean', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true)))\nend\n_p('')\n_p('help:')\n_p(1,'@echo \"Usage: make [config=name] [target]\"')\n_p(1,'@echo \"\"')\n_p(1,'@echo \"CONFIGURATIONS:\"')\nlocal cfgpairs = { }\nfor _, platform in ipairs(platforms) do\nfor _, cfgname in ipairs(sln.configurations) do\n_p(1,'@echo \" %s\"', premake.getconfigname(cfgname, platform, true))\nend\nend\n_p(1,'@echo \"\"')\n_p(1,'@echo \"TARGETS:\"')\n_p(1,'@echo \" all (default)\"')\n_p(1,'@echo \" clean\"')\nfor _, prj in ipairs(sln.projects) do\n_p(1,'@echo \" %s\"', prj.name)\nend\n_p(1,'@echo \"\"')\n_p(1,'@echo \"For more information, see https://github.com/bkaradzic/genie\"')\nend\n", /* actions/make/make_cpp.lua */ - "premake.make.cpp = { }\npremake.make.override = { }\nlocal cpp = premake.make.cpp\nlocal make = premake.make\nfunction premake.make_cpp(prj)\nlocal cc = premake.gettool(prj)\nlocal platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\npremake.gmake_cpp_header(prj, cc, platforms)\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\npremake.gmake_cpp_config(prj, cfg, cc)\nend\nend\ntable.sort(prj.allfiles)\nlocal objdirs = {}\nlocal additionalobjdirs = {}\nfor _, file in ipairs(prj.allfiles) do\nif path.isSourceFile(file) then\nobjdirs[_MAKE.esc(path.getdirectory(path.trimdots(file)))] = 1\nend\nend\nfor _, custombuildtask in ipairs(prj.custombuildtask or {}) do\nfor _, buildtask in ipairs(custombuildtask or {}) do\nadditionalobjdirs[_MAKE.esc(path.getdirectory(path.getrelative(prj.location,buildtask[2])))] = 1\nend\nend\n_p('OBJDIRS := \\\\')\n_p('\\t$(OBJDIR) \\\\')\nfor dir, _ in iter.sortByKeys(objdirs) do\n_p('\\t$(OBJDIR)/%s \\\\', dir)\nend\nfor" - " dir, _ in iter.sortByKeys(additionalobjdirs) do\n_p('\\t%s \\\\', dir)\nend\n_p('')\n_p('RESOURCES := \\\\')\nfor _, file in ipairs(prj.allfiles) do\nif path.isresourcefile(file) then\n_p('\\t$(OBJDIR)/%s.res \\\\', _MAKE.esc(path.getbasename(file)))\nend\nend\n_p('')\n_p('.PHONY: clean prebuild prelink')\n_p('')\nif os.is(\"MacOSX\") and prj.kind == \"WindowedApp\" then\n_p('all: $(OBJDIRS) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist | $(TARGETDIR)')\nelse\n_p('all: $(OBJDIRS) prebuild prelink $(TARGET) | $(TARGETDIR)')\nend\n_p('\\t@:')\n_p('')\nif (prj.kind == \"StaticLib\" and prj.options.ArchiveSplit) then\n_p('define max_args')\n_p('\\t$(eval _args:=)')\n_p('\\t$(foreach obj,$3,$(eval _args+=$(obj))$(if $(word $2,$(_args)),$1$(_args)$(EOL)$(eval _args:=)))')\n_p('\\t$(if $(_args),$1$(_args))')\n_p('endef')\n_p('')\n_p('define EOL')\n_p('')\n_p('')\n_p('endef')\n_p('')\nend\n_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(EXTERNAL_LIBS) $(RESOURCES) | $(TARGETDIR) $(O" - "BJDIRS)')\nif prj.kind == \"StaticLib\" then\nif prj.msgarchiving then\n_p('\\t@echo ' .. prj.msgarchiving)\nelse\n_p('\\t@echo Archiving %s', prj.name)\nend\nif (not prj.archivesplit_size) then\nprj.archivesplit_size=200\nend\nif (not prj.options.ArchiveSplit) then\n_p('\\t$(SILENT) $(LINKCMD) $(OBJECTS)' .. (os.is(\"MacOSX\") and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d'\" or \"\"))\nelse\n_p('\\t$(call RM,$(TARGET))')\n_p('\\t@$(call max_args,$(LINKCMD),'.. prj.archivesplit_size ..',$(OBJECTS))' .. (os.is(\"MacOSX\") and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d'\" or \"\"))\n_p('\\t$(SILENT) $(LINKCMD_NDX)')\nend\nelse\nif prj.msglinking then\n_p('\\t@echo ' .. prj.msglinking)\nelse\n_p('\\t@echo Linking %s', prj.name)\nend\n_p('\\t$(SILENT) $(LINKCMD)')\nend\n_p('\\t$(POSTBUILDCMDS)')\n_p('')\n_p('$(TARGETDIR):')\npremake.make_mkdirrule(\"$(TARGETDIR)\")\n_p('$(OBJDIRS):')\nif (not prj.solution.messageskip) or (not table.contains(prj.solution.messageskip, \"SkipCreatingMessage\"))" - " then\n_p('\\t@echo Creating $(@)')\nend\n_p('\\t-$(call MKDIR,$@)')\n_p('')\nif os.is(\"MacOSX\") and prj.kind == \"WindowedApp\" then\n_p('$(dir $(TARGETDIR))PkgInfo:')\n_p('$(dir $(TARGETDIR))Info.plist:')\n_p('')\nend\n_p('clean:')\nif (not prj.solution.messageskip) or (not table.contains(prj.solution.messageskip, \"SkipCleaningMessage\")) then\n_p('\\t@echo Cleaning %s', prj.name)\nend\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) rm -f $(TARGET)')\n_p('\\t$(SILENT) rm -rf $(OBJDIR)')\n_p('else')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(TARGET)) del $(subst /,\\\\\\\\,$(TARGET))')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\\\\\,$(OBJDIR))')\n_p('endif')\n_p('')\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\ncpp.pchrules(prj)\ncpp.fileRules(prj, cc)\ncpp.dependencyRules(prj)\nfor _, custombuildtask in ipairs(prj.custombuildtask or {}) do\nfor _, buildtask in ipairs(custombuildtask or {}) do\nlocal dep" - "s = string.format(\"%s \",path.getrelative(prj.location,buildtask[1]))\nfor _, depdata in ipairs(buildtask[3] or {}) do\ndeps = deps .. string.format(\"%s \",path.getrelative(prj.location,depdata))\nend\n_p('%s: %s | $(TARGETDIR) $(OBJDIRS)'\n,path.getrelative(prj.location,buildtask[2])\n, deps\n)\nfor _, cmdline in ipairs(buildtask[4] or {}) do\nlocal cmd = cmdline\nlocal num = 1\nfor _, depdata in ipairs(buildtask[3] or {}) do\ncmd = string.gsub(cmd,\"%$%(\" .. num ..\"%)\", string.format(\"%s \",path.getrelative(prj.location,depdata)))\nnum = num + 1\nend\ncmd = string.gsub(cmd, \"%$%(<%)\", \"$<\")\ncmd = string.gsub(cmd, \"%$%(@%)\", \"$@\")\n_p('\\t$(SILENT) %s',cmd)\nend\n_p('')\nend\nend\n_p('-include $(OBJECTS:%%.o=%%.d)')\n_p('ifneq (,$(PCH))')\n_p(' -include $(OBJDIR)/$(notdir $(PCH)).d')\n_p(' -include $(OBJDIR)/$(notdir $(PCH))_objc.d')\n_p('endif')\nend\nfunction premake.gmake_cpp_header(prj, cc, platforms)\n_p('# %s project makefile autogenerated by GENie', premake.action.current().shortname)" - "\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true)))\n_p('endif')\n_p('')\n_p('ifndef verbose')\n_p(' SILENT = @')\n_p('endif')\n_p('')\n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(MAKESHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('')\n_p('ifeq (posix,$(SHELLTYPE))')\n_p(' MKDIR = $(SILENT) mkdir -p \"$(1)\"')\n_p(' COPY = $(SILENT) cp -fR \"$(1)\" \"$(2)\"')\n_p(' RM = $(SILENT) rm -f \"$(1)\"')\n_p('else')\n_p(' MKDIR = $(SILENT) mkdir \"$(subst /,\\\\\\\\,$(1))\" 2> nul || exit 0')\n_p(' COPY = $(SILENT) copy /Y \"$(subst /,\\\\\\\\,$(1))\" \"$(subst /,\\\\\\\\,$(2))\"')\n_p(' RM = $(SILENT) del /F \"$(subst /,\\\\\\\\,$(1))\" 2> nul || exit 0')\n_p('endif')\n_p('')\n_p('CC = %s', cc.cc)\n_p('CXX = %s', cc.cxx)\n_p('AR = %s', cc." - "ar)\n_p('')\n_p('ifndef RESCOMP')\n_p(' ifdef WINDRES')\n_p(' RESCOMP = $(WINDRES)')\n_p(' else')\n_p(' RESCOMP = windres')\n_p(' endif')\n_p('endif')\n_p('')\nend\nlocal function is_excluded(prj, cfg, file)\nif table.icontains(prj.excludes, file) then\nreturn true\nend\nif table.icontains(cfg.excludes, file) then\nreturn true\nend\nreturn false\nend\nfunction premake.gmake_cpp_config(prj, cfg, cc)\n_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))\ncpp.platformtools(cfg, cc)\n_p(' ' .. (table.contains(premake.make.override,\"OBJDIR\") and \"override \" or \"\") .. 'OBJDIR = %s', _MAKE.esc(cfg.objectsdir))\n_p(' ' .. (table.contains(premake.make.override,\"TARGETDIR\") and \"override \" or \"\") .. 'TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory))\n_p(' ' .. (table.contains(premake.make.override,\"TARGET\") and \"override \" or \"\") .. 'TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))\n_p(' DEFINES +=%s', make.list(cc.getdefi" - "nes(cfg.defines)))\n_p(' INCLUDES +=%s', make.list(cc.getincludedirs(cfg.includedirs)))\n_p(' INCLUDES +=%s', make.list(cc.getquoteincludedirs(cfg.userincludedirs)))\ncpp.pchconfig(cfg)\ncpp.flags(cfg, cc)\ncpp.linker(prj, cfg, cc)\ntable.sort(cfg.files)\n_p(' OBJECTS := \\\\')\nfor _, file in ipairs(cfg.files) do\nif path.isSourceFile(file) then\nif not is_excluded(prj, cfg, file) then\n_p('\\t$(OBJDIR)/%s.o \\\\'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n)\nend\nend\nend\n_p('')\n_p(' define PREBUILDCMDS')\nif #cfg.prebuildcommands > 0 then\n_p('\\t@echo Running pre-build commands')\n_p('\\t%s', table.implode(cfg.prebuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define PRELINKCMDS')\nif #cfg.prelinkcommands > 0 then\n_p('\\t@echo Running pre-link commands')\n_p('\\t%s', table.implode(cfg.prelinkcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define POSTBUILDCMDS')\nif #cfg.postbuildcommands > 0 then\n_p('\\t@echo Running post-build commands')" - "\n_p('\\t%s', table.implode(cfg.postbuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\nmake.settings(cfg, cc)\n_p('endif')\n_p('')\nend\nfunction cpp.platformtools(cfg, cc)\nlocal platform = cc.platforms[cfg.platform]\nif platform.cc then\n_p(' CC = %s', platform.cc)\nend\nif platform.cxx then\n_p(' CXX = %s', platform.cxx)\nend\nif platform.ar then\n_p(' AR = %s', platform.ar)\nend\nend\nfunction cpp.flags(cfg, cc)\nif cfg.pchheader and not cfg.flags.NoPCH then\n_p(' FORCE_INCLUDE += -include $(OBJDIR)/$(notdir $(PCH))')\n_p(' FORCE_INCLUDE_OBJC += -include $(OBJDIR)/$(notdir $(PCH))_objc')\nend\nif #cfg.forcedincludes > 0 then\n_p(' FORCE_INCLUDE += -include %s'\n,_MAKE.esc(table.concat(cfg.forcedincludes, \";\")))\nend\n_p(' ALL_CPPFLAGS += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), \" \"))\n_p(' ALL_ASMFLAGS += $(ASMFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptio" - "ns, cfg.buildoptions_asm)))\n_p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_c)))\n_p(' ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_cpp)))\n_p(' ALL_OBJCFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_objc)))\n_p(' ALL_OBJCPPFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_objcpp)))\n_p(' ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s',\n make.list(table.join(cc.getdefines(cfg.resdefines),\n cc.getincludedirs(cfg.resincludedirs), cfg.resoptions)))\nend\nfunction cpp.linker(prj, cfg, cc)\n_p(' ALL_LDFLAGS += $(LDFLAGS)%s', make.list(table.join(cc.getlib" - "dirflags(cfg), cc.getldflags(cfg), cfg.linkoptions)))\n_p(' LDDEPS +=%s', make.list(_MAKE.esc(premake.getlinks(cfg, \"siblings\", \"fullpath\"))))\n_p(' LIBS += $(LDDEPS)%s', make.list(cc.getlinkflags(cfg)))\n_p(' EXTERNAL_LIBS +=%s', make.list(cc.getlibfiles(cfg)))\nif cfg.kind == \"StaticLib\" then\nif (not prj.options.ArchiveSplit) then\n_p(' LINKCMD = $(AR) %s $(TARGET)', make.list(cc.getarchiveflags(prj, cfg, false)))\nelse\n_p(' LINKCMD = $(AR) %s $(TARGET)', make.list(cc.getarchiveflags(prj, cfg, false)))\n_p(' LINKCMD_NDX = $(AR) %s $(TARGET)', make.list(cc.getarchiveflags(prj, cfg, true)))\nend\nelse\nlocal tool = iif(cfg.language == \"C\", \"CC\", \"CXX\")\n_p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)', tool)\nend\nend\nfunction cpp.pchconfig(cfg)\nif not cfg.pchheader or cfg.flags.NoPCH then\nreturn\nend\nlocal pch = cfg.pchheader\nfor _, incdir in ipairs(cfg.includedirs) do" - "\nlocal abspath = path.getabsolute(path.join(cfg.project.location, incdir))\nlocal testname = path.join(abspath, pch)\nif os.isfile(testname) then\npch = path.getrelative(cfg.location, testname)\nbreak\nend\nend\n_p(' PCH = %s', _MAKE.esc(pch))\n_p(' GCH = $(OBJDIR)/$(notdir $(PCH)).gch')\n_p(' GCH_OBJC = $(OBJDIR)/$(notdir $(PCH))_objc.gch')\nend\nfunction cpp.pchrules(prj)\n_p('ifneq (,$(PCH))')\n_p('$(GCH): $(PCH) $(MAKEFILE) | $(OBJDIR)')\nif prj.msgprecompile then\n_p('\\t@echo ' .. prj.msgprecompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\nlocal cmd = iif(prj.language == \"C\", \"$(CC) $(ALL_CFLAGS) -x c-header\", \"$(CXX) $(ALL_CXXFLAGS) -x c++-header\")\n_p('\\t$(SILENT) %s $(DEFINES) $(INCLUDES) -o \"$@\" -c \"$<\"', cmd)\n_p('')\n_p('$(GCH_OBJC): $(PCH) $(MAKEFILE) | $(OBJDIR)')\nif prj.msgprecompile then\n_p('\\t@echo ' .. prj.msgprecompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\nlocal cmd = iif(prj.language == \"C\", \"$(CC) $(ALL_OBJCFLAGS) -x objec" - "tive-c-header\", \"$(CXX) $(ALL_OBJCPPFLAGS) -x objective-c++-header\")\n_p('\\t$(SILENT) %s $(DEFINES) $(INCLUDES) -o \"$@\" -c \"$<\"', cmd)\n_p('endif')\n_p('')\nend\nfunction cpp.fileRules(prj, cc)\nlocal platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\ntable.sort(prj.allfiles)\nfor _, file in ipairs(prj.allfiles or {}) do\nif path.isSourceFile(file) then\nif (path.isobjcfile(file)) then\n_p('$(OBJDIR)/%s.o: %s $(GCH_OBJC) $(MAKEFILE)'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n, _MAKE.esc(file)\n)\nelse\n_p('$(OBJDIR)/%s.o: %s $(GCH) $(MAKEFILE)'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n, _MAKE.esc(file)\n)\nend\nif (path.isobjcfile(file) and prj.msgcompile_objc) then\n_p('\\t@echo ' .. prj.msgcompile_objc)\nelseif prj.msgcompile then\n_p('\\t@echo ' .. prj.msgcompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\nif (path.isobjcfile(file)) then\nif (path.iscfile(file)) then\n_p('\\t$(SILENT) $(CXX) $(ALL_OBJCFLAGS) $(FORCE_INCLUDE_OBJC) -o \"$@\" -c \"$<\"')\nelse" - "\n_p('\\t$(SILENT) $(CXX) $(ALL_OBJCPPFLAGS) $(FORCE_INCLUDE_OBJC) -o \"$@\" -c \"$<\"')\nend\nelseif (path.isasmfile(file)) then\n_p('\\t$(SILENT) $(CC) $(ALL_ASMFLAGS) -o \"$@\" -c \"$<\"')\nelse\ncpp.buildcommand(path.iscfile(file) and not prj.options.ForceCPP, \"o\")\nend\nfor _, task in ipairs(prj.postcompiletasks or {}) do\n_p('\\t$(SILENT) %s', task)\n_p('')\nend\n_p('')\nelseif (path.getextension(file) == \".rc\") then\n_p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))\nif prj.msgresource then\n_p('\\t@echo ' .. prj.msgresource)\nelse\n_p('\\t@echo $(notdir $<)')\nend\n_p('\\t$(SILENT) $(RESCOMP) $< -O coff -o \"$@\" $(ALL_RESFLAGS)')\n_p('')\nend\nend\nend\nfunction cpp.dependencyRules(prj)\nfor _, dependency in ipairs(prj.dependency or {}) do\nfor _, dep in ipairs(dependency or {}) do\nif (dep[3]==nil or dep[3]==false) then\n_p('$(OBJDIR)/%s.o: %s'\n, _MAKE.esc(path.trimdots(path.removeext(path.getrelative(prj.location, dep[1]))))\n, _MAKE.esc(path.getrelative(prj.locatio" - "n, dep[2]))\n)\nelse\n_p('%s: %s'\n, _MAKE.esc(dep[1])\n, _MAKE.esc(path.getrelative(prj.location, dep[2]))\n)\nend\n_p('')\nend\nend\nend\nfunction cpp.buildcommand(iscfile, objext)\nlocal flags = iif(iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')\n_p('\\t$(SILENT) %s $(FORCE_INCLUDE) -o \"$@\" -c \"$<\"', flags, objext)\nend\n", + "premake.make.cpp = { }\npremake.make.override = { }\npremake.make.makefile_ignore = false\nlocal cpp = premake.make.cpp\nlocal make = premake.make\nfunction premake.make_cpp(prj)\nlocal cc = premake.gettool(prj)\nlocal platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\npremake.gmake_cpp_header(prj, cc, platforms)\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\npremake.gmake_cpp_config(prj, cfg, cc)\nend\nend\ntable.sort(prj.allfiles)\nlocal objdirs = {}\nlocal additionalobjdirs = {}\nfor _, file in ipairs(prj.allfiles) do\nif path.isSourceFile(file) then\nobjdirs[_MAKE.esc(path.getdirectory(path.trimdots(file)))] = 1\nend\nend\nfor _, custombuildtask in ipairs(prj.custombuildtask or {}) do\nfor _, buildtask in ipairs(custombuildtask or {}) do\nadditionalobjdirs[_MAKE.esc(path.getdirectory(path.getrelative(prj.location,buildtask[2])))] = 1\nend\nend\n_p('OBJDIRS := \\\\')\n_p('\\t$(OBJDIR) \\\\')\nfor dir, _ in iter.sortByKeys(objdirs) do\n_p(" + "'\\t$(OBJDIR)/%s \\\\', dir)\nend\nfor dir, _ in iter.sortByKeys(additionalobjdirs) do\n_p('\\t%s \\\\', dir)\nend\n_p('')\n_p('RESOURCES := \\\\')\nfor _, file in ipairs(prj.allfiles) do\nif path.isresourcefile(file) then\n_p('\\t$(OBJDIR)/%s.res \\\\', _MAKE.esc(path.getbasename(file)))\nend\nend\n_p('')\n_p('.PHONY: clean prebuild prelink')\n_p('')\nif os.is(\"MacOSX\") and prj.kind == \"WindowedApp\" then\n_p('all: $(OBJDIRS) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist | $(TARGETDIR)')\nelse\n_p('all: $(OBJDIRS) prebuild prelink $(TARGET) | $(TARGETDIR)')\nend\n_p('\\t@:')\n_p('')\nif (prj.kind == \"StaticLib\" and prj.options.ArchiveSplit) then\n_p('define max_args')\n_p('\\t$(eval _args:=)')\n_p('\\t$(foreach obj,$3,$(eval _args+=$(obj))$(if $(word $2,$(_args)),$1$(_args)$(EOL)$(eval _args:=)))')\n_p('\\t$(if $(_args),$1$(_args))')\n_p('endef')\n_p('')\n_p('define EOL')\n_p('')\n_p('')\n_p('endef')\n_p('')\nend\n_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(EXTERNAL" + "_LIBS) $(RESOURCES) | $(TARGETDIR) $(OBJDIRS)')\nif prj.kind == \"StaticLib\" then\nif prj.msgarchiving then\n_p('\\t@echo ' .. prj.msgarchiving)\nelse\n_p('\\t@echo Archiving %s', prj.name)\nend\nif (not prj.archivesplit_size) then\nprj.archivesplit_size=200\nend\nif (not prj.options.ArchiveSplit) then\n_p('\\t$(SILENT) $(LINKCMD) $(OBJECTS)' .. (os.is(\"MacOSX\") and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d'\" or \"\"))\nelse\n_p('\\t$(call RM,$(TARGET))')\n_p('\\t@$(call max_args,$(LINKCMD),'.. prj.archivesplit_size ..',$(OBJECTS))' .. (os.is(\"MacOSX\") and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d'\" or \"\"))\n_p('\\t$(SILENT) $(LINKCMD_NDX)')\nend\nelse\nif prj.msglinking then\n_p('\\t@echo ' .. prj.msglinking)\nelse\n_p('\\t@echo Linking %s', prj.name)\nend\n_p('\\t$(SILENT) $(LINKCMD)')\nend\n_p('\\t$(POSTBUILDCMDS)')\n_p('')\n_p('$(TARGETDIR):')\npremake.make_mkdirrule(\"$(TARGETDIR)\")\n_p('$(OBJDIRS):')\nif (not prj.solution.messageskip) or (not table.contains(prj.solution." + "messageskip, \"SkipCreatingMessage\")) then\n_p('\\t@echo Creating $(@)')\nend\n_p('\\t-$(call MKDIR,$@)')\n_p('')\nif os.is(\"MacOSX\") and prj.kind == \"WindowedApp\" then\n_p('$(dir $(TARGETDIR))PkgInfo:')\n_p('$(dir $(TARGETDIR))Info.plist:')\n_p('')\nend\n_p('clean:')\nif (not prj.solution.messageskip) or (not table.contains(prj.solution.messageskip, \"SkipCleaningMessage\")) then\n_p('\\t@echo Cleaning %s', prj.name)\nend\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) rm -f $(TARGET)')\n_p('\\t$(SILENT) rm -rf $(OBJDIR)')\n_p('else')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(TARGET)) del $(subst /,\\\\\\\\,$(TARGET))')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\\\\\,$(OBJDIR))')\n_p('endif')\n_p('')\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\ncpp.pchrules(prj)\ncpp.fileRules(prj, cc)\ncpp.dependencyRules(prj)\nfor _, custombuildtask in ipairs(prj.custombuildtask or {}) do\nfor _, buildtask in ipair" + "s(custombuildtask or {}) do\nlocal deps = string.format(\"%s \",path.getrelative(prj.location,buildtask[1]))\nfor _, depdata in ipairs(buildtask[3] or {}) do\ndeps = deps .. string.format(\"%s \",path.getrelative(prj.location,depdata))\nend\n_p('%s: %s | $(TARGETDIR) $(OBJDIRS)'\n,path.getrelative(prj.location,buildtask[2])\n, deps\n)\nfor _, cmdline in ipairs(buildtask[4] or {}) do\nlocal cmd = cmdline\nlocal num = 1\nfor _, depdata in ipairs(buildtask[3] or {}) do\ncmd = string.gsub(cmd,\"%$%(\" .. num ..\"%)\", string.format(\"%s \",path.getrelative(prj.location,depdata)))\nnum = num + 1\nend\ncmd = string.gsub(cmd, \"%$%(<%)\", \"$<\")\ncmd = string.gsub(cmd, \"%$%(@%)\", \"$@\")\n_p('\\t$(SILENT) %s',cmd)\nend\n_p('')\nend\nend\n_p('-include $(OBJECTS:%%.o=%%.d)')\n_p('ifneq (,$(PCH))')\n_p(' -include $(OBJDIR)/$(notdir $(PCH)).d')\n_p(' -include $(OBJDIR)/$(notdir $(PCH))_objc.d')\n_p('endif')\nend\nfunction premake.gmake_cpp_header(prj, cc, platforms)\n_p('# %s project makefile autogenerated by GENie" + "', premake.action.current().shortname)\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true)))\n_p('endif')\n_p('')\n_p('ifndef verbose')\n_p(' SILENT = @')\n_p('endif')\n_p('')\n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(MAKESHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('')\n_p('ifeq (posix,$(SHELLTYPE))')\n_p(' MKDIR = $(SILENT) mkdir -p \"$(1)\"')\n_p(' COPY = $(SILENT) cp -fR \"$(1)\" \"$(2)\"')\n_p(' RM = $(SILENT) rm -f \"$(1)\"')\n_p('else')\n_p(' MKDIR = $(SILENT) mkdir \"$(subst /,\\\\\\\\,$(1))\" 2> nul || exit 0')\n_p(' COPY = $(SILENT) copy /Y \"$(subst /,\\\\\\\\,$(1))\" \"$(subst /,\\\\\\\\,$(2))\"')\n_p(' RM = $(SILENT) del /F \"$(subst /,\\\\\\\\,$(1))\" 2> nul || exit 0')\n_p('endif')\n_p('')\n_p('CC = %s', cc.cc)\n_p('" + "CXX = %s', cc.cxx)\n_p('AR = %s', cc.ar)\n_p('')\n_p('ifndef RESCOMP')\n_p(' ifdef WINDRES')\n_p(' RESCOMP = $(WINDRES)')\n_p(' else')\n_p(' RESCOMP = windres')\n_p(' endif')\n_p('endif')\n_p('')\nif (not premake.make.makefile_ignore) then\n_p('MAKEFILE = %s', _MAKE.getmakefilename(prj, true))\n_p('')\nend\nend\nlocal function is_excluded(prj, cfg, file)\nif table.icontains(prj.excludes, file) then\nreturn true\nend\nif table.icontains(cfg.excludes, file) then\nreturn true\nend\nreturn false\nend\nfunction premake.gmake_cpp_config(prj, cfg, cc)\n_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))\ncpp.platformtools(cfg, cc)\n_p(' ' .. (table.contains(premake.make.override,\"OBJDIR\") and \"override \" or \"\") .. 'OBJDIR = %s', _MAKE.esc(cfg.objectsdir))\n_p(' ' .. (table.contains(premake.make.override,\"TARGETDIR\") and \"override \" or \"\") .. 'TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory))\n_p(' ' .. (table.contains(premake.make.override,\"TARGET\") and \"over" + "ride \" or \"\") .. 'TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))\n_p(' DEFINES +=%s', make.list(cc.getdefines(cfg.defines)))\n_p(' INCLUDES +=%s', make.list(cc.getincludedirs(cfg.includedirs)))\n_p(' INCLUDES +=%s', make.list(cc.getquoteincludedirs(cfg.userincludedirs)))\ncpp.pchconfig(cfg)\ncpp.flags(cfg, cc)\ncpp.linker(prj, cfg, cc)\ntable.sort(cfg.files)\n_p(' OBJECTS := \\\\')\nfor _, file in ipairs(cfg.files) do\nif path.isSourceFile(file) then\nif not is_excluded(prj, cfg, file) then\n_p('\\t$(OBJDIR)/%s.o \\\\'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n)\nend\nend\nend\n_p('')\n_p(' define PREBUILDCMDS')\nif #cfg.prebuildcommands > 0 then\n_p('\\t@echo Running pre-build commands')\n_p('\\t%s', table.implode(cfg.prebuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define PRELINKCMDS')\nif #cfg.prelinkcommands > 0 then\n_p('\\t@echo Running pre-link commands')\n_p('\\t%s', table.implode(cfg.prelinkcommands, \"\"" + ", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define POSTBUILDCMDS')\nif #cfg.postbuildcommands > 0 then\n_p('\\t@echo Running post-build commands')\n_p('\\t%s', table.implode(cfg.postbuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\nmake.settings(cfg, cc)\n_p('endif')\n_p('')\nend\nfunction cpp.platformtools(cfg, cc)\nlocal platform = cc.platforms[cfg.platform]\nif platform.cc then\n_p(' CC = %s', platform.cc)\nend\nif platform.cxx then\n_p(' CXX = %s', platform.cxx)\nend\nif platform.ar then\n_p(' AR = %s', platform.ar)\nend\nend\nfunction cpp.flags(cfg, cc)\nif cfg.pchheader and not cfg.flags.NoPCH then\n_p(' FORCE_INCLUDE += -include $(OBJDIR)/$(notdir $(PCH))')\n_p(' FORCE_INCLUDE_OBJC += -include $(OBJDIR)/$(notdir $(PCH))_objc')\nend\nif #cfg.forcedincludes > 0 then\n_p(' FORCE_INCLUDE += -include %s'\n,_MAKE.esc(table.concat(cfg.forcedincludes, \";\")))\nend\n_p(' ALL_CPPFLAGS += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppfla" + "gs(cfg), \" \"))\n_p(' ALL_ASMFLAGS += $(ASMFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_asm)))\n_p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_c)))\n_p(' ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_cpp)))\n_p(' ALL_OBJCFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_objc)))\n_p(' ALL_OBJCPPFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_objcpp)))\n_p(' ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s',\n make.list(table.join(cc.getdefines(cfg.resdefines),\n cc.getincludedirs(cfg" + ".resincludedirs), cfg.resoptions)))\nend\nfunction cpp.linker(prj, cfg, cc)\n_p(' ALL_LDFLAGS += $(LDFLAGS)%s', make.list(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions)))\n_p(' LDDEPS +=%s', make.list(_MAKE.esc(premake.getlinks(cfg, \"siblings\", \"fullpath\"))))\n_p(' LIBS += $(LDDEPS)%s', make.list(cc.getlinkflags(cfg)))\n_p(' EXTERNAL_LIBS +=%s', make.list(cc.getlibfiles(cfg)))\nif cfg.kind == \"StaticLib\" then\nif (not prj.options.ArchiveSplit) then\n_p(' LINKCMD = $(AR) %s $(TARGET)', make.list(cc.getarchiveflags(prj, cfg, false)))\nelse\n_p(' LINKCMD = $(AR) %s $(TARGET)', make.list(cc.getarchiveflags(prj, cfg, false)))\n_p(' LINKCMD_NDX = $(AR) %s $(TARGET)', make.list(cc.getarchiveflags(prj, cfg, true)))\nend\nelse\nlocal tool = iif(cfg.language == \"C\", \"CC\", \"CXX\")\n_p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)', tool)\nend\nend\nfunction " + "cpp.pchconfig(cfg)\nif not cfg.pchheader or cfg.flags.NoPCH then\nreturn\nend\nlocal pch = cfg.pchheader\nfor _, incdir in ipairs(cfg.includedirs) do\nlocal abspath = path.getabsolute(path.join(cfg.project.location, incdir))\nlocal testname = path.join(abspath, pch)\nif os.isfile(testname) then\npch = path.getrelative(cfg.location, testname)\nbreak\nend\nend\n_p(' PCH = %s', _MAKE.esc(pch))\n_p(' GCH = $(OBJDIR)/$(notdir $(PCH)).gch')\n_p(' GCH_OBJC = $(OBJDIR)/$(notdir $(PCH))_objc.gch')\nend\nfunction cpp.pchrules(prj)\n_p('ifneq (,$(PCH))')\n_p('$(GCH): $(PCH) $(MAKEFILE) | $(OBJDIR)')\nif prj.msgprecompile then\n_p('\\t@echo ' .. prj.msgprecompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\nlocal cmd = iif(prj.language == \"C\", \"$(CC) $(ALL_CFLAGS) -x c-header\", \"$(CXX) $(ALL_CXXFLAGS) -x c++-header\")\n_p('\\t$(SILENT) %s $(DEFINES) $(INCLUDES) -o \"$@\" -c \"$<\"', cmd)\n_p('')\n_p('$(GCH_OBJC): $(PCH) $(MAKEFILE) | $(OBJDIR)')\nif prj.msgprecompile then\n_" + "p('\\t@echo ' .. prj.msgprecompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\nlocal cmd = iif(prj.language == \"C\", \"$(CC) $(ALL_OBJCFLAGS) -x objective-c-header\", \"$(CXX) $(ALL_OBJCPPFLAGS) -x objective-c++-header\")\n_p('\\t$(SILENT) %s $(DEFINES) $(INCLUDES) -o \"$@\" -c \"$<\"', cmd)\n_p('endif')\n_p('')\nend\nfunction cpp.fileRules(prj, cc)\nlocal platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\ntable.sort(prj.allfiles)\nfor _, file in ipairs(prj.allfiles or {}) do\nif path.isSourceFile(file) then\nif (path.isobjcfile(file)) then\n_p('$(OBJDIR)/%s.o: %s $(GCH_OBJC) $(MAKEFILE)'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n, _MAKE.esc(file)\n)\nelse\n_p('$(OBJDIR)/%s.o: %s $(GCH) $(MAKEFILE)'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n, _MAKE.esc(file)\n)\nend\nif (path.isobjcfile(file) and prj.msgcompile_objc) then\n_p('\\t@echo ' .. prj.msgcompile_objc)\nelseif prj.msgcompile then\n_p('\\t@echo ' .. prj.msgcompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\nif (" + "path.isobjcfile(file)) then\nif (path.iscfile(file)) then\n_p('\\t$(SILENT) $(CXX) $(ALL_OBJCFLAGS) $(FORCE_INCLUDE_OBJC) -o \"$@\" -c \"$<\"')\nelse\n_p('\\t$(SILENT) $(CXX) $(ALL_OBJCPPFLAGS) $(FORCE_INCLUDE_OBJC) -o \"$@\" -c \"$<\"')\nend\nelseif (path.isasmfile(file)) then\n_p('\\t$(SILENT) $(CC) $(ALL_ASMFLAGS) -o \"$@\" -c \"$<\"')\nelse\ncpp.buildcommand(path.iscfile(file) and not prj.options.ForceCPP, \"o\")\nend\nfor _, task in ipairs(prj.postcompiletasks or {}) do\n_p('\\t$(SILENT) %s', task)\n_p('')\nend\n_p('')\nelseif (path.getextension(file) == \".rc\") then\n_p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))\nif prj.msgresource then\n_p('\\t@echo ' .. prj.msgresource)\nelse\n_p('\\t@echo $(notdir $<)')\nend\n_p('\\t$(SILENT) $(RESCOMP) $< -O coff -o \"$@\" $(ALL_RESFLAGS)')\n_p('')\nend\nend\nend\nfunction cpp.dependencyRules(prj)\nfor _, dependency in ipairs(prj.dependency or {}) do\nfor _, dep in ipairs(dependency or {}) do\nif (dep[3]==nil or dep[3]==false) then\n" + "_p('$(OBJDIR)/%s.o: %s'\n, _MAKE.esc(path.trimdots(path.removeext(path.getrelative(prj.location, dep[1]))))\n, _MAKE.esc(path.getrelative(prj.location, dep[2]))\n)\nelse\n_p('%s: %s'\n, _MAKE.esc(dep[1])\n, _MAKE.esc(path.getrelative(prj.location, dep[2]))\n)\nend\n_p('')\nend\nend\nend\nfunction cpp.buildcommand(iscfile, objext)\nlocal flags = iif(iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')\n_p('\\t$(SILENT) %s $(FORCE_INCLUDE) -o \"$@\" -c \"$<\"', flags, objext)\nend\n", /* actions/make/make_csharp.lua */ "local function getresourcefilename(cfg, fname)\nif path.getextension(fname) == \".resx\" then\n local name = cfg.buildtarget.basename .. \".\"\n local dir = path.getdirectory(fname)\n if dir ~= \".\" then \nname = name .. path.translate(dir, \".\") .. \".\"\nend\nreturn \"$(OBJDIR)/\" .. _MAKE.esc(name .. path.getbasename(fname)) .. \".resources\"\nelse\nreturn fname\nend\nend\nfunction premake.make_csharp(prj)\nlocal csc = premake.dotnet\nlocal cfglibs = { }\nlocal cfgpairs = { }\nlocal anycfg\nfor cfg in premake.eachconfig(prj) do\nanycfg = cfg\ncfglibs[cfg] = premake.getlinks(cfg, \"siblings\", \"fullpath\")\ncfgpairs[cfg] = { }\nfor _, fname in ipairs(cfglibs[cfg]) do\nif path.getdirectory(fname) ~= cfg.buildtarget.directory then\ncfgpairs[cfg][\"$(TARGETDIR)/\" .. _MAKE.esc(path.getname(fname))] = _MAKE.esc(fname)\nend\nend\nend\nlocal sources = {}\nlocal embedded = { }\nlocal copypairs = { }\nfor fcfg in premake.project.eachfile(prj) do\nlocal action = csc.getbuildaction(fcfg)\nif action == \"Co" diff --git a/3rdparty/genie/tests/actions/codeblocks/codeblocks_files.lua b/3rdparty/genie/tests/actions/codeblocks/codeblocks_files.lua deleted file mode 100644 index 34945f3da1d..00000000000 --- a/3rdparty/genie/tests/actions/codeblocks/codeblocks_files.lua +++ /dev/null @@ -1,101 +0,0 @@ --- --- tests/actions/codeblocks/codeblocks_files.lua --- Validate generation of files block in CodeLite C/C++ projects. --- Copyright (c) 2011 Jason Perkins and the Premake project --- - - T.codeblocks_files = { } - local suite = T.codeblocks_files - local codeblocks = premake.codeblocks - - --- --- Setup --- - - local sln, prj - - function suite.setup() - sln = test.createsolution() - end - - local function prepare() - premake.bake.buildconfigs() - prj = premake.solution.getproject(sln, 1) - codeblocks.files(prj) - end - - --- --- Test grouping and nesting --- - - function suite.SimpleSourceFile() - files { "hello.cpp" } - prepare() - test.capture [[ - <Unit filename="hello.cpp"> - </Unit> - ]] - end - - - function suite.SingleFolderLevel() - files { "src/hello.cpp" } - prepare() - test.capture [[ - <Unit filename="src/hello.cpp"> - </Unit> - ]] - end - - - function suite.MultipleFolderLevels() - files { "src/greetings/hello.cpp" } - prepare() - test.capture [[ - <Unit filename="src/greetings/hello.cpp"> - </Unit> - ]] - end - - --- --- Test source file type handling --- - - function suite.CFileInCppProject() - files { "hello.c" } - prepare() - test.capture [[ - <Unit filename="hello.c"> - <Option compilerVar="CC" /> - </Unit> - ]] - end - - - function suite.WindowsResourceFile() - files { "hello.rc" } - prepare() - test.capture [[ - <Unit filename="hello.rc"> - <Option compilerVar="WINDRES" /> - </Unit> - ]] - end - - - function suite.PchFile() - files { "hello.h" } - pchheader "hello.h" - prepare() - test.capture [[ - <Unit filename="hello.h"> - <Option compilerVar="CPP" /> - <Option compile="1" /> - <Option weight="0" /> - <Add option="-x c++-header" /> - </Unit> - ]] - end diff --git a/3rdparty/genie/tests/actions/codeblocks/environment_variables.lua b/3rdparty/genie/tests/actions/codeblocks/environment_variables.lua deleted file mode 100644 index 83602ad76b6..00000000000 --- a/3rdparty/genie/tests/actions/codeblocks/environment_variables.lua +++ /dev/null @@ -1,59 +0,0 @@ --- --- tests/actions/codeblocks/environment_variables.lua --- Validate generation of files block in CodeLite C/C++ projects. --- Copyright (c) 2011 Jason Perkins and the Premake project --- - - T.codeblocks_environment = { } - local suite = T.codeblocks_environment - local codeblocks = premake.codeblocks - - local old_eol = io.eol - function suite.setup() - _OPTIONS.cc = 'gcc' - old_eol = io.eol - io.eol = '\n' - end - - function suite.teardown() - io.eol = old_eol - end - - function suite.withVar_bufferContainsDebugger() - local MockName = 'MockName' - codeblocks.debugenvs( {debugenvs = {'foo=bar'},language='C',longname=MockName} ) - test.string_contains(io.endcapture(), - '\t\t\t<debugger>\n' .. - '\t\t\t\t<remote_debugging target="'..MockName..'">\n' .. - '\t\t\t\t\t<options additional_cmds_before=.- />\n' .. - '\t\t\t\t</remote_debugging>\n' .. - '\t\t\t</debugger>' - ) - end - - function suite.format_SetEnvKeyValuePair() - local env_arg = 'foo=bar' - codeblocks.debugenvs( {debugenvs = {env_arg},language='C',longname='DontCare'} ) - test.string_contains(io.endcapture(),'<options additional_cmds_before="set env '..env_arg..'" />') - end - - function suite.format_mutipleValues_setEnvKeyValuePairEscapeSetEnvKeyValuePair() - local env_arg = { 'foo=bar','baz=qux'} - codeblocks.debugenvs( {debugenvs = env_arg,language='C',longname='DontCare'} ) - test.string_contains(io.endcapture(),'<options additional_cmds_before="set env '.. env_arg[1] - ..'
set env ' .. env_arg[2] .. '" />') - end - - --Why is this an error and not silent? Because I feel if you are setting environment variables - --and they are not getting set in your IDE, than that is a problem which premake should not be - --quite about. - --See codeblocks project generator source for the assumption that gcc has anything to do with this setting. - function suite.withVar_noneGccCompiler_willCallError() - _OPTIONS.cc = 'msc' - local called = 0 - local real_error = error - error = function() called = 1 end - codeblocks.debugenvs( {debugenvs = {'foo=bar'},language='C',longname='foo'} ) - error = real_error - test.isequal(1,called) - end
\ No newline at end of file diff --git a/3rdparty/genie/tests/actions/codeblocks/test_filters.lua b/3rdparty/genie/tests/actions/codeblocks/test_filters.lua deleted file mode 100644 index 1f454b8005f..00000000000 --- a/3rdparty/genie/tests/actions/codeblocks/test_filters.lua +++ /dev/null @@ -1,42 +0,0 @@ --- --- tests/actions/codeblocks/test_filters.lua --- Test CodeBlocks virtual path support. --- Copyright (c) 2011 Jason Perkins and the Premake project --- - - T.codeblocks_filters = { } - local suite = T.codeblocks_filters - local codeblocks = premake.codeblocks - - --- --- Setup --- - - local sln, prj - - function suite.setup() - sln = test.createsolution() - end - - local function prepare() - premake.bake.buildconfigs() - prj = premake.solution.getproject(sln, 1) - codeblocks.files(prj) - end - - --- --- File/filter assignment tests --- - - function suite.Filter_UsesVirtualForm_OnVpath() - files { "src/hello.cpp" } - vpaths { ["Source Files"] = "**.c" } - prepare() - test.capture [[ - <Unit filename="src/hello.cpp"> - <Option virtualFolder="Source Files" /> - </Unit> - ]] - end diff --git a/3rdparty/genie/tests/actions/codelite/codelite_files.lua b/3rdparty/genie/tests/actions/codelite/codelite_files.lua deleted file mode 100644 index 423945c0a86..00000000000 --- a/3rdparty/genie/tests/actions/codelite/codelite_files.lua +++ /dev/null @@ -1,70 +0,0 @@ --- --- tests/actions/codelite/codelite_files.lua --- Validate generation of files block in CodeLite C/C++ projects. --- Copyright (c) 2011 Jason Perkins and the Premake project --- - - T.codelite_files = { } - local suite = T.codelite_files - local codelite = premake.codelite - - --- --- Setup --- - - local sln, prj - - function suite.setup() - sln = test.createsolution() - end - - local function prepare() - io.indent = " " - premake.bake.buildconfigs() - prj = premake.solution.getproject(sln, 1) - codelite.files(prj) - end - - --- --- Test grouping and nesting --- - - function suite.SimpleSourceFile() - files { "hello.c" } - prepare() - test.capture [[ - <VirtualDirectory Name="MyProject"> - <File Name="hello.c"/> - </VirtualDirectory> - ]] - end - - - function suite.SingleFolderLevel() - files { "src/hello.c" } - prepare() - test.capture [[ - <VirtualDirectory Name="MyProject"> - <VirtualDirectory Name="src"> - <File Name="src/hello.c"/> - </VirtualDirectory> - </VirtualDirectory> - ]] - end - - - function suite.MultipleFolderLevels() - files { "src/greetings/hello.c" } - prepare() - test.capture [[ - <VirtualDirectory Name="MyProject"> - <VirtualDirectory Name="src"> - <VirtualDirectory Name="greetings"> - <File Name="src/greetings/hello.c"/> - </VirtualDirectory> - </VirtualDirectory> - </VirtualDirectory> - ]] - end diff --git a/3rdparty/genie/tests/premake4.lua b/3rdparty/genie/tests/premake4.lua index eb644158cc4..c1fd3c6a10e 100644 --- a/3rdparty/genie/tests/premake4.lua +++ b/3rdparty/genie/tests/premake4.lua @@ -130,14 +130,6 @@ dofile("actions/xcode/test_xcode4_project.lua") dofile("actions/xcode/test_xcode4_workspace.lua") - -- CodeLite tests - dofile("actions/codelite/codelite_files.lua") - - -- CodeBlocks tests - dofile("actions/codeblocks/codeblocks_files.lua") - dofile("actions/codeblocks/test_filters.lua") - dofile("actions/codeblocks/environment_variables.lua") - -- -- Register a test action -- |