Skip to content

Commit 9b83733

Browse files
committed
chore: Switch the build system to CMake
Switching to CMake provides consistency with other Papyros projects which use CMake and allows us to avoid limitations in QMake. Fixes #360 Closes #369
1 parent 7674fb1 commit 9b83733

23 files changed

+127
-138
lines changed

.builder.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
dependencies:
2+
- qt5-base
3+
- qt5-declarative
4+
- qt5-quickcontrols
5+
- qt5-svg
6+
- qt5-graphicaleffects
7+
- cmake
8+
- extra-cmake-modules
9+
build:
10+
- cmake {srcdir}
11+
- make
12+
- make test

.qmake.conf

Lines changed: 0 additions & 3 deletions
This file was deleted.

.travis.yml

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,40 @@
1-
before_install:
2-
- "export DISPLAY=:99.0"
3-
- "sh -e /etc/init.d/xvfb start"
1+
sudo: required
2+
dist: trusty
3+
language: generic
44

55
install:
6-
- sudo add-apt-repository -y ppa:beineri/opt-qt542
6+
- sudo add-apt-repository -y ppa:beineri/opt-qt551-trusty
7+
- sudo add-apt-repository -y ppa:george-edison55/cmake-3.x
78
- sudo apt-get update
8-
- sudo apt-get -y install pep8 pyflakes python python-pip npm
9-
- sudo apt-get -y install qt54declarative
10-
- sudo apt-get -y install qt54quickcontrols qt54graphicaleffects
11-
- sudo apt-get -y install qt54tools
9+
- sudo apt-get -y install pep8 pyflakes python python-pip npm nodejs nodejs-legacy
10+
- sudo apt-get -y install qt55declarative
11+
- sudo apt-get -y install qt55quickcontrols qt55graphicaleffects
12+
- sudo apt-get -y install qt55tools
13+
- sudo apt-get -y install cmake
14+
- sudo apt-get -y install xvfb
15+
- sudo npm install -g jshint
1216

1317
before_script:
14-
- git clone git://github.com/papyros/docmaker.git
15-
- sudo pip install -r docmaker/requirements.txt
16-
- npm install -g jshint
17-
- export PATH=$PATH:$(pwd)/docmaker
18+
# - git clone git://github.com/papyros/docmaker.git
19+
# - sudo pip install -r docmaker/requirements.txt
20+
# - export PATH=$PATH:$(pwd)/docmaker
21+
- git clone git://anongit.kde.org/extra-cmake-modules
22+
- pushd extra-cmake-modules
23+
- cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIB_INSTALL_DIR=lib -DLIBEXEC_INSTALL_DIR=lib -DQML_INSTALL_DIR=lib/qt/qml
24+
- make
25+
- sudo make install
26+
- popd
1827

1928
script:
20-
- source /opt/qt54/bin/qt54-env.sh
21-
- qmake
22-
- make check
23-
- ./lint.sh
24-
- ./build_docs.sh
29+
- source /opt/qt55/bin/qt55-env.sh
30+
- cmake .
31+
- make
32+
- xvfb-run -a -s "-screen 0 800x600x24" ctest -V
33+
- ./scripts/lint.sh
34+
# - ./scripts/build_docs.sh
2535

26-
after_success:
27-
- ./deploy.sh
36+
# after_success:
37+
# - ./scripts/deploy.sh
2838

2939
notifications:
3040
slack: papyros:Z7PeY2Y4mh0GWPoypZZNLd3D
@@ -36,4 +46,4 @@ env:
3646
- ENCRYPTION_LABEL="a0d7d9cd7ef9"
3747
- GIT_NAME="Travis CI"
3848
- GIT_EMAIL="[email protected]"
39-
- SOURCE_BRANCH="develop"
49+
- SOURCE_BRANCH="develop"

CMakeLists.txt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
project(io.papyros.Material)
2+
3+
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
4+
5+
# Find includes in corresponding build directories
6+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
7+
8+
# Instruct CMake to run moc and rrc automatically when needed
9+
set(CMAKE_AUTOMOC ON)
10+
set(CMAKE_AUTORCC ON)
11+
12+
# Extra CMake files
13+
find_package(ECM 0.0.11 REQUIRED NO_MODULE)
14+
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
15+
16+
include(KDEInstallDirs)
17+
include(KDECMakeSettings)
18+
include(KDECompilerSettings)
19+
include(FeatureSummary)
20+
21+
# Build flags
22+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -Werror -Wall -Wextra -Wno-unused-parameter -pedantic -std=c++11")
23+
24+
# Disable debug output for release builds
25+
if(CMAKE_BUILD_TYPE MATCHES "^[Rr]elease$")
26+
add_definitions(-DQT_NO_DEBUG_OUTPUT)
27+
endif()
28+
29+
# Minimum version requirements
30+
set(QT_MIN_VERSION "5.4.0")
31+
32+
# Find Qt5
33+
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
34+
Core
35+
Qml
36+
Quick
37+
Test
38+
QuickTest)
39+
40+
add_subdirectory(modules)
41+
# add_subdirectory(documentation)
42+
add_subdirectory(tests)
43+
44+
# Display feature summary
45+
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

modules/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
add_subdirectory(Material)
2+
add_subdirectory(QtQuick/Controls/Styles/Material)

modules/Material/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
file(GLOB QML_FILES *.qml)
2+
file(GLOB JS_FILES *.js)
3+
4+
install(FILES ${QML_FILES} ${JS_FILES} qmldir
5+
DESTINATION ${QML_INSTALL_DIR}/Material)
6+
install(DIRECTORY fonts icons
7+
DESTINATION ${QML_INSTALL_DIR}/Material)
8+
9+
add_subdirectory(Extras)
10+
add_subdirectory(ListItems)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
file(GLOB QML_FILES *.qml)
2+
3+
install(FILES ${QML_FILES} qmldir
4+
DESTINATION ${QML_INSTALL_DIR}/Material/Extras)
5+
install(DIRECTORY js images
6+
DESTINATION ${QML_INSTALL_DIR}/Material/Extras)

modules/Material/Extras/Extras.pro

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
file(GLOB QML_FILES *.qml)
2+
3+
install(FILES ${QML_FILES} qmldir
4+
DESTINATION ${QML_INSTALL_DIR}/Material/ListItems)

modules/Material/Material.pro

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
file(GLOB QML_FILES *.qml)
2+
3+
install(FILES ${QML_FILES} qmldir
4+
DESTINATION ${QML_INSTALL_DIR}/QtQuick/Controls/Styles/Material)

modules/QtQuick/Controls/Styles/Material/Material.pro

Lines changed: 0 additions & 9 deletions
This file was deleted.

qml-material.pro

Lines changed: 0 additions & 4 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

lint.sh renamed to scripts/lint.sh

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
include(ECMMarkAsTest)
2+
3+
set(SOURCES tests.cpp)
4+
5+
set(CMAKE_MACOSX_BUNDLE FALSE)
6+
7+
add_definitions(-DQUICK_TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
8+
9+
add_executable(materialtests ${SOURCES})
10+
target_link_libraries(materialtests Qt5::Core Qt5::Qml Qt5::Quick Qt5::Test Qt5::QuickTest)
11+
12+
add_test(NAME material COMMAND materialtests -import ${CMAKE_SOURCE_DIR}/modules)
13+
ecm_mark_as_test(materialtests)

tests/qml-materials.qml

Lines changed: 0 additions & 67 deletions
This file was deleted.

tests/tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
*/
1818

1919
#include <QtQuickTest/QtQuickTest>
20-
QUICK_TEST_MAIN(materials)
20+
QUICK_TEST_MAIN(material)

tests/tests.pro

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)