Fix compile with clang and openbsd

This commit is contained in:
Jonas Kvinge 2018-05-14 17:57:37 +02:00
parent 4746922e9f
commit 7356344136
13 changed files with 506 additions and 591 deletions

View File

@ -1,3 +1,6 @@
cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_CXX_STANDARD 11)
set(SOURCES) set(SOURCES)
set(HEADERS set(HEADERS
@ -26,7 +29,5 @@ else()
qt5_add_resources(RESOURCES_SOURCES ${RESOURCES}) qt5_add_resources(RESOURCES_SOURCES ${RESOURCES})
endif() endif()
add_library(Qocoa STATIC add_library(Qocoa STATIC ${SOURCES} ${MOC_SOURCES} ${RESOURCES_SOURCES})
${SOURCES} ${MOC_SOURCES} ${RESOURCES_SOURCES}
)
target_link_libraries(Qocoa ${QT_LIBRARIES}) target_link_libraries(Qocoa ${QT_LIBRARIES})

View File

@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 2.8.11) cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_CXX_STANDARD 11)
set(SINGLEAPP-SOURCES set(SINGLEAPP-SOURCES
qtlocalpeer.cpp qtlocalpeer.cpp

View File

@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 2.8.11) cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_CXX_STANDARD 11)
set(QTWIN-SOURCES set(QTWIN-SOURCES
qtwin.cpp qtwin.cpp

View File

@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 2.8.11) cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_CXX_STANDARD 11)
set(QXT-SOURCES set(QXT-SOURCES
qxtglobal.cpp qxtglobal.cpp

View File

@ -1,3 +1,4 @@
cmake_minimum_required(VERSION 2.8.11) cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_CXX_STANDARD 11)
add_library(sha2 STATIC sha2.cpp) add_library(sha2 STATIC sha2.cpp)

View File

@ -1,3 +1,5 @@
cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-delete-non-virtual-dtor") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-delete-non-virtual-dtor")
set(TAGLIB_SOVERSION_CURRENT 17) set(TAGLIB_SOVERSION_CURRENT 17)

View File

@ -1 +1,2 @@
cmake_minimum_required(VERSION 2.8.11) cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_CXX_STANDARD 11)

View File

@ -29,9 +29,19 @@ include(cmake/Summary.cmake)
include(cmake/OptionalSource.cmake) include(cmake/OptionalSource.cmake)
include(cmake/Rpm.cmake) include(cmake/Rpm.cmake)
#set(CMAKE_BUILD_TYPE Debug) if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(LINUX 1)
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set(FREEBSD 1)
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
set(OPENBSD 1)
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
#set(CMAKE_BUILD_TYPE Debug)
if(${CMAKE_BUILD_TYPE} MATCHES "Release") if(${CMAKE_BUILD_TYPE} MATCHES "Release")
add_definitions(-DNDEBUG) add_definitions(-DNDEBUG)
@ -46,7 +56,7 @@ endif ()
if (APPLE) if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --stdlib=libc++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --stdlib=libc++")
endif () endif(APPLE)
find_program(CCACHE_EXECUTABLE NAMES ccache) find_program(CCACHE_EXECUTABLE NAMES ccache)
if (CCACHE_EXECUTABLE) if (CCACHE_EXECUTABLE)
@ -57,10 +67,6 @@ endif ()
find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert lconvert-qt5 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH) find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert lconvert-qt5 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH)
find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert lconvert-qt5) find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert lconvert-qt5)
if (UNIX AND NOT APPLE)
set(LINUX 1)
endif (UNIX AND NOT APPLE)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB REQUIRED glib-2.0) pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(GIO REQUIRED gio-2.0) pkg_check_modules(GIO REQUIRED gio-2.0)
@ -72,7 +78,12 @@ find_package(Protobuf REQUIRED)
find_library(PROTOBUF_STATIC_LIBRARY libprotobuf.a libprotobuf) find_library(PROTOBUF_STATIC_LIBRARY libprotobuf.a libprotobuf)
if(LINUX) if(LINUX)
find_package(ALSA REQUIRED) find_package(ALSA REQUIRED)
else(LINUX)
find_package(ALSA)
endif(LINUX) endif(LINUX)
if(ALSA_FOUND)
set(HAVE_ALSA ON)
endif()
find_package(X11) find_package(X11)
pkg_check_modules(GSTREAMER gstreamer-1.0) pkg_check_modules(GSTREAMER gstreamer-1.0)
pkg_check_modules(GSTREAMER_BASE gstreamer-base-1.0) pkg_check_modules(GSTREAMER_BASE gstreamer-base-1.0)
@ -223,7 +234,7 @@ optional_component(LIBGPOD ON "Devices: iPod classic support"
optional_component(GIO ON "Devices: GIO device backend" optional_component(GIO ON "Devices: GIO device backend"
DEPENDS "libgio" GIO_FOUND DEPENDS "libgio" GIO_FOUND
DEPENDS "Linux or Windows" "NOT APPLE" DEPENDS "Unix or Windows" "NOT APPLE"
) )
optional_component(IMOBILEDEVICE ON "Devices: iPod Touch, iPhone, iPad support" optional_component(IMOBILEDEVICE ON "Devices: iPod Touch, iPhone, iPad support"
@ -242,7 +253,7 @@ optional_component(LIBLASTFM ON "Last.fm support"
) )
optional_component(DBUS ON "D-Bus support" optional_component(DBUS ON "D-Bus support"
DEPENDS "Linux" LINUX DEPENDS "Unix" "NOT APPLE"
) )
optional_component(DEVICEKIT ON "Devices: DeviceKit backend" optional_component(DEVICEKIT ON "Devices: DeviceKit backend"
@ -326,6 +337,7 @@ else (USE_SYSTEM_QXT)
endif (USE_SYSTEM_QXT) endif (USE_SYSTEM_QXT)
# Qocoa # Qocoa
set(QOCOA_LIBRARIES Qocoa)
add_subdirectory(3rdparty/qocoa) add_subdirectory(3rdparty/qocoa)
#if(IMOBILEDEVICE_FOUND AND PLIST_FOUND) #if(IMOBILEDEVICE_FOUND AND PLIST_FOUND)

View File

@ -3,7 +3,7 @@ set(STRAWBERRY_VERSION_MINOR 1)
set(STRAWBERRY_VERSION_PATCH 3) set(STRAWBERRY_VERSION_PATCH 3)
#set(STRAWBERRY_VERSION_PRERELEASE rc1) #set(STRAWBERRY_VERSION_PRERELEASE rc1)
set(INCLUDE_GIT_REVISION OFF) set(INCLUDE_GIT_REVISION ON)
set(majorminorpatch "${STRAWBERRY_VERSION_MAJOR}.${STRAWBERRY_VERSION_MINOR}.${STRAWBERRY_VERSION_PATCH}") set(majorminorpatch "${STRAWBERRY_VERSION_MAJOR}.${STRAWBERRY_VERSION_MINOR}.${STRAWBERRY_VERSION_PATCH}")

View File

@ -1,132 +1,30 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>schema/schema.sql</file> <file>schema/schema.sql</file>
<file>schema/device-schema.sql</file> <file>schema/device-schema.sql</file>
<file>style/mainwindow.css</file> <file>style/mainwindow.css</file>
<file>style/statusview.css</file> <file>style/statusview.css</file>
<file>misc/blank.ttf</file>
<file>misc/playing_tooltip.txt</file> <file>misc/playing_tooltip.txt</file>
<file>pictures/strawberry.png</file> <file>pictures/strawberry.png</file>
<file>pictures/strawbs-transparent.png</file> <file>pictures/strawbs-transparent.png</file>
<file>pictures/noalbumart.png</file> <file>pictures/noalbumart.png</file>
<file>pictures/nomusic.png</file> <file>pictures/nomusic.png</file>
<file>pictures/musicbrainz.png</file> <file>pictures/musicbrainz.png</file>
<file>pictures/tiny-play.png</file> <file>pictures/tiny-play.png</file>
<file>pictures/tiny-pause.png</file> <file>pictures/tiny-pause.png</file>
<file>pictures/spinner.gif</file> <file>pictures/spinner.gif</file>
<file>pictures/volumeslider-gradient.png</file> <file>pictures/volumeslider-gradient.png</file>
<file>pictures/volumeslider-handle_glow.png</file> <file>pictures/volumeslider-handle_glow.png</file>
<file>pictures/volumeslider-handle.png</file> <file>pictures/volumeslider-handle.png</file>
<file>pictures/volumeslider-inset.png</file> <file>pictures/volumeslider-inset.png</file>
<file>pictures/currenttrack_play.png</file> <file>pictures/currenttrack_play.png</file>
<file>pictures/currenttrack_pause.png</file> <file>pictures/currenttrack_pause.png</file>
<file>pictures/currenttrack_bar_left.png</file> <file>pictures/currenttrack_bar_left.png</file>
<file>pictures/currenttrack_bar_mid.png</file> <file>pictures/currenttrack_bar_mid.png</file>
<file>pictures/currenttrack_bar_right.png</file> <file>pictures/currenttrack_bar_right.png</file>
<file>pictures/osd_background.png</file> <file>pictures/osd_background.png</file>
<file>pictures/osd_shadow_corner.png</file> <file>pictures/osd_shadow_corner.png</file>
<file>pictures/osd_shadow_edge.png</file> <file>pictures/osd_shadow_edge.png</file>
<file>icons/full/albums.png</file>
<file>icons/full/alsa.png</file>
<file>icons/full/application-exit.png</file>
<file>icons/full/applications-internet.png</file>
<file>icons/full/bluetooth.png</file>
<file>icons/full/cdcase.png</file>
<file>icons/full/cd.png</file>
<file>icons/full/configure.png</file>
<file>icons/full/device-ipod-nano.png</file>
<file>icons/full/device-ipod.png</file>
<file>icons/full/device-phone.png</file>
<file>icons/full/device.png</file>
<file>icons/full/device-usb-drive.png</file>
<file>icons/full/device-usb-flash.png</file>
<file>icons/full/dialog-error.png</file>
<file>icons/full/dialog-information.png</file>
<file>icons/full/dialog-ok-apply.png</file>
<file>icons/full/dialog-password.png</file>
<file>icons/full/dialog-warning.png</file>
<file>icons/full/document-download.png</file>
<file>icons/full/document-new.png</file>
<file>icons/full/document-open-folder.png</file>
<file>icons/full/document-open.png</file>
<file>icons/full/document-save.png</file>
<file>icons/full/document-search.png</file>
<file>icons/full/download.png</file>
<file>icons/full/edit-clear-list.png</file>
<file>icons/full/edit-clear-locationbar-ltr.png</file>
<file>icons/full/edit-copy.png</file>
<file>icons/full/edit-delete.png</file>
<file>icons/full/edit-find.png</file>
<file>icons/full/edit-redo.png</file>
<file>icons/full/edit-rename.png</file>
<file>icons/full/edit-undo.png</file>
<file>icons/full/electrocompaniet.png</file>
<file>icons/full/equalizer.png</file>
<file>icons/full/folder-new.png</file>
<file>icons/full/folder.png</file>
<file>icons/full/folder-sound.png</file>
<file>icons/full/footsteps.png</file>
<file>icons/full/go-down.png</file>
<file>icons/full/go-home.png</file>
<file>icons/full/go-jump.png</file>
<file>icons/full/go-next.png</file>
<file>icons/full/go-previous.png</file>
<file>icons/full/go-up.png</file>
<file>icons/full/gstreamer.png</file>
<file>icons/full/guitar.png</file>
<file>icons/full/headset.png</file>
<file>icons/full/help-hint.png</file>
<file>icons/full/intel.png</file>
<file>icons/full/jack.png</file>
<file>icons/full/keyboard.png</file>
<file>icons/full/list-add.png</file>
<file>icons/full/list-remove.png</file>
<file>icons/full/mcintosh-player.png</file>
<file>icons/full/mcintosh.png</file>
<file>icons/full/mcintosh-text.png</file>
<file>icons/full/media-eject.png</file>
<file>icons/full/media-forward.png</file>
<file>icons/full/media-pause.png</file>
<file>icons/full/media-playlist-repeat.png</file>
<file>icons/full/media-playlist-shuffle.png</file>
<file>icons/full/media-play.png</file>
<file>icons/full/media-rewind.png</file>
<file>icons/full/media-stop.png</file>
<file>icons/full/nvidia.png</file>
<file>icons/full/play2.png</file>
<file>icons/full/pulseaudio.png</file>
<file>icons/full/realtek.png</file>
<file>icons/full/search.png</file>
<file>icons/full/soundcard2.png</file>
<file>icons/full/soundcard.png</file>
<file>icons/full/speaker.png</file>
<file>icons/full/star-grey.png</file>
<file>icons/full/star.png</file>
<file>icons/full/strawberry-panel-grey.png</file>
<file>icons/full/strawberry-panel.png</file>
<file>icons/full/strawberry.png</file>
<file>icons/full/strawberry.svg</file>
<file>icons/full/tools-wizard.png</file>
<file>icons/full/view-choose.png</file>
<file>icons/full/view-fullscreen.png</file>
<file>icons/full/view-media-lyrics.png</file>
<file>icons/full/view-media-playlist.png</file>
<file>icons/full/view-media-visualization.png</file>
<file>icons/full/view-refresh.png</file>
<file>icons/full/vinyl.png</file>
<file>icons/full/vlc.png</file>
<file>icons/full/xine.png</file>
<file>icons/full/zoom-in.png</file>
<file>icons/full/zoom-out.png</file>
<file>icons/128x128/albums.png</file> <file>icons/128x128/albums.png</file>
<file>icons/128x128/alsa.png</file> <file>icons/128x128/alsa.png</file>
<file>icons/128x128/application-exit.png</file> <file>icons/128x128/application-exit.png</file>
@ -578,6 +476,5 @@
<file>icons/22x22/xine.png</file> <file>icons/22x22/xine.png</file>
<file>icons/22x22/zoom-in.png</file> <file>icons/22x22/zoom-in.png</file>
<file>icons/22x22/zoom-out.png</file> <file>icons/22x22/zoom-out.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -16,8 +16,9 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Strawberry. If not, see <http://www.gnu.org/licenses/>. # along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Woverloaded-virtual -Wno-sign-compare -Wno-deprecated-declarations -Wno-unused-local-typedefs -fpermissive --std=c++0x -U__STRICT_ANSI__") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Woverloaded-virtual -Wno-sign-compare -Wno-deprecated-declarations -Wno-unused-local-typedefs -fpermissive --std=c++11 -U__STRICT_ANSI__")
option(BUILD_WERROR "Build with -Werror" ON) option(BUILD_WERROR "Build with -Werror" ON)
@ -504,7 +505,7 @@ optional_source(HAVE_LIBLASTFM
) )
# Platform specific - Linux # Platform specific - Linux
optional_source(LINUX optional_source(HAVE_ALSA
SOURCES SOURCES
engine/alsadevicefinder.cpp engine/alsadevicefinder.cpp
) )
@ -552,9 +553,9 @@ optional_source(WIN32
) )
# Platform specific - X11 # Platform specific - X11
optional_source(LINUX SOURCES widgets/osd_x11.cpp) optional_source(UNIX SOURCES widgets/osd_x11.cpp)
# DBUS and MPRIS - Linux specific # DBUS and MPRIS - Unix specific
if(HAVE_DBUS) if(HAVE_DBUS)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dbus) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dbus)
@ -827,7 +828,6 @@ add_library(strawberry_lib STATIC
target_link_libraries(strawberry_lib target_link_libraries(strawberry_lib
libstrawberry-common libstrawberry-common
libstrawberry-tagreader libstrawberry-tagreader
#gstafc
${GLIB_LIBRARIES} ${GLIB_LIBRARIES}
${GIO_LIBRARIES} ${GIO_LIBRARIES}
${SHA2_LIBRARIES} ${SHA2_LIBRARIES}
@ -839,13 +839,13 @@ target_link_libraries(strawberry_lib
${QTSINGLEAPPLICATION_LIBRARIES} ${QTSINGLEAPPLICATION_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${SQLITE_LIBRARIES} ${SQLITE_LIBRARIES}
${QOCOA_LIBRARIES}
z z
Qocoa
) )
if(LINUX) if(HAVE_ALSA)
target_link_libraries(strawberry_lib ${ALSA_LIBRARIES}) target_link_libraries(strawberry_lib ${ALSA_LIBRARIES})
endif(LINUX) endif(HAVE_ALSA)
if(HAVE_LIBLASTFM) if(HAVE_LIBLASTFM)
target_link_libraries(strawberry_lib ${LASTFM5_LIBRARIES}) target_link_libraries(strawberry_lib ${LASTFM5_LIBRARIES})
@ -910,13 +910,11 @@ if (WIN32)
endif (WIN32) endif (WIN32)
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
# Hack: the Gold linker pays attention to the order that libraries are # Hack: the Gold linker pays attention to the order that libraries are specified on the link line.
# specified on the link line. -lX11 and -ldl are provided earlier in the link # -lX11 and -ldl are provided earlier in the link command but they're actually used by libraries that appear after them, so they end up getting ignored.
# command but they're actually used by libraries that appear after them, so # This appends them to the very end of the link line, ensuring they're always used.
# they end up getting ignored. This appends them to the very end of the link
# line, ensuring they're always used.
find_package(X11) find_package(X11)
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") if (FREEBSD)
target_link_libraries(strawberry_lib ${X11_X11_LIB}) target_link_libraries(strawberry_lib ${X11_X11_LIB})
else () else ()
target_link_libraries(strawberry_lib ${X11_X11_LIB} ${CMAKE_DL_LIBS}) target_link_libraries(strawberry_lib ${X11_X11_LIB} ${CMAKE_DL_LIBS})
@ -948,9 +946,9 @@ add_executable(strawberry
core/main.cpp core/main.cpp
) )
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") if(FREEBSD)
target_link_libraries(strawberry execinfo) target_link_libraries(strawberry execinfo)
endif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") endif()
target_link_libraries(strawberry target_link_libraries(strawberry
strawberry_lib strawberry_lib

View File

@ -647,6 +647,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
FancyTabWidget::Mode default_mode = FancyTabWidget::Mode_LargeSidebar; FancyTabWidget::Mode default_mode = FancyTabWidget::Mode_LargeSidebar;
ui_->tabs->SetMode(FancyTabWidget::Mode(settings_.value("tab_mode", default_mode).toInt())); ui_->tabs->SetMode(FancyTabWidget::Mode(settings_.value("tab_mode", default_mode).toInt()));
file_view_->SetPath(settings_.value("file_path", QDir::homePath()).toString()); file_view_->SetPath(settings_.value("file_path", QDir::homePath()).toString());
TabSwitched(); TabSwitched();
// Users often collapse one side of the splitter by mistake and don't know how to restore it. This must be set after the state is restored above. // Users often collapse one side of the splitter by mistake and don't know how to restore it. This must be set after the state is restored above.
@ -729,7 +730,6 @@ void MainWindow::ReloadSettings() {
doubleclick_playlist_addmode_ = PlaylistAddBehaviour(settings.value("doubleclick_playlist_addmode", PlaylistAddBehaviour_Play).toInt()); doubleclick_playlist_addmode_ = PlaylistAddBehaviour(settings.value("doubleclick_playlist_addmode", PlaylistAddBehaviour_Play).toInt());
menu_playmode_ = PlayBehaviour(settings.value("menu_playmode", PlayBehaviour_IfStopped).toInt()); menu_playmode_ = PlayBehaviour(settings.value("menu_playmode", PlayBehaviour_IfStopped).toInt());
settings.endGroup(); settings.endGroup();
} }
void MainWindow::ReloadAllSettings() { void MainWindow::ReloadAllSettings() {

View File

@ -87,7 +87,7 @@ StatusView::StatusView(CollectionViewContainer *collectionviewcontainer, QWidget
show_hide_animation_(new QTimeLine(500, this)), show_hide_animation_(new QTimeLine(500, this)),
fade_animation_(new QTimeLine(1000, this)), fade_animation_(new QTimeLine(1000, this)),
image_blank_(""), image_blank_(""),
image_nosong_(":/icons/full/strawberry.png"), image_nosong_(":/pictures/strawberry.png"),
widgetstate_(None), widgetstate_(None),
menu_(new QMenu(this)) menu_(new QMenu(this))
{ {
@ -348,7 +348,7 @@ void StatusView::NoSong() {
//qLog(Debug) << __PRETTY_FUNCTION__; //qLog(Debug) << __PRETTY_FUNCTION__;
QString html; QString html;
QImage image_logo(":/icons/full/strawberry.png"); QImage image_logo(":/pictures/strawberry.png");
QImage image_logo_scaled = image_logo.scaled(300, 300, Qt::KeepAspectRatio); QImage image_logo_scaled = image_logo.scaled(300, 300, Qt::KeepAspectRatio);
QPixmap pixmap_logo(QPixmap::fromImage(image_logo_scaled)); QPixmap pixmap_logo(QPixmap::fromImage(image_logo_scaled));