diff options
Diffstat (limited to 'meson.build')
| -rw-r--r-- | meson.build | 238 |
1 files changed, 220 insertions, 18 deletions
diff --git a/meson.build b/meson.build index ff6a6fc..c3b6302 100644 --- a/meson.build +++ b/meson.build @@ -5,9 +5,10 @@ project( meson_version : '>= 1.3.0', default_options : [ 'warning_level=3', - 'cpp_std=c++23', + 'cpp_std=c++26', 'cpp_eh=none', 'cpp_rtti=false', + 'default_library=static', ], ) @@ -17,25 +18,149 @@ configure_file(input: 'src/config.h.in', output: 'config.h', configuration : conf_data) -dependencies = [ -] +z_dep = dependency('zlib', version: '>=1.3.0') +lzma_dep = dependency('liblzma', version: '>=5.8.0') inc = include_directories('src') -exe = executable( - 'jkc', +args_lib = library( + 'args', sources: [ 'src/args.cc', 'src/args.hh', + ], + include_directories: inc, +) +args_dep = declare_dependency(link_with: args_lib) + +buffer_lib = library( + 'buffer', + sources: [ + 'src/buffer.cc', + 'src/buffer.hh', + ], + include_directories: inc, +) +buffer_dep = declare_dependency(link_with: buffer_lib) + +io_lib = library( + 'io', + sources: [ + 'src/line.cc', + 'src/line.hh', + 'src/io.cc', + 'src/io.hh', + 'src/unique_fd.cc', + 'src/unique_fd.hh', + ], + include_directories: inc, +) +io_dep = declare_dependency(link_with: io_lib) + +str_lib = library( + 'str', + sources: [ + 'src/str.cc', + 'src/str.hh', + ], + include_directories: inc, +) +str_dep = declare_dependency(link_with: str_lib) + +csv_lib = library( + 'csv', + sources: [ + 'src/csv.cc', + 'src/csv.hh', + ], + include_directories: inc, + dependencies: [io_dep, str_dep], +) +csv_dep = declare_dependency( + link_with: csv_lib, + dependencies: [io_dep, str_dep], +) + +decompress_lib = library( + 'decompress', + sources: [ + 'src/decompress.hh', + 'src/decompress_lzma.cc', + 'src/decompress_z.cc', + ], + include_directories: inc, + dependencies: [buffer_dep, io_dep, lzma_dep, z_dep], +) +decompress_dep = declare_dependency( + link_with: decompress_lib, + dependencies: [buffer_dep, io_dep, lzma_dep, z_dep], +) + +gen_ugc = executable( + 'gen_ugc', + sources: [ + 'src/gen_ugc.cc', + ], + include_directories: inc, + install : false, + dependencies : [ + args_dep, + csv_dep, + decompress_dep, + ], +) + +unicode_versions = [ + '6.2.0', + '8.0.0', + '10.0.0', + '11.0.0', + '12.1.0', + '13.0.0', + '14.0.0', + '15.0.0', + '15.1.0', + '16.0.0', +] + +ugc_sources = [] +foreach unicode_version : unicode_versions + ugc_sources += custom_target( + 'gen-ugc-' + unicode_version, + input: ['data/unicode-' + unicode_version + '/UnicodeData.txt.xz'], + output: ['ugc_lookup_' + unicode_version + '.cc'], + command : [gen_ugc, '--prefix', + 'u' + unicode_version.replace('.', '_') + '_', + '@INPUT@', '@OUTPUT@']) +endforeach + +unicode_lib = library( + 'unicode', + sources: [ 'src/u.hh', + 'src/u.cc', 'src/u16.hh', 'src/u8.hh', + 'src/ugc.hh', 'src/umod8.hh', + ugc_sources, + ], + include_directories: inc, +) +unicode_dep = declare_dependency(link_with: unicode_lib) + +jkc = executable( + 'jkc', + sources: [ 'src/main.cc', ], include_directories: inc, install : true, - dependencies : dependencies, + dependencies : [ + args_dep, + io_dep, + unicode_dep, + ], ) gtest_main_dep = dependency('gtest_main', fallback : ['gtest_main']) @@ -46,22 +171,99 @@ test_dependencies = [ test('args', executable( 'test_args', - sources: [ - 'src/args.cc', - 'src/args.hh', - 'test/args.cc', - ], + sources: ['test/args.cc'], include_directories: inc, - dependencies : test_dependencies)) + dependencies: [ + args_dep, + test_dependencies, + ], +)) test('u', executable( 'test_u', + sources: ['test/u.cc'], + include_directories: inc, + dependencies: [ + unicode_dep, + test_dependencies, + ], +)) + +test('csv', executable( + 'test_csv', + sources: ['test/csv.cc'], + include_directories: inc, + dependencies: [ + csv_dep, + test_dependencies, + ], +)) + +test('line', executable( + 'test_line', sources: [ - 'src/u.hh', - 'src/u16.hh', - 'src/u8.hh', - 'src/umod8.hh', - 'test/u.cc', + 'test/line.cc', + 'test/io_test_helper.hh', + 'test/io_test_helper.cc', + ], + include_directories: inc, + dependencies: [ + io_dep, + test_dependencies, + ], +)) + +test('str', executable( + 'test_str', + sources: ['test/str.cc'], + include_directories: inc, + dependencies: [ + str_dep, + test_dependencies, ], +)) + +test('io', executable( + 'test_io', + sources: ['test/io.cc'], + include_directories: inc, + dependencies: [ + io_dep, + test_dependencies, + ], +)) + +test('buffer', executable( + 'test_buffer', + sources: ['test/buffer.cc'], + include_directories: inc, + dependencies : [ + buffer_dep, + test_dependencies, + ], +)) + +test('decompress', executable( + 'test_decompress', + sources: ['test/decompress.cc'], include_directories: inc, - dependencies : test_dependencies)) + dependencies : [ + decompress_dep, + test_dependencies, + ], +)) + +run_clang_tidy = find_program('run-clang-tidy', required: false) + +if run_clang_tidy.found() + # The clang-tidy target generated by meson misses most of the + # source files, so create our own. + run_target( + 'clang-tidy', + command: [ + run_clang_tidy, + '-quiet', + '-use-color', + ], + ) +endif |
