Skip to content
Snippets Groups Projects
Verified Commit f19a1ea7 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Make benchmark and examples optional + fix windows compilation

parent 853e3b80
No related branches found
No related tags found
No related merge requests found
......@@ -18,12 +18,12 @@ main(int argc, char **argv)
int height = 0, width = 0;
std::string_view width_str{argv[2]}, height_str{argv[3]};
std::from_chars(height_str.begin(), height_str.end(), height);
std::from_chars(height_str.data(), height_str.data()+height_str.size(), height);
if (height <= 0) {
std::cerr << "Invalid height.";
return -2;
}
std::from_chars(width_str.begin(), width_str.end(), width);
std::from_chars(width_str.data(), width_str.data()+width_str.size(), width);
if (width <= 0) {
std::cerr << "Invalid width.";
return -2;
......
......@@ -18,11 +18,15 @@ if get_option('tests')
test('blurhash-tests', tests)
endif
bench = executable('blurhash-decode-bench', 'blurhash-decode-bench.cpp', link_with: lib, install: false)
benchmark('blurhash-decode-bench', bench, timeout: 60, should_fail: true)
if get_option('benchmarks')
bench = executable('blurhash-decode-bench', 'blurhash-decode-bench.cpp', link_with: lib, install: false)
benchmark('blurhash-decode-bench', bench, timeout: 60, should_fail: true)
endif
executable('blurhash2bmp', 'blurhash2bmp.cpp', link_with: lib, install: true)
executable('blurhash', 'image2blurhash.cpp', link_with: lib, install: true)
if get_option('examples')
executable('blurhash2bmp', 'blurhash2bmp.cpp', link_with: lib, install: true)
executable('blurhash', 'image2blurhash.cpp', link_with: lib, install: true)
endif
install_headers('blurhash.hpp')
......
option('tests', type : 'boolean', value : false, description : 'Build the tests')
option('examples', type : 'boolean', value : false, description : 'Build the examples')
option('benchmarks', type : 'boolean', value : false, description : 'Build the benchmarks')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment