Skip to content
This repository has been archived by the owner on May 3, 2019. It is now read-only.

Commit

Permalink
Switch from CMake to Qbs (#213)
Browse files Browse the repository at this point in the history
Qbs (pronounced cubes) is the new build system from the Qt company that will replace qmake in the future. Qbs is much easier to use (from a developer perspective) than CMake, especially for Qt projects.
  • Loading branch information
ColinDuquesnoy authored Mar 13, 2018
1 parent be7f5ff commit 59bf2c6
Show file tree
Hide file tree
Showing 654 changed files with 3,254 additions and 5,965 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ Makefile*
doxyxml
# sphinx
_build
bin
dist
# Python
*.pyc

# Pycharm project files
.idea
setup.iss
*.usr

# Dolpin
Expand Down Expand Up @@ -61,10 +59,11 @@ appdir/
qt/

qt\.zip
schema.json
.vscode
/.vs
/venv

*.qmlc
*.jsc

*.dmg
9 changes: 9 additions & 0 deletions 3rdparty/3rdparty.qbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import qbs

Project {
name: "Third Parties"

references: [
"libqxt/libqxt.qbs"
]
}
15 changes: 11 additions & 4 deletions 3rdparty/fakeit/fakeit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
#include <atomic>
#include <tuple>

inline bool catch_uncaught_exceptions() {
#if __cplusplus >= 201703L
return std::uncaught_exceptions() > 0;
#else
return std::uncaught_exception();
#endif
}

namespace fakeit
{
Expand Down Expand Up @@ -9671,7 +9678,7 @@ m_timer.start();
Section::~Section() {
if( m_sectionIncluded ) {
SectionEndInfo endInfo( m_info, m_assertions, m_timer.getElapsedSeconds() );
if( std::uncaught_exception() )
if( catch_uncaught_exceptions() )
getResultCapture().sectionEndedEarly( endInfo );
else
getResultCapture().sectionEnded( endInfo );
Expand Down Expand Up @@ -21063,7 +21070,7 @@ namespace fakeit
virtual ~StubbingChange() THROWS
{

if (std::uncaught_exception()) {
if (catch_uncaught_exceptions()) {
return;
}

Expand Down Expand Up @@ -21362,7 +21369,7 @@ namespace fakeit

~SequenceVerificationExpectation() THROWS
{
if (std::uncaught_exception()) {
if (catch_uncaught_exceptions()) {
return;
}
VerifyExpectation(_fakeit);
Expand Down Expand Up @@ -21788,7 +21795,7 @@ namespace fakeit

~VerifyNoOtherInvocationsExpectation() THROWS
{
if (std::uncaught_exception()) {
if (catch_uncaught_exceptions()) {
return;
}

Expand Down
Binary file removed 3rdparty/lcov-1.13.tar.gz
Binary file not shown.
72 changes: 72 additions & 0 deletions 3rdparty/libqxt/libqxt.qbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import qbs
import qbs.Probes

StaticLibrary {
id: product

name: "qxtglobalshortcut"
condition: product.qxt === undefined || !product.qxt.found

cpp.cxxLanguageVersion: platform.cxxLanguageVersion
cpp.includePaths: [
product.sourceDirectory + "/src/core",
product.sourceDirectory + "/src/widgets",
]
cpp.defines: ["QXT_STATIC=1"]
cpp.frameworks: platform.macOs ? base.concat(["Carbon", "Cocoa"]) : base

Group {
name: "Source Files"
files: [
"src/core/*.cpp",
"src/widgets/*.cpp",
]
}

Group {
name: "Header Files"
files: [
"src/core/*.h",
"src/widgets/*.h",
]
}

Group {
name: "Windows"
files: "src/widgets/win/qxtglobalshortcut_win.cpp"
condition: { return product.platform.windows; }
}

Group {
name: "Unix"
files: "src/widgets/x11/qxtglobalshortcut_x11.cpp"
condition: product.platform.unix
}

Group {
name: "MacOS"
files: "src/widgets/mac/qxtglobalshortcut_mac.cpp"
condition: product.platform.macOs
}

Depends { name: 'cpp' }
Depends { name: "platform" }
Depends { name: "Qt.core" }
Depends { name: "Qt.core-private" }
Depends { name: "Qt.gui-private" }
Depends { name: "Qt.widgets" }
Depends { name: "qxt"; condition: platform.unix }
Depends { name: "x11"; condition: platform.unix }

Export {
Depends { name: 'cpp' }
Depends { name: "Qt.core" }
Depends { name: "Qt.core-private" }
Depends { name: "Qt.gui-private" }
Depends { name: "Qt.widgets" }

cpp.includePaths: product.cpp.includePaths
cpp.cxxFlags: product.cxxFlags
cpp.linkerFlags: product.cxxFlags
}
}
80 changes: 0 additions & 80 deletions CMakeLists.txt

This file was deleted.

27 changes: 0 additions & 27 deletions CMakeSettings.json

This file was deleted.

81 changes: 40 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ MellowPlayer is licensed under the GPL license.

## Build dependencies

- cmake
- qbs >= 1.10
- a c++17 compiler (gcc6, msvc 2015 or clang)
- Qt5 (>= 5.9.0, QtWebEngine and QtQuickControls2 needed)
- Libnotify (optional, GNU/Linux only)
Expand All @@ -91,65 +91,64 @@ MellowPlayer is licensed under the GPL license.

# Compilation

Building MellowPlayer requires a **C++17** compiler:
Building MellowPlayer requires [Qbs](http://doc.qt.io/qbs/) >= 1.10 and a **C++17** compiler (GCC >= 6.x or Clang >= 3.5 or MSVC 2015 Update 2).

- GCC >= 6.x
- Clang >= 3.5
- MSVC 2015 Update 2
Qbs is a new build system from the Qt Company that is much easier to use compared to CMake, especially for Qt based projects.

## GNU/Linux
If you want to learn more, please read the [Qbs manual](http://doc.qt.io/qbs/index.html),
especially the [setup guide](http://doc.qt.io/qbs/configuring.html) and how to install artifacts
from the [installation guide](http://doc.qt.io/qbs/installing-files.html).

```bash
mkdir build && cd build
cmake ..
make
```
## From QtCreator

## OSX
Open up `mellowplayer.qbs` with QtCreator, hit build and run.

```bash
mkdir build && cd build
brew install qt5 cmake
cmake -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5 ..
make
```
## From Command Line

## Windows
Before you can build, you have to [setup qbs](http://doc.qt.io/qbs/configuring.html). This step must be done the first time you're building MellowPlayer and everytime you update your Qt version or toolchain.

### Setting up qbs

```bash
mkdir build && cd build
cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release
qbs-setup-toolchains --detect
qbs-setup-qt $(which qmake) qt5 # make sure that qmake is in PATH
qbs-config defaultProfile qt5
```
### Building MellowPlayer

# Build options

You can specify the following options when calling cmake:
```
qbs build release
```

- ``-DCMAKE_BUILD_TYPE=``: **Debug** or **Release** - Default is **Release**.
- ``-DDEFAULT_THEME=``: **Adaptive** by default. Can be set to any theme appearing in the theme combo box.
- ``-DBUILD_TESTS=``: **ON** or **OFF** - Default is **OFF**.
- ``-DENABLE_COVERAGE``: **ON** or **OFF** (requires ``BUILD_TEST=ON`` and ``CMAKE_BUILD_TYPE=Debug``) - Default is **OFF** .
- ``-ENABLE_LCOV_REPORT``: **ON** or **OFF** (requires ``BUILD_TEST=ON``, ``CMAKE_BUILD_TYPE=Debug`` and ``ENABLE_COVERAGE``) - Default is **OFF** .
*Note: If you're using qbs >= 1.11, replace ``release`` by ``config:release``*

Example build commands:
#### Build options

- release build:
```bash
cmake ..
```
- developer build command
You can append the following command line options when building MellowPlayer:

```bash
cmake -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON -DENABLE_LCOV_REPORT=ON -DCMAKE_BUILD_TYPE=Debug ..
```
- ``projects.MellowPlayer.defaultTheme``:``<string>``: the name of the default theme. Can be set to any theme appearing in the theme combo box. Default value: "Adaptive".
- ``projects.MellowPlayer.buildTests``:``<bool>``: true to build mellowplayer test suite. Default value: false.
- ``projects.MellowPlayer.enableCoverage``:``<bool>``: true to enable code coverage build. Require a debug build config and a gcc compiler. Default value: false;

# Running the test suite

Make sure you've built MellowPlayer with -DBUILD_TEST.
Make sure you've built MellowPlayer with ``projects.MellowPlayer.buildTests:true``

```bash
qbs resolve debug projects.MellowPlayer.buildTests:true
qbs build debug projects.MellowPlayer.buildTests:true
```

To run the tests, just build one of the below products (either from QtCreator or from command line):

- ``tests``: run all tests (unit and integration tests)
- ``unit-tests``: run unit tests only
- ``integration-tests``: run integration tests only

Example from command line:

```bash
make test
qbs build -p tests debug
```

# Contributing
Expand Down
Loading

0 comments on commit 59bf2c6

Please sign in to comment.