MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / main

Function main

GTE/Tools/GenerateProject/GenerateProject.cpp:17–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15#include <string>
16
17std::int32_t main(std::int32_t numArguments, char const* arguments[])
18{
19 if (4 != numArguments)
20 {
21 std::cout << "usage: GenerateProject [c,w2,w3] [nesting] projname" << std::endl;
22 std::cout << "Use c for Console application." << std::endl;
23 std::cout << "Use w2 for Window2 application." << std::endl;
24 std::cout << "Use w3 for Window3 application." << std::endl;
25 std::cout << "Nesting is the number of levels from the GTE folder." << std::endl;
26 std::cout << "Example: GenerateProject w3 3 GTE/Samples/Graphics/VertexColoring" << std::endl;
27 std::cout << "generates the vertex-coloring sample projects." << std::endl;
28 return -1;
29 }
30
31 std::string appType = arguments[1];
32 if (appType != "c" && appType != "w2" && appType != "w3")
33 {
34 std::cout << "Application type must be c, w2 or w3." << std::endl;
35 return -1;
36 }
37
38 std::int32_t nesting = atoi(arguments[2]);
39 if (nesting <= 0)
40 {
41 std::cout << "Nesting must be positive" << std::endl;
42 return -2;
43 }
44
45 // Generate the relative path to GeometricTools/GTE.
46 std::string gteRelativePath{};
47 for (std::int32_t i = 0; i < nesting; ++i)
48 {
49 gteRelativePath += "..\\";
50 }
51
52 // Generate the files for the project.
53 std::string projectName = arguments[3];
54 bool success = false;
55
56 TemplateV17 generatev17(gteRelativePath);
57 success = generatev17.Execute(projectName, appType);
58 if (!success)
59 {
60 std::cout << "Could not create the V17 project files." << std::endl;
61 return -3;
62 }
63
64 TemplateV18 generatev18(gteRelativePath);
65 success = generatev18.Execute(projectName, appType);
66 if (!success)
67 {
68 std::cout << "Could not create the V18 project files." << std::endl;
69 return -3;
70 }
71
72 TemplateVSCode generateVSCode{};
73 success = generateVSCode.Execute(projectName, appType);
74 if (!success)

Callers

nothing calls this directly

Calls 1

ExecuteMethod · 0.45

Tested by

no test coverage detected