forked from ariadne/libucontext
meson: remove the subproject-based library checking
this is not idiomatic, and should not be done (and it did not even work in the first place); meson is capable of building both libraries via library() and then you can choose on commandline it defaults to only shared, but we want both out of box, so specify thatarm_linker_fix
parent
4801f0bdd8
commit
f3e0033a06
33
meson.build
33
meson.build
|
@ -2,7 +2,7 @@ project(
|
||||||
'libucontext',
|
'libucontext',
|
||||||
'c',
|
'c',
|
||||||
meson_version : '>=0.55.0',
|
meson_version : '>=0.55.0',
|
||||||
default_options: ['c_std=gnu99'],
|
default_options: ['c_std=gnu99', 'default_library=both'],
|
||||||
version : run_command('head', files('VERSION')).stdout()
|
version : run_command('head', files('VERSION')).stdout()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -52,8 +52,7 @@ project_includes = [
|
||||||
]
|
]
|
||||||
|
|
||||||
build_args = [
|
build_args = [
|
||||||
'-D_BSD_SOURCE',
|
'-D_BSD_SOURCE'
|
||||||
'-DPIC'
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,39 +84,31 @@ endif
|
||||||
# ======
|
# ======
|
||||||
|
|
||||||
headers = include_directories(project_includes)
|
headers = include_directories(project_includes)
|
||||||
is_subproject = meson.is_subproject()
|
|
||||||
# Build only static library if subproject
|
|
||||||
|
|
||||||
libucontext_target = both_libraries(
|
libucontext_target = library(
|
||||||
'ucontext',
|
'ucontext',
|
||||||
project_source_files,
|
project_source_files,
|
||||||
version: meson.project_version(),
|
version: meson.project_version(),
|
||||||
install : not is_subproject,
|
install : not meson.is_subproject(),
|
||||||
c_args : build_args,
|
c_args : build_args,
|
||||||
pic: true,
|
pic: true,
|
||||||
include_directories : headers,
|
include_directories : headers,
|
||||||
)
|
)
|
||||||
if is_subproject
|
|
||||||
libucontext_target = libucontext_target.get_static_lib()
|
|
||||||
endif
|
|
||||||
libucontext_dep = declare_dependency(
|
libucontext_dep = declare_dependency(
|
||||||
include_directories: headers,
|
include_directories: headers,
|
||||||
link_with : libucontext_target
|
link_with : libucontext_target
|
||||||
)
|
)
|
||||||
|
|
||||||
if build_posix
|
if build_posix
|
||||||
libucontext_posix_target = both_libraries(
|
libucontext_posix_target = library(
|
||||||
'ucontext_posix',
|
'ucontext_posix',
|
||||||
project_source_files + ['libucontext_posix.c'],
|
project_source_files + ['libucontext_posix.c'],
|
||||||
version: meson.project_version(),
|
version: meson.project_version(),
|
||||||
install : not is_subproject,
|
install : not meson.is_subproject(),
|
||||||
c_args : build_args,
|
c_args : build_args,
|
||||||
pic: true,
|
pic: true,
|
||||||
include_directories : headers,
|
include_directories : headers,
|
||||||
)
|
)
|
||||||
if is_subproject
|
|
||||||
libucontext_posix_target = libucontext_posix_target.get_static_lib()
|
|
||||||
endif
|
|
||||||
libucontext_posix_dep = declare_dependency(
|
libucontext_posix_dep = declare_dependency(
|
||||||
include_directories: headers,
|
include_directories: headers,
|
||||||
link_with : libucontext_posix_target
|
link_with : libucontext_posix_target
|
||||||
|
@ -128,7 +119,7 @@ endif
|
||||||
# Project
|
# Project
|
||||||
# =======
|
# =======
|
||||||
|
|
||||||
if not is_subproject
|
if not meson.is_subproject()
|
||||||
# Make this library usable from the system's
|
# Make this library usable from the system's
|
||||||
# package manager.
|
# package manager.
|
||||||
install_headers(project_headers, subdir : meson.project_name())
|
install_headers(project_headers, subdir : meson.project_name())
|
||||||
|
@ -148,7 +139,7 @@ endif
|
||||||
# ====
|
# ====
|
||||||
|
|
||||||
# TODO: meson.build for docs
|
# TODO: meson.build for docs
|
||||||
if not is_subproject
|
if not meson.is_subproject()
|
||||||
#subdir('docs')
|
#subdir('docs')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -156,16 +147,15 @@ endif
|
||||||
# Unit Tests
|
# Unit Tests
|
||||||
# ==========
|
# ==========
|
||||||
|
|
||||||
if not is_subproject
|
test('test_libucontext',
|
||||||
test('test_libucontext',
|
|
||||||
executable(
|
executable(
|
||||||
'test_libucontext',
|
'test_libucontext',
|
||||||
files('test_libucontext.c'),
|
files('test_libucontext.c'),
|
||||||
dependencies : libucontext_dep,
|
dependencies : libucontext_dep,
|
||||||
install : false
|
install : false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if build_posix
|
if build_posix
|
||||||
test('test_libucontext_posix',
|
test('test_libucontext_posix',
|
||||||
executable(
|
executable(
|
||||||
'test_libucontext_posix',
|
'test_libucontext_posix',
|
||||||
|
@ -174,5 +164,4 @@ if not is_subproject
|
||||||
install : false
|
install : false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue