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

Base for c++ modules #615

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

cmake_minimum_required(VERSION 3.25)
cmake_minimum_required(VERSION 3.28)
project(PhotoBroom VERSION 1.7.0 LANGUAGES CXX)

if(POLICY CMP0140)
Expand Down
1 change: 1 addition & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ target_include_directories(core
)

set_target_properties(core PROPERTIES AUTOMOC TRUE)
set_target_properties(core PROPERTIES POSITION_INDEPENDENT_CODE ON)

generate_export_header(core)
hideSymbols(core)
Expand Down
4 changes: 2 additions & 2 deletions src/core/implementation/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
#include <QFileInfo>
#include <QVariant>

#include <system/system.hpp>

#include "constants.hpp"

import system;


ConfigurationPrivate::ConfigurationPrivate(IConfigStorage& configStorage):
m_configStorage(configStorage),
Expand Down
3 changes: 2 additions & 1 deletion src/core/implementation/thumbnail_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <QFileInfo>
#include <opencv2/opencv.hpp>

#include <system/system.hpp>
#include "constants.hpp"
#include "iconfiguration.hpp"
#include "iexif_reader.hpp"
Expand All @@ -32,6 +31,8 @@
#include "media_types.hpp"
#include "video_media_information.hpp"

import system;


ThumbnailGenerator::ThumbnailGenerator(ILogger* logger, IExifReaderFactory& exif):
m_logger(logger),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@

#include <core/ilogger.hpp>
#include <core/lazy_ptr.hpp>
#include <system/filesystem.hpp>

#include "cnn_face_detector.hpp"
#include "face_recognition.hpp"
#include "dlib_face_recognition_api.hpp"
#include "helpers.hpp"

import system;


#ifdef DLIB_USE_CUDA
#define CUDA_AVAILABLE true
Expand Down
7 changes: 4 additions & 3 deletions src/face_recognition/face_recognition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@
#include <database/filter.hpp>
#include <database/ibackend.hpp>
#include <database/idatabase.hpp>
#include <system/filesystem.hpp>
#include <system/system.hpp>

#include "dlib_wrapper/dlib_face_recognition_api.hpp"
#include "unit_tests_utils/empty_logger.hpp"


import system;


using namespace std::placeholders;

namespace
Expand Down Expand Up @@ -129,7 +130,7 @@ int FaceRecognition::recognize(const Person::Fingerprint& unknown, const std::ve

QVector<QRect> FaceRecognition::fetchFaces(const OrientedImage& orientedPhoto, double scale) const
{
std::lock_guard lock(g_dlibMutex);
std::lock_guard<std::mutex> lock(g_dlibMutex);
QVector<QRect> result;

const QSize scaledSize = orientedPhoto.get().size() * scale;
Expand Down
3 changes: 2 additions & 1 deletion src/gui/desktop/models/photo_properties_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
#include <QDir>
#include <QFileInfo>

#include <system/filesystem.hpp>

import system;


namespace
Expand Down
1 change: 0 additions & 1 deletion src/gui/desktop/ui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <database/database_executor_traits.hpp>
#include <project_utils/iproject_manager.hpp>
#include <project_utils/project.hpp>
#include <system/system.hpp>
#include <features.hpp>

#include "config.hpp"
Expand Down
1 change: 0 additions & 1 deletion src/gui/desktop/ui/photos_grouping_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <core/containers_utils.hpp>
#include <core/iexif_reader.hpp>
#include <core/tags_utils.hpp>
#include <system/system.hpp>
#include <project_utils/project.hpp>
#include <project_utils/misc.hpp>

Expand Down
3 changes: 2 additions & 1 deletion src/gui/desktop/utils/grouppers/animation_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
#include <webp_generator.hpp>

#include <core/function_wrappers.hpp>
#include <system/system.hpp>

import system;

using std::placeholders::_1;

Expand Down
3 changes: 2 additions & 1 deletion src/gui/desktop/utils/grouppers/generator_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
#include <core/image_aligner.hpp>
#include <core/image_tools.hpp>
#include <core/utils.hpp>
#include <system/system.hpp>

import system;

#include "generator_utils.hpp"

Expand Down
7 changes: 4 additions & 3 deletions src/gui/desktop/utils/grouppers/hdr_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
#include <QImage>
#include <opencv2/imgcodecs.hpp>

#include "hdr_generator.hpp"

#include <core/image_aligner.hpp>
#include <core/hdr_assembler.hpp>
#include <system/system.hpp>

#include "hdr_generator.hpp"

import system;


HDRGenerator::HDRGenerator(const Data& data, ILogger* logger, IExifReaderFactory& exif):
Expand Down
3 changes: 2 additions & 1 deletion src/gui/desktop/utils/groups_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
#include <database/iphoto_operator.hpp>
#include <database/photo_utils.hpp>
#include <project_utils/misc.hpp>
#include <system/system.hpp>

#include "utils/grouppers/collage_generator.hpp"
#include "groups_manager.hpp"

import system;


QString GroupsManager::includeRepresentatInDatabase(const QString& representativePhoto, Project& project)
{
Expand Down
1 change: 0 additions & 1 deletion src/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ target_link_libraries(plugins
)

generate_export_header(plugins)
hideSymbols(plugins)
4 changes: 3 additions & 1 deletion src/plugins/implementation/plugin_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
#include <core/ilogger.hpp>
#include <core/ilogger_factory.hpp>
#include <core/cast.hpp>
#include <system/filesystem.hpp>
#include <database/idatabase_plugin.hpp>


import system;


namespace
{
struct PluginFinder final
Expand Down
3 changes: 2 additions & 1 deletion src/project_utils/implementation/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#include <QTemporaryFile>

#include "project.hpp"
#include <system/system.hpp>

import system;


namespace
Expand Down
3 changes: 2 additions & 1 deletion src/project_utils/implementation/project_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
#include <database/project_info.hpp>
#include <database/idatabase.hpp>
#include <plugins/iplugin_loader.hpp>
#include <system/system.hpp>

#include "project.hpp"

import system;


ProjectManager::ProjectManager(Database::IBuilder& builder): m_dbBuilder(builder)
{
Expand Down
30 changes: 15 additions & 15 deletions src/system/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,36 @@ elseif(UNIX)

endif(WIN32)


# common stuff
set(SYSTEM_SOURCES ${SYSTEM_SOURCES}
implementation/filesystem.cpp
implementation/system.cpp
)

set(SYSTEM_HEADERS
system.hpp
filesystem.hpp
)

if(WIN32)
configure_file(paths_win.hpp.cmake ${CMAKE_BINARY_DIR}/paths.hpp @ONLY)
else()
configure_file(paths_unix.hpp.cmake ${CMAKE_BINARY_DIR}/paths.hpp @ONLY)
endif()

add_library(system ${SYSTEM_SOURCES} ${SYSTEM_HEADERS})

add_library(system)

target_sources(system
PUBLIC FILE_SET CXX_MODULES FILES
system.cxx
implementation/filesystem.cpp
implementation/system.cpp

PRIVATE
#${SYSTEM_SOURCES}
)

target_include_directories(system
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)

target_link_libraries(system PRIVATE Qt::Core)

hideSymbols(system)
generate_export_header(system)

if(BUILD_SHARED_LIBS)
install(TARGETS system RUNTIME DESTINATION ${PATH_LIBS}
Expand All @@ -60,5 +60,5 @@ endif()


if(BUILD_TESTING)
include(system_tests.cmake)
#include(system_tests.cmake)
endif()
41 changes: 0 additions & 41 deletions src/system/filesystem.hpp

This file was deleted.

19 changes: 18 additions & 1 deletion src/system/implementation/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,29 @@
*
*/

#include "filesystem.hpp"
module;

#include <QDir>

#include "paths.hpp"

export module system:filesystem;


export struct FileSystem
{
QString getPluginsPath() const;
QString getTranslationsPath() const;
QString getLibrariesPath() const;
QString getScriptsPath() const;
QString getDataPath() const;

QString commonPath(const QString &, const QString &) const;

private:
QString read(const char *) const;
};

QString FileSystem::getPluginsPath() const
{
return read(Paths::plugins);
Expand Down
Loading
Loading