Last active
August 29, 2015 14:16
-
-
Save leidegre/3d11e16a7565083b8a47 to your computer and use it in GitHub Desktop.
Repo for issue https://github.com/deplinenoise/tundra/issues/246
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Dummy() | |
{ | |
// so that we have at least one object file | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
extern const char* g_Text; | |
int main(int argc, const char* argv[]) | |
{ | |
printf("%s\n", g_Text); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cassert> | |
#include <cstdio> | |
#include <cctype> | |
#include <cstring> | |
int main(int argc, const char* argv[]) | |
{ | |
assert(3 <= argc); | |
FILE* f = fopen(argv[2], "rb"); | |
if (!f) | |
{ | |
return 1; | |
} | |
char temp[512]; | |
size_t read = fread(temp, 1, sizeof(temp), f); | |
temp[read] = 0; | |
char output_file[256]; | |
strcpy(output_file, argv[1]); | |
strcat(output_file, "\\"); | |
strcat(output_file, strrchr(argv[2], '\\') + 1); | |
strcat(output_file, ".cpp"); | |
FILE* f2 = fopen(output_file, "w+b"); | |
if (!f2) | |
{ | |
fclose(f); | |
return 1; | |
} | |
char* p = temp; | |
while (*p) | |
{ | |
if (!isalnum(*p)) | |
*p = '.'; | |
++p; | |
} | |
fprintf(f2, "const char* g_Text = \"%s\";\n", temp); | |
fclose(f2); | |
fclose(f); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is some text. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Build { | |
Passes = { | |
A = { Name = "A", BuildOrder = 1 }, | |
B = { Name = "B", BuildOrder = 2 }, | |
}, | |
Units = function() | |
local path = require "tundra.path" | |
Program { | |
Name = "strc", | |
Pass = "A", | |
Sources = { | |
"Strc.cpp", | |
}, | |
} | |
Always "strc" | |
DefRule { | |
Name = "Strc", | |
Pass = "B", | |
ConfigInvariant = false, | |
Command = "$(OBJECTDIR)$(SEP)strc$(PROGSUFFIX) $(OBJECTDIR) $(<)", | |
ImplicitInputs = { "$(OBJECTDIR)$(SEP)strc$(PROGSUFFIX)" }, | |
Blueprint = { | |
InputFiles = { Type = "table", Required = true }, | |
}, | |
Setup = function (env, data) | |
local ouput_files = {} | |
for _, v in ipairs(data.InputFiles) do | |
local output_file = "$(OBJECTDIR)/" .. path.get_filename(v) .. ".cpp" | |
ouput_files[#ouput_files] = output_file | |
print("stc: " .. output_file) | |
end | |
return { | |
InputFiles = data.InputFiles, | |
OutputFiles = ouput_files, | |
} | |
end | |
} | |
StaticLibrary { | |
Name = "textlib", | |
Sources = { | |
"Dummy.cpp", | |
Strc { | |
InputFiles = "Text.txt", | |
} | |
} | |
} | |
Program { | |
Name = "text", | |
Depends = { "textlib" }, | |
Sources = { | |
"Main.cpp", | |
} | |
} | |
end, | |
Configs = { | |
Config { | |
Name = "win64-msvc", | |
SupportedHosts = { "windows" }, | |
DefaultOnHost = "windows", | |
Tools = { { "msvc-vs2013"; TargetArch = "x64"; } }, | |
Env = { | |
GENERATE_PDB = "1", | |
CXXOPTS = { "/FC" } | |
} | |
}, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment