-
-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* README: initial malloc size before allow realloc * meson: fix wrong dependency for INIReader * meson: implement options * r49 release
- Loading branch information
1 parent
3e95a77
commit 16787c4
Showing
3 changed files
with
171 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,115 @@ | ||
project('inih', | ||
['c','cpp'], | ||
meson_version : '>= 0.46.0', | ||
default_options : ['default_library=both'], | ||
default_options : ['default_library=static'], | ||
license : 'BSD-3-Clause', | ||
version : '48' | ||
version : '49' | ||
) | ||
|
||
pkg = import('pkgconfig') | ||
#### options #### | ||
|
||
#### inih #### | ||
install_headers('ini.h') | ||
arg_static = [] | ||
distro_install = get_option('distro_install') | ||
|
||
if distro_install | ||
pkg = import('pkgconfig') | ||
else | ||
if not get_option('multi-line_entries') | ||
arg_static += ['-DINI_ALLOW_MULTILINE=0'] | ||
endif | ||
if not get_option('utf-8_bom') | ||
arg_static += ['-DINI_ALLOW_BOM=0'] | ||
endif | ||
if not get_option('inline_comments') | ||
arg_static += ['-DINI_ALLOW_INLINE_COMMENTS=0'] | ||
endif | ||
inline_comment_prefix = get_option('inline_comment_prefix') | ||
if inline_comment_prefix != ';' | ||
arg_static += ['-DINI_INLINE_COMMENT_PREFIXES="' + inline_comment_prefix + '"'] | ||
endif | ||
sol_comment_prefix = get_option('start-of-line_comment_prefix') | ||
if sol_comment_prefix != ';#' | ||
arg_static += ['-DINI_START_COMMENT_PREFIXES="' + start-of-line_comment_prefix + '"'] | ||
endif | ||
if get_option('allow_no_value') | ||
arg_static += ['-DINI_ALLOW_NO_VALUE=1'] | ||
endif | ||
if get_option('stop_on_first_error') | ||
arg_static += ['-DINI_STOP_ON_FIRST_ERROR=1'] | ||
endif | ||
if get_option('report_line_numbers') | ||
arg_static += ['-DINI_HANDLER_LINENO=1'] | ||
endif | ||
if get_option('call_handler_on_new_section') | ||
arg_static += ['-DINI_CALL_HANDLER_ON_NEW_SECTION=1'] | ||
endif | ||
if get_option('use_heap') | ||
arg_static += ['-DINI_USE_STACK=0'] | ||
endif | ||
max_line_length = get_option('max_line_length') | ||
if max_line_length != 200 | ||
arg_static += ['-DINI_MAX_LINE=' + str(max_line_length)] | ||
endif | ||
initial_malloc_size = get_option('initial_malloc_size') | ||
if initial_malloc_size != 200 | ||
arg_static += ['-DINI_INITIAL_ALLOC=' + str(initial_malloc_size)] | ||
endif | ||
if get_option('allow_realloc') | ||
arg_static += ['-DINI_ALLOW_REALLOC=1'] | ||
endif | ||
endif | ||
|
||
#### inih #### | ||
inc_inih = include_directories('.') | ||
|
||
lib_inih = library('inih', | ||
['ini.c'], | ||
include_directories : inc_inih, | ||
install : true, | ||
c_args : arg_static, | ||
install : distro_install, | ||
version : meson.project_version(), | ||
soversion : '0' | ||
) | ||
|
||
pkg.generate(lib_inih, | ||
name : 'inih', | ||
description : 'simple .INI file parser', | ||
version : meson.project_version() | ||
) | ||
if distro_install | ||
install_headers('ini.h') | ||
|
||
pkg.generate(lib_inih, | ||
name : 'inih', | ||
description : 'simple .INI file parser', | ||
version : meson.project_version() | ||
) | ||
endif | ||
|
||
inih_dep = declare_dependency( | ||
link_with : lib_inih, | ||
include_directories : inc_inih | ||
) | ||
|
||
#### INIReader #### | ||
install_headers('cpp/INIReader.h') | ||
if get_option('with_INIReader') | ||
inc_INIReader = include_directories('cpp') | ||
|
||
inc_INIReader = include_directories('cpp') | ||
lib_INIReader = library('INIReader', | ||
['cpp/INIReader.cpp'], | ||
include_directories : inc_INIReader, | ||
dependencies : inih_dep, | ||
install : distro_install, | ||
version : meson.project_version(), | ||
soversion : '0' | ||
) | ||
|
||
lib_INIReader = library('INIReader', | ||
['cpp/INIReader.cpp'], | ||
include_directories : inc_INIReader, | ||
dependencies : inih_dep, | ||
install : true, | ||
version : meson.project_version(), | ||
soversion : '0' | ||
) | ||
if distro_install | ||
install_headers('cpp/INIReader.h') | ||
|
||
pkg.generate(lib_INIReader, | ||
name : 'INIReader', | ||
description : 'simple .INI file parser for C++', | ||
version : meson.project_version() | ||
) | ||
pkg.generate(lib_INIReader, | ||
name : 'INIReader', | ||
description : 'simple .INI file parser for C++', | ||
version : meson.project_version() | ||
) | ||
endif | ||
|
||
INIReader_dep = declare_dependency( | ||
link_with : lib_inih, | ||
include_directories : inc_INIReader | ||
) | ||
INIReader_dep = declare_dependency( | ||
link_with : lib_INIReader, | ||
include_directories : inc_INIReader | ||
) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
option('distro_install', | ||
type : 'boolean', | ||
value : false, | ||
description : 'install shared libs, headers and pkg-config entries' | ||
) | ||
option('with_INIReader', | ||
type : 'boolean', | ||
value : false, | ||
description : 'compile and (if selected) install INIReader' | ||
) | ||
option('multi-line_entries', | ||
type : 'boolean', | ||
value : true, | ||
description : 'support for multi-line entries in the style of Python\'s ConfigParser' | ||
) | ||
option('utf-8_bom', | ||
type : 'boolean', | ||
value : true, | ||
description : 'allow a UTF-8 BOM sequence (0xEF 0xBB 0xBF) at the start of INI files' | ||
) | ||
option('inline_comments', | ||
type : 'boolean', | ||
value : true, | ||
description : 'allow inline comments with the comment prefix character' | ||
) | ||
option('inline_comment_prefix', | ||
type : 'string', | ||
value : ';', | ||
description : 'character(s) to start an inline comment (if enabled)' | ||
) | ||
option('start-of-line_comment_prefix', | ||
type : 'string', | ||
value : ';#', | ||
description : 'character(s) to start a comment at the beginning of a line' | ||
) | ||
option('allow_no_value', | ||
type : 'boolean', | ||
value : false, | ||
description : 'allow name with no value' | ||
) | ||
option('stop_on_first_error', | ||
type : 'boolean', | ||
value : false, | ||
description : 'stop parsing after an error' | ||
) | ||
option('report_line_numbers', | ||
type : 'boolean', | ||
value : false, | ||
description : 'report line number on ini_handler callback' | ||
) | ||
option('call_handler_on_new_section', | ||
type : 'boolean', | ||
value : false, | ||
description : 'call the handler each time a new section is encountered' | ||
) | ||
option('use_heap', | ||
type : 'boolean', | ||
value : false, | ||
description : 'allocate memory on the heap using malloc instead using a fixed-sized line buffer on the stack' | ||
) | ||
option('max_line_length', | ||
type : 'integer', | ||
value : 200, | ||
description : 'maximum line length in bytes' | ||
) | ||
option('initial_malloc_size', | ||
type : 'integer', | ||
value : 200, | ||
description : 'initial malloc size in bytes (when using the heap)' | ||
) | ||
option('allow_realloc', | ||
type : 'boolean', | ||
value : false, | ||
description : 'allow initial malloc size to grow to max line length (when using the heap)' | ||
) |