diff --git a/build/premake/extern_libs.lua b/build/premake/extern_libs.lua index ae8eaa48ef..66d48bd5cb 100644 --- a/build/premake/extern_libs.lua +++ b/build/premake/extern_libs.lua @@ -48,6 +48,8 @@ extern_lib_defs = { }, cxxtest = { }, + misc = { + }, dbghelp = { win_names = { "dbghelp" }, dbg_suffix = "", diff --git a/build/premake/premake.exe b/build/premake/premake.exe index 5edf628f81..9f01c56990 100755 Binary files a/build/premake/premake.exe and b/build/premake/premake.exe differ diff --git a/build/premake/premake.lua b/build/premake/premake.lua index a097ee34a1..d1756e9ab9 100755 --- a/build/premake/premake.lua +++ b/build/premake/premake.lua @@ -17,6 +17,9 @@ project.configs = { "Debug", "Release", "Testing" } if OS == "windows" then project.nasmpath = "../../build/bin/nasm.exe" + project.cxxtestpath = "../../build/bin/cxxtestgen.pl" +else + project.cxxtestpath = "../../build/bin/cxxtestgen" end source_root = "../../../source/" -- default for most projects - overridden by local in others @@ -571,17 +574,29 @@ end function setup_tests() --- package_create("test_3_gen" , "cxxtestgen") --- package.files = files_in_test_subdirs(source_root, ".h") + package_create("test_3_gen" , "cxxtestgen") + --package.files = files_in_test_subdirs(source_root, ".h") + package.files = { source_root .. "lib/tests/test_byte_order.h" } + package.rootfile = source_root .. "test_root.cpp" + if OS == "windows" then + package.rootoptions = "--gui=Win32Gui --have-eh --runner=ParenPrinter" + else + package.rootoptions = "--error-printer" + end package_create("test_2_build", "winexe") - package.files = files_in_test_subdirs(source_root, ".cpp") + --package.files = files_in_test_subdirs(source_root, ".cpp") + package.files = { source_root .. "lib/tests/test_byte_order.cpp" } + table.insert(package.files, source_root .. "test_root.cpp") + + package.includepaths = {source_root} + package.links = { "test_3_gen" } + listconcat(package.links, static_lib_names) package_add_extern_libs(used_extern_libs) --- package_create("test_1_run" , "run") - -- use package's output target as the file to run - -- (avoids having to mess around with project.bindir and - -- OS-specific application extension, e.g. EXE) + package_create("test_1_run" , "run") + package.links = { "test_2_build" } -- This determines which project's executable to run + end @@ -608,4 +623,4 @@ if options["atlas"] then setup_atlas_frontends() end -setup_tests() \ No newline at end of file +setup_tests() diff --git a/build/premake/src/Premake.sln b/build/premake/src/Premake.sln index 85d2c8aba0..c3da3906c6 100644 --- a/build/premake/src/Premake.sln +++ b/build/premake/src/Premake.sln @@ -1,19 +1,21 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 +Microsoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Premake", "Src\Premake.vcproj", "{B33708C1-1744-52D6-8DCE-385E5CF8C348}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection EndProject Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B33708C1-1744-52D6-8DCE-385E5CF8C348}.Debug|Win32.ActiveCfg = Debug|Win32 - {B33708C1-1744-52D6-8DCE-385E5CF8C348}.Debug|Win32.Build.0 = Debug|Win32 - {B33708C1-1744-52D6-8DCE-385E5CF8C348}.Release|Win32.ActiveCfg = Release|Win32 - {B33708C1-1744-52D6-8DCE-385E5CF8C348}.Release|Win32.Build.0 = Release|Win32 + GlobalSection(ProjectConfiguration) = postSolution + {B33708C1-1744-52D6-8DCE-385E5CF8C348}.Debug.ActiveCfg = Debug|Win32 + {B33708C1-1744-52D6-8DCE-385E5CF8C348}.Debug.Build.0 = Debug|Win32 + {B33708C1-1744-52D6-8DCE-385E5CF8C348}.Release.ActiveCfg = Release|Win32 + {B33708C1-1744-52D6-8DCE-385E5CF8C348}.Release.Build.0 = Release|Win32 EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution EndGlobalSection EndGlobal diff --git a/build/premake/src/Src/Premake.vcproj b/build/premake/src/Src/Premake.vcproj index a24472667a..53714ea827 100644 --- a/build/premake/src/Src/Premake.vcproj +++ b/build/premake/src/Src/Premake.vcproj @@ -1,552 +1,395 @@ + Keyword="Win32Proj"> + Name="Win32"/> - - - - - - - + CharacterSet="2"> + Detect64BitPortabilityProblems="FALSE" + DebugInformationFormat="4"/> - - + Name="VCCustomBuildTool"/> + TargetMachine="1"/> + Name="VCMIDLTool"/> + Name="VCPostBuildEventTool"/> + Name="VCPreBuildEventTool"/> + Name="VCPreLinkEventTool"/> + Name="VCResourceCompilerTool"/> + Name="VCWebServiceProxyGeneratorTool"/> + Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool"/> + + - - - - - + CharacterSet="2"> + Detect64BitPortabilityProblems="FALSE" + DebugInformationFormat="0"/> - - + Name="VCCustomBuildTool"/> + TargetMachine="1"/> + Name="VCMIDLTool"/> + Name="VCPostBuildEventTool"/> + Name="VCPreBuildEventTool"/> + Name="VCPreLinkEventTool"/> + Name="VCResourceCompilerTool"/> + Name="VCWebServiceProxyGeneratorTool"/> + Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool"/> + + + Name="Lua"> + RelativePath=".\Lua\lapi.c"> + RelativePath=".\Lua\lapi.h"> + RelativePath=".\Lua\lauxlib.c"> + RelativePath=".\Lua\lauxlib.h"> + RelativePath=".\Lua\lbaselib.c"> + RelativePath=".\Lua\lcode.c"> + RelativePath=".\Lua\lcode.h"> + RelativePath=".\Lua\ldblib.c"> + RelativePath=".\Lua\ldebug.c"> + RelativePath=".\Lua\ldebug.h"> + RelativePath=".\Lua\ldo.c"> + RelativePath=".\Lua\ldo.h"> + RelativePath=".\Lua\ldump.c"> + RelativePath=".\Lua\lfunc.c"> + RelativePath=".\Lua\lfunc.h"> + RelativePath=".\Lua\lgc.c"> + RelativePath=".\Lua\lgc.h"> + RelativePath=".\Lua\liolib.c"> + RelativePath=".\Lua\llex.c"> + RelativePath=".\Lua\llex.h"> + RelativePath=".\Lua\llimits.h"> + RelativePath=".\Lua\lmathlib.c"> + RelativePath=".\Lua\lmem.c"> + RelativePath=".\Lua\lmem.h"> + RelativePath=".\Lua\loadlib.c"> + RelativePath=".\Lua\lobject.c"> + RelativePath=".\Lua\lobject.h"> + RelativePath=".\Lua\lopcodes.c"> + RelativePath=".\Lua\lopcodes.h"> + RelativePath=".\Lua\lparser.c"> + RelativePath=".\Lua\lparser.h"> + RelativePath=".\Lua\lstate.c"> + RelativePath=".\Lua\lstate.h"> + RelativePath=".\Lua\lstring.c"> + RelativePath=".\Lua\lstring.h"> + RelativePath=".\Lua\lstrlib.c"> + RelativePath=".\Lua\ltable.c"> + RelativePath=".\Lua\ltable.h"> + RelativePath=".\Lua\ltablib.c"> + RelativePath=".\Lua\ltests.c"> + RelativePath=".\Lua\ltm.c"> + RelativePath=".\Lua\ltm.h"> + RelativePath=".\Lua\lua.h"> + RelativePath=".\Lua\luadebug.h"> + RelativePath=".\Lua\lualib.h"> + RelativePath=".\Lua\lundump.c"> + RelativePath=".\Lua\lundump.h"> + RelativePath=".\Lua\lvm.c"> + RelativePath=".\Lua\lvm.h"> + RelativePath=".\Lua\lzio.c"> + RelativePath=".\Lua\lzio.h"> + RelativePath=".\arg.c"> + RelativePath=".\arg.h"> + RelativePath=".\clean.c"> + RelativePath=".\gnu.c"> + RelativePath=".\gnu.h"> + RelativePath=".\gnu_cpp.c"> + RelativePath=".\gnu_cs.c"> + RelativePath=".\gnu_helpers.c"> + RelativePath=".\io.c"> + RelativePath=".\io.h"> + RelativePath=".\os.c"> + RelativePath=".\os.h"> + RelativePath=".\path.c"> + RelativePath=".\path.h"> + RelativePath=".\platform.h"> + RelativePath=".\platform_posix.c"> + RelativePath=".\platform_windows.c"> + RelativePath=".\premake.c"> + RelativePath=".\premake.h"> + RelativePath=".\project.c"> + RelativePath=".\project.h"> + RelativePath=".\script.c"> + RelativePath=".\script.h"> + RelativePath=".\sharpdev.c"> + RelativePath=".\sharpdev.h"> + RelativePath=".\sharpdev_cs.c"> + RelativePath=".\util.c"> + RelativePath=".\util.h"> + RelativePath=".\vs.c"> + RelativePath=".\vs.h"> + RelativePath=".\vs2002.c"> + RelativePath=".\vs2002.h"> + RelativePath=".\vs2002_cs.c"> + RelativePath=".\vs2005.c"> + RelativePath=".\vs2005.h"> + RelativePath=".\vs2005_cs.c"> + RelativePath=".\vs6.c"> + RelativePath=".\vs6.h"> + RelativePath=".\vs6_cpp.c"> diff --git a/build/premake/src/Src/gnu_cpp.c b/build/premake/src/Src/gnu_cpp.c index a9c3dd24bf..141c889c3a 100644 --- a/build/premake/src/Src/gnu_cpp.c +++ b/build/premake/src/Src/gnu_cpp.c @@ -22,6 +22,7 @@ #include "os.h" static const char* filterLinks(const char* name); +static const char* listCxxTestSources(const char* name); static const char* listCppSources(const char* name); static const char* listRcSources(const char* name); static const char* listCppTargets(const char* name); @@ -50,6 +51,8 @@ int gnu_cpp() io_print("Windowed Executable"); else if (prj_is_kind("dll")) io_print("Shared Library"); + else if (prj_is_kind("cxxtestgen")) + io_print("CxxTest Generator"); else if (prj_is_kind("lib")) io_print("Static Library"); @@ -133,7 +136,10 @@ int gnu_cpp() io_print("\n"); /* Build the target name */ - io_print(" TARGET := %s\n", path_getname(prj_get_target())); + if (prj_is_kind("cxxtestgen")) + io_print(" TARGET := $(OBJECTS)\n"); + else + io_print(" TARGET := %s\n", path_getname(prj_get_target())); if (os_is("macosx") && prj_is_kind("winexe")) io_print(" MACAPP := %s.app/Contents\n", path_getname(prj_get_target())); @@ -141,6 +147,8 @@ int gnu_cpp() io_print(" BLDCMD = "); if (prj_is_kind("lib")) io_print("ar -cr $(OUTDIR)/$(TARGET) $(OBJECTS); ranlib $(OUTDIR)/$(TARGET)"); + else if (prj_is_kind("cxxtestgen")) + io_print("true"); else io_print("$(%s) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES)", prj_is_lang("c") ? "CC" : "CXX"); io_print("\n"); @@ -150,7 +158,10 @@ int gnu_cpp() /* Write out the list of object file targets for all C/C++ sources */ io_print("OBJECTS := \\\n"); - print_list(prj_get_files(), "\t$(OBJDIR)/", " \\\n", "", listCppSources); + if (prj_is_kind("cxxtestgen")) + print_list(prj_get_files(), "\t", " \\\n", "", listCxxTestSources); + else + print_list(prj_get_files(), "\t$(OBJDIR)/", " \\\n", "", listCppSources); io_print("\n"); /* Write out the list of resource files for windows targets */ @@ -184,20 +195,29 @@ int gnu_cpp() io_print("all: $(OUTDIR)/$(MACAPP)/PkgInfo $(OUTDIR)/$(MACAPP)/Info.plist $(OUTDIR)/$(MACAPP)/MacOS/$(TARGET)\n\n"); io_print("$(OUTDIR)/$(MACAPP)/MacOS/$(TARGET)"); } + else if (prj_is_kind("cxxtestgen")) + io_print("all"); else { io_print("$(OUTDIR)/$(TARGET)"); } io_print(": $(OBJECTS) $(LDDEPS) $(RESOURCES)\n"); - if (!g_verbose) - io_print("\t@echo Linking %s\n", prj_get_pkgname()); - io_print("\t-%s$(CMD_MKBINDIR)\n", prefix); - io_print("\t-%s$(CMD_MKLIBDIR)\n", prefix); - io_print("\t-%s$(CMD_MKOUTDIR)\n", prefix); - if (os_is("macosx") && prj_is_kind("winexe")) - io_print("\t-%sif [ ! -d $(OUTDIR)/$(MACAPP)/MacOS ]; then mkdir -p $(OUTDIR)/$(MACAPP)/MacOS; fi\n", prefix); - io_print("\t%s$(BLDCMD)\n\n", prefix); + if (!prj_is_kind("cxxtestgen")) + { + if (!g_verbose) + io_print("\t@echo Linking %s\n", prj_get_pkgname()); + io_print("\t-%s$(CMD_MKBINDIR)\n", prefix); + io_print("\t-%s$(CMD_MKLIBDIR)\n", prefix); + io_print("\t-%s$(CMD_MKOUTDIR)\n", prefix); + if (os_is("macosx") && prj_is_kind("winexe")) + io_print("\t-%sif [ ! -d $(OUTDIR)/$(MACAPP)/MacOS ]; then mkdir -p $(OUTDIR)/$(MACAPP)/MacOS; fi\n", prefix); + io_print("\t%s$(BLDCMD)\n\n", prefix); + } + else + { + io_print("\t@true\n\n", prefix); + } /* if (prj_is_kind("lib")) @@ -241,8 +261,9 @@ int gnu_cpp() if (os_is("windows")) print_list(prj_get_files(), "", "", "", listRcTargets); - /* Include the automatically generated dependency lists */ - io_print("-include $(OBJECTS:%%.o=%%.d)\n\n"); + if (!prj_is_kind("cxxtestgen")) + /* Include the automatically generated dependency lists */ + io_print("-include $(OBJECTS:%%.o=%%.d)\n\n"); io_closefile(); return 1; @@ -261,7 +282,10 @@ static const char* filterLinks(const char* name) if (i >= 0) { const char* lang = prj_get_language_for(i); - if (matches(lang, "c++") || matches(lang, "c")) + const char *kind = prj_get_config_for(i)->kind; + if (matches(kind, "cxxtestgen")) + return NULL; + else if (matches(lang, "c++") || matches(lang, "c")) { return prj_get_target_for(i); } @@ -297,6 +321,16 @@ static const char* listCppSources(const char* name) } +static const char* listCxxTestSources(const char* name) +{ + if (endsWith(name, ".h")) + { + return path_swapextension(name, ".h", ".cpp"); + } + + return NULL; +} + /************************************************************************ * Checks each source code file and filters out everything that is * not a windows resource file @@ -322,10 +356,10 @@ static const char* listRcSources(const char* name) static const char* listCppTargets(const char* name) { + const char* ext = path_getextension(name); + const char* basename = path_getbasename(name); if (is_cpp(name)) { - const char* ext = path_getextension(name); - const char* basename = path_getbasename(name); sprintf(g_buffer, "$(OBJDIR)/%s.o: %s\n", basename, name); strcat(g_buffer, "\t-"); @@ -376,6 +410,19 @@ static const char* listCppTargets(const char* name) return g_buffer; } + else if (prj_is_kind("cxxtestgen")) + { + const char *target_name=path_swapextension(name, ".h", ".cpp"); + sprintf(g_buffer, + "%s: %s\n" + "%s" + "\t%s%s --part -o %s %s\n", target_name, name, + g_verbose?"":"\t@echo $(notdir $<)\n", + g_verbose?"":"@", + "cxxtestgen", target_name, name); + + return g_buffer; + } else { return NULL; @@ -419,7 +466,11 @@ static const char* listLinkerDeps(const char* name) int i = prj_find_package(name); if (i >= 0) { - return prj_get_target_for(i); + const char *kind = prj_get_config_for(i)->kind; + if (!strcmp(kind, "cxxtestgen")) + return NULL; + else + return prj_get_target_for(i); } return NULL; diff --git a/build/premake/src/Src/project.c b/build/premake/src/Src/project.c index 6bcd9c64cc..c208db2360 100644 --- a/build/premake/src/Src/project.c +++ b/build/premake/src/Src/project.c @@ -248,6 +248,22 @@ const char* prj_get_nasmpath() return buffer; } +const char* prj_get_cxxtestpath() +{ + strcpy(buffer, path_build(my_pkg->path, my_cfg->prjConfig->cxxtest_path)); + return buffer; +} + +const char* prj_get_cxxtest_rootoptions() +{ + return my_cfg->cxxtest_rootoptions; +} + +const char* prj_get_cxxtest_rootfile() +{ + return my_cfg->cxxtest_rootfile; +} + const char* prj_get_trimprefix() { return my_cfg->trimprefix; diff --git a/build/premake/src/Src/project.h b/build/premake/src/Src/project.h index f2afaf0a71..18ab0a3186 100644 --- a/build/premake/src/Src/project.h +++ b/build/premake/src/Src/project.h @@ -28,6 +28,7 @@ typedef struct tagPrjConfig const char* bindir; const char* libdir; const char* nasmpath; + const char* cxxtest_path; } PrjConfig; typedef struct tagFileConfig @@ -55,6 +56,8 @@ typedef struct tagPkgConfig const char* pchSource; const char* trimprefix; FileConfig** fileconfigs; + const char* cxxtest_rootoptions; + const char* cxxtest_rootfile; } PkgConfig; typedef struct tagPackage @@ -112,6 +115,7 @@ const char* prj_get_objdir(); const char* prj_get_prefix(); const char* prj_get_name(); const char* prj_get_nasmpath(); +const char* prj_get_cxxtestpath(); int prj_get_numbuildoptions(); int prj_get_numconfigs(); int prj_get_numdefines(); @@ -129,6 +133,8 @@ Package* prj_get_package_for(); const char* prj_get_path(); const char* prj_get_pch_header(); const char* prj_get_pch_source(); +const char* prj_get_cxxtest_rootoptions(); +const char* prj_get_cxxtest_rootfile(); const char* prj_get_pkgfilename(const char* extension); const char* prj_get_pkgname(); const char* prj_get_pkgname_for(); diff --git a/build/premake/src/Src/script.c b/build/premake/src/Src/script.c index a936132ddf..4db9c57a34 100644 --- a/build/premake/src/Src/script.c +++ b/build/premake/src/Src/script.c @@ -352,6 +352,8 @@ static int export_pkgconfig(Package* package, int tbl) config->pchHeader = export_value(tbl, obj, "pchheader"); config->pchSource = export_value(tbl, obj, "pchsource"); config->trimprefix = export_value(tbl, obj, "trimprefix"); + config->cxxtest_rootoptions = export_value(tbl, obj, "rootoptions"); + config->cxxtest_rootfile = export_value(tbl, obj, "rootfile"); /* Assign a default target, if none specified */ if (config->target == NULL) @@ -418,6 +420,7 @@ int script_export() config->bindir = export_value(tbl, obj, "bindir"); config->libdir = export_value(tbl, obj, "libdir"); config->nasmpath = export_value(tbl, obj, "nasmpath"); + config->cxxtest_path = export_value(tbl, obj, "cxxtestpath"); } /* Copy out the packages */ diff --git a/build/premake/src/Src/vs.c b/build/premake/src/Src/vs.c index 974326eace..3106c25c76 100644 --- a/build/premake/src/Src/vs.c +++ b/build/premake/src/Src/vs.c @@ -326,7 +326,7 @@ int vs_write_cpp() prj_select_config(i); - if (prj_is_kind("winexe") || prj_is_kind("exe")) + if (prj_is_kind("winexe") || prj_is_kind("exe") || prj_is_kind("cxxtestgen") || prj_is_kind("run")) { configTypeId = 1; } @@ -390,6 +390,35 @@ int vs_write_cpp() break; case VCCustomBuildTool: tag_attr("Name=\"VCCustomBuildTool\""); + if (prj_is_kind("run")) + { + tag_attr("Description=\"Running CxxTest Test Suite\""); + tag_attr_open("CommandLine"); + print_list(prj_get_links(), "", "", " ", vs_filter_links); + print_list(prj_get_buildoptions(), " ", "", "", NULL); + tag_attr_close(); + // This so that we're always run (and never "up-to-date") + tag_attr("Outputs=\".\\dummy.file.thats.never.created\""); + } + else if (prj_is_kind("cxxtestgen")) + { + char *rootfile = strdup(prj_get_cxxtest_rootfile()); + char *ctpath = strdup(path_translate(prj_get_cxxtestpath(), "windows")); + char *options = strdup(prj_get_cxxtest_rootoptions()); + + tag_attr("Description=\"Generating test_root.cpp\""); + tag_attr("CommandLine=\"%s%s --root %s -o "%s"\"", + endsWith(prj_get_cxxtestpath(), ".pl")?"perl ":"", + ctpath, + options, + rootfile); + + tag_attr("Outputs=\"%s\"", rootfile); + + free(options); + free(ctpath); + free(rootfile); + } break; case VCXMLDataGeneratorTool: tag_attr("Name=\"VCXMLDataGeneratorTool\""); @@ -443,7 +472,7 @@ int vs_write_cpp() tag_attr("Name=\"VCWebDeploymentTool\""); break; case VCPostBuildEventTool: - tag_attr("Name=\"VCPostBuildEventTool\""); + tag_attr("Name=\"VCPostBuildEventTool\""); break; case VCCLCompilerTool: tag_attr("Name=\"VCCLCompilerTool\""); @@ -603,6 +632,48 @@ int vs_write_cpp() tag_open("Files"); print_source_tree("", vs_list_files); + /*if (prj_is_kind("cxxtestgen")) + { + char *rootfile = strdup(prj_get_cxxtest_rootfile()); + char *ctpath = strdup(path_translate(prj_get_cxxtestpath(), "windows")); + int i; + + tag_open("File"); + tag_attr_open("RelativePath"); + if (rootfile[0] != '.') + io_print(".\\"); + io_print(rootfile); + tag_attr_close(); + + for (i = 0; i < prj_get_numconfigs(); ++i) + { + char *options; + prj_select_config(i); + + options = strdup(prj_get_cxxtest_rootoptions()); + + tag_open("FileConfiguration"); + tag_attr("Name=\"%s|Win32\"", prj_get_cfgname()); + + tag_open("Tool"); + tag_attr("Name=\"VCCustomBuildTool\""); + tag_attr("Description=\"Generating test_root.cpp\""); + tag_attr("CommandLine=\"%s%s --root %s -o "%s"\"", + endsWith(prj_get_cxxtestpath(), ".pl")?"perl ":"", + ctpath, + options, + rootfile); + + tag_attr("Outputs=\"%s\"", rootfile); + tag_close("Tool", 0); + tag_close("FileConfiguration", 1); + + free(options); + } + tag_close("File", 1); + free(ctpath); + free(rootfile); + }*/ tag_close("Files", 1); tag_open("Globals"); @@ -625,7 +696,16 @@ const char* vs_filter_links(const char* name) if (i >= 0) { const char* lang = prj_get_language_for(i); - if (matches(lang, "c") || matches(lang, "c++")) + const char* kind = prj_get_config_for(i)->kind; + if (matches(kind, "cxxtestgen")) + return NULL; + // note that "run" matches against the /current/ project, not the link + // dependency we've been run for + else if (prj_is_kind("run")) + { + return path_translate(prj_get_target_for(i), "windows"); + } + else if (matches(lang, "c") || matches(lang, "c++")) { strcpy(g_buffer, prj_get_libdir_for(i)); return path_combine(g_buffer, prj_get_targetname_for(i)); @@ -687,7 +767,8 @@ void vs_list_files(const char* path, int stage) /* Add FileConfiguration section if this is a special PCH file, or if it's a custom-built .asm */ - if (matches(path_getname(path), pchSource) || endsWith(path, ".asm")) + if (matches(path_getname(path), pchSource) || endsWith(path, ".asm") + || (prj_is_kind("cxxtestgen") && endsWith(path, ".h"))) { for (i = 0; i < prj_get_numconfigs(); ++i) { @@ -706,6 +787,21 @@ void vs_list_files(const char* path, int stage) tag_attr("Outputs=\"$(IntDir)\\$(InputName).obj\""); tag_close("Tool", 0); } + else if (prj_is_kind("cxxtestgen") && endsWith(path, ".h")) + { + char *targetname=strdup(path_swapextension(path, ".h", ".cpp")); + + tag_open("Tool"); + tag_attr("Name=\"VCCustomBuildTool\""); + tag_attr("Description=\"Generating %s\"", targetname); + tag_attr("CommandLine=\"%s%s --part -o "%s" "$(InputPath)"\"", + endsWith(prj_get_cxxtestpath(), ".pl")?"perl ":"", + path_translate(prj_get_cxxtestpath(), "windows"), targetname); + tag_attr("Outputs=\"%s\"", targetname); + tag_close("Tool", 0); + + free(targetname); + } else /* (.asm doesn't need PCH) */ { tag_open("Tool");