migrating to the latest JUCE version

This commit is contained in:
2022-11-04 23:11:33 +01:00
committed by Nikolai Rodionov
parent 4257a0f8ba
commit faf8f18333
2796 changed files with 888518 additions and 784244 deletions

View File

@ -6,8 +6,7 @@
companyCopyright="Raw Material Software Limited" useAppConfig="0"
addUsingNamespaceToJuceHeader="1" jucerFormatVersion="1">
<EXPORTFORMATS>
<XCODE_MAC targetFolder="Builds/MacOSX" vstFolder="~/SDKs/vstsdk2.4" rtasFolder="~/SDKs/PT_80_SDK"
objCExtraSuffix="OeJtJb" applicationCategory="public.app-category.developer-tools">
<XCODE_MAC targetFolder="Builds/MacOSX" applicationCategory="public.app-category.developer-tools">
<CONFIGURATIONS>
<CONFIGURATION name="Debug" isDebug="1" targetName="BinaryBuilder"/>
<CONFIGURATION name="Release" isDebug="0" optimisation="2" targetName="BinaryBuilder"/>
@ -16,7 +15,7 @@
<MODULEPATH id="juce_core" path="../../modules"/>
</MODULEPATHS>
</XCODE_MAC>
<LINUX_MAKE targetFolder="Builds/LinuxMakefile" vstFolder="~/SDKs/vstsdk2.4">
<LINUX_MAKE targetFolder="Builds/LinuxMakefile">
<CONFIGURATIONS>
<CONFIGURATION name="Debug" isDebug="1" targetName="BinaryBuilder"/>
<CONFIGURATION name="Release" isDebug="0" optimisation="2" targetName="BinaryBuilder"/>
@ -25,7 +24,7 @@
<MODULEPATH id="juce_core" path="../../modules"/>
</MODULEPATHS>
</LINUX_MAKE>
<VS2019 targetFolder="Builds/VisualStudio2019">
<VS2022 targetFolder="Builds/VisualStudio2022">
<CONFIGURATIONS>
<CONFIGURATION name="Debug" isDebug="1" targetName="BinaryBuilder"/>
<CONFIGURATION name="Release" isDebug="0" targetName="BinaryBuilder"/>
@ -33,7 +32,7 @@
<MODULEPATHS>
<MODULEPATH id="juce_core" path="../../modules"/>
</MODULEPATHS>
</VS2019>
</VS2022>
</EXPORTFORMATS>
<MAINGROUP id="TTBP5JihO" name="BinaryBuilder">
<GROUP id="noYkBuTg" name="Source">

View File

@ -11,6 +11,10 @@ endif
# (this disables dependency generation if multiple architectures are set)
DEPFLAGS := $(if $(word 2, $(TARGET_ARCH)), , -MMD)
ifndef PKG_CONFIG
PKG_CONFIG=pkg-config
endif
ifndef STRIP
STRIP=strip
endif
@ -35,13 +39,13 @@ ifeq ($(CONFIG),Debug)
TARGET_ARCH :=
endif
JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x60102" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell pkg-config --cflags libcurl) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
JUCE_CPPFLAGS_CONSOLEAPP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_RTAS=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0"
JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags libcurl) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
JUCE_CPPFLAGS_CONSOLEAPP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0"
JUCE_TARGET_CONSOLEAPP := BinaryBuilder
JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 $(CFLAGS)
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS)
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs libcurl) -fvisibility=hidden -lrt -ldl -lpthread $(LDFLAGS)
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs libcurl) -fvisibility=hidden -lrt -ldl -lpthread $(LDFLAGS)
CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)
endif
@ -56,13 +60,13 @@ ifeq ($(CONFIG),Release)
TARGET_ARCH :=
endif
JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x60102" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell pkg-config --cflags libcurl) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
JUCE_CPPFLAGS_CONSOLEAPP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_RTAS=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0"
JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=0" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70002" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" $(shell $(PKG_CONFIG) --cflags libcurl) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
JUCE_CPPFLAGS_CONSOLEAPP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0"
JUCE_TARGET_CONSOLEAPP := BinaryBuilder
JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -Os $(CFLAGS)
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS)
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs libcurl) -fvisibility=hidden -lrt -ldl -lpthread $(LDFLAGS)
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs libcurl) -fvisibility=hidden -lrt -ldl -lpthread $(LDFLAGS)
CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)
endif
@ -76,8 +80,8 @@ OBJECTS_CONSOLEAPP := \
all : $(JUCE_OUTDIR)/$(JUCE_TARGET_CONSOLEAPP)
$(JUCE_OUTDIR)/$(JUCE_TARGET_CONSOLEAPP) : $(OBJECTS_CONSOLEAPP) $(RESOURCES)
@command -v pkg-config >/dev/null 2>&1 || { echo >&2 "pkg-config not installed. Please, install it."; exit 1; }
@pkg-config --print-errors libcurl
@command -v $(PKG_CONFIG) >/dev/null 2>&1 || { echo >&2 "pkg-config not installed. Please, install it."; exit 1; }
@$(PKG_CONFIG) --print-errors libcurl
@echo Linking "BinaryBuilder - ConsoleApp"
-$(V_AT)mkdir -p $(JUCE_BINDIR)
-$(V_AT)mkdir -p $(JUCE_LIBDIR)

View File

@ -140,7 +140,7 @@
36B6F402BC83F21646259DEF = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1340;
ORGANIZATIONNAME = "Raw Material Software Limited";
};
buildConfigurationList = E4C85B0464A93027D035AA1F;
@ -193,6 +193,7 @@
COMBINE_HIDPI_IMAGES = YES;
CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)";
COPY_PHASE_STRIP = NO;
EXCLUDED_ARCHS = "";
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
@ -200,7 +201,7 @@
"DEBUG=1",
"JUCE_DISPLAY_SPLASH_SCREEN=0",
"JUCE_USE_DARK_SPLASH_SCREEN=1",
"JUCE_PROJUCER_VERSION=0x60102",
"JUCE_PROJUCER_VERSION=0x70002",
"JUCE_MODULE_AVAILABLE_juce_core=1",
"JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1",
"JUCE_STANDALONE_APPLICATION=1",
@ -211,10 +212,10 @@
"JucePlugin_Build_VST3=0",
"JucePlugin_Build_AU=0",
"JucePlugin_Build_AUv3=0",
"JucePlugin_Build_RTAS=0",
"JucePlugin_Build_AAX=0",
"JucePlugin_Build_Standalone=0",
"JucePlugin_Build_Unity=0",
"JucePlugin_Build_LV2=0",
);
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
HEADER_SEARCH_PATHS = (
@ -290,6 +291,7 @@
COMBINE_HIDPI_IMAGES = YES;
CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)/build/$(CONFIGURATION)";
DEAD_CODE_STRIPPING = YES;
EXCLUDED_ARCHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = s;
GCC_PREPROCESSOR_DEFINITIONS = (
@ -297,7 +299,7 @@
"NDEBUG=1",
"JUCE_DISPLAY_SPLASH_SCREEN=0",
"JUCE_USE_DARK_SPLASH_SCREEN=1",
"JUCE_PROJUCER_VERSION=0x60102",
"JUCE_PROJUCER_VERSION=0x70002",
"JUCE_MODULE_AVAILABLE_juce_core=1",
"JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1",
"JUCE_STANDALONE_APPLICATION=1",
@ -308,10 +310,10 @@
"JucePlugin_Build_VST3=0",
"JucePlugin_Build_AU=0",
"JucePlugin_Build_AUv3=0",
"JucePlugin_Build_RTAS=0",
"JucePlugin_Build_AAX=0",
"JucePlugin_Build_Standalone=0",
"JucePlugin_Build_Unity=0",
"JucePlugin_Build_LV2=0",
);
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
HEADER_SEARCH_PATHS = (

View File

@ -1,20 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2019
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BinaryBuilder - ConsoleApp", "BinaryBuilder_ConsoleApp.vcxproj", "{88983F7C-DB65-9E04-84E7-05F8979E0383}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{88983F7C-DB65-9E04-84E7-05F8979E0383}.Debug|x64.ActiveCfg = Debug|x64
{88983F7C-DB65-9E04-84E7-05F8979E0383}.Debug|x64.Build.0 = Debug|x64
{88983F7C-DB65-9E04-84E7-05F8979E0383}.Release|x64.ActiveCfg = Release|x64
{88983F7C-DB65-9E04-84E7-05F8979E0383}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio Version 17
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BinaryBuilder - ConsoleApp", "BinaryBuilder_ConsoleApp.vcxproj", "{88983F7C-DB65-9E04-84E7-05F8979E0383}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{88983F7C-DB65-9E04-84E7-05F8979E0383}.Debug|x64.ActiveCfg = Debug|x64
{88983F7C-DB65-9E04-84E7-05F8979E0383}.Debug|x64.Build.0 = Debug|x64
{88983F7C-DB65-9E04-84E7-05F8979E0383}.Release|x64.ActiveCfg = Release|x64
{88983F7C-DB65-9E04-84E7-05F8979E0383}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,33 +1,33 @@
#pragma code_page(65001)
#ifdef JUCE_USER_DEFINED_RC_FILE
#include JUCE_USER_DEFINED_RC_FILE
#else
#undef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "Raw Material Software Limited\0"
VALUE "LegalCopyright", "Raw Material Software Limited\0"
VALUE "FileDescription", "BinaryBuilder\0"
VALUE "FileVersion", "1.0.0\0"
VALUE "ProductName", "BinaryBuilder\0"
VALUE "ProductVersion", "1.0.0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
#endif
#pragma code_page(65001)
#ifdef JUCE_USER_DEFINED_RC_FILE
#include JUCE_USER_DEFINED_RC_FILE
#else
#undef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "Raw Material Software Limited\0"
VALUE "LegalCopyright", "Raw Material Software Limited\0"
VALUE "FileDescription", "BinaryBuilder\0"
VALUE "FileVersion", "1.0.0\0"
VALUE "ProductName", "BinaryBuilder\0"
VALUE "ProductVersion", "1.0.0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
#endif

View File

@ -1,15 +1,15 @@
# ==============================================================================
#
# This file is part of the JUCE library.
# Copyright (c) 2020 - Raw Material Software Limited
# Copyright (c) 2022 - Raw Material Software Limited
#
# JUCE is an open source library subject to commercial or open-source
# licensing.
#
# By using JUCE, you agree to the terms of both the JUCE 6 End-User License
# Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
# By using JUCE, you agree to the terms of both the JUCE 7 End-User License
# Agreement and JUCE Privacy Policy.
#
# End User License Agreement: www.juce.com/juce-6-licence
# End User License Agreement: www.juce.com/juce-7-licence
# Privacy Policy: www.juce.com/juce-privacy-policy
#
# Or: You may also use this code under the terms of the GPL v3 (see

View File

@ -1,42 +1,42 @@
/*
IMPORTANT! This file is auto-generated each time you save your
project - if you alter its contents, your changes may be overwritten!
This is the header file that your files should include in order to get all the
JUCE library headers. You should avoid including the JUCE headers directly in
your own source files, because that wouldn't pick up the correct configuration
options for your app.
*/
#pragma once
#include <juce_core/juce_core.h>
#if defined (JUCE_PROJUCER_VERSION) && JUCE_PROJUCER_VERSION < JUCE_VERSION
/** If you've hit this error then the version of the Projucer that was used to generate this project is
older than the version of the JUCE modules being included. To fix this error, re-save your project
using the latest version of the Projucer or, if you aren't using the Projucer to manage your project,
remove the JUCE_PROJUCER_VERSION define.
*/
#error "This project was last saved using an outdated version of the Projucer! Re-save this project with the latest version to fix this error."
#endif
#if ! DONT_SET_USING_JUCE_NAMESPACE
// If your code uses a lot of JUCE classes, then this will obviously save you
// a lot of typing, but can be disabled by setting DONT_SET_USING_JUCE_NAMESPACE.
using namespace juce;
#endif
#if ! JUCE_DONT_DECLARE_PROJECTINFO
namespace ProjectInfo
{
const char* const projectName = "BinaryBuilder";
const char* const companyName = "Raw Material Software Limited";
const char* const versionString = "1.0.0";
const int versionNumber = 0x10000;
}
#endif
/*
IMPORTANT! This file is auto-generated each time you save your
project - if you alter its contents, your changes may be overwritten!
This is the header file that your files should include in order to get all the
JUCE library headers. You should avoid including the JUCE headers directly in
your own source files, because that wouldn't pick up the correct configuration
options for your app.
*/
#pragma once
#include <juce_core/juce_core.h>
#if defined (JUCE_PROJUCER_VERSION) && JUCE_PROJUCER_VERSION < JUCE_VERSION
/** If you've hit this error then the version of the Projucer that was used to generate this project is
older than the version of the JUCE modules being included. To fix this error, re-save your project
using the latest version of the Projucer or, if you aren't using the Projucer to manage your project,
remove the JUCE_PROJUCER_VERSION define.
*/
#error "This project was last saved using an outdated version of the Projucer! Re-save this project with the latest version to fix this error."
#endif
#if ! DONT_SET_USING_JUCE_NAMESPACE
// If your code uses a lot of JUCE classes, then this will obviously save you
// a lot of typing, but can be disabled by setting DONT_SET_USING_JUCE_NAMESPACE.
using namespace juce;
#endif
#if ! JUCE_DONT_DECLARE_PROJECTINFO
namespace ProjectInfo
{
const char* const projectName = "BinaryBuilder";
const char* const companyName = "Raw Material Software Limited";
const char* const versionString = "1.0.0";
const int versionNumber = 0x10000;
}
#endif

View File

@ -1,8 +1,8 @@
/*
IMPORTANT! This file is auto-generated each time you save your
project - if you alter its contents, your changes may be overwritten!
*/
#include <juce_core/juce_core.cpp>
/*
IMPORTANT! This file is auto-generated each time you save your
project - if you alter its contents, your changes may be overwritten!
*/
#include <juce_core/juce_core.cpp>

View File

@ -1,221 +1,221 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
By using JUCE, you agree to the terms of both the JUCE 6 End-User License
Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
End User License Agreement: www.juce.com/juce-6-licence
Privacy Policy: www.juce.com/juce-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses).
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
/*
==============================================================================
Utility to turn a bunch of binary files into a .cpp file and .h file full of
data so they can be built directly into an executable.
Use this code at your own risk! It carries no warranty!
==============================================================================
*/
#include <JuceHeader.h>
//==============================================================================
static int addFile (const File& file,
const String& classname,
OutputStream& headerStream,
OutputStream& cppStream)
{
MemoryBlock mb;
file.loadFileAsData (mb);
const String name (file.getFileName()
.replaceCharacter (' ', '_')
.replaceCharacter ('.', '_')
.retainCharacters ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789"));
std::cout << "Adding " << name << ": "
<< (int) mb.getSize() << " bytes" << std::endl;
headerStream << " extern const char* " << name << ";\r\n"
" const int " << name << "Size = "
<< (int) mb.getSize() << ";\r\n\r\n";
static int tempNum = 0;
cppStream << "static const unsigned char temp" << ++tempNum << "[] = {";
size_t i = 0;
const uint8* const data = (const uint8*) mb.getData();
while (i < mb.getSize() - 1)
{
if ((i % 40) != 39)
cppStream << (int) data[i] << ",";
else
cppStream << (int) data[i] << ",\r\n ";
++i;
}
cppStream << (int) data[i] << ",0,0};\r\n";
cppStream << "const char* " << classname << "::" << name
<< " = (const char*) temp" << tempNum << ";\r\n\r\n";
return (int) mb.getSize();
}
static bool isHiddenFile (const File& f, const File& root)
{
return f.getFileName().endsWithIgnoreCase (".scc")
|| f.getFileName() == ".svn"
|| f.getFileName().startsWithChar ('.')
|| (f.getSize() == 0 && ! f.isDirectory())
|| (f.getParentDirectory() != root && isHiddenFile (f.getParentDirectory(), root));
}
//==============================================================================
int main (int argc, char* argv[])
{
std::cout << std::endl << " BinaryBuilder! Visit www.juce.com for more info." << std::endl;
if (argc < 4 || argc > 5)
{
std::cout << " Usage: BinaryBuilder sourcedirectory targetdirectory targetclassname [optional wildcard pattern]\n\n"
" BinaryBuilder will find all files in the source directory, and encode them\n"
" into two files called (targetclassname).cpp and (targetclassname).h, which it\n"
" will write into the target directory supplied.\n\n"
" Any files in sub-directories of the source directory will be put into the\n"
" resultant class, but #ifdef'ed out using the name of the sub-directory (hard to\n"
" explain, but obvious when you try it...)\n";
return 0;
}
const File sourceDirectory (File::getCurrentWorkingDirectory()
.getChildFile (String (argv[1]).unquoted()));
if (! sourceDirectory.isDirectory())
{
std::cout << "Source directory doesn't exist: "
<< sourceDirectory.getFullPathName()
<< std::endl << std::endl;
return 0;
}
const File destDirectory (File::getCurrentWorkingDirectory()
.getChildFile (String (argv[2]).unquoted()));
if (! destDirectory.isDirectory())
{
std::cout << "Destination directory doesn't exist: "
<< destDirectory.getFullPathName() << std::endl << std::endl;
return 0;
}
String className (argv[3]);
className = className.trim();
const File headerFile (destDirectory.getChildFile (className).withFileExtension (".h"));
const File cppFile (destDirectory.getChildFile (className).withFileExtension (".cpp"));
std::cout << "Creating " << headerFile.getFullPathName()
<< " and " << cppFile.getFullPathName()
<< " from files in " << sourceDirectory.getFullPathName()
<< "..." << std::endl << std::endl;
auto files = sourceDirectory.findChildFiles (File::findFiles, true,
(argc > 4) ? argv[4] : "*");
if (files.isEmpty())
{
std::cout << "Didn't find any source files in: "
<< sourceDirectory.getFullPathName() << std::endl << std::endl;
return 0;
}
headerFile.deleteFile();
cppFile.deleteFile();
std::unique_ptr<OutputStream> header (headerFile.createOutputStream());
if (header == nullptr)
{
std::cout << "Couldn't open "
<< headerFile.getFullPathName() << " for writing" << std::endl << std::endl;
return 0;
}
std::unique_ptr<OutputStream> cpp (cppFile.createOutputStream());
if (cpp == nullptr)
{
std::cout << "Couldn't open "
<< cppFile.getFullPathName() << " for writing" << std::endl << std::endl;
return 0;
}
*header << "/* (Auto-generated binary data file). */\r\n\r\n"
"#pragma once\r\n\r\n"
"namespace " << className << "\r\n"
"{\r\n";
*cpp << "/* (Auto-generated binary data file). */\r\n\r\n"
"#include \"" << className << ".h\"\r\n\r\n";
int totalBytes = 0;
for (int i = 0; i < files.size(); ++i)
{
const File file (files[i]);
// (avoid source control files and hidden files..)
if (! isHiddenFile (file, sourceDirectory))
{
if (file.getParentDirectory() != sourceDirectory)
{
*header << " #ifdef " << file.getParentDirectory().getFileName().toUpperCase() << "\r\n";
*cpp << "#ifdef " << file.getParentDirectory().getFileName().toUpperCase() << "\r\n";
totalBytes += addFile (file, className, *header, *cpp);
*header << " #endif\r\n";
*cpp << "#endif\r\n";
}
else
{
totalBytes += addFile (file, className, *header, *cpp);
}
}
}
*header << "}\r\n";
header = nullptr;
cpp = nullptr;
std::cout << std::endl << " Total size of binary data: " << totalBytes << " bytes" << std::endl;
return 0;
}
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
By using JUCE, you agree to the terms of both the JUCE 7 End-User License
Agreement and JUCE Privacy Policy.
End User License Agreement: www.juce.com/juce-7-licence
Privacy Policy: www.juce.com/juce-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses).
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
/*
==============================================================================
Utility to turn a bunch of binary files into a .cpp file and .h file full of
data so they can be built directly into an executable.
Use this code at your own risk! It carries no warranty!
==============================================================================
*/
#include <JuceHeader.h>
//==============================================================================
static int addFile (const File& file,
const String& classname,
OutputStream& headerStream,
OutputStream& cppStream)
{
MemoryBlock mb;
file.loadFileAsData (mb);
const String name (file.getFileName()
.replaceCharacter (' ', '_')
.replaceCharacter ('.', '_')
.retainCharacters ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789"));
std::cout << "Adding " << name << ": "
<< (int) mb.getSize() << " bytes" << std::endl;
headerStream << " extern const char* " << name << ";\r\n"
" const int " << name << "Size = "
<< (int) mb.getSize() << ";\r\n\r\n";
static int tempNum = 0;
cppStream << "static const unsigned char temp" << ++tempNum << "[] = {";
size_t i = 0;
const uint8* const data = (const uint8*) mb.getData();
while (i < mb.getSize() - 1)
{
if ((i % 40) != 39)
cppStream << (int) data[i] << ",";
else
cppStream << (int) data[i] << ",\r\n ";
++i;
}
cppStream << (int) data[i] << ",0,0};\r\n";
cppStream << "const char* " << classname << "::" << name
<< " = (const char*) temp" << tempNum << ";\r\n\r\n";
return (int) mb.getSize();
}
static bool isHiddenFile (const File& f, const File& root)
{
return f.getFileName().endsWithIgnoreCase (".scc")
|| f.getFileName() == ".svn"
|| f.getFileName().startsWithChar ('.')
|| (f.getSize() == 0 && ! f.isDirectory())
|| (f.getParentDirectory() != root && isHiddenFile (f.getParentDirectory(), root));
}
//==============================================================================
int main (int argc, char* argv[])
{
std::cout << std::endl << " BinaryBuilder! Visit www.juce.com for more info." << std::endl;
if (argc < 4 || argc > 5)
{
std::cout << " Usage: BinaryBuilder sourcedirectory targetdirectory targetclassname [optional wildcard pattern]\n\n"
" BinaryBuilder will find all files in the source directory, and encode them\n"
" into two files called (targetclassname).cpp and (targetclassname).h, which it\n"
" will write into the target directory supplied.\n\n"
" Any files in sub-directories of the source directory will be put into the\n"
" resultant class, but #ifdef'ed out using the name of the sub-directory (hard to\n"
" explain, but obvious when you try it...)\n";
return 0;
}
const File sourceDirectory (File::getCurrentWorkingDirectory()
.getChildFile (String (argv[1]).unquoted()));
if (! sourceDirectory.isDirectory())
{
std::cout << "Source directory doesn't exist: "
<< sourceDirectory.getFullPathName()
<< std::endl << std::endl;
return 0;
}
const File destDirectory (File::getCurrentWorkingDirectory()
.getChildFile (String (argv[2]).unquoted()));
if (! destDirectory.isDirectory())
{
std::cout << "Destination directory doesn't exist: "
<< destDirectory.getFullPathName() << std::endl << std::endl;
return 0;
}
String className (argv[3]);
className = className.trim();
const File headerFile (destDirectory.getChildFile (className).withFileExtension (".h"));
const File cppFile (destDirectory.getChildFile (className).withFileExtension (".cpp"));
std::cout << "Creating " << headerFile.getFullPathName()
<< " and " << cppFile.getFullPathName()
<< " from files in " << sourceDirectory.getFullPathName()
<< "..." << std::endl << std::endl;
auto files = sourceDirectory.findChildFiles (File::findFiles, true,
(argc > 4) ? argv[4] : "*");
if (files.isEmpty())
{
std::cout << "Didn't find any source files in: "
<< sourceDirectory.getFullPathName() << std::endl << std::endl;
return 0;
}
headerFile.deleteFile();
cppFile.deleteFile();
std::unique_ptr<OutputStream> header (headerFile.createOutputStream());
if (header == nullptr)
{
std::cout << "Couldn't open "
<< headerFile.getFullPathName() << " for writing" << std::endl << std::endl;
return 0;
}
std::unique_ptr<OutputStream> cpp (cppFile.createOutputStream());
if (cpp == nullptr)
{
std::cout << "Couldn't open "
<< cppFile.getFullPathName() << " for writing" << std::endl << std::endl;
return 0;
}
*header << "/* (Auto-generated binary data file). */\r\n\r\n"
"#pragma once\r\n\r\n"
"namespace " << className << "\r\n"
"{\r\n";
*cpp << "/* (Auto-generated binary data file). */\r\n\r\n"
"#include \"" << className << ".h\"\r\n\r\n";
int totalBytes = 0;
for (int i = 0; i < files.size(); ++i)
{
const File file (files[i]);
// (avoid source control files and hidden files..)
if (! isHiddenFile (file, sourceDirectory))
{
if (file.getParentDirectory() != sourceDirectory)
{
*header << " #ifdef " << file.getParentDirectory().getFileName().toUpperCase() << "\r\n";
*cpp << "#ifdef " << file.getParentDirectory().getFileName().toUpperCase() << "\r\n";
totalBytes += addFile (file, className, *header, *cpp);
*header << " #endif\r\n";
*cpp << "#endif\r\n";
}
else
{
totalBytes += addFile (file, className, *header, *cpp);
}
}
}
*header << "}\r\n";
header = nullptr;
cpp = nullptr;
std::cout << std::endl << " Total size of binary data: " << totalBytes << " bytes" << std::endl;
return 0;
}