# HG changeset patch # User Danielle Hutzley # Date 1652820644 25200 # Tue May 17 13:50:44 2022 -0700 # Node ID 9a87d40bb98aaa4c02171e81a93fc2e934de9838 # Parent 0efbdc192644b01e6c16ac9423d37357de0d0a2c Tweak builds diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -42,6 +42,10 @@ ## Building +### Configuration + +See `meson_options.txt` + ### Build ```sh diff --git a/include/meson.build b/include/meson.build --- a/include/meson.build +++ b/include/meson.build @@ -16,6 +16,19 @@ ]) # configuration header +config = configuration_data({ + 'LAAL_COMPILER_GCC' : false, + 'LAAL_COMPILER_MSVC' : false, + 'LAAL_IO_BUFFER_SIZE' : 255, +}) + +if get_option('target_compiler') == 'GCC/Clang' + config.set('LAAL_COMPILER_GCC', true) +elif get_option('target_compiler') == 'MSVC' + config.set('LAAL_COMPILER_MSVC', true) +endif +config.set('LAAL_IO_BUFFER_SIZE', get_option('io_buffer_size')) + configure_file(input : 'config.h.in', output : 'config.h', configuration : config) diff --git a/meson.build b/meson.build --- a/meson.build +++ b/meson.build @@ -14,16 +14,6 @@ 'default_library=shared' ]) -# Configuration options -config = configuration_data({ - # only specify at most one compiler syntax - 'LAAL_COMPILER_GCC' : false, - 'LAAL_COMPILER_MSVC' : false, - - # File IO buffer size - 'LAAL_IO_BUFFER_SIZE' : 255, -}) - # Subdirs # subdir('po') # TODO: localisation # subdir('doc') # TODO: documentation @@ -36,3 +26,5 @@ pkg.generate(laal, description : 'Language As A Library, a flexible, portable, and generic frontend for any runtime') +# Meson dependency +liblaal_dep = declare_dependency(include_directories : include, link_with = laal) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,7 @@ +option('target_compiler', type : 'combo', choices : ['GCC/Clang', 'MSVC', 'Other'], + description : 'The compiler to include optimization hints for', + value : 'Other') + +option('io_buffer_size', type : 'integer', min : 1, + description : 'The size of the buffer used in buffered I/O', + value : 255)