Skip to content

Commit cd8724c

Browse files
committed
Add meson wrap files for dependencies and more meson fixes
1 parent 513a9cf commit cd8724c

File tree

6 files changed

+82
-5
lines changed

6 files changed

+82
-5
lines changed

meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ project('giv', ['c','cpp','vala'],
33
license: 'LGPLv3+')
44

55
PACKAGE_DOC_DIR = 'doc'
6-
PACKAGE_PLUGIN_DIR = get_option('prefix') + 'lib/giv-1.0/plugins/'
6+
PACKAGE_PLUGIN_DIR = get_option('prefix') / 'lib/giv-1.0/plugins/'
77

88
add_global_arguments('-DSPDLOG_FMT_EXTERNAL',
99
language : 'cpp')
@@ -17,7 +17,7 @@ add_global_arguments(['-DPACKAGE_DOC_DIR="'+PACKAGE_DOC_DIR+'" ',
1717

1818
gob2_proj = subproject('gob2')
1919

20-
libsimple_dep = dependency(
20+
libplis_dep = dependency(
2121
'libplis',
2222
fallback : ['libplis', 'libplis_dep'],
2323
default_options: ['default_library=static']

src/file2c.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env python3
2+
######################################################################
3+
# Wrap an arbitrary file for inclusion in c.
4+
#
5+
# 2024-04-21 Sun
6+
# Dov Grobgeld <dov.grobgeld@gmail.com>
7+
######################################################################
8+
9+
import argparse
10+
import re
11+
12+
def file2c(target, source):
13+
out = open(target, "wb")
14+
inp = open(source, "rb")
15+
16+
for line in inp.readlines():
17+
line = line.decode('utf8').rstrip()
18+
line = re.sub("\\\\", "\\\\", line)
19+
line = re.sub("\\\"", "\\\"", line)
20+
line = '"'+line+'\\n"\n'
21+
out.write(line.encode('utf8'))
22+
23+
out.close()
24+
inp.close()
25+
26+
parser = argparse.ArgumentParser(description='Process a file')
27+
parser.add_argument('--target',
28+
dest='target',
29+
action='store',
30+
type=str,
31+
default=None,
32+
help='target filename')
33+
parser.add_argument('--source',
34+
dest='source',
35+
action='store',
36+
default=None,
37+
help='source filename editing')
38+
39+
args = vars(parser.parse_args())
40+
print(f'{args["target"]=} {args["source"]=}')
41+
if not args['target'] or not args['source']:
42+
sys.write('Need both target asnd source arguments!')
43+
44+
file2c(args['target'],
45+
args['source'])

src/meson.build

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
gob2 = gob2_proj.get_variable('gob2_exe')
2+
pymod = import('python')
23

4+
python = pymod.find_installation()
35
giv_widget_src = custom_target('gen-output',
46
output : ['giv-widget.h','giv-widget-private.h','giv-widget.cc'],
57
input : 'giv-widget.gob',
@@ -24,7 +26,6 @@ giv_widget_sources = [
2426
]
2527

2628
subdir('agg')
27-
#subdir('plis')
2829
subdir('glib-jsonrpc')
2930
subdir('gtkimageviewer')
3031

@@ -35,7 +36,6 @@ gtk_dep = dependency('gtk+-3.0')
3536
fmt_dep = dependency('fmt')
3637
spdlog_dep = dependency('spdlog')
3738
gmodule_dep = dependency('gmodule-2.0')
38-
libplis_dep = dependency('libplis')
3939

4040
libgivwidget = shared_library(
4141
'giv-widget',
@@ -100,6 +100,33 @@ foreach basename : [
100100
)[2]
101101
endforeach
102102

103+
file2c = find_program('file2c.py')
104+
105+
foreach src_trg : [
106+
['menu-top-xml.i','menu-top.xml'],
107+
['menu-popup-xml.i','menu-popup.xml'],
108+
['copyright.i','copyright.markup']]
109+
110+
target = src_trg[0]
111+
source = src_trg[1]
112+
giv_src += custom_target(
113+
target,
114+
output : [target],
115+
input : source,
116+
command : [file2c, '--source', '@INPUT@', '--target', '@OUTPUT@'],
117+
)
118+
endforeach
119+
120+
gdk_pixbuf_csource = find_program('gdk-pixbuf-csource')
121+
122+
giv_src += custom_target(
123+
'giv-logo.i',
124+
output : ['giv-logo.i'],
125+
input : ['../doc/giv-logo.png'],
126+
capture : true,
127+
command : [gdk_pixbuf_csource, '--name=image_giv_icon_inline', '@INPUT@']
128+
)
129+
103130
glib_dep = dependency('glib-2.0')
104131
gobject_dep = dependency('gobject-2.0')
105132
gio_dep = dependency('gio-2.0')

src/plugins/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ inc = ['..']
33
png_dep = dependency('libpng')
44
zip_dep = dependency('libzip')
55
tiff_dep = dependency('libtiff-4')
6-
libplis_dep = dependency('libplis')
76

87
plugins = [['npy', 'npy.c', []],
98
['tiff','tiff.c', [tiff_dep]],

subprojects/gob2.wrap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[wrap-git]
2+
url = http://github.com/dov/gob2
3+
revision = cpp-new

subprojects/libplis.wrap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[wrap-git]
2+
url = http://github.com/dov/libplis.git
3+
revision = master

0 commit comments

Comments
 (0)