Skip to content

Commit e45ddfc

Browse files
committed
Adding logging to the givimage dll and fixed fitsio
1 parent 61bc531 commit e45ddfc

File tree

8 files changed

+58
-22
lines changed

8 files changed

+58
-22
lines changed

giv.nsi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ File ${SYSROOT}\mingw\bin\libepoxy-0.dll
5353
File ${SYSROOT}\mingw\bin\libcairo*.dll
5454
File ${SYSROOT}\mingw\bin\libjasper*.dll
5555
File ${SYSROOT}\mingw\bin\zlib*.dll
56+
File ${SYSROOT}\mingw\bin\libzip*.dll
57+
File ${SYSROOT}\mingw\bin\libwebp*.dll
5658
File ${SYSROOT}\mingw\bin\libglib*.dll
5759
File ${SYSROOT}\mingw\bin\libatk*.dll
5860
File ${SYSROOT}\mingw\bin\libgobject*.dll
@@ -70,7 +72,9 @@ File ${SYSROOT}\mingw\bin\libwinpthread*.dll
7072
File ${SYSROOT}\mingw\bin\libssp-0.dll
7173
File ${SYSROOT}\mingw\bin\libfribidi-0.dll
7274
File ${SYSROOT}\mingw\bin\libharfbuzz-0.dll
75+
7376
#File \usr\local\mingw32\bin\libjson-glib-1.0-0.dll
77+
File \usr\local\mingw64\bin\libcfitsio.dll
7478
File ${SYSROOT}\mingw\bin\gdk-pixbuf-query-loaders.exe
7579

7680
# # Not sure that I need this. It doesn't seem to make any difference.

src/SConscript

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ def file2c(env, target, source):
3636
out.close()
3737
inp.close()
3838

39-
src_giv_image = ['givimage.cc',
39+
src_giv_image = ['givimagedll.cc',
40+
'givimage.cc',
4041
'givplugin.cc',
4142
]
4243

src/giv-win.gob

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ requires 2.0.0
1818

1919
%{
2020
#ifdef _WIN32
21-
#if 0
22-
#include <windows.h>
23-
#include <cairo-win32.h>
24-
#endif
2521
#endif
2622

2723
#include <gdk/gdkkeysyms.h>
@@ -3250,20 +3246,6 @@ cb_menu_about(GtkAction *action,
32503246
gtk_widget_destroy (about_window);
32513247
}
32523248

3253-
static void
3254-
cb_menu_manual(GtkAction *action,
3255-
gpointer data)
3256-
{
3257-
#ifdef WIN32
3258-
// Fix the path
3259-
ShellExecute(NULL, "open", "file:///c|/Progra~1/giv/doc/giv.html", NULL, NULL, SW_SHOWNORMAL);
3260-
#else
3261-
// Linux
3262-
system(slipprintf("xdg-open %s/giv.html",
3263-
PACKAGE_DOC_DIR));
3264-
#endif
3265-
}
3266-
32673249
static void
32683250
cb_menu_copyright(GtkAction *action,
32693251
gpointer data)
@@ -4642,5 +4624,23 @@ static void create_remote_commands(GivWin *self)
46424624
self);
46434625
}
46444626

4627+
#ifdef _WIN32
4628+
#include <shellapi.h>
4629+
#endif
4630+
4631+
static void
4632+
cb_menu_manual(GtkAction *action,
4633+
gpointer data)
4634+
{
4635+
#ifdef _WIN32
4636+
// Fix the path
4637+
ShellExecute(NULL, "open", "file:///c|/Progra~1/giv/doc/giv.html", NULL, NULL, SW_SHOWNORMAL);
4638+
#else
4639+
// Linux
4640+
system(slipprintf("xdg-open %s/giv.html",
4641+
PACKAGE_DOC_DIR));
4642+
#endif
4643+
}
4644+
46454645
%}
46464646

src/giv.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <string.h>
1111
#include "gtk/gtk.h"
1212
#include "giv-win.h"
13+
#include "givimagedll.h"
1314
#include "glib-jsonrpc/glib-jsonrpc-json.h"
1415
#include "glib-jsonrpc/glib-jsonrpc-client.h"
1516
#include "spdlog/sinks/basic_file_sink.h"
@@ -193,6 +194,9 @@ int main(int argc, char **argv)
193194
spdlog::info("CommitTime: {}", GIT_COMMIT_TIME);
194195
spdlog::info("Command line: {}", join(args," "));
195196

197+
spdlog::info("Calling to register logger in givimagedll");
198+
registerLogger(logger);
199+
196200
// Load an image into a remote instance of giv. If this fails,
197201
// then normal loading should take place.
198202
if (do_remote)

src/givimage.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
#include "givimage.h"
1111
#include "givplugin.h"
1212
#include <gdk-pixbuf/gdk-pixbuf.h>
13-
#include "spdlog/spdlog.h"
14-
13+
#include <spdlog/spdlog.h>
1514

1615
#define GIV_IMAGE_ERROR g_spawn_error_quark ()
1716

@@ -719,3 +718,5 @@ GivImageType giv_image_get_type(GivImage *img)
719718
{
720719
return img->img_type;
721720
}
721+
722+

src/givimagedll.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// A spdlog registration for the givimage dll
2+
3+
#include "givimagedll.h"
4+
5+
void registerLogger(std::shared_ptr<spdlog::logger> logger)
6+
{
7+
spdlog::register_logger(logger);
8+
spdlog::set_default_logger(logger);
9+
spdlog::info("Registering the logger in the givimage dll");
10+
}

src/givimagedll.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//======================================================================
2+
// givimagedll.h -
3+
//
4+
// Dov Grobgeld <[email protected]>
5+
// Mon Jan 9 12:09:18 2023
6+
//----------------------------------------------------------------------
7+
#ifndef GIVIMAGEDLL_H
8+
#define GIVIMAGEDLL_H
9+
10+
#include <spdlog/spdlog.h>
11+
12+
void registerLogger(std::shared_ptr<spdlog::logger> logger);
13+
14+
#endif /* GIVIMAGEDLL */

src/plugins/SConscript

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if not env['SBOX']:
2222
conf = Configure(env,
2323
custom_tests = { 'CheckPKG' : CheckPKG } )
2424

25-
if conf.CheckLib('cfitsio'):
25+
if True or conf.CheckLib('cfitsio'):
2626
print("Using system cfitsio library")
2727
env.ParseConfig('${PKGCONFIG} --cflags --libs cfitsio')
2828

@@ -32,6 +32,8 @@ if not env['SBOX']:
3232
LIBS=['giv-image']+env['LIBS'],
3333
CPPPATH= env['CPPPATH']
3434
)
35+
else:
36+
print('No cfitsio found')
3537

3638
use_system_dcmtk = conf.CheckCXXHeader('dcmtk/ofstd/ofstd.h')
3739
print('use_system_dcmtk=',use_system_dcmtk)

0 commit comments

Comments
 (0)