Fix macOS build

This commit is contained in:
Jonas Kvinge 2019-06-12 06:34:59 +02:00
parent 4875d319dc
commit 5ef5da687d
7 changed files with 71 additions and 11 deletions

View File

@ -24,9 +24,7 @@ before_install:
brew unlink python;
brew install glib pkgconfig libffi protobuf protobuf-c qt gettext gnutls fftw;
brew install sqlite --with-fts;
brew install gstreamer gst-plugins-base;
brew install gst-plugins-good --with-flac;
brew install gst-plugins-bad gst-plugins-ugly gst-libav;
brew install gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav;
brew install chromaprint;
brew install libcdio libmtp libimobiledevice libplist;
export Qt5_DIR=/usr/local/opt/qt5/lib/cmake;
@ -36,19 +34,19 @@ before_install:
ls /usr/local/lib/gstreamer-1.0;
fi
before_script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker exec build cmake -Hstrawberry -Bbuild -DENABLE_TRANSLATIONS=ON ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir build; cd build; cmake .. -DUSE_BUNDLE=ON -DENABLE_TRANSLATIONS=ON ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker exec build cmake -Hstrawberry -Bbuild ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir build; cd build; cmake .. -DUSE_BUNDLE=ON ; fi
script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker exec build make -C build -j8 ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
make -j8;
sudo make install;
sudo ../dist/macos/macdeploy.py strawberry.app;
../dist/macos/create-dmg.sh strawberry.app $CC_FOR_BUILD;
../dist/macos/create-dmg.sh strawberry.app;
fi
after_success:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ls -lh strawberry.dmg; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ "$TRAVIS_BRANCH" == "master" ]]; then rsync -e "ssh -o StrictHostKeyChecking=no" -va strawberry*.dmg travis@echoes.jkvinge.net:/home/travis/builds/macos; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ "$TRAVIS_BRANCH" == "master" ]] && [[ "$CC_FOR_BUILD" == "gcc" ]]; then rsync -e "ssh -o StrictHostKeyChecking=no" -va strawberry*.dmg travis@echoes.jkvinge.net:/home/travis/builds/macos; fi
branches:
except:

View File

@ -100,7 +100,8 @@ GSTREAMER_PLUGINS = [
'libgsttaglib.so',
'libgstvorbis.so',
'libgstisomp4.so',
'libgstlame.so',
#'libgstlame.so',
#'libgsttwolame.so',
'libgstlibav.so',
]
@ -465,7 +466,7 @@ def main():
FixPlugin(FindGstreamerPlugin('gst-plugin-scanner'), '.')
FixPlugin(FindGioModule('libgiognutls.so'), 'gio-modules')
FixPlugin(FindGioModule('libgiognomeproxy.so'), 'gio-modules')
#FixPlugin(FindGioModule('libgiognomeproxy.so'), 'gio-modules')
try:
FixPlugin('strawberry-tagreader', '.')

View File

@ -9,6 +9,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${GLIB_INCLUDE_DIRS})
include_directories(${GOBJECT_INCLUDE_DIRS})
include_directories(${GSTREAMER_INCLUDE_DIRS})
include_directories(${GSTREAMER_AUDIO_INCLUDE_DIRS})
include_directories(${FFTW3_INCLUDE_DIR})
set(SOURCES gstfastspectrum.cpp gstmoodbarplugin.cpp)

View File

@ -22,6 +22,9 @@
#include <cstring>
#include <cmath>
#include <gst/gst.h>
#include <gst/audio/gstaudiofilter.h>
#include <QMutex>
#include <QMutexLocker>

View File

@ -40,7 +40,7 @@ class MacSystemTrayIcon : public SystemTrayIcon {
MacSystemTrayIcon(QObject *parent = nullptr);
~MacSystemTrayIcon();
void SetupMenu(QAction *previous, QAction *play, QAction *stop, QAction *stop_after, QAction *next, QAction *mute, QAction *quit);
void SetupMenu(QAction *previous, QAction *play, QAction *stop, QAction *stop_after, QAction *next, QAction *mute, QAction *love, QAction *quit);
void SetNowPlaying(const Song& song, const QString& image_path);
void ClearNowPlaying();

View File

@ -171,7 +171,7 @@ MacSystemTrayIcon::MacSystemTrayIcon(QObject* parent)
MacSystemTrayIcon::~MacSystemTrayIcon() {
}
void MacSystemTrayIcon::SetupMenu(QAction* previous, QAction* play, QAction* stop, QAction* stop_after, QAction* next, QAction* mute, QAction* quit) {
void MacSystemTrayIcon::SetupMenu(QAction* previous, QAction* play, QAction* stop, QAction* stop_after, QAction* next, QAction* mute, QAction* love, QAction* quit) {
p_.reset(new MacSystemTrayIconPrivate());
SetupMenuItem(previous);
@ -182,6 +182,7 @@ void MacSystemTrayIcon::SetupMenu(QAction* previous, QAction* play, QAction* sto
p_->AddSeparator();
SetupMenuItem(mute);
p_->AddSeparator();
SetupMenuItem(love);
Q_UNUSED(quit); // Mac already has a Quit item.
}

56
src/widgets/qocoa_mac.h Normal file
View File

@ -0,0 +1,56 @@
/*
Copyright (C) 2011 by Mike McQuaid
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <AppKit/NSImage.h>
#include <Foundation/NSString.h>
#include <QString>
#include <QBoxLayout>
#include <QtMacExtras>
#include <QMacCocoaViewContainer>
static inline NSString* fromQString(const QString &string)
{
const QByteArray utf8 = string.toUtf8();
const char* cString = utf8.constData();
return [[NSString alloc] initWithUTF8String:cString];
}
static inline QString toQString(NSString *string)
{
if (!string)
return QString();
return QString::fromUtf8([string UTF8String]);
}
static inline NSImage* fromQPixmap(const QPixmap &pixmap)
{
CGImageRef cgImage = QtMac::toCGImageRef(pixmap);
return [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize];
}
static inline void setupLayout(NSView *cocoaView, QWidget *parent)
{
parent->setAttribute(Qt::WA_NativeWindow);
QVBoxLayout *layout = new QVBoxLayout(parent);
layout->setMargin(0);
layout->addWidget(new QMacCocoaViewContainer(cocoaView, parent));
}