Skip to content

Commit 6cbc24f

Browse files
committed
GITechDemo:
*further reduced the size of the included Python distribution Synesthesia3D: *added the option to override the default log location for both the texture and model compilers
1 parent 8fb2738 commit 6cbc24f

25 files changed

+45
-21
lines changed
-1.06 MB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-19.5 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-1.35 MB
Binary file not shown.
Binary file not shown.
-70.5 KB
Binary file not shown.
-19.3 KB
Binary file not shown.
-19.3 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

GITechDemo/Code/Tools/ModelCompiler.vcxproj.filters

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
66
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
77
</Filter>
8-
<Filter Include="Model Compiler">
8+
<Filter Include="Main">
99
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
1010
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
1111
</Filter>
@@ -15,26 +15,26 @@
1515
<Filter>Common</Filter>
1616
</ClInclude>
1717
<ClInclude Include="ModelCompiler\ModelCompiler.h">
18-
<Filter>Model Compiler</Filter>
18+
<Filter>Main</Filter>
1919
</ClInclude>
2020
<ClInclude Include="ModelCompiler\stdafx.h">
21-
<Filter>Model Compiler</Filter>
21+
<Filter>Main</Filter>
2222
</ClInclude>
2323
<ClInclude Include="ModelCompiler\targetver.h">
24-
<Filter>Model Compiler</Filter>
24+
<Filter>Main</Filter>
2525
</ClInclude>
2626
</ItemGroup>
2727
<ItemGroup>
2828
<ClCompile Include="ModelCompiler\ModelCompiler.cpp">
29-
<Filter>Model Compiler</Filter>
29+
<Filter>Main</Filter>
3030
</ClCompile>
3131
<ClCompile Include="ModelCompiler\stdafx.cpp">
32-
<Filter>Model Compiler</Filter>
32+
<Filter>Main</Filter>
3333
</ClCompile>
3434
</ItemGroup>
3535
<ItemGroup>
3636
<Text Include="ModelCompiler\ReadMe.txt">
37-
<Filter>Model Compiler</Filter>
37+
<Filter>Main</Filter>
3838
</Text>
3939
</ItemGroup>
4040
</Project>

GITechDemo/Code/Tools/ModelCompiler/ModelCompiler.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void ModelCompiler::Run(int argc, char* argv[])
2626
bool bValidCmdParams = false;
2727
bool bQuiet = false;
2828
char outputDirPath[1024] = "";
29+
char outputLogDirPath[1024] = "";
2930

3031
for (unsigned int arg = 1; arg < (unsigned int)argc; arg++)
3132
{
@@ -44,6 +45,13 @@ void ModelCompiler::Run(int argc, char* argv[])
4445
continue;
4546
}
4647

48+
if (_stricmp(argv[arg], "-log") == 0)
49+
{
50+
arg++;
51+
strcpy_s(outputLogDirPath, argv[arg]);
52+
continue;
53+
}
54+
4755
break;
4856
}
4957
else
@@ -61,6 +69,7 @@ void ModelCompiler::Run(int argc, char* argv[])
6169
cout << "Options:" << endl;
6270
cout << "-q\t\tQuiet. Does not produce output to the console window" << endl;
6371
cout << "-d output/dir/\tOverride default output directory (output/dir/ must exist!)" << endl;
72+
cout << "-log output/dir/\tOverride default log output directory (output/dir/ must exist!)" << endl;
6473
return;
6574
}
6675

@@ -78,13 +87,16 @@ void ModelCompiler::Run(int argc, char* argv[])
7887
std::strftime(time, 80, "%Y%m%d%H%M%S", timeinfo);
7988
delete timeinfo;
8089

81-
if (!(CreateDirectoryA("Logs", NULL) || ERROR_ALREADY_EXISTS == GetLastError()))
90+
if (strlen(outputLogDirPath) == 0)
91+
strcpy_s(outputLogDirPath, "Logs");
92+
93+
if (!(CreateDirectoryA(outputLogDirPath, NULL) || ERROR_ALREADY_EXISTS == GetLastError()))
8294
{
8395
cout << "ModelCompiler requires write permission into the current directory";
8496
return;
8597
}
8698

87-
sprintf_s(logName, 1024, "Logs\\ModelCompiler_%s_%s.log", time, fileName);
99+
sprintf_s(logName, 1024, "%s\\ModelCompiler_%s_%s.log", outputLogDirPath, time, fileName);
88100
mstream Log(logName, ofstream::trunc, !bQuiet);
89101

90102
Log << "Compiling: \"" << argv[argc - 1] << "\"\n";

GITechDemo/Code/Tools/TextureCompiler.vcxproj.filters

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,36 @@
55
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
66
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
77
</Filter>
8-
<Filter Include="Texture Compiler">
8+
<Filter Include="Main">
99
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
1010
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
1111
</Filter>
1212
</ItemGroup>
1313
<ItemGroup>
1414
<ClInclude Include="TextureCompiler\TextureCompiler.h">
15-
<Filter>Texture Compiler</Filter>
15+
<Filter>Main</Filter>
1616
</ClInclude>
1717
<ClInclude Include="TextureCompiler\stdafx.h">
18-
<Filter>Texture Compiler</Filter>
18+
<Filter>Main</Filter>
1919
</ClInclude>
2020
<ClInclude Include="TextureCompiler\targetver.h">
21-
<Filter>Texture Compiler</Filter>
21+
<Filter>Main</Filter>
2222
</ClInclude>
2323
<ClInclude Include="Common\Logging.h">
2424
<Filter>Common</Filter>
2525
</ClInclude>
2626
</ItemGroup>
2727
<ItemGroup>
2828
<ClCompile Include="TextureCompiler\stdafx.cpp">
29-
<Filter>Texture Compiler</Filter>
29+
<Filter>Main</Filter>
3030
</ClCompile>
3131
<ClCompile Include="TextureCompiler\TextureCompiler.cpp">
32-
<Filter>Texture Compiler</Filter>
32+
<Filter>Main</Filter>
3333
</ClCompile>
3434
</ItemGroup>
3535
<ItemGroup>
3636
<Text Include="TextureCompiler\ReadMe.txt">
37-
<Filter>Texture Compiler</Filter>
37+
<Filter>Main</Filter>
3838
</Text>
3939
</ItemGroup>
4040
</Project>

GITechDemo/Code/Tools/TextureCompiler/TextureCompiler.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ void TextureCompiler::Run(int argc, char* argv[])
245245
bool bQuiet = false;
246246
PixelFormat format = PF_NONE;
247247
char outputDirPath[1024] = "";
248+
char outputLogDirPath[1024] = "";
248249
unsigned int mipCount = 0;
249250

250251
for (unsigned int arg = 1; arg < (unsigned int)argc; arg++)
@@ -402,6 +403,13 @@ void TextureCompiler::Run(int argc, char* argv[])
402403
continue;
403404
}
404405

406+
if (_stricmp(argv[arg], "-log") == 0)
407+
{
408+
arg++;
409+
strcpy_s(outputLogDirPath, argv[arg]);
410+
continue;
411+
}
412+
405413
break;
406414
}
407415
else
@@ -420,6 +428,7 @@ void TextureCompiler::Run(int argc, char* argv[])
420428
cout << "-q\t\tQuiet. Does not produce output to the console window" << endl;
421429
cout << "-f format\tOptional pixel format (see below) for conversion" << endl;
422430
cout << "-d output/dir/\tOverride default output directory (output/dir/ must exist!)" << endl;
431+
cout << "-log output/dir/\tOverride default log output directory (output/dir/ must exist!)" << endl;
423432
cout << "-mip n\tNumber of generated mip levels: 0 (default) = all, 1 = none, etc." << endl << endl;
424433

425434
cout << "Pixel formats:" << endl;
@@ -446,13 +455,16 @@ void TextureCompiler::Run(int argc, char* argv[])
446455
std::strftime(time, 80, "%Y%m%d%H%M%S", timeinfo);
447456
delete timeinfo;
448457

449-
if (!(CreateDirectoryA("Logs", NULL) || ERROR_ALREADY_EXISTS == GetLastError()))
458+
if (strlen(outputLogDirPath) == 0)
459+
strcpy_s(outputLogDirPath, "Logs");
460+
461+
if (!(CreateDirectoryA(outputLogDirPath, NULL) || ERROR_ALREADY_EXISTS == GetLastError()))
450462
{
451463
cout << "TextureCompiler requires write permission into the current directory";
452464
return;
453465
}
454466

455-
sprintf_s(logName, 1024, "Logs\\TextureCompiler_%s_%s.log", time, fileName);
467+
sprintf_s(logName, 1024, "%s\\TextureCompiler_%s_%s.log", outputLogDirPath, time, fileName);
456468
mstream Log(logName, ofstream::trunc, !bQuiet);
457469

458470
const unsigned long long startTick = GetTickCount64();

GITechDemo/DataSrc/compile_sponza_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
compiledFileExists = os.path.isfile(modelOutputPath + os.path.splitext(file)[0] + ".s3dmdl")
9090
if sourceFileIsNewer or not compiledFileExists or forceRebuildModels:
9191
print "Compiling model \"" + rootModelDir.replace(scriptAbsPath + "/", "") + file + "\""
92-
subprocess.call([modelCompilerExe, "-q", "-d", modelOutputPath, rootModelDir + file])
92+
subprocess.call([modelCompilerExe, "-q", "-d", modelOutputPath, "-log", scriptAbsPath + "/Logs", rootModelDir + file])
9393
else:
9494
print "Model \"" + rootModelDir.replace(scriptAbsPath + "/", "") + file + "\" is up-to-date"
9595

@@ -107,7 +107,7 @@
107107
compiledFileExists = os.path.isfile(textureOutputPath + os.path.splitext(name)[0] + ".s3dtex")
108108
if sourceFileIsNewer or not compiledFileExists or forceRebuildTextures:
109109
print "Compiling texture \"" + os.path.join(root, name).replace(scriptAbsPath + "/", "") + "\""
110-
subprocess.call(textureCompilerExe + " " + customArgs[name] + " -d " + textureOutputPath + " " + os.path.join(root, name))
110+
subprocess.call(textureCompilerExe + " " + customArgs[name] + " -d " + textureOutputPath + " -log " + scriptAbsPath + "/Logs " + os.path.join(root, name))
111111
else:
112112
print "Texture \"" + os.path.join(root, name).replace(scriptAbsPath + "/", "") + "\" is up-to-date"
113113

GITechDemo/DataSrc/compile_utility_textures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
compiledFileExists = os.path.isfile(outputPath + os.path.splitext(name)[0] + ".s3dtex")
7979
if sourceFileIsNewer or not compiledFileExists or defaultForceRebuild:
8080
print "Compiling texture \"" + os.path.join(root, name).replace(scriptAbsPath + "/", "") + "\""
81-
subprocess.call(textureCompilerExe + " " + customArgs[name] + " -d " + outputPath + " " + os.path.join(root, name))
81+
subprocess.call(textureCompilerExe + " " + customArgs[name] + " -d " + outputPath + " -log " + scriptAbsPath + "/Logs " + os.path.join(root, name))
8282
else:
8383
print "Texture \"" + os.path.join(root, name).replace(scriptAbsPath + "/", "") + "\" is up-to-date"
8484

0 commit comments

Comments
 (0)