meson: Setup the Meson build infrastructure

This commit is contained in:
2021-09-22 18:52:34 +02:00
parent 9d3ffdadf5
commit 638f1771a8
8 changed files with 70 additions and 0 deletions

2
c/cli/meson.build Normal file
View File

@ -0,0 +1,2 @@
executable('passgeny', 'src/passgeny.c', dependencies: phogen_dep)

2
c/meson.build Normal file
View File

@ -0,0 +1,2 @@
subdir('phogen')
subdir('cli')

18
c/phogen/meson.build Normal file
View File

@ -0,0 +1,18 @@
# phogen_map is needed for generating phogen_map.h
subdir('phogen_map')
phogen_map_h = custom_target(
'phogen_map.h',
input : PHOGEN_WORD_LIST,
output : 'phogen_map.h',
command : [PHOGEN_MAP_EXE, '--input=@INPUT@', '--clang=@OUTPUT@'])
phogen_inc = include_directories('inc')
phogen_lib = static_library(
'phogen',
[phogen_map_h, 'src/phogen.c'],
include_directories : phogen_inc)
phogen_dep = declare_dependency(link_with : phogen_lib, include_directories : phogen_inc)

View File

@ -0,0 +1,5 @@
libcrypto_dep = dependency('libcrypto')
PHOGEN_MAP_EXE = executable('phogen_map', 'phogen_map.c', dependencies: libcrypto_dep)

10
meson.build Normal file
View File

@ -0,0 +1,10 @@
project(
'passgeny',
'c',
default_options: ['warning_level=1', 'werror=true'],
version : '0.1')
PHOGEN_WORD_LIST = files('data/words_alpha.txt.backup')
subdir('c')
subdir('python')

7
python/meson.build Normal file
View File

@ -0,0 +1,7 @@
pymod = import('python')
pyinst = pymod.find_installation('python3')
PYTHONPATH = meson.current_build_dir()
subdir('phogen_map')
subdir('passgeny')

View File

@ -0,0 +1,24 @@
pysrc = files(
'__init__.py',
'passgeny.py',
'bhash.py',
'phogen.py')
phogen_map_py = custom_target(
'phogen_map.py',
input : PHOGEN_WORD_LIST,
output : 'phogen_map.py',
install: true,
install_dir: pyinst.get_install_dir() / meson.project_name(),
build_by_default: true,
command : [PHOGEN_MAP_EXE, '--input=@INPUT@', '--python=@OUTPUT@'])
custom_target(
'python_passgeny',
input: pysrc,
output: 'passgeny',
command: ['cp', '@INPUT@', '@OUTDIR@'],
build_by_default: true)
pyinst.install_sources(pysrc, subdir: meson.project_name())

View File

@ -0,0 +1,2 @@
PHOGEN_MAP_PY = files('phogen_map.py')