diff --git a/.gitignore b/.gitignore
index b215aae..c0c51c9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,13 @@
+# Folder
builddir/
+ptouch-print/
subprojects/*
-!subprojects/*.wrap
.cache/
+coverageReport/
+
+# Files
+!subprojects/*.wrap
.vscode/*
!.vscode/c_cpp_properties.json
!.vscode/settings.json
!.vscode/launch.json
-ptouch-print/
\ No newline at end of file
diff --git a/generate_coverage.sh b/generate_coverage.sh
new file mode 100755
index 0000000..32b1ef4
--- /dev/null
+++ b/generate_coverage.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+SCRIPT_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
+HTML_COV_PATH="coverageReport/html"
+HTML_START_FILE="index.html"
+
+echo "Generating Coverage report for ptouch-prnt"
+
+ninja -C builddir
+ninja -C builddir test
+
+mkdir -p ${HTML_COV_PATH}
+gcovr --html --html-details --html-syntax-highlighting --filter src --output ${HTML_COV_PATH}/${HTML_START_FILE}
+
+if [ $? ]
+then
+ echo "Coverage report successful generated!"
+ echo "Open: file://${SCRIPT_PATH}/${HTML_COV_PATH}/${HTML_START_FILE}"
+else
+ echo "Error generating coverage report!"
+fi
\ No newline at end of file
diff --git a/meson.build b/meson.build
index 888c1e7..84a0756 100644
--- a/meson.build
+++ b/meson.build
@@ -17,45 +17,15 @@ endif
incdir = include_directories('src')
-ptprnt_hpps = [
- 'src/libusbwrap/interface/IUsbDeviceFactory.hpp',
- 'src/libusbwrap/interface/IUsbDevice.hpp',
- 'src/libusbwrap/UsbDeviceFactory.hpp',
- 'src/libusbwrap/LibUsbTypes.hpp',
- 'src/libusbwrap/UsbDevice.hpp',
- 'src/interface/IPrinterDriver.hpp',
- 'src/interface/IPrinterTypes.hpp',
- 'src/P700Printer.hpp',
- 'src/PtouchPrint.hpp',
- 'src/graphics/Bitmap.hpp',
- 'src/graphics/Image.hpp',
- 'src/graphics/Monochrome.hpp'
-]
-
-ptprnt_srcs = [
- 'src/PtouchPrint.cpp',
- 'src/P700Printer.cpp',
- 'src/graphics/Image.cpp',
- 'src/graphics/Bitmap.cpp',
- 'src/graphics/Monochrome.cpp',
- 'src/libusbwrap/UsbDeviceFactory.cpp',
- 'src/libusbwrap/UsbDevice.cpp',
-]
-
-ptprnt_lib = library('ptprnt',
- include_directories: incdir,
- install: true,
- dependencies: [usb_dep, log_dep, pangocairo_dep, cli11_dep],
- sources: [ptprnt_hpps, ptprnt_srcs])
-
-ptprnt_dep = declare_dependency(include_directories: incdir,
- link_with: ptprnt_lib)
+subdir('src')
ptprnt_exe = executable(
'ptprnt',
'src/main.cpp',
install: true,
- dependencies : [usb_dep, log_dep, cli11_dep, ptprnt_dep],
+ dependencies : [usb_dep, log_dep, pangocairo_dep, cli11_dep],
+ include_directories: incdir,
+ sources: [ptprnt_srcs],
cpp_args : ['-DPROJ_VERSION="'+meson.project_version()+'"'],
)
diff --git a/src/main.cpp b/src/main.cpp
index ddc6b74..ed35bcc 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -16,10 +16,6 @@
along with this program. If not, see .
*/
-
-#include
-#include
-
#include "PtouchPrint.hpp"
int main(int argc, char** argv) {
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..a5fb667
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,24 @@
+ptprnt_hpps = files (
+ 'libusbwrap/interface/IUsbDeviceFactory.hpp',
+ 'libusbwrap/interface/IUsbDevice.hpp',
+ 'libusbwrap/UsbDeviceFactory.hpp',
+ 'libusbwrap/LibUsbTypes.hpp',
+ 'libusbwrap/UsbDevice.hpp',
+ 'interface/IPrinterDriver.hpp',
+ 'interface/IPrinterTypes.hpp',
+ 'P700Printer.hpp',
+ 'PtouchPrint.hpp',
+ 'graphics/Bitmap.hpp',
+ 'graphics/Image.hpp',
+ 'graphics/Monochrome.hpp'
+)
+
+ptprnt_srcs = files (
+ 'PtouchPrint.cpp',
+ 'P700Printer.cpp',
+ 'graphics/Image.cpp',
+ 'graphics/Bitmap.cpp',
+ 'graphics/Monochrome.cpp',
+ 'libusbwrap/UsbDeviceFactory.cpp',
+ 'libusbwrap/UsbDevice.cpp',
+)
\ No newline at end of file
diff --git a/tests/meson.build b/tests/meson.build
index 5bfd7a6..493afcc 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,6 +1,6 @@
-tests = [['bitmap_test', 'bitmap_test_exe', ['bitmap_test/bitmap_test.cpp']],
- ['image_test', 'image_test_exe', ['image_test/image_test.cpp']],
- ['monochrome_test', 'monochrome_test_exe', ['monochrome_test/monochrome_test.cpp']]
+tests = [['bitmap_test', 'bitmap_test_exe', ptprnt_srcs + ['bitmap_test/bitmap_test.cpp']],
+ ['image_test', 'image_test_exe', ptprnt_srcs +['image_test/image_test.cpp']],
+ ['monochrome_test', 'monochrome_test_exe', ptprnt_srcs +['monochrome_test/monochrome_test.cpp']]
]
foreach test : tests
@@ -8,8 +8,7 @@ foreach test : tests
executable(test.get(1),
sources: test.get(2),
include_directories: incdir,
- link_with:[ptprnt_lib],
- dependencies: [gtest_dep, pangocairo_dep]
+ dependencies: [gtest_dep, usb_dep, log_dep, pangocairo_dep, cli11_dep]
)
)
endforeach
\ No newline at end of file