Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure qt project #38

Merged
merged 4 commits into from
Mar 11, 2024
Merged
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
10 changes: 10 additions & 0 deletions .github/workflows/cmake_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ jobs:
- name: Install Boost library
run: sudo apt-get update && sudo apt-get install libboost-all-dev -y

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '6.6.0'
host: 'linux'
dir: ${{env.BUILD_PATH}}
aqtversion: '==3.1.*'
target: 'desktop'
arch: 'gcc_64'

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ project(PasswordManager)

set(FLAGS -Wall -Werror -Wpedantic -Wextra)

set(LIB_DIR ${PROJECT_SOURCE_DIR}/lib)
set(HEADERS_DIR ${PROJECT_SOURCE_DIR}/headers)

enable_testing()

if(NOT CMAKE_BUILD_TYPE)
Expand Down
21 changes: 21 additions & 0 deletions source/Backend/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
project(PasswordManager)

add_library(sqlite3 STATIC ${LIB_DIR}/sqlite3.c)

find_package(OpenSSL REQUIRED)
find_package(Boost REQUIRED)

add_executable(passwordManager
main.cpp
PasswordManager.cpp
Common/Logger.cpp)

target_include_directories(sqlite3 PUBLIC ${LIB_DIR})
target_link_libraries(passwordManager PRIVATE sqlite3 ${OPENSSL_LIBRARIES} ${Boost_LIBRARIES})

add_subdirectory(DataBase)

target_include_directories(passwordManager PRIVATE
${HEADERS_DIR}
${Boost_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR})
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 3 additions & 20 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
project(PasswordManager)

add_library(sqlite3 STATIC ../lib/sqlite3.c)

find_package(OpenSSL REQUIRED)
find_package(Boost REQUIRED)

add_executable(passwordManager
main.cpp
PasswordManager.cpp
Common/Logger.cpp)

target_include_directories(sqlite3 PUBLIC ../lib)
target_link_libraries(passwordManager PRIVATE sqlite3 ${OPENSSL_LIBRARIES} ${Boost_LIBRARIES})

add_subdirectory(test)
add_subdirectory(DataBase)

target_include_directories(passwordManager PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/headers
${Boost_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR})
add_subdirectory(Backend)
add_subdirectory(Frontend)
add_subdirectory(Test)
14 changes: 14 additions & 0 deletions source/Frontend/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.16)

project(QTFrontend VERSION 1.0.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 REQUIRED COMPONENTS Widgets)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

add_subdirectory(src/app)
11 changes: 11 additions & 0 deletions source/Frontend/src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
qt_add_executable(${PROJECT_NAME}
main.cpp
mainwindow.h mainwindow.cpp mainwindow.ui
)

target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Widgets)

set_target_properties(${PROJECT_NAME} PROPERTIES
WIN32_EXECUTABLE ON
MACOSX_BUNDLE ON
)
12 changes: 12 additions & 0 deletions source/Frontend/src/app/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <QApplication>
#include <iostream>

#include "mainwindow.h"

int main(int argc, char *argv[]) {
std::cout << "Hello QT cmake project" << std::endl;
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
10 changes: 10 additions & 0 deletions source/Frontend/src/app/mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "mainwindow.h"

#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this);
}

MainWindow::~MainWindow() { delete ui; }
21 changes: 21 additions & 0 deletions source/Frontend/src/app/mainwindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow {
Q_OBJECT

public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();

private:
Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H
31 changes: 31 additions & 0 deletions source/Frontend/src/app/mainwindow.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
2 changes: 1 addition & 1 deletion source/test/CMakeLists.txt → source/Test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ FetchContent_MakeAvailable(googletest)

add_executable(${TEST_NAME} test.cpp)
target_link_libraries(${TEST_NAME} gtest_main)
set_target_properties(${TEST_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/test")
set_target_properties(${TEST_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Test")

include(GoogleTest)
gtest_discover_tests(${TEST_NAME})
File renamed without changes.
Loading