Skip to content

Commit

Permalink
Merge pull request #1741 from timblechmann/cleanups/preprocessor
Browse files Browse the repository at this point in the history
cleanup: detect apple via __APPLE__
  • Loading branch information
gusano committed Nov 28, 2015
2 parents 0f91fe0 + f8d4d2d commit ed2f9fa
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 72 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
endif()

if(APPLE)
set_property(DIRECTORY
APPEND
PROPERTY COMPILE_DEFINITIONS SC_DARWIN)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/Install" CACHE STRING "Cmake install path")
endif()
Expand Down
2 changes: 1 addition & 1 deletion QtCollider/factories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static void doLoadFactories ()
QC_ADD_FACTORY( QcGridLayout );
QC_ADD_FACTORY( QcStackLayout );
QC_ADD_FACTORY( QtDownload );
#ifdef SC_DARWIN
#ifdef __APPLE__
QC_ADD_FACTORY( QcQuartzComposerView );
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions QtCollider/primitives/primitives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void defineQWidgetPrimitives();
void defineQPalettePrimitives();
void defineQImagePrimitives();

#ifdef SC_DARWIN
#ifdef __APPLE__
void defineQcQuartzComposerPrimitives();
#endif

Expand All @@ -54,7 +54,7 @@ void initPrimitives () {
defineQPalettePrimitives();
defineQImagePrimitives();

#ifdef SC_DARWIN
#ifdef __APPLE__
defineQcQuartzComposerPrimitives();
#endif

Expand Down
2 changes: 1 addition & 1 deletion editors/sc-ide/widgets/multi_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ MultiEditor::MultiEditor( Main *main, QWidget * parent ) :
QWidget(parent),
mEditorSigMux(new SignalMultiplexer(this)),
mBoxSigMux(new SignalMultiplexer(this)),
#ifdef SC_DARWIN
#ifdef __APPLE__
mDocModifiedIcon( QApplication::style()->standardIcon(QStyle::SP_DriveHDIcon) )
#else
mDocModifiedIcon( QIcon::fromTheme("document-save") )
Expand Down
2 changes: 1 addition & 1 deletion lang/LangPrimSource/OSCData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ int prBootInProcessServer(VMGlobals *g, int numArgsPushed)

options.mLoadGraphDefs = IsTrue(optionsSlots + 14) ? 1 : 0;

#ifdef SC_DARWIN
#ifdef __APPLE__
err = slotStrVal(optionsSlots+15, mInputStreamsEnabled, 512);
if(err) options.mInputStreamsEnabled = NULL;
else options.mInputStreamsEnabled = mInputStreamsEnabled;
Expand Down
6 changes: 3 additions & 3 deletions lang/LangPrimSource/PyrFilePrim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ int prFileRealPath(struct VMGlobals* g, int numArgsPushed )
}
strcpy(opath,p.string().c_str());

#if SC_DARWIN
#if __APPLE__
CFStringRef cfstring =
CFStringCreateWithCString(NULL,
opath,
kCFStringEncodingUTF8);
err = !CFStringGetFileSystemRepresentation(cfstring, opath, PATH_MAX);
CFRelease(cfstring);
if (err) return errFailed;
#endif // SC_DARWIN
#endif // __APPLE__

PyrString* pyrString = newPyrString(g->gc, opath, 0, true);
SetObject(a, pyrString);
Expand Down Expand Up @@ -1382,7 +1382,7 @@ int headerFormatToString(struct SF_INFO *info, const char **string){
*string = "FLAC";
break ;
// TODO allow other platforms to know vorbis once libsndfile 1.0.18 is established
#if SC_DARWIN || _WIN32 || LIBSNDFILE_1018
#if __APPLE__ || _WIN32 || LIBSNDFILE_1018
case SF_FORMAT_VORBIS :
*string = "vorbis";
break ;
Expand Down
2 changes: 1 addition & 1 deletion lang/LangPrimSource/PyrPrimitive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4263,7 +4263,7 @@ void initWiiPrimitives();
#endif

#endif
#ifdef SC_DARWIN
#ifdef __APPLE__
void initCoreAudioPrimitives();
initCoreAudioPrimitives();
#endif
Expand Down
16 changes: 8 additions & 8 deletions lang/LangPrimSource/PyrSched.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "GC.h"
#include "PyrPrimitive.h"
#include "PyrSymbol.h"
#ifdef SC_DARWIN
#ifdef __APPLE__
# include <CoreAudio/HostTime.h>
#endif
#include <sys/time.h>
Expand All @@ -34,7 +34,7 @@
#include <math.h>
#include <limits>

#if defined(SC_DARWIN) || defined(__linux__)
#if defined(__APPLE__) || defined(__linux__)
# include <pthread.h>
#endif

Expand Down Expand Up @@ -479,7 +479,7 @@ static void schedRunFunc()
return;
}

#ifdef SC_DARWIN
#ifdef __APPLE__
#include <mach/mach.h>
#include <mach/thread_policy.h>

Expand Down Expand Up @@ -567,7 +567,7 @@ kern_return_t RescheduleStdThread( mach_port_t machThread,
THREAD_PRECEDENCE_POLICY_COUNT );

}
#endif // SC_DARWIN
#endif // __APPLE__

#ifdef __linux__
#include <string.h>
Expand Down Expand Up @@ -598,7 +598,7 @@ SCLANG_DLLEXPORT_C void schedRun()
thread thread(schedRunFunc);
gSchedThread = std::move(thread);

#ifdef SC_DARWIN
#ifdef __APPLE__
int policy;
struct sched_param param;

Expand Down Expand Up @@ -626,7 +626,7 @@ SCLANG_DLLEXPORT_C void schedRun()
pthread_getschedparam (gSchedThread.native_handle(), &policy, &param);

//post("param.sched_priority %d\n", param.sched_priority);
#endif // SC_DARWIN
#endif // __APPLE__

#ifdef __linux__
SC_LinuxSetRealtimePriority(gSchedThread.native_handle(), 1);
Expand Down Expand Up @@ -739,7 +739,7 @@ TempoClock::TempoClock(VMGlobals *inVMGlobals, PyrObject* inTempoClockObj,
thread thread(std::bind(&TempoClock::Run, this));
mThread = std::move(thread);

#ifdef SC_DARWIN
#ifdef __APPLE__
int machprio;
boolean_t timeshare;
GetStdThreadSchedule(pthread_mach_thread_np(mThread.native_handle()), &machprio, &timeshare);
Expand All @@ -754,7 +754,7 @@ TempoClock::TempoClock(VMGlobals *inVMGlobals, PyrObject* inTempoClockObj,

//param.sched_priority = 70; // you'll have to play with this to see what it does
//pthread_setschedparam (mThread, policy, &param);
#endif // SC_DARWIN
#endif // __APPLE__

#ifdef __linux__
SC_LinuxSetRealtimePriority(mThread.native_handle(), 1);
Expand Down
10 changes: 5 additions & 5 deletions lang/LangPrimSource/PyrStringPrim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ int prStringPathMatch(struct VMGlobals *g, int numArgsPushed)
glob_t pglob;

int gflags = GLOB_MARK | GLOB_TILDE;
#ifdef SC_DARWIN
#ifdef __APPLE__
gflags |= GLOB_QUOTE;
#endif

Expand Down Expand Up @@ -862,9 +862,9 @@ int prString_FindBackwards(struct VMGlobals *g, int numArgsPushed)
return errNone;
}

#if SC_DARWIN
#if __APPLE__
# include <CoreFoundation/CoreFoundation.h>
#endif // SC_DARWIN
#endif // __APPLE__

int prString_StandardizePath(struct VMGlobals* g, int numArgsPushed);
int prString_StandardizePath(struct VMGlobals* g, int /* numArgsPushed */)
Expand All @@ -882,15 +882,15 @@ int prString_StandardizePath(struct VMGlobals* g, int /* numArgsPushed */)
opath = ipath;
}

#if SC_DARWIN
#if __APPLE__
CFStringRef cfstring =
CFStringCreateWithCString(NULL,
opath,
kCFStringEncodingUTF8);
err = !CFStringGetFileSystemRepresentation(cfstring, opath, PATH_MAX);
CFRelease(cfstring);
if (err) return errFailed;
#endif // SC_DARWIN
#endif // __APPLE__

PyrString* pyrString = newPyrString(g->gc, opath, 0, true);
SetObject(arg, pyrString);
Expand Down
Loading

0 comments on commit ed2f9fa

Please sign in to comment.