Convert project to meson.
This commit is contained in:
parent
528467ca8e
commit
28d70a32b6
5 changed files with 57 additions and 6 deletions
51
meson.build
Normal file
51
meson.build
Normal file
|
@ -0,0 +1,51 @@
|
|||
project('tigersum', 'c', 'd',
|
||||
version: '0.1',
|
||||
meson_version: '>=0.49.2',
|
||||
default_options: [
|
||||
'buildtype=release',
|
||||
],
|
||||
)
|
||||
|
||||
pvt_incl = include_directories('src')
|
||||
read_buff_size = (get_option('read_buff_size') / 64) * 64
|
||||
if (read_buff_size < 64)
|
||||
read_buff_size = 64
|
||||
endif
|
||||
|
||||
conf = configuration_data()
|
||||
conf.set('PROJECT_NAME', meson.project_name())
|
||||
conf.set('DEFAULT_TIGER_VERSION', get_option('default_tiger_version'))
|
||||
|
||||
version_arr = meson.project_version().split('.')
|
||||
conf.set('TIGERSUM_MAJOR', version_arr[0])
|
||||
conf.set('TIGERSUM_MINOR', version_arr[1])
|
||||
conf.set('READ_BUFF_SIZE', read_buff_size)
|
||||
|
||||
if get_option('reference_tiger')
|
||||
conf.set('BACKEND_NAME', 'tiger')
|
||||
conf.set('BACKEND_WEBSITE', 'http://www.cs.technion.ac.il/~biham/Reports/Tiger/')
|
||||
conf.set('BACKEND_AUTHOR', 'Ross Anderson and Eli Biham')
|
||||
tiger_src = files('lib/reference_tiger/sboxes.c', 'lib/reference_tiger/tiger.c')
|
||||
else
|
||||
conf.set('BACKEND_NAME', 'freetiger')
|
||||
conf.set('BACKEND_WEBSITE', 'http://klondike.es/freetiger/')
|
||||
conf.set('BACKEND_AUTHOR', 'klondike')
|
||||
tiger_src = files('lib/freetiger/C/tiger.c')
|
||||
endif
|
||||
|
||||
project_config_file = configure_file(
|
||||
input: 'src/' + meson.project_name() + 'Config.d.in',
|
||||
output: meson.project_name() + 'Config.d',
|
||||
configuration: conf
|
||||
)
|
||||
|
||||
executable(meson.project_name(),
|
||||
'src/main.d',
|
||||
'src/sums.d',
|
||||
'src/tiger.d',
|
||||
project_config_file,
|
||||
tiger_src,
|
||||
install: true,
|
||||
include_directories: pvt_incl,
|
||||
d_import_dirs: [include_directories('.')],
|
||||
)
|
3
meson_options.txt
Normal file
3
meson_options.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
option('reference_tiger', type: 'boolean', value: false)
|
||||
option('default_tiger_version', type: 'combo', description: 'Default version of the Tiger algorithm', choices: ['1', '2'], value: '1')
|
||||
option('read_buff_size', type: 'integer', value: 16384, min: 64, description: 'Read buffer size in bytes')
|
|
@ -15,14 +15,13 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import tigersumConfig;
|
||||
import std.stdio;
|
||||
import std.file;
|
||||
import std.array;
|
||||
import std.getopt;
|
||||
import sums;
|
||||
|
||||
mixin(import("tigersumConfig.d"));
|
||||
|
||||
int main (string[] parArgs) {
|
||||
if (parArgs.length == 1)
|
||||
return 0;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import tigersumConfig;
|
||||
import std.regex;
|
||||
import std.stdio;
|
||||
import std.file : isDir;
|
||||
|
@ -24,8 +25,6 @@ import std.exception;
|
|||
import std.format;
|
||||
import std.array : appender;
|
||||
|
||||
mixin(import("tigersumConfig.d"));
|
||||
|
||||
private void writeError (string parFile, string parMessage) {
|
||||
stderr.writefln("tigersum: %s: %s", parFile, parMessage);
|
||||
}
|
||||
|
|
|
@ -15,13 +15,12 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import tigersumConfig;
|
||||
import std.stdio;
|
||||
import std.string;
|
||||
import std.array, std.range;
|
||||
import std.algorithm;
|
||||
|
||||
mixin(import("tigersumConfig.d"));
|
||||
|
||||
private extern(C) void tiger (char* parMessage, ulong parLength, out ulong[3] parOut, char parPadding);
|
||||
private extern(C) void tiger_init (out ulong[3] parOut);
|
||||
private extern(C) void tiger_chunk (char* parMessage, ulong parLength, out ulong[3] parOut);
|
||||
|
|
Loading…
Reference in a new issue