Browse Source

tags/2021-05-28
jules 17 years ago
parent
commit
8ea760cdab
10 changed files with 313807 additions and 3 deletions
  1. +340
    -0
      extras/amalgamator/juce_AmalgamatorMain.cpp
  2. +28
    -0
      extras/amalgamator/juce_AppConfig.h
  3. +12
    -0
      extras/amalgamator/juce_LibrarySource.cpp
  4. +20
    -0
      extras/amalgamator/vc8/Amalgamator.sln
  5. +193
    -0
      extras/amalgamator/vc8/Amalgamator.vcproj
  6. +259886
    -0
      juce_amalgamated.cpp
  7. +53316
    -0
      juce_amalgamated.h
  8. +10
    -0
      juce_amalgamated.mm
  9. +0
    -3
      src/juce_amalgamated_template.cpp
  10. +2
    -0
      src/juce_appframework/audio/plugins/formats/juce_VSTPluginFormat.cpp

+ 340
- 0
extras/amalgamator/juce_AmalgamatorMain.cpp View File

@@ -0,0 +1,340 @@
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-7 by Raw Material Software ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the
GNU General Public License, as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
JUCE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with JUCE; if not, visit www.gnu.org/licenses or write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
------------------------------------------------------------------------------
If you'd like to release a closed-source product which uses JUCE, commercial
licenses are also available: visit www.rawmaterialsoftware.com/juce for
more information.
==============================================================================
*/
#include "juce_AppConfig.h"
#include "../../juce_amalgamated.h"
//==============================================================================
static bool matchesWildcard (const String& filename, const StringArray& wildcards)
{
for (int i = wildcards.size(); --i >= 0;)
if (filename.matchesWildcard (wildcards[i], true))
return true;
return false;
}
static bool canFileBeReincluded (const File& f)
{
String content (f.loadFileAsString());
for (;;)
{
content = content.trimStart();
if (content.startsWith (T("//")))
content = content.fromFirstOccurrenceOf (T("\n"), false, false);
else if (content.startsWith (T("/*")))
content = content.fromFirstOccurrenceOf (T("*/"), false, false);
else
break;
}
StringArray lines;
lines.addLines (content);
lines.trim();
lines.removeEmptyStrings();
const String l1 (lines[0].removeCharacters (T(" \t")).trim());
const String l2 (lines[1].removeCharacters (T(" \t")).trim());
if (l1.replace (T("#ifndef"), T("#define")) == l2)
return false;
return true;
}
//==============================================================================
static bool parseFile (const File& rootFolder,
const File& newTargetFile,
StringArray& dest,
const File& file,
StringArray& alreadyIncludedFiles,
const StringArray& includesToIgnore,
const StringArray& wildcards,
const bool isOuterFile,
const bool stripUnnecessaryStuff)
{
printf ("reading: " + file.getFileName() + "\n");
if (! file.exists())
{
printf ("!! ERROR - file doesn't exist!");
return false;
}
String content (file.loadFileAsString());
if (stripUnnecessaryStuff && ! isOuterFile)
{
if (content.startsWith (T("/*")))
content = content.fromFirstOccurrenceOf (T("*/"), false, false).trimStart();
content = content.replace (T("\r\n\r\n\r\n"), T("\r\n\r\n"));
}
StringArray lines;
lines.addLines (content);
while (lines[0].trim().isEmpty())
lines.remove (0);
for (int i = 0; i < lines.size(); ++i)
{
String line (lines[i]);
if ((! isOuterFile) && line.contains (T("//================================================================")))
line = String::empty;
if (line.trimStart().startsWithChar (T('#'))
&& line.removeCharacters (T(" \t")).startsWithIgnoreCase (T("#include\"")))
{
const int endOfInclude = line.indexOfChar (line.indexOfChar (T('\"')) + 1, T('\"')) + 1;
const String lineUpToEndOfInclude (line.substring (0, endOfInclude));
const String lineAfterInclude (line.substring (endOfInclude));
const String filename (line.fromFirstOccurrenceOf (T("\""), false, false)
.upToLastOccurrenceOf (T("\""), false, false));
const File targetFile (file.getSiblingFile (filename));
if (targetFile.exists()
&& targetFile.isAChildOf (rootFolder))
{
if (matchesWildcard (filename.replaceCharacter (T('\\'), T('/')), wildcards)
&& ! includesToIgnore.contains (targetFile.getFileName()))
{
if (! alreadyIncludedFiles.contains (targetFile.getFullPathName()))
{
if (! canFileBeReincluded (targetFile))
alreadyIncludedFiles.add (targetFile.getFullPathName());
dest.add (String::empty);
dest.add (T("/********* Start of inlined file: ")
+ targetFile.getFileName()
+ T(" *********/"));
if (! parseFile (rootFolder, newTargetFile,
dest, targetFile, alreadyIncludedFiles, includesToIgnore,
wildcards, false, stripUnnecessaryStuff))
{
return false;
}
dest.add (T("/********* End of inlined file: ")
+ targetFile.getFileName()
+ T(" *********/"));
dest.add (String::empty);
line = lineAfterInclude;
}
else
{
if (stripUnnecessaryStuff)
line = String::empty;
else
line = T("/* ") + lineUpToEndOfInclude + T(" */") + lineAfterInclude;
}
}
else
{
line = lineUpToEndOfInclude.upToFirstOccurrenceOf (T("\""), true, false)
+ targetFile.getRelativePathFrom (newTargetFile.getParentDirectory())
.replaceCharacter (T('\\'), T('/'))
+ T("\"")
+ lineAfterInclude;
}
}
}
dest.add (line.trimEnd());
}
return true;
}
//==============================================================================
static bool munge (const File& templateFile, const File& targetFile, const String& wildcard,
const bool stripUnnecessaryStuff, StringArray& alreadyIncludedFiles,
const StringArray& includesToIgnore)
{
if (! templateFile.existsAsFile())
{
printf (" The template file doesn't exist!\n\n");
return false;
}
StringArray lines, wildcards;
wildcards.addTokens (wildcard, T(";,"), T("'\""));
wildcards.trim();
wildcards.removeEmptyStrings();
if (! parseFile (targetFile.getParentDirectory(),
targetFile,
lines, templateFile,
alreadyIncludedFiles,
includesToIgnore,
wildcards,
true, stripUnnecessaryStuff))
{
return false;
}
//lines.trim();
//lines.removeEmptyStrings();
printf ("\nwriting: " + targetFile.getFullPathName() + "...\n\n");
for (int i = 0; i < lines.size() - 2; ++i)
{
if (lines[i].isEmpty() && lines[i + 1].isEmpty())
{
lines.remove (i + 1);
--i;
}
}
MemoryBlock newData, oldData;
const String newText (lines.joinIntoString (T("\n")) + T("\n"));
newData.append ((const char*) newText, (int) strlen ((const char*) newText));
targetFile.loadFileAsData (oldData);
if (oldData == newData)
{
printf ("(No need to write - new file is identical)\n\n");
return true;
}
if (! targetFile.replaceWithData (newData.getData(), newData.getSize()))
{
printf ("\n!! ERROR - couldn't write to the target file: " + targetFile.getFullPathName() + "\n\n");
return false;
}
return true;
}
static void findAllFilesIncludedIn (const File& hppTemplate, StringArray& alreadyIncludedFiles)
{
StringArray lines;
lines.addLines (hppTemplate.loadFileAsString());
for (int i = 0; i < lines.size(); ++i)
{
String line (lines[i]);
if (line.removeCharacters (T(" \t")).startsWithIgnoreCase (T("#include\"")))
{
const String filename (line.fromFirstOccurrenceOf (T("\""), false, false)
.upToLastOccurrenceOf (T("\""), false, false));
const File targetFile (hppTemplate.getSiblingFile (filename));
if (! alreadyIncludedFiles.contains (targetFile.getFullPathName()))
{
alreadyIncludedFiles.add (targetFile.getFullPathName());
if (targetFile.getFileName().containsIgnoreCase (T("juce_")) && targetFile.exists())
findAllFilesIncludedIn (targetFile, alreadyIncludedFiles);
}
}
}
}
//==============================================================================
static void mungeJuce (const File& juceFolder)
{
if (! juceFolder.isDirectory())
{
printf (" The folder supplied must be the root of your Juce directory!\n\n");
return;
}
const File hppTemplate (juceFolder.getChildFile (T("src/juce_amalgamated_template.h")));
const File cppTemplate (juceFolder.getChildFile (T("src/juce_amalgamated_template.cpp")));
const File hppTarget (juceFolder.getChildFile (T("juce_amalgamated.h")));
const File cppTarget (juceFolder.getChildFile (T("juce_amalgamated.cpp")));
StringArray alreadyIncludedFiles, includesToIgnore;
if (! munge (hppTemplate, hppTarget,
"*.h", true, alreadyIncludedFiles, includesToIgnore))
{
return;
}
findAllFilesIncludedIn (hppTemplate, alreadyIncludedFiles);
includesToIgnore.add (hppTarget.getFileName());
munge (cppTemplate, cppTarget,
"*.cpp;*.c;*.h;*.mm;*.m", true, alreadyIncludedFiles,
includesToIgnore);
}
//==============================================================================
int main (int argc, char* argv[])
{
// If you're running a command-line app, you need to initialise juce manually
// before calling any Juce functionality..
initialiseJuce_NonGUI();
printf ("\n The C++ Amalgamator! Copyright 2008 by Julian Storer - www.rawmaterialsoftware.com\n\n");
if (argc == 4)
{
const File templateFile (File::getCurrentWorkingDirectory().getChildFile (argv[1]));
const File targetFile (File::getCurrentWorkingDirectory().getChildFile (argv[2]));
const String wildcard (String (argv[3]).unquoted());
StringArray alreadyIncludedFiles, includesToIgnore;
munge (templateFile, targetFile, wildcard, false, alreadyIncludedFiles, includesToIgnore);
}
else if (argc == 2)
{
const File juceFolder (File::getCurrentWorkingDirectory().getChildFile (argv[1]));
mungeJuce (juceFolder);
}
else
{
printf (" Usage: amalgamator TemplateFile TargetFile \"FileToReplaceWildcard\"\n\n");
printf (" amalgamator will run through a C++ file and replace any\n"
" #include statements with the contents of the file they refer to.\n"
" It'll only do this for files that are within the same parent\n"
" directory as the target file, and will ignore include statements\n"
" that use '<>' instead of quotes. It'll also only include a file once,\n"
" ignoring any repeated instances of it.\n\n"
" The wildcard lets you specify what kind of files will be replaced, so\n"
" \"*.cpp;*.h\" would replace only includes that reference a .cpp or .h file.\n\n"
" Or: just run 'amalgamator YourJuceDirectory' to rebuild the juce files."
);
}
return 0;
}

+ 28
- 0
extras/amalgamator/juce_AppConfig.h View File

@@ -0,0 +1,28 @@
/*
This file contains settings that you might want to explicitly apply to
the your build.
Most of these are turned on or off by default, but you can override
that setting here by un-commenting it and giving it a 1 or 0 value.
*/
#define JUCE_ONLY_BUILD_CORE_LIBRARY 1
//#define JUCE_FORCE_DEBUG 1
//#define JUCE_LOG_ASSERTIONS 1
//#define JUCE_ASIO 1
//#define JUCE_ALSA 1
//#define JUCE_QUICKTIME 1
//#define JUCE_OPENGL 1
//#define JUCE_USE_FLAC 1
//#define JUCE_USE_OGGVORBIS 1
//#define JUCE_USE_CDBURNER 1
//#define JUCE_ENABLE_REPAINT_DEBUGGING 1
//#define JUCE_USE_XINERAMA 1
//#define JUCE_USE_XSHM 1
//#define JUCE_PLUGINHOST_VST 1
//#define JUCE_PLUGINHOST_AU 1
//#define JUCE_BUILD_GUI_CLASSES 1
//#define JUCE_CHECK_MEMORY_LEAKS 1
//#define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
//#define JUCE_STRINGS_ARE_UNICODE 1

+ 12
- 0
extras/amalgamator/juce_LibrarySource.cpp View File

@@ -0,0 +1,12 @@
/*
This file includes the entire juce source tree via the amalgamated file.
You could add the amalgamated file directly to your project, but doing it
like this allows you to put your app's config settings in the
juce_AppConfig.h file and have them applied to both the juce headers and
the source code.
*/
#include "juce_AppConfig.h"
#include "../../juce_amalgamated.cpp"

+ 20
- 0
extras/amalgamator/vc8/Amalgamator.sln View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Amalgamator", "Amalgamator.vcproj", "{E616D10E-A3BF-4227-9512-186086D297A6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E616D10E-A3BF-4227-9512-186086D297A6}.Debug|Win32.ActiveCfg = Debug|Win32
{E616D10E-A3BF-4227-9512-186086D297A6}.Debug|Win32.Build.0 = Debug|Win32
{E616D10E-A3BF-4227-9512-186086D297A6}.Release|Win32.ActiveCfg = Release|Win32
{E616D10E-A3BF-4227-9512-186086D297A6}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

+ 193
- 0
extras/amalgamator/vc8/Amalgamator.vcproj View File

@@ -0,0 +1,193 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="Amalgamator"
ProjectGUID="{E616D10E-A3BF-4227-9512-186086D297A6}"
RootNamespace="Amalgamator"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\juce_AmalgamatorMain.cpp"
>
</File>
<File
RelativePath="..\juce_AppConfig.h"
>
</File>
<File
RelativePath="..\juce_LibrarySource.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

+ 259886
- 0
juce_amalgamated.cpp
File diff suppressed because it is too large
View File


+ 53316
- 0
juce_amalgamated.h
File diff suppressed because it is too large
View File


+ 10
- 0
juce_amalgamated.mm View File

@@ -0,0 +1,10 @@

/*
When using XCode, you should add this file to your project
instead of using juce_amalgamated.cpp directly.

This is because on the Mac we need to force the compiler to
treat the code as mixed C++/objective-C.
*/

#include "juce_amalgamated.cpp"

+ 0
- 3
src/juce_amalgamated_template.cpp View File

@@ -57,9 +57,6 @@
#endif #endif
#elif defined (LINUX) #elif defined (LINUX)
#include "../build/linux/platform_specific_code/linuxincludes.h"
#include <ft2build.h>
#include FT_FREETYPE_H
#else #else
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>


+ 2
- 0
src/juce_appframework/audio/plugins/formats/juce_VSTPluginFormat.cpp View File

@@ -34,7 +34,9 @@
#if JUCE_PLUGINHOST_VST #if JUCE_PLUGINHOST_VST
#ifdef _WIN32 #ifdef _WIN32
#undef #define _WIN32_WINNT
#define _WIN32_WINNT 0x500 #define _WIN32_WINNT 0x500
#undef STRICT
#define STRICT #define STRICT
#include <windows.h> #include <windows.h>
#include <float.h> #include <float.h>


Loading…
Cancel
Save