Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 29 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
cmake_minimum_required(VERSION 2.8.6)
cmake_minimum_required(VERSION 3.6)
project(liblastfm)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)

# general settings
set(LASTFM_SOVERSION 1)
set(LASTFM_VERSION "0x00010100")
Expand All @@ -21,43 +19,44 @@ option(BUILD_TESTS "Build liblastfm tests" ON)
# installation dirs
include(GNUInstallDirs)
include(FeatureSummary)

#cmake module path
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake/Modules")
include(FindPkgConfig)

# setup qt stuff
set(CMAKE_AUTOMOC ON)

option(BUILD_WITH_QT4 "Build liblastfm with Qt4" OFF)
find_package(Qt5 CONFIG REQUIRED COMPONENTS Core Network Xml)

if(NOT BUILD_WITH_QT4)
find_package(Qt5 REQUIRED COMPONENTS Core Network Xml CONFIG)
if(BUILD_FINGERPRINT)
find_package(Qt5Sql CONFIG REQUIRED)

if(BUILD_FINGERPRINT)
find_package(Qt5Sql REQUIRED CONFIG)
endif()
pkg_check_modules(LibSamplerate REQUIRED IMPORTED_TARGET samplerate)
add_feature_info(LibSamplerate LibSamplerate_FOUND "Required for lastfm-fingerprint library")

set(LASTFM_LIB_VERSION_SUFFIX 5)
if(UNIX AND NOT APPLE)
find_package(Qt5DBus REQUIRED CONFIG)
endif()
pkg_check_modules(FFTW3F REQUIRED IMPORTED_TARGET fftw3f>=3.0)
add_feature_info(FFTW3F FFTW3F_FOUND "Required for lastfm-fingerprint library")
endif()

# macro(qt_wrap_ui)
# qt5_wrap_ui(${ARGN})
# endmacro()
#
# macro(qt_add_resources)
# qt5_add_resources(${ARGN})
# endmacro()
#
# find_package(Qt5LinguistTools REQUIRED)
# macro(qt_add_translation)
# qt5_add_translation(${ARGN})
# endmacro()
else()
find_package(Qt4 COMPONENTS QtCore QtNetwork QtXml REQUIRED)
if(BUILD_TESTS)
find_package(Qt5Test CONFIG REQUIRED)
endif()

set(LASTFM_LIB_VERSION_SUFFIX 5)
if(UNIX AND NOT APPLE)
find_package(Qt5DBus CONFIG REQUIRED)
endif()

# macro(qt_wrap_ui)
# qt5_wrap_ui(${ARGN})
# endmacro()
#
# macro(qt_add_resources)
# qt5_add_resources(${ARGN})
# endmacro()
#
# find_package(Qt5LinguistTools REQUIRED)
# macro(qt_add_translation)
# qt5_add_translation(${ARGN})
# endmacro()

if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions("-fno-operator-names -fvisibility-inlines-hidden -fvisibility=hidden")
Expand Down
21 changes: 6 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Channel: #last.desktop

liblastfm requires:

* Qt 4.8 http://qt.digia.com/
* Qt 5.0 https://www.qt.io/
* FFTW http://www.fftw.org/
* libsamplerate http://www.mega-nerd.com/SRC/

Expand All @@ -27,23 +27,14 @@ Additionally, to build it you will need:

## Mac OS X

We recommend that you use Homebrew to install dependancies http://mxcl.github.com/homebrew/
We recommend that you use Homebrew to install dependancies https://brew.sh/

In order to install QT 5 run:
In order to install Qt 5 run:
```
brew install qt
```

In order to install QT 4.8 run:

```
brew install cartr/qt4/qt@4
brew install cartr/qt4/[email protected]
```
Don't forget to turn on the BUILD_WITH_QT4 option in CMakeLists.txt


And for other dependencies:
For other dependencies:
```
brew install cmake
brew install fftw
Expand All @@ -52,9 +43,9 @@ brew install libsamplerate

## Linux/*NIX

Do something like this:
On Debian-based systems, do something like this:

sudo apt-get install qt4-qmake pkg-config g++ libqt4-dev cmake libfftw-dev libsamplerate0-dev
sudo apt-get install qt5-qmake pkg-config g++ qtbase5-dev cmake libfftw-dev libsamplerate0-dev

Please note, we have only tested on Linux, but we think it'll work on all
varieties of UNIX. If it doesn't, report the bug to eartle on GitHub.
Expand Down
72 changes: 0 additions & 72 deletions cmake/Modules/FindDBus.cmake

This file was deleted.

51 changes: 0 additions & 51 deletions cmake/Modules/FindLibFFTW3.cmake

This file was deleted.

27 changes: 0 additions & 27 deletions cmake/Modules/FindLibSamplerate.cmake

This file was deleted.

21 changes: 4 additions & 17 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/global.h.in ${CMAKE_CURRENT_BINARY_DIR}/global.h)


add_definitions(${QT_DEFINITIONS})
include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})

set(liblastfm_SOURCES
ws.cpp
Expand Down Expand Up @@ -66,20 +64,9 @@ endif()

add_library(${LASTFM_LIB_TARGET_NAME} SHARED ${liblastfm_SOURCES})

if(Qt5Core_DIR)
target_link_libraries(${LASTFM_LIB_TARGET_NAME} Qt5::Network Qt5::Xml)
if(UNIX AND NOT APPLE)
target_link_libraries(${LASTFM_LIB_TARGET_NAME} Qt5::DBus)
endif()
else()
target_link_libraries(${LASTFM_LIB_TARGET_NAME}
${QT_QTCORE_LIBRARY}
${QT_QTNETWORK_LIBRARY}
${QT_QTXML_LIBRARY}
)
if(UNIX AND NOT APPLE)
target_link_libraries(${LASTFM_LIB_TARGET_NAME} ${QT_QTDBUS_LIBRARY})
endif()
target_link_libraries(${LASTFM_LIB_TARGET_NAME} Qt5::Network Qt5::Xml)
if(UNIX AND NOT APPLE)
target_link_libraries(${LASTFM_LIB_TARGET_NAME} Qt5::DBus)
endif()

if(WIN32 AND NOT MINGW)
Expand Down
12 changes: 0 additions & 12 deletions src/Url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,19 @@

#include "Url.h"

#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
#include <QUrlQuery>
#endif

class lastfm::UrlPrivate
{
public:
UrlPrivate( const QUrl& url );
QUrl url;
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QUrlQuery query;
#endif
};

lastfm::UrlPrivate::UrlPrivate( const QUrl& u )
: url( u )
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
, query( u.query() )
#endif
{
}

Expand All @@ -55,12 +49,8 @@ lastfm::Url::~Url()
void
lastfm::Url::addQueryItem( const QString& key, const QString& value )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
d->query.addQueryItem( key, value );
d->url.setQuery( d->query );
#else
d->url.addQueryItem( key, value );
#endif
}

QUrl
Expand All @@ -73,9 +63,7 @@ lastfm::Url&
lastfm::Url::operator=( const lastfm::Url& that )
{
d->url = that.d->url;
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
d->query = that.d->query;
#endif
return *this;
}

Expand Down
4 changes: 0 additions & 4 deletions src/UrlBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ lastfm::UrlBuilder::url() const
QUrl url;
url.setScheme( "http" );
url.setHost( host() );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
url.setPath( d->path );
#else
url.setEncodedPath( d->path );
#endif
return url;
}

Expand Down
Loading