Skip to content

Commit

Permalink
CMake: Fix missing pragma in generated resource.rc files
Browse files Browse the repository at this point in the history
  • Loading branch information
reuk committed Apr 15, 2020
1 parent c244bbb commit 7dca2fb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 29 deletions.
15 changes: 0 additions & 15 deletions extras/Build/juce_build_tools/utils/juce_CppTokeniserFunctions.cpp
Expand Up @@ -195,20 +195,5 @@ namespace build_tools
}
}
}

/** Takes a string and returns a version of it where standard C++ escape sequences have been
used to replace any non-ascii bytes.
Although not strictly a tokenising function, this is still a function that often comes in
handy when working with C++ code!
@see writeEscapeChars
*/
static String addEscapeChars (const String& s)
{
MemoryOutputStream mo;
writeEscapeChars (mo, s.toRawUTF8(), -1, -1, false, true, true);
return mo.toString();
}
}
}
30 changes: 16 additions & 14 deletions extras/Build/juce_build_tools/utils/juce_ResourceRc.cpp
Expand Up @@ -20,13 +20,6 @@ namespace juce
{
namespace build_tools
{
static void writeRCValue (MemoryOutputStream& mo, const String& n, const String& value)
{
if (value.isNotEmpty())
mo << " VALUE \"" << n << "\", \""
<< addEscapeChars (value) << "\\0\"" << newLine;
}

static String getCommaSeparatedVersionNumber (const String& version)
{
auto versionParts = StringArray::fromTokens (version, ",.", "");
Expand All @@ -42,7 +35,9 @@ namespace build_tools
{
MemoryOutputStream mo;

mo << "#ifdef JUCE_USER_DEFINED_RC_FILE" << newLine
mo << "#pragma code_page(65001)" << newLine
<< newLine
<< "#ifdef JUCE_USER_DEFINED_RC_FILE" << newLine
<< " #include JUCE_USER_DEFINED_RC_FILE" << newLine
<< "#else" << newLine
<< newLine
Expand All @@ -58,12 +53,19 @@ namespace build_tools
<< " BLOCK \"040904E4\"" << newLine
<< " BEGIN" << newLine;

writeRCValue (mo, "CompanyName", companyName);
writeRCValue (mo, "LegalCopyright", companyCopyright);
writeRCValue (mo, "FileDescription", projectName);
writeRCValue (mo, "FileVersion", version);
writeRCValue (mo, "ProductName", projectName);
writeRCValue (mo, "ProductVersion", version);
const auto writeRCValue = [&] (const String& n, const String& value)
{
if (value.isNotEmpty())
mo << " VALUE \"" << n << "\", \""
<< value.replace ("\"", "\"\"") << "\\0\"" << newLine;
};

writeRCValue ("CompanyName", companyName);
writeRCValue ("LegalCopyright", companyCopyright);
writeRCValue ("FileDescription", projectName);
writeRCValue ("FileVersion", version);
writeRCValue ("ProductName", projectName);
writeRCValue ("ProductVersion", version);

mo << " END" << newLine
<< " END" << newLine
Expand Down

0 comments on commit 7dca2fb

Please sign in to comment.