Browse Source

Introjucer: refactored some functions and made it add "--no-undefined" to linux VST makefile linker settings.

tags/2021-05-28
jules 10 years ago
parent
commit
43ce64a099
13 changed files with 56 additions and 63 deletions
  1. +2
    -2
      examples/audio plugin demo/Builds/Linux/Makefile
  2. +4
    -10
      extras/Introjucer/Source/ComponentEditor/jucer_GeneratedCode.cpp
  3. +1
    -5
      extras/Introjucer/Source/ComponentEditor/jucer_JucerDocument.cpp
  4. +3
    -4
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h
  5. +8
    -15
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_CodeBlocks.h
  6. +1
    -2
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h
  7. +13
    -5
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h
  8. +5
    -9
      extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h
  9. +4
    -3
      extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h
  10. +5
    -2
      extras/Introjucer/Source/Project/jucer_AudioPluginModule.h
  11. +2
    -2
      extras/Introjucer/Source/Project/jucer_Module.cpp
  12. +6
    -4
      extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp
  13. +2
    -0
      extras/Introjucer/Source/Utility/jucer_MiscUtilities.h

+ 2
- 2
examples/audio plugin demo/Builds/Linux/Makefile View File

@@ -21,7 +21,7 @@ ifeq ($(CONFIG),Debug)
CPPFLAGS := $(DEPFLAGS) -std=c++11 -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "JUCE_APP_VERSION=1.0.0" -D "JUCE_APP_VERSION_HEX=0x10000" -I /usr/include -I /usr/include/freetype2 -I ~/SDKs/VST3\ SDK -I ~/SDKs/vstsdk2.4 -I ../../JuceLibraryCode -I ../../../../modules
CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -ggdb -fPIC -O0
CXXFLAGS += $(CFLAGS)
LDFLAGS += $(TARGET_ARCH) -L$(BINDIR) -L$(LIBDIR) -shared -L/usr/X11R6/lib/ -lX11 -lXext -lXinerama -lasound -ldl -lfreetype -lpthread -lrt
LDFLAGS += $(TARGET_ARCH) -L$(BINDIR) -L$(LIBDIR) --no-undefined -shared -L/usr/X11R6/lib/ -lX11 -lXext -lXinerama -lasound -ldl -lfreetype -lpthread -lrt
TARGET := JuceDemoPlugin.so
BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH)
@@ -41,7 +41,7 @@ ifeq ($(CONFIG),Release)
CPPFLAGS := $(DEPFLAGS) -std=c++11 -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "JUCE_APP_VERSION=1.0.0" -D "JUCE_APP_VERSION_HEX=0x10000" -I /usr/include -I /usr/include/freetype2 -I ~/SDKs/VST3\ SDK -I ~/SDKs/vstsdk2.4 -I ../../JuceLibraryCode -I ../../../../modules
CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -fPIC -Os
CXXFLAGS += $(CFLAGS)
LDFLAGS += $(TARGET_ARCH) -L$(BINDIR) -L$(LIBDIR) -shared -fvisibility=hidden -L/usr/X11R6/lib/ -lX11 -lXext -lXinerama -lasound -ldl -lfreetype -lpthread -lrt
LDFLAGS += $(TARGET_ARCH) -L$(BINDIR) -L$(LIBDIR) --no-undefined -shared -fvisibility=hidden -L/usr/X11R6/lib/ -lX11 -lXext -lXinerama -lasound -ldl -lfreetype -lpthread -lrt
TARGET := JuceDemoPlugin.so
BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH)


+ 4
- 10
extras/Introjucer/Source/ComponentEditor/jucer_GeneratedCode.cpp View File

@@ -164,9 +164,7 @@ String GeneratedCode::getClassDeclaration() const
parentClassLines.addTokens (parentClasses, ",", StringRef());
parentClassLines.addArray (getExtraParentClasses());
parentClassLines.trim();
parentClassLines.removeEmptyStrings();
parentClassLines.removeDuplicates (false);
parentClassLines = getCleanedStringArray (parentClassLines);
if (parentClassLines.contains ("public Button", false))
parentClassLines.removeString ("public Component", false);
@@ -186,9 +184,7 @@ String GeneratedCode::getInitialiserList() const
if (parentClassInitialiser.isNotEmpty())
inits.insert (0, parentClassInitialiser);
inits.trim();
inits.removeEmptyStrings();
inits.removeDuplicates (false);
inits = getCleanedStringArray (inits);
String s;
@@ -217,12 +213,10 @@ String GeneratedCode::getInitialiserList() const
static String getIncludeFileCode (StringArray files)
{
files.trim();
files.removeEmptyStrings();
files.removeDuplicates (false);
String s;
files = getCleanedStringArray (files);
for (int i = 0; i < files.size(); ++i)
s << "#include \"" << files[i] << "\"\n";


+ 1
- 5
extras/Introjucer/Source/ComponentEditor/jucer_JucerDocument.cpp View File

@@ -158,11 +158,7 @@ void JucerDocument::setParentClasses (const String& classes)
{
if (classes != parentClasses)
{
StringArray parentClassLines;
parentClassLines.addTokens (classes, ",", StringRef());
parentClassLines.trim();
parentClassLines.removeEmptyStrings();
parentClassLines.removeDuplicates (false);
StringArray parentClassLines (getCleanedStringArray (StringArray::fromTokens (classes, ",", StringRef())));
for (int i = parentClassLines.size(); --i >= 0;)
{


+ 3
- 4
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h View File

@@ -336,9 +336,7 @@ private:
if (getInternetNeeded()) s.add ("android.permission.INTERNET");
if (getAudioRecordNeeded()) s.add ("android.permission.RECORD_AUDIO");
s.trim();
s.removeDuplicates (false);
return s;
return getCleanedStringArray (s);
}
//==============================================================================
@@ -557,7 +555,8 @@ private:
String flags;
StringArray searchPaths (extraSearchPaths);
searchPaths.addArray (config.getHeaderSearchPaths());
searchPaths.removeDuplicates (false);
searchPaths = getCleanedStringArray (searchPaths);
for (int i = 0; i < searchPaths.size(); ++i)
flags << " -I " << FileHelpers::unixStylePath (replacePreprocessorTokens (config, searchPaths[i])).quoted();


+ 8
- 15
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_CodeBlocks.h View File

@@ -95,7 +95,8 @@ public:
bool canLaunchProject() override { return false; }
bool launchProject() override { return false; }
bool isCodeBlocksWindows() const override { return os == windowsTarget; }
bool isCodeBlocksLinux() const override { return os == linuxTarget; }
bool isCodeBlocksLinux() const override { return isLinux(); }
bool isLinux() const override { return os == linuxTarget; }
bool usesMMFiles() const override { return false; }
bool canCopeWithDuplicateFiles() override { return false; }
@@ -153,14 +154,6 @@ private:
xml.createNewChildElement ("Option")->setAttribute ("compiler", "gcc");
}
static StringArray cleanArray (StringArray s)
{
s.trim();
s.removeDuplicates (false);
s.removeEmptyStrings (true);
return s;
}
StringArray getDefines (const BuildConfiguration& config) const
{
StringPairArray defines;
@@ -191,7 +184,7 @@ private:
for (int i = 0; i < defines.size(); ++i)
defs.add (defines.getAllKeys()[i] + "=" + defines.getAllValues()[i]);
return cleanArray (defs);
return getCleanedStringArray (defs);
}
StringArray getCompilerFlags (const BuildConfiguration& config) const
@@ -221,12 +214,12 @@ private:
}
}
return cleanArray (flags);
return getCleanedStringArray (flags);
}
StringArray getLinkerFlags (const BuildConfiguration& config) const
{
StringArray flags;
StringArray flags (makefileExtraLinkerFlags);
if (! config.isDebug())
flags.add ("-s");
@@ -234,7 +227,7 @@ private:
flags.addTokens (replacePreprocessorTokens (config, getExtraLinkerFlagsString()).trim(),
" \n", "\"'");
return cleanArray (flags);
return getCleanedStringArray (flags);
}
StringArray getIncludePaths (const BuildConfiguration& config) const
@@ -250,7 +243,7 @@ private:
if (! isCodeBlocksWindows())
paths.add ("/usr/include/freetype2");
return cleanArray (paths);
return getCleanedStringArray (paths);
}
static int getTypeIndex (const ProjectType& type)
@@ -360,7 +353,7 @@ private:
libs.addTokens (getExternalLibrariesString(), ";\n", "\"'");
libs = cleanArray (libs);
libs = getCleanedStringArray (libs);
for (int i = 0; i < libs.size(); ++i)
setAddOption (*linker, "library", replacePreprocessorDefs (getAllPreprocessorDefs(), libs[i]));


+ 1
- 2
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h View File

@@ -291,8 +291,7 @@ protected:
{
StringArray searchPaths (extraSearchPaths);
searchPaths.addArray (config.getHeaderSearchPaths());
searchPaths.removeDuplicates (false);
return searchPaths;
return getCleanedStringArray (searchPaths);
}
virtual String createConfigName (const BuildConfiguration& config) const


+ 13
- 5
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h View File

@@ -52,6 +52,7 @@ public:
bool launchProject() override { return false; }
bool usesMMFiles() const override { return false; }
bool isLinuxMakefile() const override { return true; }
bool isLinux() const override { return true; }
bool canCopeWithDuplicateFiles() override { return false; }
void createExporterProperties (PropertyListBuilder&) override
@@ -147,7 +148,7 @@ private:
searchPaths.insert (0, "/usr/include/freetype2");
searchPaths.insert (0, "/usr/include");
searchPaths.removeDuplicates (false);
searchPaths = getCleanedStringArray (searchPaths);
for (int i = 0; i < searchPaths.size(); ++i)
out << " -I " << escapeSpaces (FileHelpers::unixStylePath (replacePreprocessorTokens (config, searchPaths[i])));
@@ -165,11 +166,18 @@ private:
{
out << " LDFLAGS += $(TARGET_ARCH) -L$(BINDIR) -L$(LIBDIR)";
if (makefileIsDLL)
out << " -shared";
{
StringArray flags (makefileExtraLinkerFlags);
if (makefileIsDLL)
flags.add ("-shared");
if (! config.isDebug())
out << " -fvisibility=hidden";
if (! config.isDebug())
flags.add ("-fvisibility=hidden");
if (flags.size() > 0)
out << " " << getCleanedStringArray (flags).joinIntoString (" ");
}
out << config.getGCCLibraryPathFlags();


+ 5
- 9
extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h View File

@@ -661,8 +661,8 @@ private:
StringArray paths (extraSearchPaths);
paths.addArray (config.getHeaderSearchPaths());
paths.add ("$(inherited)");
paths.removeDuplicates (false);
paths.removeEmptyStrings();
paths = getCleanedStringArray (paths);
for (int i = 0; i < paths.size(); ++i)
{
@@ -723,8 +723,7 @@ private:
for (int i = 0; i < xcodeLibs.size(); ++i)
flags.add (getLinkerFlagForLib (xcodeLibs[i]));
flags.removeEmptyStrings (true);
flags.removeDuplicates (false);
flags = getCleanedStringArray (flags);
}
StringArray getProjectSettings (const XcodeBuildConfiguration& config) const
@@ -876,7 +875,7 @@ private:
s.add ("OTHER_LDFLAGS = \"" + linkerFlags.joinIntoString (" ") + "\"");
librarySearchPaths.addArray (config.getLibrarySearchPaths());
librarySearchPaths.removeDuplicates (false);
librarySearchPaths = getCleanedStringArray (librarySearchPaths);
if (librarySearchPaths.size() > 0)
{
@@ -926,11 +925,8 @@ private:
}
s.addTokens (config.getCustomXcodeFlags(), ",", "\"'");
s.trim();
s.removeEmptyStrings();
s.removeDuplicates (false);
return s;
return getCleanedStringArray (s);
}
void addFrameworks() const


+ 4
- 3
extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h View File

@@ -68,10 +68,11 @@ public:
virtual int getVisualStudioVersion() const { return 0; }
virtual bool isCodeBlocksWindows() const { return false; }
virtual bool isCodeBlocksLinux() const { return false; }
virtual bool isLinuxMakefile() const { return false; }
virtual bool isAndroid() const { return false; }
virtual bool isWindows() const { return false; }
virtual bool isLinuxMakefile() const { return false; }
virtual bool isLinux() const { return false; }
virtual bool isOSX() const { return false; }
bool mayCompileOnCurrentOS() const
@@ -81,7 +82,7 @@ public:
#elif JUCE_WINDOWS
return isWindows() || isAndroid();
#elif JUCE_LINUX
return isLinuxMakefile() || isCodeBlocksLinux() || isAndroid();
return isLinux() || isAndroid();
#else
#error
#endif
@@ -173,7 +174,7 @@ public:
//==============================================================================
String makefileTargetSuffix;
bool makefileIsDLL;
StringArray linuxLibs;
StringArray linuxLibs, makefileExtraLinkerFlags;
//==============================================================================
String msvcTargetSuffix;


+ 5
- 2
extras/Introjucer/Source/Project/jucer_AudioPluginModule.h View File

@@ -243,7 +243,7 @@ namespace VSTHelpers
if (exporter.isVisualStudio())
exporter.extraSearchPaths.add (path.toWindowsStyle());
else if (exporter.isLinuxMakefile() || exporter.isCodeBlocksLinux() || exporter.isXcode())
else if (exporter.isLinux() || exporter.isXcode())
exporter.extraSearchPaths.insert (0, path.toUnixStyle());
}
}
@@ -282,7 +282,7 @@ namespace VSTHelpers
if (exporter.isWindows())
exporter.extraSearchPaths.add (juceWrapperFolder.toWindowsStyle());
else if (exporter.isLinuxMakefile() || exporter.isCodeBlocksLinux() )
else if (exporter.isLinux())
exporter.extraSearchPaths.add (juceWrapperFolder.toUnixStyle());
if (exporter.isVisualStudio())
@@ -305,6 +305,9 @@ namespace VSTHelpers
config->getValue (Ids::postbuildCommand) = "copy /Y \"$(OutDir)\\$(TargetFileName)\" \"$(OutDir)\\$(TargetName).vst3\"";
}
}
if (exporter.isLinux())
exporter.makefileExtraLinkerFlags.add ("--no-undefined");
}
static inline void createPropertyEditors (ProjectExporter& exporter, PropertyListBuilder& props, bool isVST3)


+ 2
- 2
extras/Introjucer/Source/Project/jucer_Module.cpp View File

@@ -370,7 +370,7 @@ void LibraryModule::prepareExporter (ProjectExporter& exporter, ProjectSaver& pr
parseAndAddLibs (exporter.xcodeLibs, moduleInfo.moduleInfo [exporter.isOSX() ? "OSXLibs" : "iOSLibs"].toString());
}
else if (exporter.isLinuxMakefile() || exporter.isCodeBlocksLinux())
else if (exporter.isLinux())
{
parseAndAddLibs (exporter.linuxLibs, moduleInfo.moduleInfo ["LinuxLibs"].toString());
}
@@ -501,7 +501,7 @@ static bool fileTargetMatches (ProjectExporter& exporter, const String& target)
return exporterTargetMatches ("xcode", target);
if (exporter.isWindows())
return exporterTargetMatches ("msvc", target);
if (exporter.isLinuxMakefile() || exporter.isCodeBlocksLinux())
if (exporter.isLinux())
return exporterTargetMatches ("linux", target);
if (exporter.isAndroid())
return exporterTargetMatches ("android", target);


+ 6
- 4
extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp View File

@@ -165,16 +165,18 @@ StringArray getSearchPathsFromString (const String& searchPath)
{
StringArray s;
s.addTokens (searchPath, ";\r\n", StringRef());
s.trim();
s.removeEmptyStrings();
s.removeDuplicates (false);
return s;
return getCleanedStringArray (s);
}
StringArray getCommaOrWhitespaceSeparatedItems (const String& sourceString)
{
StringArray s;
s.addTokens (sourceString, ", \t\r\n", StringRef());
return getCleanedStringArray (s);
}
StringArray getCleanedStringArray (StringArray s)
{
s.trim();
s.removeEmptyStrings();
s.removeDuplicates (false);


+ 2
- 0
extras/Introjucer/Source/Utility/jucer_MiscUtilities.h View File

@@ -56,6 +56,8 @@ void showSVGPathDataToolWindow (ScopedPointer<Component>& ownerPointer);
bool cancelAnyModalComponents();
bool reinvokeCommandAfterCancellingModalComps (const ApplicationCommandTarget::InvocationInfo&);
StringArray getCleanedStringArray (StringArray);
//==============================================================================
class RolloverHelpComp : public Component,
private Timer


Loading…
Cancel
Save