diff --git a/src/actions/vstudio/vs2010_vcxproxj.lua b/src/actions/vstudio/vs2010_vcxproxj.lua index f2b2333b..81f09daf 100644 --- a/src/actions/vstudio/vs2010_vcxproxj.lua +++ b/src/actions/vstudio/vs2010_vcxproxj.lua @@ -84,7 +84,8 @@ local vs10_helpers = premake.vstudio.vs10_helpers c = "ClCompile", cpp = "ClCompile", cxx = "ClCompile", - cc = "ClCompile" + cc = "ClCompile", + rc = "ResourceCompile" } for _, current_file in ipairs(files) do @@ -499,7 +500,7 @@ local vs10_helpers = premake.vstudio.vs10_helpers common_link_section(cfg) - if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then + if vs10_helpers.config_type(cfg) == 'Application' and not cfg.flags.WinMain then _p(3,'mainCRTStartup') end @@ -541,6 +542,8 @@ local vs10_helpers = premake.vstudio.vs10_helpers -- local function write_file_type_block(files,group_type) + _p(4,#files) + _p(4,group_type) if #files > 0 then _p(1,'') for _, current_file in ipairs(files) do @@ -555,7 +558,8 @@ local vs10_helpers = premake.vstudio.vs10_helpers { ClCompile ={}, ClInclude ={}, - None ={} + None ={}, + ResourceCompile ={} } cfg = premake.getconfig(prj) @@ -563,6 +567,7 @@ local vs10_helpers = premake.vstudio.vs10_helpers write_file_type_block(sorted.ClInclude,"ClInclude") write_file_type_block(sorted.ClCompile,'ClCompile') write_file_type_block(sorted.None,'None') + write_file_type_block(sorted.ResourceCompile,'ResourceCompile') end diff --git a/tests/actions/vstudio/test_vs2010_vcxproj.lua b/tests/actions/vstudio/test_vs2010_vcxproj.lua index fff203f4..07d29375 100644 --- a/tests/actions/vstudio/test_vs2010_vcxproj.lua +++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua @@ -28,7 +28,8 @@ "foo/dummyHeader.h", "foo/dummySource.cpp", "../src/host/*h", - "../src/host/*.c" + "../src/host/*.c", + "dummyResourceScript.rc" } configuration("Release") @@ -47,99 +48,99 @@ premake.buildconfigs() sln.vstudio_configs = premake.vstudio_buildconfigs(sln) premake.vs2010_vcxproj(prj) - buffer = io.endcapture() + local buffer = io.endcapture() return buffer end function vs10_vcxproj.xmlDeclarationPresent() - buffer = get_buffer() + local buffer = get_buffer() test.istrue(string.startswith(buffer, '')) end function vs10_vcxproj.projectBlocksArePresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'') end function vs10_vcxproj.projectOpenTagIsCorrect() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end function vs10_vcxproj.configItemGroupPresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end function vs10_vcxproj.configBlocksArePresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'') end function vs10_vcxproj.configTypeBlockPresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end function vs10_vcxproj.twoConfigTypeBlocksPresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end function vs10_vcxproj.propsDefaultForCppProjArePresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'') end function vs10_vcxproj.propsForCppProjArePresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'') end function vs10_vcxproj.extensionSettingArePresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end function vs10_vcxproj.userMacrosPresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'') end function vs10_vcxproj.intermediateAndOutDirsPropertyGroupWithMagicNumber() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*<_ProjectFileVersion>10%.0%.30319%.1') end function vs10_vcxproj.outDirPresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'') end function vs10_vcxproj.initDirPresent() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'') end function vs10_vcxproj.projectWithDebugAndReleaseConfig_twoOutDirsAndTwoIntDirs() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*.*.*') end function vs10_vcxproj.containsItemDefinition() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end function vs10_vcxproj.containsClCompileBlock() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end function vs10_vcxproj.containsAdditionalOptions() buildoptions {"/Gm"} - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'/Gm %%%(AdditionalOptions%)') end @@ -148,47 +149,47 @@ end function vs10_vcxproj.debugHasNoOptimisation() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer, cl_compile_string('Debug').. '.*Disabled.*') end function vs10_vcxproj.releaseHasFullOptimisation() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer, cl_compile_string('Release').. '.*Full.*') end function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,cl_compile_string('Debug').. '.*'.. path.translate(include_directory, '\\') ..'.*') end function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory2PrefixWithSemiColon() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,cl_compile_string('Debug').. '.*.*;'.. path.translate(include_directory2, '\\') ..'.*') end function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory2PostfixWithSemiColon() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,cl_compile_string('Debug').. '.*.*'.. path.translate(include_directory2, '\\') ..';.*') end function vs10_vcxproj.debugContainsPreprossorBlock() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,cl_compile_string('Debug').. '.*.*') end function vs10_vcxproj.debugHasDebugDefine() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,cl_compile_string('Debug')..'.*.*'..debug_define..'.*') end function vs10_vcxproj.releaseHasStringPoolingOn() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,cl_compile_string('Release')..'.*true') end function vs10_vcxproj.hasItemGroupSection() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*') end @@ -227,7 +228,8 @@ { ClInclude ={}, ClCompile ={}, - None ={} + None ={}, + ResourceCompile ={} } vs10_helpers.sort_input_files(input,sorted) return sorted @@ -250,8 +252,22 @@ test.isequal(file, sorted.None) end + function vs10_vcxproj.sortFile_resourceScript_resourceCompileEqualToFile() + local file = {"foo.rc"} + local sorted = SortAndReturnSortedInputFiles(file) + test.isequal(file, sorted.ResourceCompile) + end + + function vs10_vcxproj.itemGroupSection_hasResourceCompileSection() + --for some reason this does not work here and it needs to be in + --the project setting at the top ? + --files{"dummyResourceScript.rc"} + local buffer = get_buffer() + test.string_contains(buffer,'.*') + end + function vs10_vcxproj.itemGroupSection_hasHeaderListed() - buffer = get_buffer() + local buffer = get_buffer() test.string_contains(buffer,'.*.*') end @@ -352,5 +368,6 @@ language "C" local buffer = get_buffer() test.string_contains(buffer,'CompileAsC') - end + end + \ No newline at end of file