diff options
author | Jason Perkins <starkos@industriousone.com> | 2011-08-19 16:58:12 +0400 |
---|---|---|
committer | Jason Perkins <starkos@industriousone.com> | 2011-08-19 16:58:12 +0400 |
commit | 74706ad18dd4346f6bb52455ea89245e8e66346b (patch) | |
tree | aa77cbe087f825055f4b55c248edc2760351d96e | |
parent | e00181b5b1420b5c1011459d23f5ea76d8f3791a (diff) |
Added virtual path support for CodeBlocks
-rw-r--r-- | src/actions/codeblocks/codeblocks_cbp.lua | 13 | ||||
-rwxr-xr-x | tests/actions/codeblocks/test_filters.lua | 42 | ||||
-rw-r--r-- | tests/premake4.lua | 1 |
3 files changed, 51 insertions, 5 deletions
diff --git a/src/actions/codeblocks/codeblocks_cbp.lua b/src/actions/codeblocks/codeblocks_cbp.lua index aeeb22e..44b1c84 100644 --- a/src/actions/codeblocks/codeblocks_cbp.lua +++ b/src/actions/codeblocks/codeblocks_cbp.lua @@ -17,14 +17,17 @@ pchheader = path.getrelative(prj.location, prj.pchheader) end - for _,fname in ipairs(prj.files) do - _p(2,'<Unit filename="%s">', premake.esc(fname)) - if path.isresourcefile(fname) then + 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(fname) and prj.language == "C++" then + elseif path.iscfile(fcfg.name) and prj.language == "C++" then _p(3,'<Option compilerVar="CC" />') end - if not prj.flags.NoPCH and fname == pchheader then + 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" />') diff --git a/tests/actions/codeblocks/test_filters.lua b/tests/actions/codeblocks/test_filters.lua new file mode 100755 index 0000000..1f454b8 --- /dev/null +++ b/tests/actions/codeblocks/test_filters.lua @@ -0,0 +1,42 @@ +-- +-- 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/tests/premake4.lua b/tests/premake4.lua index 326d080..00ce43f 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -126,6 +126,7 @@ -- CodeBlocks tests dofile("actions/codeblocks/codeblocks_files.lua") + dofile("actions/codeblocks/test_filters.lua") -- -- Register a test action |