Browse Source

CMake: Fix missing pragma in generated resource.rc files

tags/2021-05-28
reuk 5 years ago
parent
commit
7dca2fb488
2 changed files with 16 additions and 29 deletions
  1. +0
    -15
      extras/Build/juce_build_tools/utils/juce_CppTokeniserFunctions.cpp
  2. +16
    -14
      extras/Build/juce_build_tools/utils/juce_ResourceRc.cpp

+ 0
- 15
extras/Build/juce_build_tools/utils/juce_CppTokeniserFunctions.cpp View File

@@ -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();
}
}
}

+ 16
- 14
extras/Build/juce_build_tools/utils/juce_ResourceRc.cpp View File

@@ -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, ",.", "");
@@ -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
@@ -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


Loading…
Cancel
Save