Skip to content

Commit

Permalink
Merged new version
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLazarescu committed Jul 27, 2023
2 parents d279a48 + c1c8dd4 commit 6c43982
Show file tree
Hide file tree
Showing 93 changed files with 668 additions and 274 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@
*.dll
*.dylib

# Windows
/.vs/
/.qtc_clangd/
/.cmake/
CMakeFiles/
/Testing/
/.qtc/
/.qt/

# Cmake
CMakeCache.txt
qtcsettings.cmake
cmake_install.cmake
build.ninja

# Qt-es
object_script.*.Release
object_script.*.Debug
Expand Down
42 changes: 28 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,41 @@ project(Librum VERSION 0.1
LANGUAGES CXX)


# Set output directory
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}")
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}")
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}")
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}")
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}")


# Configuration
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
option(BUILD_TESTS ON)
option(ENABLE_COVERAGE OFF)
option(USE_SANITIZERS OFF) # Slows down program startup significantly

if(WIN32)
add_compile_options(-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -permissive- -Zc:__cplusplus -Zc:externConstexpr -utf-8 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()

# Create a set of warnings
string(CONCAT LIBRUM_WARNINGS "-Wall;-Wextra;-Wshadow;-Wnon-virtual-dtor;-Wold-style-cast;-Wcast-align;"
"-Wunused;-Woverloaded-virtual;-Wpedantic;-Wmissing-include-dirs;"
"-Wnull-dereference;-Wdouble-promotion;-Wformat=2;-Wcast-qual;-Winit-self;"
"-Wswitch-enum;-Wunreachable-code;-Wredundant-decls;")

# GCC specific warnings
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # If compiler is GCC
list(APPEND LIBRUM_WARNINGS "-Wduplicated-cond")
list(APPEND LIBRUM_WARNINGS "-Wduplicated-branches")
list(APPEND LIBRUM_WARNINGS "-Wunsafe-loop-optimizations")
list(APPEND LIBRUM_WARNINGS "-Wlogical-op")
list(APPEND LIBRUM_WARNINGS "-Wunsafe-loop-optimizations")
# Create a set of warnings for unix systems
if(UNIX)
string(CONCAT LIBRUM_WARNINGS "-Wall;-Wextra;-Wshadow;-Wnon-virtual-dtor;-Wold-style-cast;-Wcast-align;"
"-Wunused;-Woverloaded-virtual;-Wpedantic;-Wmissing-include-dirs;"
"-Wnull-dereference;-Wdouble-promotion;-Wformat=2;-Wcast-qual;-Winit-self;"
"-Wswitch-enum;-Wunreachable-code;-Wredundant-decls;")

# GCC specific warnings
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # If compiler is GCC
list(APPEND LIBRUM_WARNINGS "-Wduplicated-cond")
list(APPEND LIBRUM_WARNINGS "-Wduplicated-branches")
list(APPEND LIBRUM_WARNINGS "-Wunsafe-loop-optimizations")
list(APPEND LIBRUM_WARNINGS "-Wlogical-op")
list(APPEND LIBRUM_WARNINGS "-Wunsafe-loop-optimizations")
endif()
endif()


Expand Down
61 changes: 51 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ If you are interested in contributing, feel free to contact us on either:<br>
<br>
We are following a pull request workflow where every contribution is sent as a pull request and merged into the dev/develop branch for testing. <br>
Please make sure to run clang format, keep to the conventions used throughout the application and ensure that all tests pass, before submitting any pull request.

<br>
<br>

# Contact
Expand Down Expand Up @@ -126,22 +128,21 @@ Want a new feature? Feel free to leave a feature request ticket!

<br><br>

# Getting started
# Build Guide

Here's how to get Librum up and running in your environment.
<br>

### Prerequisites
- cmake (at least version 3.21) https://cmake.org/download/
- make (or any other build system) http://ftp.gnu.org/gnu/make/
- g++ (or any other c++ compiler) https://gcc.gnu.org/
- python3-venv (on ubuntu use `sudo apt install python3-venv`)
- Qt 6.5 https://www.qt.io/download-open-source

<br>

## For GNU/Linux

### Prerequisites
- cmake (https://cmake.org/download)
- make (http://ftp.gnu.org/gnu/make)
- g++ (https://gcc.gnu.org)
- python3-venv (on ubuntu use `sudo apt install python3-venv`)
- Qt 6.5 (https://www.qt.io/download-open-source)

### Installation
The installation is straight forward, just follow the steps below:

Expand Down Expand Up @@ -187,8 +188,48 @@ Here are solutions to some common errors. If your error is not listed here, plea

<br>


## For Windows
Support coming soon!
### Prerequisites
- cmake (https://cmake.org/download)
- Visual Studio <b>19</b> (https://visualstudio.microsoft.com/de/vs/older-downloads)
- Python (https://www.python.org/downloads)
- Qt 6.5 (https://www.qt.io/download-open-source)

### Installation
To build Librum on windows, run the following commands in the Powershell:

<br>

1. Clone the repository.
```sh
git clone https://github.com/Etovex/Librum.git --recursive
```
2. Step into the cloned project folder.
```sh
cd Librum
```
3. Create the build folder and step into it.
```sh
mkdir build
cd build
```
4. Run cmake.
```sh
cmake -DBUILD_TESTS=Off -DCMAKE_PREFIX_PATH=<Drive>\\Qt\\<version>\\msvc2019_64 ..
```
`CMAKE_PREFIX_PATH` needs to be set to the Qt install path, for example:
```sh
cmake -DBUILD_TESTS=Off -DCMAKE_PREFIX_PATH=C:\\Qt\\6.5.1\\msvc2019_64 ..
```
6. Build the project
```sh
cmake --build . --config Release
```
7. Run the app
```sh
./appLibrum
```

## For macOS
Support coming soon!
2 changes: 2 additions & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -203,5 +203,7 @@
<file>resources/images/light_mode/utility/trash_red_icon.svg</file>
<file>resources/images/light_mode/reading_options_popup/invert_color_icon.svg</file>
<file>resources/images/dark_mode/reading_options_popup/invert_color_icon.svg</file>
<file>resources/images/light_mode/utility/cloud_off_icon.svg</file>
<file>resources/images/dark_mode/utility/cloud_off_icon.svg</file>
</qresource>
</RCC>
11 changes: 11 additions & 0 deletions resources/images/dark_mode/utility/cloud_off_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions resources/images/light_mode/utility/cloud_off_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ target_link_libraries(appLibrum
adapters
application
infrastructure
${PROJECT_SOURCE_DIR}/libs/mupdf/build/$<IF:$<CONFIG:Debug>,shared-debug,shared-release>/libmupdfcpp.so
${MUPDF_OUTPUT}
Qt6::Quick
Qt6::Widgets
Qt6::QuickControls2
Expand All @@ -83,4 +83,4 @@ include(CopyRecursive)
set(FONTS_OUT_DIR ${PROJECT_BINARY_DIR}/resources/fonts)
file(MAKE_DIRECTORY ${FONTS_OUT_DIR})
message(DEBUG "Folder created at ${FONTS_OUT_DIR}")
copy_recursive(${PROJECT_SOURCE_DIR}/resources/fonts ${FONTS_OUT_DIR} "*.otf")
copy_recursive(${PROJECT_SOURCE_DIR}/resources/fonts ${FONTS_OUT_DIR} "*.otf")
7 changes: 5 additions & 2 deletions src/adapters/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Dependencies
find_package(Qt6 6.5 REQUIRED COMPONENTS Core Quick Network)

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

# Build
add_library(adapters
Expand Down Expand Up @@ -48,8 +49,11 @@ add_library(adapters
DTOs/tag_dto.hpp
)

target_compile_definitions(adapters PRIVATE ADAPTERS_LIBRARY)

target_include_directories(adapters
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/interfaces/persistance
${CMAKE_CURRENT_SOURCE_DIR}/interfaces/controllers
${CMAKE_CURRENT_SOURCE_DIR}/controllers
Expand All @@ -60,7 +64,6 @@ target_include_directories(adapters
${CMAKE_CURRENT_SOURCE_DIR}/data_models/shortcuts_model
${CMAKE_CURRENT_SOURCE_DIR}/data_models
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${DOMAIN_INCLUDES}
${APPLICATION_INCLUDES}
)
Expand Down Expand Up @@ -95,4 +98,4 @@ if (ENABLE_COVERAGE AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # Only works when
EXECUTABLE adapters_unit_tests
BASE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
EXCLUDE ${PROJECT_BINARY_DIR}/* ${PROJECT_SOURCE_DIR}/libs/*)
endif()
endif()
5 changes: 3 additions & 2 deletions src/adapters/DTOs/book_dto.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
#include <QUuid>
#include <QVariant>
#include "tag_dto.hpp"
#include "adapters_export.hpp"

namespace adapters::dtos
{

struct BookDto
struct ADAPTERS_LIBRARY BookDto
{
Q_GADGET
Q_PROPERTY(QString uuid MEMBER uuid)
Expand Down Expand Up @@ -55,4 +56,4 @@ struct BookDto

} // namespace adapters::dtos

Q_DECLARE_METATYPE(adapters::dtos::BookDto)
Q_DECLARE_METATYPE(adapters::dtos::BookDto)
5 changes: 3 additions & 2 deletions src/adapters/DTOs/login_dto.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#pragma once
#include <QString>
#include "adapters_export.hpp"

namespace adapters::dtos
{

struct LoginDto
struct ADAPTERS_LIBRARY LoginDto
{
QString email;
QString password;
};

} // namespace adapters::dtos
} // namespace adapters::dtos
5 changes: 3 additions & 2 deletions src/adapters/DTOs/register_dto.hpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#pragma once
#include <QString>
#include "adapters_export.hpp"

namespace adapters::dtos
{

struct RegisterDto
struct ADAPTERS_LIBRARY RegisterDto
{
QString firstName;
QString lastName;
QString email;
QString password;
};

} // namespace adapters::dtos
} // namespace adapters::dtos
5 changes: 3 additions & 2 deletions src/adapters/DTOs/tag_dto.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#pragma once
#include <QObject>
#include <QString>
#include "adapters_export.hpp"

namespace adapters::dtos
{

struct TagDto
struct ADAPTERS_LIBRARY TagDto
{
Q_GADGET
Q_PROPERTY(QString uuid MEMBER uuid)
Expand All @@ -18,4 +19,4 @@ struct TagDto

} // namespace adapters::dtos

Q_DECLARE_METATYPE(adapters::dtos::TagDto)
Q_DECLARE_METATYPE(adapters::dtos::TagDto)
8 changes: 8 additions & 0 deletions src/adapters/adapters_export.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once
#include <QtCore/QtGlobal>

#if defined(ADAPTERS_LIBRARY)
# define ADAPTERS_LIBRARY Q_DECL_EXPORT
#else
# define ADAPTERS_LIBRARY Q_DECL_IMPORT
#endif
5 changes: 3 additions & 2 deletions src/adapters/controllers/authentication_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#include <QObject>
#include "i_authentication_controller.hpp"
#include "i_authentication_service.hpp"
#include "adapters_export.hpp"

namespace adapters::controllers
{

class AuthenticationController : public IAuthenticationController
class ADAPTERS_LIBRARY AuthenticationController : public IAuthenticationController
{
Q_OBJECT

Expand All @@ -27,4 +28,4 @@ class AuthenticationController : public IAuthenticationController
application::IAuthenticationService* m_authenticationService;
};

} // namespace adapters::controllers
} // namespace adapters::controllers
Loading

0 comments on commit 6c43982

Please sign in to comment.