meson.build 2.4 KB
Newer Older
M
Michael Brockus 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
###################################################################################
#                                                                                 #
# NAME: meson.build                                                               #
#                                                                                 #
# AUTHOR: Mike Karlesky, Mark VanderVoord, Greg Williams.                         #
# WRITTEN BY: Michael Brockus.                                                    #
#                                                                                 #
# License: MIT                                                                    #
#                                                                                 #
###################################################################################



project('unity', 'c',
    license         : 'MIT',
16
    meson_version   : '>=0.52.0',
M
Michael Brockus 已提交
17 18
    default_options: [
        'buildtype=minsize',
M
Michael Brockus 已提交
19
        'optimization=3', 
M
Michael Brockus 已提交
20 21 22 23 24 25 26
        'warning_level=3',
        'werror=true',
        ]
)
lang = 'c'
cc = meson.get_compiler(lang)

M
Michael Brockus 已提交
27

M
Michael Brockus 已提交
28 29 30 31 32
##
#
# Meson: Add compiler flags
#
##
M
Michael Brockus 已提交
33
if cc.get_id() == 'clang'
M
Michael Brockus 已提交
34 35 36 37 38 39
    add_project_arguments(cc.get_supported_arguments(
            [
            '-Wweak-vtables', '-Wexit-time-destructors',
            '-Wglobal-constructors', '-Wmissing-noreturn' 
            ]
        ), language: lang)
M
Michael Brockus 已提交
40 41 42
endif

if cc.get_argument_syntax() == 'gcc'
M
Michael Brockus 已提交
43 44 45 46 47 48 49 50 51 52 53 54
    add_project_arguments(cc.get_supported_arguments(
            [
            '-Wformat', '-Waddress', '-Winit-self', '-Wno-multichar',
            '-Wpointer-arith'       , '-Wwrite-strings'              , 
            '-Wno-parentheses'      , '-Wno-type-limits'             , 
            '-Wformat-security'     , '-Wunreachable-code'           , 
            '-Waggregate-return'    , '-Wformat-nonliteral'          ,
            '-Wmissing-prototypes'  , '-Wold-style-definition'       ,
            '-Wmissing-declarations', '-Wmissing-include-dirs'       , 
            '-Wno-unused-parameter' , '-Wdeclaration-after-statement'
            ]
        ), language: lang)
M
Michael Brockus 已提交
55 56 57
endif

if cc.get_id() == 'msvc'
M
Michael Brockus 已提交
58 59 60 61 62 63 64
    add_project_arguments(cc.get_supported_arguments(
            [
            '/w44265', '/w44061', '/w44062', 
            '/wd4018', '/wd4146', '/wd4244',
            '/wd4305',
            ]
        ), language: lang)
M
Michael Brockus 已提交
65 66 67 68
endif

subdir('src')

M
Michael Brockus 已提交
69
unity_dep = declare_dependency(link_with: unity_lib, include_directories: unity_dir)