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
that
arm_linker_fix
Daniel Kolesa 2021-01-08 15:51:55 +01:00
parent 4801f0bdd8
commit f3e0033a06
1 changed files with 21 additions and 32 deletions

View File

@ -2,7 +2,7 @@ project(
'libucontext',
'c',
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()
)
@ -52,8 +52,7 @@ project_includes = [
]
build_args = [
'-D_BSD_SOURCE',
'-DPIC'
'-D_BSD_SOURCE'
]
@ -85,39 +84,31 @@ endif
# ======
headers = include_directories(project_includes)
is_subproject = meson.is_subproject()
# Build only static library if subproject
libucontext_target = both_libraries(
libucontext_target = library(
'ucontext',
project_source_files,
version: meson.project_version(),
install : not is_subproject,
install : not meson.is_subproject(),
c_args : build_args,
pic: true,
include_directories : headers,
)
if is_subproject
libucontext_target = libucontext_target.get_static_lib()
endif
libucontext_dep = declare_dependency(
include_directories: headers,
link_with : libucontext_target
)
if build_posix
libucontext_posix_target = both_libraries(
libucontext_posix_target = library(
'ucontext_posix',
project_source_files + ['libucontext_posix.c'],
version: meson.project_version(),
install : not is_subproject,
install : not meson.is_subproject(),
c_args : build_args,
pic: true,
include_directories : headers,
)
if is_subproject
libucontext_posix_target = libucontext_posix_target.get_static_lib()
endif
libucontext_posix_dep = declare_dependency(
include_directories: headers,
link_with : libucontext_posix_target
@ -128,7 +119,7 @@ endif
# Project
# =======
if not is_subproject
if not meson.is_subproject()
# Make this library usable from the system's
# package manager.
install_headers(project_headers, subdir : meson.project_name())
@ -148,7 +139,7 @@ endif
# ====
# TODO: meson.build for docs
if not is_subproject
if not meson.is_subproject()
#subdir('docs')
endif
@ -156,7 +147,6 @@ endif
# Unit Tests
# ==========
if not is_subproject
test('test_libucontext',
executable(
'test_libucontext',
@ -175,4 +165,3 @@ if not is_subproject
)
)
endif
endif