Skip to content

Instantly share code, notes, and snippets.

@Techcable
Last active January 16, 2023 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Techcable/bc7b2412d59e8e0a82ae8fe58c71becb to your computer and use it in GitHub Desktop.
Save Techcable/bc7b2412d59e8e0a82ae8fe58c71becb to your computer and use it in GitHub Desktop.
Meson Wrapfile for klib
# Website: https://attractivechaos.github.io/klib/
# Source: https://github.com/attractivechaos/klib
#
# Meson Wrap Gist:
# Meson Wrap Version: 1
[wrap-git]
url = https://github.com/attractivechaos/klib.git
revision = head
patch_directory = klib
[provide]
klib = klib_dep
project('klib', 'c', license : 'MIT')
modules = get_option('modules')
sources = []
foreach mod_name : modules
sources += [mod_name + '.c']
endforeach
thread_dep = dependency(
'threads',
required : get_option('threads').disable_auto_if('kthreads' not in modules)
)
curl_dep = dependency(
'curl',
required : get_option('curl').disable_auto_if('kurl' not in modules)
)
get_option('threads').require(
'kthreads' in modules,
error_message : 'The `kthreads` module requires the `threads` feature'
)
get_option('curl').require(
'kurl' in modules,
error_message : 'The `kurl` module requires the `curl` feature'
)
klib_dep = declare_dependency(
include_directories : include_directories('.'),
dependencies : [thread_dep, curl_dep],
sources : sources
)
option(
'modules',
type : 'array',
choices : [
'kalloc',
'keigen',
'kexpr',
'khmm',
'kmath',
'knetfile',
'knhx',
'kopen',
'ksa',
'kson',
'kstring',
'ksw',
'kthread',
'kurl'
],
# By default, include no modules.
#
# However, do note that decent linkers will
# strip unused definitions & object files.
# So even if these are unused, there should be no cost
# beyond compilation
value : [],
description: '''Controls which modules are included in klib.
Because klib has so many modules,
these are compiled into the main dependency.
They do not have seperate module objects.
Also, be aware that decent linkers will strip unused symbols,
so including redundant modules here should have no cost beyond
compilation time.
See docs for full explination of each module's purpose.'''
)
option(
'curl', type : 'feature',
description : '''Enable support for curl.
Required to use the `kurl` module''',
value : 'disabled'
)
option(
'threads', type : 'feature',
description : '''Enable support for threads.
Required to use the `kthreads` module.''',
value : 'disabled'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment