Browse Source

Fix build with -std=c++98 and adjustments for old Mac OS

tags/v1.9.11
falkTX FilipeCSnuk 6 years ago
parent
commit
2355f147b3
21 changed files with 94 additions and 36 deletions
  1. +19
    -0
      data/macos/mac-build-test.sh
  2. +1
    -1
      source/backend/CarlaBackend.h
  3. +1
    -1
      source/backend/engine/CarlaEngine.cpp
  4. +6
    -2
      source/backend/engine/Makefile
  5. +1
    -1
      source/backend/plugin/CarlaPluginSFZero.cpp
  6. +2
    -0
      source/backend/plugin/CarlaPluginVST2.cpp
  7. +1
    -1
      source/bridges-plugin/CarlaBridgeSingleLV2.cpp
  8. +1
    -1
      source/discovery/carla-discovery.cpp
  9. +2
    -2
      source/modules/dgl/src/nanovg/fontstash.h
  10. +1
    -1
      source/modules/sfzero/sfzero/SFZReader.cpp
  11. +2
    -2
      source/modules/sfzero/sfzero/SFZSound.cpp
  12. +10
    -0
      source/modules/water/common.hpp
  13. +1
    -0
      source/modules/water/containers/Array.h
  14. +14
    -15
      source/modules/water/files/File.cpp
  15. +0
    -1
      source/native-plugins/_all.all.c
  16. +2
    -2
      source/native-plugins/audio-base.hpp
  17. +5
    -1
      source/plugin/Makefile
  18. +1
    -1
      source/plugin/carla-lv2.cpp
  19. +1
    -1
      source/utils/CarlaBackendUtils.hpp
  20. +6
    -2
      source/utils/CarlaPatchbayUtils.hpp
  21. +17
    -1
      source/utils/CarlaPluginUI.cpp

+ 19
- 0
data/macos/mac-build-test.sh View File

@@ -0,0 +1,19 @@
#!/bin/bash

set -e

export MACOS_OLD=true
export CROSS_COMPILING=true

_FLAGS="-mmacosx-version-min=10.6 -Wno-attributes -Wno-deprecated-declarations -Werror"

export CFLAGS="${_FLAGS} -m32"
export CXXFLAGS="${_FLAGS} -m32"
export LDFLAGS="-m32"
apple-cross-setup make -j4

export CFLAGS="${_FLAGS} -m64"
export CXXFLAGS="${_FLAGS} -m64"
export LDFLAGS="-m64"
# FIXME
apple-cross-setup make posix64 -j4

+ 1
- 1
source/backend/CarlaBackend.h View File

@@ -1087,7 +1087,7 @@ typedef enum {
*/ */
ENGINE_OPTION_FRONTEND_WIN_ID = 17, ENGINE_OPTION_FRONTEND_WIN_ID = 17,


#ifndef CARLA_OS_WIN
#if !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) && !defined(CARLA_OS_WIN)
/*! /*!
* Set path to wine executable. * Set path to wine executable.
*/ */


+ 1
- 1
source/backend/engine/CarlaEngine.cpp View File

@@ -1525,7 +1525,7 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch
pData->options.frontendWinId = static_cast<uintptr_t>(winId); pData->options.frontendWinId = static_cast<uintptr_t>(winId);
} break; } break;


#ifndef CARLA_OS_WIN
#if !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) && !defined(CARLA_OS_WIN)
case ENGINE_OPTION_WINE_EXECUTABLE: case ENGINE_OPTION_WINE_EXECUTABLE:
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',);




+ 6
- 2
source/backend/engine/Makefile View File

@@ -15,11 +15,15 @@ OBJS = \
$(OBJDIR)/CarlaEngineData.cpp.o \ $(OBJDIR)/CarlaEngineData.cpp.o \
$(OBJDIR)/CarlaEngineGraph.cpp.o \ $(OBJDIR)/CarlaEngineGraph.cpp.o \
$(OBJDIR)/CarlaEngineInternal.cpp.o \ $(OBJDIR)/CarlaEngineInternal.cpp.o \
$(OBJDIR)/CarlaEngineOsc.cpp.o \
$(OBJDIR)/CarlaEngineOscSend.cpp.o \
$(OBJDIR)/CarlaEnginePorts.cpp.o \ $(OBJDIR)/CarlaEnginePorts.cpp.o \
$(OBJDIR)/CarlaEngineThread.cpp.o $(OBJDIR)/CarlaEngineThread.cpp.o


ifeq ($(HAVE_LIBLO),true)
OBJS += \
$(OBJDIR)/CarlaEngineOsc.cpp.o \
$(OBJDIR)/CarlaEngineOscSend.cpp.o
endif

OBJSa = $(OBJS) \ OBJSa = $(OBJS) \
$(OBJDIR)/CarlaEngineJack.cpp.o \ $(OBJDIR)/CarlaEngineJack.cpp.o \
$(OBJDIR)/CarlaEngineNative.cpp.o \ $(OBJDIR)/CarlaEngineNative.cpp.o \


+ 1
- 1
source/backend/plugin/CarlaPluginSFZero.cpp View File

@@ -589,7 +589,7 @@ public:


{ {
const bool doVolume = carla_isNotEqual(pData->postProc.volume, 1.0f); const bool doVolume = carla_isNotEqual(pData->postProc.volume, 1.0f);
const bool doBalance = carla_isNotEqual(pData->postProc.balanceLeft, -1.0f) || carla_isNotEqual(pData->postProc.balanceRight, 1.0f);
//const bool doBalance = carla_isNotEqual(pData->postProc.balanceLeft, -1.0f) || carla_isNotEqual(pData->postProc.balanceRight, 1.0f);


float* outBufferL = audioOutBuffer.getWritePointer(0, timeOffset); float* outBufferL = audioOutBuffer.getWritePointer(0, timeOffset);
float* outBufferR = audioOutBuffer.getWritePointer(1, timeOffset); float* outBufferR = audioOutBuffer.getWritePointer(1, timeOffset);


+ 2
- 0
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -489,6 +489,8 @@ public:
fUI.window = CarlaPluginUI::newX11(this, frontendWinId, false); fUI.window = CarlaPluginUI::newX11(this, frontendWinId, false);
#else #else
msg = "Unknown UI type"; msg = "Unknown UI type";
// unused
(void)frontendWinId;
#endif #endif


if (fUI.window == nullptr) if (fUI.window == nullptr)


+ 1
- 1
source/bridges-plugin/CarlaBridgeSingleLV2.cpp View File

@@ -40,7 +40,7 @@ public:
CarlaEngineSingleLV2(const double sampleRate, CarlaEngineSingleLV2(const double sampleRate,
const char* const bundlePath, const char* const bundlePath,
const LV2_Feature* const* const features) const LV2_Feature* const* const features)
: Lv2PluginBaseClass(sampleRate, features),
: Lv2PluginBaseClass<EngineTimeInfo>(sampleRate, features),
fPlugin(nullptr), fPlugin(nullptr),
fUiName() fUiName()
{ {


+ 1
- 1
source/discovery/carla-discovery.cpp View File

@@ -1040,7 +1040,7 @@ static void do_vst_check(lib_t& libHandle, const char* const filename, const boo


#ifdef CARLA_OS_MAC #ifdef CARLA_OS_MAC
CFBundleRef bundleRef = nullptr; CFBundleRef bundleRef = nullptr;
CFBundleRefNum resFileId;
CFBundleRefNum resFileId = 0;


if (libHandle == nullptr) if (libHandle == nullptr)
{ {


+ 2
- 2
source/modules/dgl/src/nanovg/fontstash.h View File

@@ -1226,7 +1226,7 @@ float fonsDrawText(FONScontext* stash,
const char* str, const char* end) const char* str, const char* end)
{ {
FONSstate* state = fons__getState(stash); FONSstate* state = fons__getState(stash);
unsigned int codepoint;
unsigned int codepoint = 0;
unsigned int utf8state = 0; unsigned int utf8state = 0;
FONSglyph* glyph = NULL; FONSglyph* glyph = NULL;
FONSquad q; FONSquad q;
@@ -1411,7 +1411,7 @@ float fonsTextBounds(FONScontext* stash,
float* bounds) float* bounds)
{ {
FONSstate* state = fons__getState(stash); FONSstate* state = fons__getState(stash);
unsigned int codepoint;
unsigned int codepoint = 0;
unsigned int utf8state = 0; unsigned int utf8state = 0;
FONSquad q; FONSquad q;
FONSglyph* glyph = NULL; FONSglyph* glyph = NULL;


+ 1
- 1
source/modules/sfzero/sfzero/SFZReader.cpp View File

@@ -516,7 +516,7 @@ const char *Reader::readPathInto(water::String *pathOut, const char *pIn, const


int Reader::keyValue(const water::String &str) int Reader::keyValue(const water::String &str)
{ {
auto chars = str.toRawUTF8();
const char* const chars = str.toRawUTF8();


char c = chars[0]; char c = chars[0];




+ 2
- 2
source/modules/sfzero/sfzero/SFZSound.cpp View File

@@ -123,7 +123,7 @@ Region *Sound::regionAt(int index) { return regions_[index]; }
water::String Sound::dump() water::String Sound::dump()
{ {
water::String info; water::String info;
auto &errors = getErrors();
const water::StringArray& errors = getErrors();
if (errors.size() > 0) if (errors.size() > 0)
{ {
info << errors.size() << " errors: \n"; info << errors.size() << " errors: \n";
@@ -135,7 +135,7 @@ water::String Sound::dump()
info << "no errors.\n\n"; info << "no errors.\n\n";
} }


auto &warnings = getWarnings();
const water::StringArray& warnings = getWarnings();
if (warnings.size() > 0) if (warnings.size() > 0)
{ {
info << warnings.size() << " warnings: \n"; info << warnings.size() << " warnings: \n";


+ 10
- 0
source/modules/water/common.hpp View File

@@ -21,6 +21,7 @@
#ifdef CARLA_OS_MAC #ifdef CARLA_OS_MAC
# include "text/String.h" # include "text/String.h"
# import <Foundation/NSAutoreleasePool.h>
# import <Foundation/NSString.h> # import <Foundation/NSString.h>
#endif #endif
@@ -90,6 +91,15 @@ NSString* waterStringToNS (const String& s)
{ {
return [NSString stringWithUTF8String: s.toUTF8()]; return [NSString stringWithUTF8String: s.toUTF8()];
} }
class AutoNSAutoreleasePool {
public:
AutoNSAutoreleasePool() : pool([NSAutoreleasePool new]) {}
~AutoNSAutoreleasePool() { [pool drain]; }
private:
NSAutoreleasePool* const pool;
};
#endif #endif
} }

+ 1
- 0
source/modules/water/containers/Array.h View File

@@ -69,6 +69,7 @@ public:
@param other the array to copy @param other the array to copy
*/ */
Array (const Array<ElementType>& other) noexcept Array (const Array<ElementType>& other) noexcept
: numUsed (0)
{ {
CARLA_SAFE_ASSERT_RETURN(data.setAllocatedSize (other.numUsed),); CARLA_SAFE_ASSERT_RETURN(data.setAllocatedSize (other.numUsed),);
numUsed = other.numUsed; numUsed = other.numUsed;


+ 14
- 15
source/modules/water/files/File.cpp View File

@@ -1407,21 +1407,20 @@ File File::getLinkedTarget() const
bool File::copyInternal (const File& dest) const bool File::copyInternal (const File& dest) const
{ {
//@autoreleasepool
{
NSFileManager* fm = [NSFileManager defaultManager];
return [fm fileExistsAtPath: waterStringToNS (fullPath)]
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
&& [fm copyItemAtPath: waterStringToNS (fullPath)
toPath: waterStringToNS (dest.getFullPathName())
error: nil];
#else
&& [fm copyPath: waterStringToNS (fullPath)
toPath: waterStringToNS (dest.getFullPathName())
handler: nil];
#endif
}
const AutoNSAutoreleasePool arpool;
NSFileManager* fm = [NSFileManager defaultManager];
return [fm fileExistsAtPath: waterStringToNS (fullPath)]
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
&& [fm copyItemAtPath: waterStringToNS (fullPath)
toPath: waterStringToNS (dest.getFullPathName())
error: nil];
#else
&& [fm copyPath: waterStringToNS (fullPath)
toPath: waterStringToNS (dest.getFullPathName())
handler: nil];
#endif
} }
File File::getSpecialLocation (const SpecialLocationType type) File File::getSpecialLocation (const SpecialLocationType type)


+ 0
- 1
source/native-plugins/_all.all.c View File

@@ -54,7 +54,6 @@ extern void carla_register_native_plugin_notes(void);


void carla_register_all_native_plugins(void) void carla_register_all_native_plugins(void)
{ {
puts("carla register all plugins\n");
// Simple plugins // Simple plugins
carla_register_native_plugin_bypass(); carla_register_native_plugin_bypass();
carla_register_native_plugin_lfo(); carla_register_native_plugin_lfo();


+ 2
- 2
source/native-plugins/audio-base.hpp View File

@@ -41,8 +41,8 @@ struct AudioFilePool {
size(0) {} size(0) {}
#else #else
AudioFilePool() AudioFilePool()
: startFrame(0),
sampleRate(0),
: sampleRate(0),
startFrame(0),
size(0) size(0)
{ {
buffer[0] = buffer[1] = nullptr; buffer[0] = buffer[1] = nullptr;


+ 5
- 1
source/plugin/Makefile View File

@@ -91,8 +91,12 @@ endif
# ---------------------------------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------------------------------


TARGETS = \ TARGETS = \
$(BINDIR)/carla.lv2/carla$(LIB_EXT) \
$(BINDIR)/carla.lv2/carla$(LIB_EXT)

ifneq ($(CROSS_COMPILING),true)
TARGETS += \
$(BINDIR)/carla.lv2/manifest.ttl $(BINDIR)/carla.lv2/manifest.ttl
endif


ifeq ($(LINUX),true) ifeq ($(LINUX),true)
ifeq ($(HAVE_X11),true) ifeq ($(HAVE_X11),true)


+ 1
- 1
source/plugin/carla-lv2.cpp View File

@@ -34,7 +34,7 @@ public:
const double sampleRate, const double sampleRate,
const char* const bundlePath, const char* const bundlePath,
const LV2_Feature* const* const features) const LV2_Feature* const* const features)
: Lv2PluginBaseClass(sampleRate, features),
: Lv2PluginBaseClass<NativeTimeInfo>(sampleRate, features),
fHandle(nullptr), fHandle(nullptr),
fHost(), fHost(),
fDescriptor(desc), fDescriptor(desc),


+ 1
- 1
source/utils/CarlaBackendUtils.hpp View File

@@ -325,7 +325,7 @@ const char* EngineOption2Str(const EngineOption option) noexcept
return "ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR"; return "ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR";
case ENGINE_OPTION_FRONTEND_WIN_ID: case ENGINE_OPTION_FRONTEND_WIN_ID:
return "ENGINE_OPTION_FRONTEND_WIN_ID"; return "ENGINE_OPTION_FRONTEND_WIN_ID";
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
#if !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) && !defined(CARLA_OS_WIN)
case ENGINE_OPTION_WINE_EXECUTABLE: case ENGINE_OPTION_WINE_EXECUTABLE:
return "ENGINE_OPTION_WINE_EXECUTABLE"; return "ENGINE_OPTION_WINE_EXECUTABLE";
case ENGINE_OPTION_WINE_AUTO_PREFIX: case ENGINE_OPTION_WINE_AUTO_PREFIX:


+ 6
- 2
source/utils/CarlaPatchbayUtils.hpp View File

@@ -166,7 +166,9 @@ struct ConnectionToId {


void clear() noexcept void clear() noexcept
{ {
id = 0;
// needed for apple GCC4.2
this->id = 0;

groupA = 0; groupA = 0;
portA = 0; portA = 0;
groupB = 0; groupB = 0;
@@ -175,7 +177,9 @@ struct ConnectionToId {


void setData(const uint i, const uint gA, const uint pA, const uint gB, const uint pB) noexcept void setData(const uint i, const uint gA, const uint pA, const uint gB, const uint pB) noexcept
{ {
id = i;
// needed for apple GCC4.2
this->id = i;

groupA = gA; groupA = gA;
portA = pA; portA = pA;
groupB = gB; groupB = gB;


+ 17
- 1
source/utils/CarlaPluginUI.cpp View File

@@ -549,6 +549,11 @@ public:
[fWindow setContentMaxSize:size]; [fWindow setContentMaxSize:size];
[[fWindow standardWindowButton:NSWindowZoomButton] setHidden:YES]; [[fWindow standardWindowButton:NSWindowZoomButton] setHidden:YES];
} }

if (forceUpdate)
{
// TODO
}
} }


void setTitle(const char* const title) override void setTitle(const char* const title) override
@@ -1070,14 +1075,25 @@ bool CarlaPluginUI::tryTransientWinIdMatch(const uintptr_t pid, const char* cons


int windowToMap, windowWithPID = 0, windowWithNameAndPID = 0; int windowToMap, windowWithPID = 0, windowWithNameAndPID = 0;


for (NSDictionary* const entry in windowList)
const NSDictionary* entry;
for (entry in windowList)
{ {
// FIXME: is this needed? is old version safe?
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
if ([entry[(id)kCGWindowSharingState] intValue] == kCGWindowSharingNone) if ([entry[(id)kCGWindowSharingState] intValue] == kCGWindowSharingNone)
continue; continue;


NSString* const windowName = entry[(id)kCGWindowName]; NSString* const windowName = entry[(id)kCGWindowName];
int const windowNumber = [entry[(id)kCGWindowNumber] intValue]; int const windowNumber = [entry[(id)kCGWindowNumber] intValue];
uintptr_t const windowPID = [entry[(id)kCGWindowOwnerPID] intValue]; uintptr_t const windowPID = [entry[(id)kCGWindowOwnerPID] intValue];
#else
if ([[entry objectForKey:(id)kCGWindowSharingState] intValue] == kCGWindowSharingNone)
continue;

NSString* const windowName = [entry objectForKey:(id)kCGWindowName];
int const windowNumber = [[entry objectForKey:(id)kCGWindowNumber] intValue];
uintptr_t const windowPID = [[entry objectForKey:(id)kCGWindowOwnerPID] intValue];
#endif


if (windowPID != pid) if (windowPID != pid)
continue; continue;


Loading…
Cancel
Save