project( 'jkc', 'cpp', version : '0.1', meson_version : '>= 1.3.0', default_options : [ 'warning_level=3', 'cpp_std=c++26', 'cpp_eh=none', 'cpp_rtti=false', 'default_library=static', ], ) conf_data = configuration_data() conf_data.set('version', meson.project_version()) configure_file(input: 'src/config.h.in', output: 'config.h', configuration : conf_data) z_dep = dependency('zlib', version: '>=1.3.0') lzma_dep = dependency('liblzma', version: '>=5.8.0') inc = include_directories('src') 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) uio_lib = library( 'uio', sources: [ 'src/uio.cc', 'src/uio.hh', ], include_directories: inc, dependencies: [buffer_dep, io_dep, unicode_dep], ) uio_dep = declare_dependency( link_with: uio_lib, dependencies: [buffer_dep, io_dep, unicode_dep], ) jkc = executable( 'jkc', sources: [ 'src/main.cc', ], include_directories: inc, install : true, dependencies : [ args_dep, io_dep, unicode_dep, ], ) gtest_main_dep = dependency('gtest_main', fallback : ['gtest_main']) test_dependencies = [ gtest_main_dep, ] test('args', executable( 'test_args', sources: ['test/args.cc'], include_directories: inc, 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, ], )) io_test_helper_lib = library( 'io_test_helper', sources: [ 'test/io_test_helper.cc', 'test/io_test_helper.hh', ], include_directories: inc, dependencies: io_dep, ) io_test_helper_dep = declare_dependency( link_with: io_test_helper_lib, dependencies: io_dep, ) test('line', executable( 'test_line', sources: ['test/line.cc'], include_directories: inc, dependencies: [ io_dep, io_test_helper_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, io_test_helper_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 : [ decompress_dep, test_dependencies, ], )) test('uio', executable( 'test_uio', sources: ['test/uio.cc'], include_directories: inc, dependencies: [ io_test_helper_dep, uio_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