project( 'hdass', 'c', version: '0.1.0', license: 'MIT', meson_version: '>=1.0.0', default_options: [ 'c_std=c17', 'warning_level=3', 'b_sanitize=address,undefined', 'b_lundef=false', ], ) cc = meson.get_compiler('c') add_project_arguments( cc.get_supported_arguments( '-Wconversion', '-Wsign-conversion', '-Wshadow', '-Wstrict-prototypes', '-Wmissing-prototypes', '-fno-omit-frame-pointer', ), language: 'c', ) src_inc = include_directories('src') core = static_library( 'hdass_core', files( 'src/args.c', 'src/ast.c', 'src/diag.c', 'src/file.c', 'src/lexer.c', 'src/nasm.c', 'src/parser.c', 'src/sema.c', ), include_directories: src_inc, ) executable( 'hdass', 'src/main.c', include_directories: src_inc, link_with: core, ) tests = executable( 'tests', files( 'tests/main.c', 'tests/codegen_test.c', 'tests/lexer_test.c', 'tests/parser_test.c', 'tests/sema_test.c', ), include_directories: [src_inc, include_directories('tests')], link_with: core, ) test('unit', tests) cppcheck = find_program('cppcheck', required: false) if cppcheck.found() run_target( 'cppcheck', command: [ cppcheck, '--project=@0@'.format(meson.project_build_root() / 'compile_commands.json'), '--enable=warning,style,performance,portability', '--error-exitcode=1', ], ) endif