From 4e1a9f6526102726989f04ef8ac102f7ff493ad0 Mon Sep 17 00:00:00 2001 From: jules Date: Sat, 31 Mar 2012 16:41:05 +0100 Subject: [PATCH] better double comparisons for var. Fix for VS2005/VS2010 RTAS exporting. Minor GL cleanups and project updates. --- .../Project Saving/jucer_ProjectExport_MSVC.h | 3 ++ .../Project Saving/jucer_ProjectExporter.h | 9 ++-- .../Source/Project/jucer_AudioPluginModule.h | 45 +++++++++++-------- .../Juce Demo.xcodeproj/project.pbxproj | 2 + .../MacOSX/juce.xcodeproj/project.pbxproj | 2 +- modules/juce_core/containers/juce_Variant.cpp | 2 +- .../juce_opengl/native/juce_OpenGL_android.h | 22 ++------- modules/juce_opengl/native/juce_OpenGL_ios.h | 4 +- .../juce_opengl/native/juce_OpenGL_linux.h | 3 +- .../juce_opengl/native/juce_OpenGL_win32.h | 26 +++-------- 10 files changed, 50 insertions(+), 68 deletions(-) diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h index 87d356df75..cf9aeeea16 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h @@ -494,6 +494,7 @@ public: static const char* getName() { return "Visual Studio 2008"; } static const char* getValueTreeTypeName() { return "VS2008"; } + int getVisualStudioVersion() const { return 9; } void launchProject() { getSLNFile().startAsProcess(); } @@ -846,6 +847,7 @@ public: static const char* getName() { return "Visual Studio 2005"; } static const char* getValueTreeTypeName() { return "VS2005"; } + int getVisualStudioVersion() const { return 8; } int getLaunchPreferenceOrderForCurrentOS() { @@ -883,6 +885,7 @@ public: static const char* getName() { return "Visual Studio 2010"; } static const char* getValueTreeTypeName() { return "VS2010"; } + int getVisualStudioVersion() const { return 10; } int getLaunchPreferenceOrderForCurrentOS() { diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h index 4bb17b2155..177c7ea72b 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h @@ -59,10 +59,11 @@ public: virtual bool shouldFileBeCompiledByDefault (const RelativePath& path) const; virtual bool canCopeWithDuplicateFiles() = 0; - virtual bool isXcode() const { return false; } - virtual bool isVisualStudio() const { return false; } - virtual bool isLinux() const { return false; } - virtual bool isOSX() const { return false; } + virtual bool isXcode() const { return false; } + virtual bool isVisualStudio() const { return false; } + virtual int getVisualStudioVersion() const { return 0; } + virtual bool isLinux() const { return false; } + virtual bool isOSX() const { return false; } //============================================================================== String getName() const { return name; } diff --git a/extras/Introjucer/Source/Project/jucer_AudioPluginModule.h b/extras/Introjucer/Source/Project/jucer_AudioPluginModule.h index 72912cdb62..cbbc82f1aa 100644 --- a/extras/Introjucer/Source/Project/jucer_AudioPluginModule.h +++ b/extras/Introjucer/Source/Project/jucer_AudioPluginModule.h @@ -302,24 +302,27 @@ namespace RTASHelpers { fixMissingRTASValues (exporter); - exporter.xcodeCanUseDwarf = false; - - exporter.msvcTargetSuffix = ".dpm"; - exporter.msvcNeedsDLLRuntimeLib = true; - - exporter.msvcExtraPreprocessorDefs.set ("JucePlugin_WinBag_path", - CodeHelpers::addEscapeChars (getRTASFolderRelativePath (exporter) - .getChildFile ("WinBag") - .toWindowsStyle()).quoted()); - - String msvcPathToRTASFolder (exporter.getJucePathFromTargetFolder() - .getChildFile ("juce_audio_plugin_client/RTAS") - .toWindowsStyle() + "\\"); - - exporter.msvcDelayLoadedDLLs = "DAE.dll; DigiExt.dll; DSI.dll; PluginLib.dll; DSPManager.dll"; - if (exporter.isVisualStudio()) { + exporter.msvcTargetSuffix = ".dpm"; + exporter.msvcNeedsDLLRuntimeLib = true; + + String winbag (CodeHelpers::addEscapeChars (getRTASFolderRelativePath (exporter) + .getChildFile ("WinBag") + .toWindowsStyle()).quoted()); + + // (VS10 automatically adds escape characters to the quotes for this definition) + winbag = (exporter.getVisualStudioVersion() < 10) ? CodeHelpers::addEscapeChars (winbag.quoted()) + : CodeHelpers::addEscapeChars (winbag).quoted(); + + exporter.msvcExtraPreprocessorDefs.set ("JucePlugin_WinBag_path", winbag); + + String msvcPathToRTASFolder (exporter.getJucePathFromTargetFolder() + .getChildFile ("juce_audio_plugin_client/RTAS") + .toWindowsStyle() + "\\"); + + exporter.msvcDelayLoadedDLLs = "DAE.dll; DigiExt.dll; DSI.dll; PluginLib.dll; DSPManager.dll"; + if (! exporter.getExtraLinkerFlags().toString().contains ("/FORCE:multiple")) exporter.getExtraLinkerFlags() = exporter.getExtraLinkerFlags().toString() + " /FORCE:multiple"; @@ -332,10 +335,14 @@ namespace RTASHelpers + "\" \"$(TargetPath)\".rsr"; } } + else + { + exporter.xcodeCanUseDwarf = false; - RelativePath rtasFolder (getRTASFolder (exporter).toString(), RelativePath::projectFolder); - exporter.xcodeExtraLibrariesDebug.add (rtasFolder.getChildFile ("MacBag/Libs/Debug/libPluginLibrary.a")); - exporter.xcodeExtraLibrariesRelease.add (rtasFolder.getChildFile ("MacBag/Libs/Release/libPluginLibrary.a")); + RelativePath rtasFolder (getRTASFolder (exporter).toString(), RelativePath::projectFolder); + exporter.xcodeExtraLibrariesDebug.add (rtasFolder.getChildFile ("MacBag/Libs/Debug/libPluginLibrary.a")); + exporter.xcodeExtraLibrariesRelease.add (rtasFolder.getChildFile ("MacBag/Libs/Release/libPluginLibrary.a")); + } writePluginCharacteristicsFile (projectSaver); diff --git a/extras/JuceDemo/Builds/MacOSX/Juce Demo.xcodeproj/project.pbxproj b/extras/JuceDemo/Builds/MacOSX/Juce Demo.xcodeproj/project.pbxproj index 1703ccc3a0..a7ff8560a7 100644 --- a/extras/JuceDemo/Builds/MacOSX/Juce Demo.xcodeproj/project.pbxproj +++ b/extras/JuceDemo/Builds/MacOSX/Juce Demo.xcodeproj/project.pbxproj @@ -514,6 +514,7 @@ 7FC1A0B1663AC9262104D715 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_KeyListener.h"; path = "../../../../modules/juce_gui_basics/keyboard/juce_KeyListener.h"; sourceTree = "SOURCE_ROOT"; }; 8042D0D2B38EBD19652CBA55 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_OldSchoolLookAndFeel.cpp"; path = "../../../../modules/juce_gui_extra/lookandfeel/juce_OldSchoolLookAndFeel.cpp"; sourceTree = "SOURCE_ROOT"; }; 805B94425CD56EA78E0A705B = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AudioDemoPlaybackPage.h; path = ../../Source/demos/AudioDemoPlaybackPage.h; sourceTree = "SOURCE_ROOT"; }; + 80945993EC383052DA7BB92D = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_OpenGLRenderer.h"; path = "../../../../modules/juce_opengl/opengl/juce_OpenGLRenderer.h"; sourceTree = "SOURCE_ROOT"; }; 80E7D8D4E601BCC20054475E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ActionBroadcaster.h"; path = "../../../../modules/juce_events/broadcasters/juce_ActionBroadcaster.h"; sourceTree = "SOURCE_ROOT"; }; 80EEC26431102B212C9F873B = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_PathIterator.cpp"; path = "../../../../modules/juce_graphics/geometry/juce_PathIterator.cpp"; sourceTree = "SOURCE_ROOT"; }; 814313374CD209A40282985E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_PluginDescription.h"; path = "../../../../modules/juce_audio_processors/processors/juce_PluginDescription.h"; sourceTree = "SOURCE_ROOT"; }; @@ -1909,6 +1910,7 @@ 17422D876DAAF091ED089B8D, AAAA086F74F507C87200AD2E, B81FA2ED22BCC03D124031ED, + 80945993EC383052DA7BB92D, 58864C3D7F369EBE01E42C5C, 8EEB4DEB11F3DF01BA6F7528, FE9A5898294228EB7F439951, diff --git a/extras/static library/Builds/MacOSX/juce.xcodeproj/project.pbxproj b/extras/static library/Builds/MacOSX/juce.xcodeproj/project.pbxproj index dd606731ed..5eae8dbfd5 100644 --- a/extras/static library/Builds/MacOSX/juce.xcodeproj/project.pbxproj +++ b/extras/static library/Builds/MacOSX/juce.xcodeproj/project.pbxproj @@ -611,7 +611,7 @@ B9E3D8A5B69F14C6404E2AB2 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_android_SystemStats.cpp"; path = "../../../../modules/juce_core/native/juce_android_SystemStats.cpp"; sourceTree = "SOURCE_ROOT"; }; BA94000B8C2FCD758F5152FC = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Path.h"; path = "../../../../modules/juce_graphics/geometry/juce_Path.h"; sourceTree = "SOURCE_ROOT"; }; BAF325E9748B0670F34129BE = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_FileInputStream.h"; path = "../../../../modules/juce_core/files/juce_FileInputStream.h"; sourceTree = "SOURCE_ROOT"; }; - BB3752B34C9A609E300D679B = { isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = sourcecode.c.h; sourceTree = "BUILT_PRODUCTS_DIR"; }; + BB3752B34C9A609E300D679B = { isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libjucedebug.a; sourceTree = "BUILT_PRODUCTS_DIR"; }; BBB6077B7D799C2FD4187355 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_PathStrokeType.cpp"; path = "../../../../modules/juce_graphics/geometry/juce_PathStrokeType.cpp"; sourceTree = "SOURCE_ROOT"; }; BC2411690315F3F1612A9A13 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_linux_Windowing.cpp"; path = "../../../../modules/juce_gui_basics/native/juce_linux_Windowing.cpp"; sourceTree = "SOURCE_ROOT"; }; BCA1200B13A683E6A3DC3CEB = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_FileSearchPath.h"; path = "../../../../modules/juce_core/files/juce_FileSearchPath.h"; sourceTree = "SOURCE_ROOT"; }; diff --git a/modules/juce_core/containers/juce_Variant.cpp b/modules/juce_core/containers/juce_Variant.cpp index af09205b65..70299cafb3 100644 --- a/modules/juce_core/containers/juce_Variant.cpp +++ b/modules/juce_core/containers/juce_Variant.cpp @@ -147,7 +147,7 @@ public: bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept { - return otherType.toDouble (otherData) == data.doubleValue; + return std::abs (otherType.toDouble (otherData) - data.doubleValue) < std::numeric_limits::epsilon(); } void writeToStream (const ValueUnion& data, OutputStream& output) const diff --git a/modules/juce_opengl/native/juce_OpenGL_android.h b/modules/juce_opengl/native/juce_OpenGL_android.h index 4a96f9143a..d75fa83ebf 100644 --- a/modules/juce_opengl/native/juce_OpenGL_android.h +++ b/modules/juce_opengl/native/juce_OpenGL_android.h @@ -63,13 +63,8 @@ public: glView.clear(); } - void initialiseOnRenderThread() - { - } - - void shutdownOnRenderThread() - { - } + void initialiseOnRenderThread() {} + void shutdownOnRenderThread() {} bool makeActive() const noexcept { return isInsideGLCallback; } bool isActive() const noexcept { return isInsideGLCallback; } @@ -93,10 +88,6 @@ public: } } - void contextChangedSize() - { - } - void triggerRepaint() { glView.callVoidMethod (OpenGLView.requestRender); @@ -104,6 +95,7 @@ public: //============================================================================== void contextCreatedCallback(); + void contextChangedSize() {} void renderCallback(); //============================================================================== @@ -168,16 +160,10 @@ JUCE_JNI_CALLBACK (GL_VIEW_CLASS_NAME, contextCreated, void, (JNIEnv* env, jobje threadLocalJNIEnvHolder.getOrAttach(); OpenGLContext::NativeContext* const context = OpenGLContext::NativeContext::findContextFor (env, view); + jassert (context != nullptr); if (context != nullptr) - { context->contextCreatedCallback(); - JUCE_CHECK_OPENGL_ERROR - } - else - { - jassertfalse; - } } JUCE_JNI_CALLBACK (GL_VIEW_CLASS_NAME, contextChangedSize, void, (JNIEnv* env, jobject view)) diff --git a/modules/juce_opengl/native/juce_OpenGL_ios.h b/modules/juce_opengl/native/juce_OpenGL_ios.h index 0622da7c29..1bd3fd5a06 100644 --- a/modules/juce_opengl/native/juce_OpenGL_ios.h +++ b/modules/juce_opengl/native/juce_OpenGL_ios.h @@ -93,9 +93,7 @@ public: [view release]; } - void initialiseOnRenderThread() - { - } + void initialiseOnRenderThread() {} void shutdownOnRenderThread() { diff --git a/modules/juce_opengl/native/juce_OpenGL_linux.h b/modules/juce_opengl/native/juce_OpenGL_linux.h index 0a467440c9..2121ce6291 100644 --- a/modules/juce_opengl/native/juce_OpenGL_linux.h +++ b/modules/juce_opengl/native/juce_OpenGL_linux.h @@ -142,7 +142,8 @@ public: ScopedXLock xlock; XMoveResizeWindow (display, embeddedWindow, bounds.getX(), bounds.getY(), - jmax (1, bounds.getWidth()), jmax (1, bounds.getHeight())); + jmax (1, bounds.getWidth()), + jmax (1, bounds.getHeight())); } bool setSwapInterval (int numFramesPerSwap) diff --git a/modules/juce_opengl/native/juce_OpenGL_win32.h b/modules/juce_opengl/native/juce_OpenGL_win32.h index 8e80a61853..907b41a133 100644 --- a/modules/juce_opengl/native/juce_OpenGL_win32.h +++ b/modules/juce_opengl/native/juce_OpenGL_win32.h @@ -81,28 +81,12 @@ public: releaseDC(); } - void initialiseOnRenderThread() - { - } + void initialiseOnRenderThread() {} + void shutdownOnRenderThread() {} - void shutdownOnRenderThread() - { - } - - bool makeActive() const noexcept - { - return wglMakeCurrent (dc, renderContext) != FALSE; - } - - bool isActive() const noexcept - { - return wglGetCurrentContext() == renderContext; - } - - void swapBuffers() const noexcept - { - SwapBuffers (dc); - } + bool makeActive() const noexcept { return wglMakeCurrent (dc, renderContext) != FALSE; } + bool isActive() const noexcept { return wglGetCurrentContext() == renderContext; } + void swapBuffers() const noexcept { SwapBuffers (dc); } bool setSwapInterval (int numFramesPerSwap) {