1project('inih', 2 ['c'], 3 license : 'BSD-3-Clause', 4) 5 6#### options #### 7arg_static = [] 8distro_install = get_option('distro_install') 9 10if distro_install 11 pkg = import('pkgconfig') 12else 13 if not get_option('multi-line_entries') 14 arg_static += ['-DINI_ALLOW_MULTILINE=0'] 15 endif 16 if not get_option('utf-8_bom') 17 arg_static += ['-DINI_ALLOW_BOM=0'] 18 endif 19 if not get_option('inline_comments') 20 arg_static += ['-DINI_ALLOW_INLINE_COMMENTS=0'] 21 endif 22 inline_comment_prefix = get_option('inline_comment_prefix') 23 if inline_comment_prefix != ';' 24 arg_static += ['-DINI_INLINE_COMMENT_PREFIXES="' + inline_comment_prefix + '"'] 25 endif 26 sol_comment_prefix = get_option('start-of-line_comment_prefix') 27 if sol_comment_prefix != ';#' 28 arg_static += ['-DINI_START_COMMENT_PREFIXES="' + start-of-line_comment_prefix + '"'] 29 endif 30 if get_option('allow_no_value') 31 arg_static += ['-DINI_ALLOW_NO_VALUE=1'] 32 endif 33 if get_option('stop_on_first_error') 34 arg_static += ['-DINI_STOP_ON_FIRST_ERROR=1'] 35 endif 36 if get_option('report_line_numbers') 37 arg_static += ['-DINI_HANDLER_LINENO=1'] 38 endif 39 if get_option('call_handler_on_new_section') 40 arg_static += ['-DINI_CALL_HANDLER_ON_NEW_SECTION=1'] 41 endif 42 if get_option('use_heap') 43 arg_static += ['-DINI_USE_STACK=0'] 44 endif 45 max_line_length = get_option('max_line_length') 46 if max_line_length != 200 47 arg_static += ['-DINI_MAX_LINE=' + max_line_length.to_string()] 48 endif 49 initial_malloc_size = get_option('initial_malloc_size') 50 if initial_malloc_size != 200 51 arg_static += ['-DINI_INITIAL_ALLOC=' + initial_malloc_size.to_string()] 52 endif 53 if get_option('allow_realloc') 54 arg_static += ['-DINI_ALLOW_REALLOC=1'] 55 endif 56endif 57 58#### inih #### 59inc_inih = include_directories('.') 60 61lib_inih = library('inih', 62 ['ini.c'], 63 include_directories : inc_inih, 64 c_args : arg_static, 65 install : distro_install, 66 soversion : '0' 67) 68 69if distro_install 70 install_headers('ini.h') 71 72 pkg.generate(lib_inih, 73 name : 'inih', 74 description : 'simple .INI file parser', 75 ) 76endif 77 78inih_dep = declare_dependency( 79 link_with : lib_inih, 80 compile_args : arg_static, 81 include_directories : inc_inih 82) 83 84#### INIReader #### 85if get_option('with_INIReader') 86 add_languages('cpp') 87 inc_INIReader = include_directories('cpp') 88 89 lib_INIReader = library('INIReader', 90 ['cpp/INIReader.cpp'], 91 include_directories : inc_INIReader, 92 dependencies : inih_dep, 93 install : distro_install, 94 soversion : '0' 95 ) 96 97 if distro_install 98 install_headers('cpp/INIReader.h') 99 100 pkg.generate(lib_INIReader, 101 name : 'INIReader', 102 description : 'simple .INI file parser for C++', 103 ) 104 endif 105 106 INIReader_dep = declare_dependency( 107 link_with : lib_INIReader, 108 include_directories : inc_INIReader 109 ) 110endif 111