aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Ribbers <bribbers@disroot.org>2021-04-23 14:24:16 +0200
committerMagneFire <idanlcontact@gmail.com>2021-05-17 13:01:52 +0200
commitfdc71d176c3d2c3e569c1d26998d4def12d9d1c3 (patch)
tree5ec778ee67490e93e8bf86b7c467d620ca038d3f
parentdab31c329a4509eb581f0eb5e953bd260118221f (diff)
Port to CMake
Qt is slowly deprecating QMake. They have stopped building Qt itself with QMake and moved Qt6 to CMake instead. Although QMake is still around, it's clear the focus has shifted and it would be good for applications to switch over to an alternative build system as well So hereby, switch the build system to CMake
Diffstat (limited to '')
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt25
-rw-r--r--asteroid-stopwatch.pro13
-rwxr-xr-xi18n/generate-desktop.sh88
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/main.cpp (renamed from main.cpp)0
-rw-r--r--src/main.qml (renamed from main.qml)0
-rw-r--r--src/resources.qrc (renamed from resources.qrc)0
8 files changed, 34 insertions, 101 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..378eac2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+build
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..8f3648a
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,25 @@
+cmake_minimum_required(VERSION 3.6.0)
+
+project(asteroid-stopwatch
+ VERSION 0.0.1
+ DESCRIPTION "Default stopwatch app for AsteroidOS")
+
+find_package(ECM REQUIRED NO_MODULE)
+find_package(AsteroidApp REQUIRED)
+
+set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ASTEROID_MODULE_PATH})
+
+include(FeatureSummary)
+include(GNUInstallDirs)
+include(ECMQMLModules)
+include(AsteroidCMakeSettings)
+include(AsteroidTranslations)
+
+ecm_find_qmlmodule(Nemo.Configuration 1.0)
+
+add_subdirectory(src)
+
+build_translations(i18n)
+generate_desktop(${CMAKE_SOURCE_DIR} asteroid-stopwatch)
+
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/asteroid-stopwatch.pro b/asteroid-stopwatch.pro
deleted file mode 100644
index 46f5dbe..0000000
--- a/asteroid-stopwatch.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TARGET = asteroid-stopwatch
-CONFIG += asteroidapp link_pkgconfig
-PKGCONFIG += asteroidapp
-
-SOURCES += main.cpp
-RESOURCES += resources.qrc
-OTHER_FILES += main.qml
-
-lupdate_only{ SOURCES += i18n/asteroid-stopwatch.desktop.h }
-TRANSLATIONS = $$files(i18n/$$TARGET.*.ts)
-
-target.path = /usr/bin/
-INSTALLS += target
diff --git a/i18n/generate-desktop.sh b/i18n/generate-desktop.sh
deleted file mode 100755
index b1738c2..0000000
--- a/i18n/generate-desktop.sh
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/bash
-
-# Copyright (C) 2017 Florent Revest <revestflo@gmail.com>
-# All rights reserved.
-#
-# You may use this file under the terms of BSD license as follows:
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of the author nor the
-# names of its contributors may be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
-# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# This script is used to extract the translated app names found inevery .ts file
-# and gather those strings with the .desktop.template file in a single .desktop
-
-if [ "$#" -ne 2 ]; then
- echo "usage: $0 src_directory output.desktop"
- exit 1
-fi
-
-SRC_DIR=$1
-OUTPUT_DESKTOP_FILE=$2
-if [ ! -f "${SRC_DIR}/${OUTPUT_DESKTOP_FILE}.template" ]; then
- echo "${SRC_DIR}/${OUTPUT_DESKTOP_FILE}.template not found"
- exit 2
-fi
-if [ ! -f "${SRC_DIR}/i18n/${OUTPUT_DESKTOP_FILE}.h" ]; then
- echo "${SRC_DIR}/i18n/${OUTPUT_DESKTOP_FILE}.h not found"
- exit 2
-fi
-
-DEFAULT_NAME=`grep -oP '//% "\K[^"]+(?=")' ${SRC_DIR}/i18n/${OUTPUT_DESKTOP_FILE}.h`
-if [ -z "$DEFAULT_NAME" ]; then
- echo "Default name can not be found in ${SRC_DIR}/i18n/${OUTPUT_DESKTOP_FILE}.h"
- exit 3
-fi
-
-cat ${SRC_DIR}/${OUTPUT_DESKTOP_FILE}.template > ${OUTPUT_DESKTOP_FILE}
-echo "Name=$DEFAULT_NAME" >> $OUTPUT_DESKTOP_FILE
-
-for FILE in ${SRC_DIR}/i18n/*.ts; do
- echo "Processing $FILE..."
-
- PROCESSED_LANG=`grep -oP 'language="\K[^"]+(?=")' $FILE`
- if [ -z "$PROCESSED_LANG" ]; then
- echo "> Couldn't find a corresponding language id, aborting"
- continue
- fi
- echo "> Language: $PROCESSED_LANG detected"
-
- TRANSLATION_LINE=`grep -A 3 '<message id=\"id-app-launcher-name\">' $FILE | grep '<translation'`
- if [ -z "$TRANSLATION_LINE" ]; then
- echo "> Couldn't find a corresponding desktop.h translation, aborting"
- continue
- fi
-
- LINE_IS_UNFINISHED=`echo $TRANSLATION_LINE | grep unfinished`
- if [ ! -z "$LINE_IS_UNFINISHED" ]; then
- echo "> Translation line has been found but is marked as unfinished, aborting"
- continue
- fi
-
- TRANSLATED_NAME=`echo $TRANSLATION_LINE | grep -oP '>\K[^<]*(?=</translation>)'`
- if [ -z "$TRANSLATED_NAME" ]; then
- echo "> Translation is empty, aborting"
- continue
- fi
- echo "> Translation '$TRANSLATED_NAME' found, filling $OUTPUT_DESKTOP_FILE"
-
- echo "Name[$PROCESSED_LANG]=$TRANSLATED_NAME" >> $OUTPUT_DESKTOP_FILE
-done
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..446b4c9
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_library(asteroid-stopwatch main.cpp resources.qrc)
+set_target_properties(asteroid-stopwatch PROPERTIES PREFIX "" SUFFIX "")
+
+target_link_libraries(asteroid-stopwatch PUBLIC
+ AsteroidApp)
+
+install(TARGETS asteroid-stopwatch
+ DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/main.cpp b/src/main.cpp
index a44544c..a44544c 100644
--- a/main.cpp
+++ b/src/main.cpp
diff --git a/main.qml b/src/main.qml
index a0b6e4a..a0b6e4a 100644
--- a/main.qml
+++ b/src/main.qml
diff --git a/resources.qrc b/src/resources.qrc
index 5f6483a..5f6483a 100644
--- a/resources.qrc
+++ b/src/resources.qrc