Skip to content

Commit

Permalink
Refactored CMakeLists
Browse files Browse the repository at this point in the history
  • Loading branch information
juliagoda committed Sep 30, 2023
1 parent c0fa388 commit f18df90
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 68 deletions.
32 changes: 22 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)

project(pak-gui VERSION 1.0.0 LANGUAGES CXX)
set(VERSION_MAJOR "1")
set(VERSION_MINOR "0")
set(VERSION_PATCH "0")

set(VERSION_MAJOR 1)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")

set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
project(pak-gui VERSION ${VERSION} LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -18,15 +18,28 @@ set(KF_MIN_VERSION "5.68.0")
find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/packages")

include(ECMInstallIcons)
include(ECMSetupVersion)
include(ECMOptionalAddSubdirectory)
include(GenerateExportHeader)
include(ECMAddAppIcon)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)

include(ECMInstallIcons)
include(ECMAddTests)
include(ECMAddAppIcon)
include(CMakePackageConfigHelpers)
include(ECMSetupQtPluginMacroNames)
include(ECMQtDeclareLoggingCategory)
include(FeatureSummary)

option(RUN_TESTS "Allow tests for classes" OFF)
option(RUN_TESTS "Allow tests for classes" ON)

if(RUN_TESTS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
endif()

find_package(pak REQUIRED)
find_package(pacman-contrib REQUIRED)
find_package(kdesu REQUIRED)
Expand Down Expand Up @@ -72,5 +85,4 @@ feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAG
if(RUN_TESTS)
enable_testing()
add_subdirectory(tests)
remove_definitions(-DRUN_TESTS)
endif(RUN_TESTS)
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ make -j 2

### Running tests


It's important to run tests before running code coverage:

```
cmake -DRUN_TESTS=ON ..
make -j 2
make test
gcovr -r .
bin/pak-qtests
gcovr -r . -j 2 -f ../src/src/.*cpp
```

### Attention
Expand Down
20 changes: 9 additions & 11 deletions com.github.juliagoda.pak-gui.desktop
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
[Desktop Entry]
Categories=Qt;System;
Comment[pl_PL]=pacman wrapper, AUR and POLAUR helper with Gui
Comment=pacman wrapper, AUR and POLAUR helper with Gui
Comment[pl]=Menedżer pakietów oparty na wrapperze pacmanas o nazwie pak
Comment=Package manager based on pacman wrapper named pak
Comment[en]=Package manager based on pacman wrapper named pak
Exec=pak-gui
GenericName[pl_PL]=Pacman wrapper with Gui
GenericName=Pacman wrapper with Gui
Icon=/home/juliagoda/Github/pak-gui/resources/icons/app/icon.png
GenericName[pl]=pak-gui
GenericName=pak-gui
Icon=pak-gui
Keywords=pacman;pak;wrapper;
MimeType=
Name[pl_PL]=Pacman wrapper with Gui
Name=Pacman wrapper with Gui
Path=
Name[pl_PL]=pak-gui
Name=pak-gui
Path=/usr/bin
StartupNotify=false
Terminal=false
TerminalOptions=
Type=Application
Version=1.0
X-AppStream-Ignore=true
X-DocPath=pak-gui/index.html
X-KDE-SubstituteUID=false
X-KDE-Username=
2 changes: 1 addition & 1 deletion src/src/packagescolumn.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <QProcess>
#include <QStringList>
#include <QMessageBox>
#include <QtConcurrent>
#include <QtConcurrent/QtConcurrent>
#include <QWaitCondition>

#include <deque>
Expand Down
43 changes: 0 additions & 43 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,41 +1,6 @@
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
project(pak-gui-tests)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(QT_MIN_VERSION "5.12.8")
set(KF_MIN_VERSION "5.68.0")

find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -g -O0")

include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)

# Tell CMake to run moc when necessary:
set(CMAKE_AUTOMOC ON)

# As moc files are generated in the binary dir, tell CMake
# to always look for includes there:
set(CMAKE_INCLUDE_CURRENT_DIR ON)


find_package(Qt5Test REQUIRED)

find_package(KF5 ${KF_MIN_VERSION} REQUIRED COMPONENTS
ConfigWidgets
CoreAddons
Crash
DBusAddons
DocTools
I18n
XmlGui
Notifications
)

qt5_add_resources(RESOURCES ${CMAKE_SOURCE_DIR}/resources/pak-gui.qrc)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets Charts Concurrent Network)

Expand Down Expand Up @@ -67,7 +32,6 @@ target_link_libraries(pak-gui-src
Qt5::Network
)

target_compile_options(pak-gui-src PRIVATE -fexceptions -DPARALLEL)
target_include_directories(pak-gui-src PUBLIC ${CMAKE_SOURCE_DIR}/src/src)

add_executable(pak-qtests
Expand Down Expand Up @@ -152,15 +116,8 @@ add_executable(pak-qtests
)

target_link_libraries(pak-qtests
KF5::CoreAddons
Qt5::Test
Qt5::Core
Qt5::Gui
Qt5::Widgets
pak-gui-src
)

target_compile_options(pak-qtests PRIVATE -fexceptions -DPARALLEL)

add_test(NAME pak-qtests COMMAND $<TARGET_FILE:pak-qtests>)

1 change: 0 additions & 1 deletion tests/gui/packagescolumnfixtures.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "qipackage.h"
#include "sipackage.h"


#include <QAction>
#include <QString>
#include <QWidget>
Expand Down

0 comments on commit f18df90

Please sign in to comment.