static MsvcLink LinkExecutable(
     BuildGraph buildGraph,
     string outputName,
     params string[] objFiles)
 {
     var linkerParams = new MsvcLinkerParams();
     linkerParams.VcBinDir = vcBinDir;
     linkerParams.ToolChain = toolChain;
     linkerParams.CompileDir = compileDir;
     linkerParams.BuildFileDir = buildFileDir;
     foreach (string objFile in objFiles) {
         linkerParams.Inputs.Add(objFile);
     }
     linkerParams.OutputFilePath = outputName;
     var link = new MsvcLink(buildGraph, linkerParams);
     return link;
 }
Example #2
0
 protected virtual MsvcLink Link(
     string outputName,
     Action<MsvcLinkerParams> overrideParams)
 {
     var lp = CreateLinkerParams(outputName, overrideParams);
     var link = new MsvcLink(ProjectManager.BuildGraph, lp);
     link.ModuleName = ModuleName + ".Link";
     return link;
 }
Example #3
0
            public static void TestCppCompileLink()
            {
                var buildGraph = new BuildGraph();

                Directory.CreateDirectory(buildFileDir);

                var cc_test02 = CompileOne(buildGraph, "test02.cpp");
                var cc_foo = CompileOne(buildGraph, "foo.cpp");
                var cc_groo = CompileOne(buildGraph, "groo.cpp");
                var cc_qoo = CompileOne(buildGraph, "qoo.cpp");
                var cc_yoo = CompileOne(buildGraph, "yoo.cpp");
                var cc_aoo = CompileOne(buildGraph, "aoo.cpp");
                var cc_boo = CompileOne(buildGraph, "boo.cpp");
                var cc_coo = CompileOne(buildGraph, "coo.cpp");
                var cc_doo = CompileOne(buildGraph, "doo.cpp");

                var linkerParams = new MsvcLinkerParams();
                linkerParams.VcBinDir = vcBinDir;
                linkerParams.ToolChain = toolChain;
                linkerParams.CompileDir = compileDir;
                linkerParams.BuildFileDir = buildFileDir;
                linkerParams.Inputs.Add(cc_aoo.Params.ObjectPath);
                linkerParams.Inputs.Add(cc_boo.Params.ObjectPath);
                linkerParams.Inputs.Add(cc_coo.Params.ObjectPath);
                linkerParams.Inputs.Add(cc_doo.Params.ObjectPath);
                linkerParams.Inputs.Add(cc_foo.Params.ObjectPath);
                linkerParams.Inputs.Add(cc_groo.Params.ObjectPath);
                linkerParams.Inputs.Add(cc_qoo.Params.ObjectPath);
                linkerParams.Inputs.Add(cc_test02.Params.ObjectPath);
                linkerParams.Inputs.Add(cc_yoo.Params.ObjectPath);
                linkerParams.OutputFilePath = "result.exe";
                var link = new MsvcLink(buildGraph, linkerParams);

                BuildOptions buildOptions = new BuildOptions();
                buildOptions.ContinueOnError = false;
                buildOptions.FileDecider = new FileSizeDateDecider();
                buildOptions.MaxConcurrency = 6;

                string[] targets = { link.Params.OutputFilePath };

                BuildResults cleanBuildResults = buildGraph.Execute(BuildAction.Build, buildOptions, targets, true);
                TestHelpers.PrintBuildResults(buildOptions, cleanBuildResults);
                BuildResults incrementalBuildResults = buildGraph.Execute(BuildAction.Build, buildOptions, targets, true);
                TestHelpers.PrintBuildResults(buildOptions, incrementalBuildResults);

                bool doClean = true;
                if (doClean) {
                    BuildResults cleanResults = buildGraph.Execute(BuildAction.Clean, buildOptions, targets, true);
                    TestHelpers.PrintBuildResults(buildOptions, cleanResults);
                }
            }