Browse Source

Minor linux build fixes and clean-ups.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
ba391f55bb
9 changed files with 74 additions and 77 deletions
  1. +11
    -12
      juce_amalgamated.cpp
  2. +10
    -11
      juce_amalgamated.h
  3. +1
    -1
      src/audio/plugins/formats/juce_VSTPluginFormat.cpp
  4. +5
    -9
      src/core/juce_Atomic.h
  5. +4
    -0
      src/core/juce_PlatformDefs.h
  6. +0
    -2
      src/gui/graphics/geometry/juce_Line.h
  7. +1
    -0
      src/gui/graphics/geometry/juce_Path.h
  8. +32
    -39
      src/native/juce_linux_NativeCode.cpp
  9. +10
    -3
      src/native/linux/juce_linux_Threads.cpp

+ 11
- 12
juce_amalgamated.cpp View File

@@ -31670,7 +31670,7 @@ static void* NewCFMFromMachO (void* const machofp) throw()
#if JUCE_LINUX #if JUCE_LINUX


extern Display* display; extern Display* display;
extern XContext improbableNumber;
extern XContext windowHandleXContext;


typedef void (*EventProcPtr) (XEvent* ev); typedef void (*EventProcPtr) (XEvent* ev);


@@ -249222,14 +249222,6 @@ END_JUCE_NAMESPACE


BEGIN_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE


/* Remove this macro if you're having problems compiling the cpu affinity
calls (the API for these has changed about quite a bit in various Linux
versions, and a lot of distros seem to ship with obsolete versions)
*/
#if defined (CPU_ISSET) && ! defined (SUPPORT_AFFINITIES)
#define SUPPORT_AFFINITIES 1
#endif

#define JUCE_INCLUDED_FILE 1 #define JUCE_INCLUDED_FILE 1


// Now include the actual code files.. // Now include the actual code files..
@@ -251069,6 +251061,14 @@ bool juce_setThreadPriority (void* handle, int priority)
return false; return false;
} }


/* Remove this macro if you're having problems compiling the cpu affinity
calls (the API for these has changed about quite a bit in various Linux
versions, and a lot of distros seem to ship with obsolete versions)
*/
#if defined (CPU_ISSET) && ! defined (SUPPORT_AFFINITIES)
#define SUPPORT_AFFINITIES 1
#endif

void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask) void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask)
{ {
#if SUPPORT_AFFINITIES #if SUPPORT_AFFINITIES
@@ -251084,15 +251084,14 @@ void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask)
version of glibc installed. version of glibc installed.


If you don't want to update your copy of glibc and don't care about cpu affinities, If you don't want to update your copy of glibc and don't care about cpu affinities,
then you can just disable all this stuff by removing the SUPPORT_AFFINITIES macro
from the linuxincludes.h file.
then you can just disable all this stuff by setting the SUPPORT_AFFINITIES macro to 0.
*/ */
sched_setaffinity (getpid(), sizeof (cpu_set_t), &affinity); sched_setaffinity (getpid(), sizeof (cpu_set_t), &affinity);
sched_yield(); sched_yield();


#else #else
/* affinities aren't supported because either the appropriate header files weren't found, /* affinities aren't supported because either the appropriate header files weren't found,
or the SUPPORT_AFFINITIES macro was turned off in linuxheaders.h
or the SUPPORT_AFFINITIES macro was turned off
*/ */
jassertfalse jassertfalse
#endif #endif


+ 10
- 11
juce_amalgamated.h View File

@@ -660,6 +660,8 @@
#define forcedinline inline #define forcedinline inline
#endif #endif


#define JUCE_ALIGN(bytes) __declspec (align (bytes))

#else #else
/** A platform-independent way of forcing an inline function. /** A platform-independent way of forcing an inline function.


@@ -673,6 +675,8 @@
#define forcedinline inline #define forcedinline inline
#endif #endif


#define JUCE_ALIGN(bytes) __attribute__ ((aligned (bytes)))

#endif #endif


#endif // __JUCE_PLATFORMDEFS_JUCEHEADER__ #endif // __JUCE_PLATFORMDEFS_JUCEHEADER__
@@ -5643,7 +5647,7 @@ public:


This operation is the atomic equivalent of doing this: This operation is the atomic equivalent of doing this:
@code @code
bool compareAndSetBool (Type newValue, Type valueToCompare) throw();
bool compareAndSetBool (Type newValue, Type valueToCompare)
{ {
if (get() == valueToCompare) if (get() == valueToCompare)
{ {
@@ -5666,7 +5670,7 @@ public:


This operation is the atomic equivalent of doing this: This operation is the atomic equivalent of doing this:
@code @code
Type compareAndSetValue (Type newValue, Type valueToCompare) throw();
Type compareAndSetValue (Type newValue, Type valueToCompare)
{ {
Type oldValue = get(); Type oldValue = get();
if (oldValue == valueToCompare) if (oldValue == valueToCompare)
@@ -5681,14 +5685,10 @@ public:
*/ */
Type compareAndSetValue (Type newValue, Type valueToCompare) throw(); Type compareAndSetValue (Type newValue, Type valueToCompare) throw();


/** Performs a memory write barrier. */
/** Implements a memory read/write barrier. */
static void memoryBarrier() throw(); static void memoryBarrier() throw();


#if JUCE_MSVC
__declspec (align (8))
#else
__attribute__ ((aligned (8)))
#endif
JUCE_ALIGN(8)


/** The raw value that this class operates on. /** The raw value that this class operates on.
This is exposed publically in case you need to manipulate it directly This is exposed publically in case you need to manipulate it directly
@@ -5759,7 +5759,7 @@ inline void Atomic<Type>::set (const Type newValue) throw()
} }


template <typename Type> template <typename Type>
Type Atomic<Type>::exchange (const Type newValue) throw()
inline Type Atomic<Type>::exchange (const Type newValue) throw()
{ {
#if JUCE_ATOMICS_MAC || JUCE_ATOMICS_GCC #if JUCE_ATOMICS_MAC || JUCE_ATOMICS_GCC
Type currentVal = value; Type currentVal = value;
@@ -19819,8 +19819,6 @@ public:
/** Finds the point on this line which is nearest to a given point, and /** Finds the point on this line which is nearest to a given point, and
returns its position as a proportional position along the line. returns its position as a proportional position along the line.


@param x x position of the point to test
@param y y position of the point to test
@returns a value 0 to 1.0 which is the distance along this line from the @returns a value 0 to 1.0 which is the distance along this line from the
line's start to the point which is nearest to the point passed-in. To line's start to the point which is nearest to the point passed-in. To
turn this number into a position, use getPointAlongLineProportionally(). turn this number into a position, use getPointAlongLineProportionally().
@@ -20933,6 +20931,7 @@ public:
line would need to be cut into multiple pieces to correctly clip against line would need to be cut into multiple pieces to correctly clip against
a re-entrant shape. a re-entrant shape.


@param line the line to clip
@param keepSectionOutsidePath if true, it's the section outside the path @param keepSectionOutsidePath if true, it's the section outside the path
that will be kept; if false its the section inside that will be kept; if false its the section inside
the path the path


+ 1
- 1
src/audio/plugins/formats/juce_VSTPluginFormat.cpp View File

@@ -238,7 +238,7 @@ static void* NewCFMFromMachO (void* const machofp) throw()
#if JUCE_LINUX #if JUCE_LINUX
extern Display* display; extern Display* display;
extern XContext improbableNumber;
extern XContext windowHandleXContext;
typedef void (*EventProcPtr) (XEvent* ev); typedef void (*EventProcPtr) (XEvent* ev);


+ 5
- 9
src/core/juce_Atomic.h View File

@@ -95,7 +95,7 @@ public:
This operation is the atomic equivalent of doing this: This operation is the atomic equivalent of doing this:
@code @code
bool compareAndSetBool (Type newValue, Type valueToCompare) throw();
bool compareAndSetBool (Type newValue, Type valueToCompare)
{ {
if (get() == valueToCompare) if (get() == valueToCompare)
{ {
@@ -118,7 +118,7 @@ public:
This operation is the atomic equivalent of doing this: This operation is the atomic equivalent of doing this:
@code @code
Type compareAndSetValue (Type newValue, Type valueToCompare) throw();
Type compareAndSetValue (Type newValue, Type valueToCompare)
{ {
Type oldValue = get(); Type oldValue = get();
if (oldValue == valueToCompare) if (oldValue == valueToCompare)
@@ -133,15 +133,11 @@ public:
*/ */
Type compareAndSetValue (Type newValue, Type valueToCompare) throw(); Type compareAndSetValue (Type newValue, Type valueToCompare) throw();
/** Performs a memory write barrier. */
/** Implements a memory read/write barrier. */
static void memoryBarrier() throw(); static void memoryBarrier() throw();
//============================================================================== //==============================================================================
#if JUCE_MSVC
__declspec (align (8))
#else
__attribute__ ((aligned (8)))
#endif
JUCE_ALIGN(8)
/** The raw value that this class operates on. /** The raw value that this class operates on.
This is exposed publically in case you need to manipulate it directly This is exposed publically in case you need to manipulate it directly
@@ -215,7 +211,7 @@ inline void Atomic<Type>::set (const Type newValue) throw()
} }
template <typename Type> template <typename Type>
Type Atomic<Type>::exchange (const Type newValue) throw()
inline Type Atomic<Type>::exchange (const Type newValue) throw()
{ {
#if JUCE_ATOMICS_MAC || JUCE_ATOMICS_GCC #if JUCE_ATOMICS_MAC || JUCE_ATOMICS_GCC
Type currentVal = value; Type currentVal = value;


+ 4
- 0
src/core/juce_PlatformDefs.h View File

@@ -200,6 +200,8 @@
#define forcedinline inline #define forcedinline inline
#endif #endif
#define JUCE_ALIGN(bytes) __declspec (align (bytes))
#else #else
/** A platform-independent way of forcing an inline function. /** A platform-independent way of forcing an inline function.
@@ -213,6 +215,8 @@
#define forcedinline inline #define forcedinline inline
#endif #endif
#define JUCE_ALIGN(bytes) __attribute__ ((aligned (bytes)))
#endif #endif
#endif // __JUCE_PLATFORMDEFS_JUCEHEADER__ #endif // __JUCE_PLATFORMDEFS_JUCEHEADER__

+ 0
- 2
src/gui/graphics/geometry/juce_Line.h View File

@@ -247,8 +247,6 @@ public:
/** Finds the point on this line which is nearest to a given point, and /** Finds the point on this line which is nearest to a given point, and
returns its position as a proportional position along the line. returns its position as a proportional position along the line.
@param x x position of the point to test
@param y y position of the point to test
@returns a value 0 to 1.0 which is the distance along this line from the @returns a value 0 to 1.0 which is the distance along this line from the
line's start to the point which is nearest to the point passed-in. To line's start to the point which is nearest to the point passed-in. To
turn this number into a position, use getPointAlongLineProportionally(). turn this number into a position, use getPointAlongLineProportionally().


+ 1
- 0
src/gui/graphics/geometry/juce_Path.h View File

@@ -150,6 +150,7 @@ public:
line would need to be cut into multiple pieces to correctly clip against line would need to be cut into multiple pieces to correctly clip against
a re-entrant shape. a re-entrant shape.
@param line the line to clip
@param keepSectionOutsidePath if true, it's the section outside the path @param keepSectionOutsidePath if true, it's the section outside the path
that will be kept; if false its the section inside that will be kept; if false its the section inside
the path the path


+ 32
- 39
src/native/juce_linux_NativeCode.cpp View File

@@ -39,60 +39,53 @@
BEGIN_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE
//============================================================================== //==============================================================================
#include "../io/files/juce_FileInputStream.h"
#include "../io/files/juce_FileOutputStream.h"
#include "../core/juce_SystemStats.h" #include "../core/juce_SystemStats.h"
#include "../core/juce_Time.h" #include "../core/juce_Time.h"
#include "../core/juce_Random.h" #include "../core/juce_Random.h"
#include "../io/network/juce_URL.h"
#include "../io/files/juce_NamedPipe.h"
#include "../io/streams/juce_MemoryOutputStream.h"
#include "../threads/juce_InterProcessLock.h"
#include "../audio/devices/juce_AudioIODeviceType.h"
#include "../core/juce_Singleton.h"
#include "../core/juce_PlatformUtilities.h"
#include "../containers/juce_MemoryBlock.h"
#include "../utilities/juce_DeletedAtShutdown.h"
#include "../utilities/juce_SystemClipboard.h"
#include "../text/juce_StringArray.h"
#include "../text/juce_XmlDocument.h"
#include "../threads/juce_CriticalSection.h"
#include "../threads/juce_Thread.h" #include "../threads/juce_Thread.h"
#include "../threads/juce_ScopedLock.h" #include "../threads/juce_ScopedLock.h"
#include "../threads/juce_InterProcessLock.h"
#include "../threads/juce_WaitableEvent.h"
#include "../threads/juce_Process.h"
#include "../io/files/juce_File.h" #include "../io/files/juce_File.h"
#include "../core/juce_Singleton.h"
#include "../audio/dsp/juce_AudioDataConverters.h"
#include "../audio/audio_file_formats/juce_AudioCDReader.h"
#include "../gui/graphics/fonts/juce_Font.h"
#include "../io/streams/juce_MemoryInputStream.h"
#include "../io/files/juce_NamedPipe.h"
#include "../io/files/juce_FileInputStream.h"
#include "../io/files/juce_FileOutputStream.h"
#include "../io/files/juce_DirectoryIterator.h" #include "../io/files/juce_DirectoryIterator.h"
#include "../text/juce_XmlDocument.h"
#include "../utilities/juce_DeletedAtShutdown.h"
#include "../io/network/juce_URL.h"
#include "../io/streams/juce_MemoryInputStream.h"
#include "../io/streams/juce_MemoryOutputStream.h"
#include "../events/juce_MessageManager.h" #include "../events/juce_MessageManager.h"
#include "../threads/juce_WaitableEvent.h"
#include "../threads/juce_Process.h"
#include "../gui/components/filebrowser/juce_FileChooser.h"
#include "../events/juce_Timer.h"
#include "../application/juce_Application.h"
#include "../audio/dsp/juce_AudioSampleBuffer.h"
#include "../audio/dsp/juce_AudioDataConverters.h"
#include "../audio/audio_file_formats/juce_AudioCDReader.h"
#include "../audio/devices/juce_AudioIODeviceType.h"
#include "../audio/devices/juce_MidiOutput.h" #include "../audio/devices/juce_MidiOutput.h"
#include "../audio/devices/juce_MidiInput.h" #include "../audio/devices/juce_MidiInput.h"
#include "../text/juce_StringArray.h"
#include "../containers/juce_MemoryBlock.h"
#include "../core/juce_PlatformUtilities.h"
#include "../threads/juce_CriticalSection.h"
#include "../events/juce_Timer.h"
#include "../gui/components/special/juce_WebBrowserComponent.h"
#include "../gui/components/keyboard/juce_KeyPress.h"
#include "../utilities/juce_SystemClipboard.h"
#include "../gui/components/windows/juce_ComponentPeer.h"
#include "../gui/components/windows/juce_AlertWindow.h"
#include "../gui/components/special/juce_OpenGLComponent.h"
#include "../gui/components/juce_Desktop.h"
#include "../gui/components/mouse/juce_MouseInputSource.h"
#include "../gui/graphics/fonts/juce_Font.h"
#include "../gui/graphics/geometry/juce_RectangleList.h" #include "../gui/graphics/geometry/juce_RectangleList.h"
#include "../gui/graphics/imaging/juce_ImageFileFormat.h" #include "../gui/graphics/imaging/juce_ImageFileFormat.h"
#include "../gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h" #include "../gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.h"
#include "../gui/components/juce_Desktop.h"
#include "../gui/components/mouse/juce_MouseInputSource.h"
#include "../gui/components/mouse/juce_DragAndDropContainer.h" #include "../gui/components/mouse/juce_DragAndDropContainer.h"
#include "../gui/components/keyboard/juce_KeyPress.h"
#include "../gui/components/windows/juce_ComponentPeer.h"
#include "../gui/components/windows/juce_AlertWindow.h"
#include "../gui/components/filebrowser/juce_FileChooser.h"
#include "../gui/components/special/juce_WebBrowserComponent.h"
#include "../gui/components/special/juce_OpenGLComponent.h"
#include "../gui/components/special/juce_SystemTrayIconComponent.h" #include "../gui/components/special/juce_SystemTrayIconComponent.h"
#include "../application/juce_Application.h"
/* Remove this macro if you're having problems compiling the cpu affinity
calls (the API for these has changed about quite a bit in various Linux
versions, and a lot of distros seem to ship with obsolete versions)
*/
#if defined (CPU_ISSET) && ! defined (SUPPORT_AFFINITIES)
#define SUPPORT_AFFINITIES 1
#endif
//============================================================================== //==============================================================================
#define JUCE_INCLUDED_FILE 1 #define JUCE_INCLUDED_FILE 1


+ 10
- 3
src/native/linux/juce_linux_Threads.cpp View File

@@ -119,6 +119,14 @@ bool juce_setThreadPriority (void* handle, int priority)
return false; return false;
} }
/* Remove this macro if you're having problems compiling the cpu affinity
calls (the API for these has changed about quite a bit in various Linux
versions, and a lot of distros seem to ship with obsolete versions)
*/
#if defined (CPU_ISSET) && ! defined (SUPPORT_AFFINITIES)
#define SUPPORT_AFFINITIES 1
#endif
void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask) void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask)
{ {
#if SUPPORT_AFFINITIES #if SUPPORT_AFFINITIES
@@ -134,15 +142,14 @@ void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask)
version of glibc installed. version of glibc installed.
If you don't want to update your copy of glibc and don't care about cpu affinities, If you don't want to update your copy of glibc and don't care about cpu affinities,
then you can just disable all this stuff by removing the SUPPORT_AFFINITIES macro
from the linuxincludes.h file.
then you can just disable all this stuff by setting the SUPPORT_AFFINITIES macro to 0.
*/ */
sched_setaffinity (getpid(), sizeof (cpu_set_t), &affinity); sched_setaffinity (getpid(), sizeof (cpu_set_t), &affinity);
sched_yield(); sched_yield();
#else #else
/* affinities aren't supported because either the appropriate header files weren't found, /* affinities aren't supported because either the appropriate header files weren't found,
or the SUPPORT_AFFINITIES macro was turned off in linuxheaders.h
or the SUPPORT_AFFINITIES macro was turned off
*/ */
jassertfalse jassertfalse
#endif #endif


Loading…
Cancel
Save