Hi Nick,
Thanks for the patch. I became aware of this mess when I wrote the
SConscript, and I think all of these defines have just crept into our
source tree. I also think __WIN32__ is the standard #define, but I
know at least __WIN__ is used in the lib/soundtouch code. Some of the
obscure defines you see are there just so that the source files we
bring in from libs sitting in our tree like soundtouch compile.
One suggestion I might make then is to change the soundtouch code in
our tree to use __WIN32__, as long as MSVC sees that properly. Olli
(the SoundTouch maintainer) might even be interested in a patch for
that. (Yeah, looking at the line commented "#for soundtouch" below
reminds me that all of those are there to make SoundTouch work right.)
Probably all of the QT-related symbols that we define are obsolete
because they are all from the QT3 era, and I just left them in for
safety when we ported to Qt 4/SCONS. Now that I have a bit more
experience with both, I think they're safe to remove. :)
If you really need to add __OPENBSD__, go ahead. We try to rely on
libraries for as much cross-platform functionality as possible (ie.
the libraries have all the #ifdef __WIN32__ blocks, etc. in them), but
sometimes you just can't get around it and still have to throw down a
bunch of #ifdef sandwiches.
Thanks,
Albert
On 22-Jan-09, at 12:41 PM, Nick Guenther wrote:
> The build script -D'd __MACX__ and a bunch of source files used it,
> which is silly when Apple's gcc defines __APPLE__. The patch below
> fixes this.
>
> Also, there's a bunch of places in the code that use __WIN__ and
> there's other places that use __WIN32__. I *think* __WIN32__ is the
> canonical #define. Both are defined by the SConscript, though. I'm
> going to clean these up but I'm not entirely sure which to standardize
> on. Also, the sconscript line that makes __WIN__ reads
> env.Append(CXXFLAGS = '-DWIN32 -D__WIN__ -DUNICODE -D_WINDOWS') #for
> soundtouch
> but I don't see where this is important. Also there's Q_WS_WIN which I
> am guessing is a Qt #define.
>
> FURTHER some places use __UNIX__ and some places use __LINUX__. I'm
> planning to add __OpenBSD__ too. What should we do about all this?
>
>
> Index: lib/ladspa/SConscript
> ===================================================================
> --- lib/ladspa/SConscript (revision 2471)
> +++ lib/ladspa/SConscript (working copy)
> @@ -1,4 +1,6 @@
> #We want to build the LADSPA plugins without any "lib" prefix on
> POSIX platforms.
> +
> +#Import('*') #make these all part of a hierarchical build
> env = Environment(SHLIBPREFIX='')
> env.Append(CPPPATH=['.'], ENV = os.environ)
> SConscript(['caps/SConscript'], exports='env')
> Index: src/soundsourceoggvorbis.cpp
> ===================================================================
> --- src/soundsourceoggvorbis.cpp (revision 2471)
> +++ src/soundsourceoggvorbis.cpp (working copy)
> @@ -22,7 +22,7 @@
> #include <fcntl.h>
> #endif
>
> -#ifdef __MACX__
> +#ifdef __APPLE__
> #ifdef __i386
> #define OV_ENDIAN_ARG 0
> #else
> Index: src/configobject.cpp
> ===================================================================
> --- src/configobject.cpp (revision 2471)
> +++ src/configobject.cpp (working copy)
> @@ -28,7 +28,7 @@
> #include <windows.h>
> #endif
>
> -#ifdef __MACX__
> +#ifdef __APPLE__
> #include <CoreFoundation/CoreFoundation.h>
> #endif
>
> @@ -683,7 +683,7 @@
> GetModuleFileName(NULL, (WCHAR *)str, 200);
> qConfigPath = QFileInfo(str).dirPath();
> #endif
> -#ifdef __MACX__
> +#ifdef __APPLE__
> // Set the path relative to the bundle directory
> CFURLRef pluginRef =
> CFBundleCopyBundleURL(CFBundleGetMainBundle());
> CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef,
> kCFURLPOSIXPathStyle);
> Index: src/SConscript
> ===================================================================
> --- src/SConscript (revision 2471)
> +++ src/SConscript (working copy)
> @@ -506,7 +506,7 @@
> env.Append(CXXFLAGS = '-DTEMPORAL -D__UNIX__ -D__LINUX__
> -DBPMSCHEME_FILE=\\".mixxxbpmscheme.xml\\"
> -DSETTINGS_FILE=\\".mixxx.cfg\\" -DTRACK_FILE=\\".mixxxtrack.xml\\"')
> env.Append(CXXFLAGS = '-DUNIX_SHARE_PATH=\\"' +
> ARGUMENTS.get('prefix', '/usr/local') + '/share/mixxx\\"')
> elif platform == 'osx':
> - env.Append(CXXFLAGS = '-D__MACX__
> -DBPMSCHEME_FILE=\\".mixxxbpmscheme.xml\\"
> -DSETTINGS_FILE=\\".mixxx.cfg\\" -DTRACK_FILE=\\".mixxxtrack.xml\\"')
> + env.Append(CXXFLAGS = '-DBPMSCHEME_FILE=\\".mixxxbpmscheme.xml\\"
> -DSETTINGS_FILE=\\".mixxx.cfg\\" -DTRACK_FILE=\\".mixxxtrack.xml\\"')
> elif platform == 'win32':
> env.Append(CXXFLAGS = '-D__WIN32__
> -DBPMSCHEME_FILE=\\"mixxxbpmschemes.xml\\"
> -DSETTINGS_FILE=\\"mixxx.cfg\\" -DTRACK_FILE=\\"mixxxtrack.xml\\"')
>
> Index: src/enginespectralback.h
> ===================================================================
> --- src/enginespectralback.h (revision 2471)
> +++ src/enginespectralback.h (working copy)
> @@ -12,14 +12,13 @@
>
> #include "engineobject.h"
> #include <math.h>
> -#ifndef __MACX__
> +#ifdef __APPLE__
> +#include <fftw.h>
> +#include <rfftw.h>
> +#else
> #include <sfftw.h>
> #include <srfftw.h>
> #endif
> -#ifdef __MACX__
> -#include <fftw.h>
> -#include <rfftw.h>
> -#endif
>
> /**
> * Perfoms an inverse FFT on data in polar coordinates.
> Index: src/old/wvisualwaveform.cpp
> ===================================================================
> --- src/old/wvisualwaveform.cpp (revision 2471)
> +++ src/old/wvisualwaveform.cpp (working copy)
> @@ -34,7 +34,7 @@
>
> installEventFilter(this);
>
> -#ifdef __MACX__
> +#ifdef __APPLE__
> // Hack to reduce load in GUI thread. This makes the system behave
> // "correctly" on MacOS X, where it would otherwise stall the
> system
> // for some seconds now and then.
> Index: src/old/playerportaudio.cpp
> ===================================================================
> --- src/old/playerportaudio.cpp (revision 2471)
> +++ src/old/playerportaudio.cpp (working copy)
> @@ -740,7 +740,7 @@
> #ifdef __LINUX__
> return QStringList("OSS (PA)");
> #endif
> - #ifdef __MACX__
> + #ifdef __APPLE__
> return QStringList("CoreAudio (PA)");
> #endif
> #ifdef __WIN__
> Index: src/rtthread.h
> ===================================================================
> --- src/rtthread.h (revision 2471)
> +++ src/rtthread.h (working copy)
> @@ -22,7 +22,7 @@
> #ifndef RTTHREAD_H
> #define RTTHREAD_H
>
> -#ifdef __MACX__
> +#ifdef __APPLE__
> #include <mach/mach_init.h>
> #include <mach/task_policy.h>
> #include <mach/thread_act.h>
> @@ -35,7 +35,7 @@
> #include <sys/resource.h>
> #endif
>
> -#ifdef __MACX__
> +#ifdef __APPLE__
> int get_bus_speed();
> #endif
>
> Index: src/soundmanager.cpp
> ===================================================================
> --- src/soundmanager.cpp (revision 2471)
> +++ src/soundmanager.cpp (working copy)
> @@ -335,7 +335,7 @@
> //Do something more advanced one day if you like - Adam
> setHostAPI(MIXXX_PORTAUDIO_DIRECTSOUND_STRING);
> #endif
> -#ifdef __MACX__
> +#ifdef __APPLE__
> setHostAPI(MIXXX_PORTAUDIO_COREAUDIO_STRING);
> #endif
> }
> Index: src/reader.cpp
> ===================================================================
> --- src/reader.cpp (revision 2471)
> +++ src/reader.cpp (working copy)
> @@ -238,7 +238,7 @@
> void Reader::run()
> {
> //qDebug() << "Reader running...";
> -#ifdef __MACX__
> +#ifdef __APPLE__
> rtThread();
> #endif
>
> Index: src/rtthread.cpp
> ===================================================================
> --- src/rtthread.cpp (revision 2471)
> +++ src/rtthread.cpp (working copy)
> @@ -23,7 +23,7 @@
> #include <qobject.h>
> #include <QDebug>
>
> -#ifdef __MACX__
> +#ifdef __APPLE__
> int get_bus_speed()
> {
> int mib[2];
> @@ -43,7 +43,7 @@
>
> void rtThread()
> {
> -#ifdef __MACX__
> +#ifdef __APPLE__
> struct thread_time_constraint_policy ttcpolicy;
> kern_return_t theError;
> /* This is in AbsoluteTime units, which are equal to
> @@ -64,7 +64,7 @@
> qDebug() << "Can't do thread_policy_set";
> #endif
> #ifdef __UNIX__
> -#ifndef __MACX__
> +#ifndef __APPLE__
> // Try to set realtime priority on the current executing thread.
> This should be used in time-critical
> // producer threads.
> struct sched_param schp;
> Index: src/ladspaloader.cpp
> ===================================================================
> --- src/ladspaloader.cpp (revision 2471)
> +++ src/ladspaloader.cpp (working copy)
> @@ -32,7 +32,7 @@
> #ifdef __LINUX__
> paths.push_back ("/usr/lib/ladspa/");
> paths.push_back ("/usr/lib64/ladspa/");
> -#elif __MACX__
> +#elif __APPLE__
> paths.push_back ("/Library/Audio/Plug-ins/LADSPA");
> paths.push_back ("../../ladspa_plugins"); //ladspa_plugins
> directory in Mixxx.app bundle
> paths.push_back ("Mixxx.app/ladspa_plugins");
> //ladspa_plugins directory in Mixxx.app bundle
> Index: src/mixxx.cpp
> ===================================================================
> --- src/mixxx.cpp (revision 2471)
> +++ src/mixxx.cpp (working copy)
> @@ -86,12 +86,7 @@
>
> qDebug() << "Mixxx" << VERSION << buildRevision << "is
> starting...";
> setWindowTitle(tr("Mixxx " VERSION));
> -#ifdef __MACX__
> setWindowIcon(QIcon(":icon.svg"));
> -#else
> - setWindowIcon(QIcon(":icon.svg"));
> - //setWindowIcon(QIcon(":iconsmall.png")); //This is a smaller
> 16x16 icon, looks cleaner...
> -#endif
>
> //Reset pointer to players
> soundmanager = 0;
> Index: src/main.cpp
> ===================================================================
> --- src/main.cpp (revision 2471)
> +++ src/main.cpp (working copy)
> @@ -153,7 +153,7 @@
>
> //Hack to make QT4 find the plugins when packaging in the Mixxx.app
> bundle on OS X.
> //See http://doc.trolltech.com/4.3/deployment-mac.html for details.
> -#ifdef __MACX__
> +#ifdef __APPLE__
> QDir dir(QApplication::applicationDirPath());
> dir.cdUp();
> dir.cd("plugins");
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Mixxx-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mixxx-devel
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Mixxx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixxx-devel