Compare commits

..

7 commits

16 changed files with 113 additions and 9 deletions

6
.gitmodules vendored
View file

@ -1,9 +1,9 @@
[submodule "3rdparty/nlohmann_json"]
path = 3rdparty/nlohmann_json
path = subprojects/nlohmann_json
url = https://github.com/nlohmann/json.git
[submodule "3rdparty/singleapplication"]
path = 3rdparty/singleapplication
path = subprojects/singleapplication/singleapplication.git
url = https://github.com/itay-grudev/SingleApplication.git
[submodule "3rdparty/csv-parser"]
path = 3rdparty/csv-parser
path = subprojects/csv-parser
url = https://github.com/vincentlaucsb/csv-parser.git

View file

@ -28,7 +28,7 @@ if(KIMA2_USE_EXTERNAL_JSON)
find_package(nlohmann_json REQUIRED)
endif()
add_subdirectory(3rdparty)
add_subdirectory(subprojects)
add_subdirectory(src)
#if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES Debug)

26
meson.build Normal file
View file

@ -0,0 +1,26 @@
project('kima2', 'cpp', default_options : ['cpp_std=c++17'], version : '1.6.0')
conf_data = configuration_data()
conf_data.set('PROJECT_VERSION', '"' + meson.project_version() + '"')
configure_file(output : 'config.h',
configuration : conf_data)
configuration_inc = include_directories('.')
cmake = import('cmake')
#csv = cmake.subproject('csv-parser')
#csv_lib = csv.dependency('csv')
nlohmann = cmake.subproject('nlohmann_json', cmake_options : ['-DJSON_BuildTests=OFF', '-DCMAKE_BUILD_TYPE=Release'])
nlohmann_lib = nlohmann.dependency('nlohmann_json')
singleapp_proj = subproject('singleapplication')
singleapp_lib = singleapp_proj.get_variable('singleapp_lib')
singleapp_dep = singleapp_proj.get_variable('singleapp_dep')
subdir('src')
if build_machine.system() == 'linux'
install_data('misc/kima2.svg', install_dir : get_option('datadir') / 'icons/hicolor/scalable/apps')
install_data('misc/kima2.desktop', install_dir : get_option('datadir') / 'applications')
install_data('manual/Benutzerhandbuch.pdf', install_dir : get_option('datadir') / 'kima2')
endif

View file

@ -2,7 +2,8 @@
#include "utils.h"
#include <fstream>
#include <csv.hpp>
#include "../../subprojects/csv-parser/single_include/csv.hpp"
//#include <csv.hpp>
namespace fs = std::filesystem;

13
src/core/meson.build Normal file
View file

@ -0,0 +1,13 @@
boost = dependency('boost', modules :['date_time'])
xlnt = dependency('xlnt')
sqlite = dependency('sqlite3')
src = ['database.cpp', 'entity.cpp', 'entityint.cpp', 'entityuuid.cpp',
'seller.cpp', 'article.cpp', 'sale.cpp', 'marketplace.cpp',
'excelreader.cpp', 'csvreader.cpp', 'jsonutil.cpp', 'utils.cpp']
core_inc = include_directories('..')
core_lib = static_library('core', src, dependencies :[boost, xlnt, sqlite, nlohmann_lib])
core_dep = declare_dependency(link_with : core_lib, include_directories : core_inc)

View file

@ -33,13 +33,13 @@ set(GUI_SOURCES
settingsdialog.cpp
settingsdialog.ui
../../kima2.qrc
${PROJECT_SOURCE_DIR}/3rdparty/singleapplication/singleapplication.cpp
${PROJECT_SOURCE_DIR}/3rdparty/singleapplication/singleapplication_p.cpp
${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git/singleapplication.cpp
${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git/singleapplication_p.cpp
)
add_executable(kima2 ${GUI_SOURCES} kima2.rc)
target_include_directories(kima2 PRIVATE ${PROJECT_BINARY_DIR})
target_include_directories(kima2 PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/singleapplication)
target_include_directories(kima2 PRIVATE ${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git)
target_link_libraries(kima2 core printer Qt5::Widgets Qt5::PrintSupport Qt5::Network stdc++fs)
if(WIN32)
set_target_properties(kima2 PROPERTIES LINK_FLAGS "-mwindows")

View file

@ -1,7 +1,7 @@
#include "mainwindow.h"
#include "basketmodel.h"
#include "config.h"
#include <config.h>
#include "pricedialog.h"
#include "reportdialog.h"
#include "salemodel.h"

23
src/gui/meson.build Normal file
View file

@ -0,0 +1,23 @@
qt5 = import('qt5')
qt5_dep = dependency('qt5', modules: ['Core', 'Gui', 'PrintSupport', 'Network'])
thread_dep = dependency('threads')
src = ['kima2.cpp', 'mainwindow.cpp', 'sellerdialog.cpp', 'sellermodel.cpp',
'pricedialog.cpp', 'basketmodel.cpp', 'salemodel.cpp', 'reportdialog.cpp',
'reportmodel.cpp', 'settingsdialog.cpp']
ui = ['mainwindow.ui', 'sellerdialog.ui', 'pricedialog.ui', 'reportdialog.ui', 'settingsdialog.ui']
processed = qt5.preprocess(moc_headers : ['basketmodel.h', 'mainwindow.h', 'pricedialog.h',
'reportdialog.h', 'sellerdialog.h', 'settingsdialog.h',
'sellermodel.h', 'salemodel.h'],
ui_files : ui,
qresources : '../../kima2.qrc',
dependencies: qt5_dep)
kima2 = executable('kima2', sources : [src, processed],
dependencies : [qt5_dep, singleapp_dep, core_dep, printer_dep, thread_dep],
include_directories : [configuration_inc],
install : true)

View file

@ -9,6 +9,8 @@
class SettingsDialog : public QDialog
{
Q_OBJECT
public:
SettingsDialog(QWidget* parent = nullptr,
Qt::WindowFlags f = Qt::WindowTitleHint | Qt::WindowSystemMenuHint);

3
src/meson.build Normal file
View file

@ -0,0 +1,3 @@
subdir('core')
subdir('printer')
subdir('gui')

9
src/printer/meson.build Normal file
View file

@ -0,0 +1,9 @@
libusb = dependency('libusb-1.0')
src = ['posprinter.cpp', 'utils.cpp']
printer_inc = include_directories('..')
printer_lib = static_library('printer', src, dependencies: [libusb, core_dep])
printer_dep = declare_dependency(link_with : printer_lib, include_directories : printer_inc)

View file

@ -0,0 +1,27 @@
project('singleapplication')
qt5 = import('qt5')
dep_qt5 = dependency('qt5', modules: ['Core', 'Widgets', 'Network'])
singleapp_inc = include_directories('singleapplication.git')
singleapp_moc = qt5.preprocess(
moc_headers: ['singleapplication.git/singleapplication.h', 'singleapplication.git/singleapplication_p.h'],
moc_extra_arguments: ['-DQAPPLICATION_CLASS=QApplication'],
dependencies: dep_qt5
)
singleapp_lib = static_library('SingleApplication',
['singleapplication.git/singleapplication.cpp', 'singleapplication.git/singleapplication_p.cpp', singleapp_moc],
include_directories: singleapp_inc,
cpp_args : '-DQAPPLICATION_CLASS=QApplication',
dependencies: dep_qt5
)
singleapp_dep = declare_dependency(
include_directories: singleapp_inc,
link_with: singleapp_lib
)
# On windows, SingleApplication needs to be linked against advapi32. This is
# done by adding 'advapi32' to cpp_winlibs, where it should be by default.