mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
Meson builds work on version 0.45.
v0.45 ships with Ubuntu 18.04, which is currently the oldest distro we support. We may never do a Meson release on Ubuntu 18.04 but this allows us to start running unit tests with Meson in the meantime. Some more granular options are not available so we use buildtype in more places. The check for a in-tree autoconf/make build had to be removed since the filesystem APIs are not available. Finally, alias_target was removed. This means that full paths must be used for build targets, which does not seem too bad. For instance, test/src/test-pgbackrest must now be used as a build target instead of simple test-pgbackrest.
This commit is contained in:
parent
72960bbf17
commit
0eccbc8bf4
15
meson.build
15
meson.build
@ -6,7 +6,7 @@ project(
|
||||
['c'],
|
||||
version: '2.40dev',
|
||||
license: 'MIT',
|
||||
meson_version: '>=0.53.2',
|
||||
meson_version: '>=0.45',
|
||||
default_options: [
|
||||
# Core options
|
||||
'buildtype=release',
|
||||
@ -26,7 +26,7 @@ cc = meson.get_compiler('c')
|
||||
####################################################################################################################################
|
||||
# Error on release builds since we do not want anyone using meson for production yet
|
||||
####################################################################################################################################
|
||||
if get_option('buildtype') != 'debug'
|
||||
if get_option('buildtype') != 'debug' and get_option('buildtype') != 'debugoptimized'
|
||||
error('meson is currently not supported for release builds')
|
||||
endif
|
||||
|
||||
@ -91,9 +91,10 @@ warning_disable = [
|
||||
add_project_arguments(cc.get_supported_arguments(warning_enable, warning_disable), language: 'c')
|
||||
|
||||
####################################################################################################################################
|
||||
# Enable additional optimizations if the level is high enough
|
||||
# Enable additional optimizations for release builds. We would prefer to use `get_option('optimization') in ['2', '3']` when our
|
||||
# minimum version is high enough to allow it.
|
||||
####################################################################################################################################
|
||||
if get_option('optimization') in ['2', '3']
|
||||
if get_option('buildtype') == 'release'
|
||||
optimization_enable = [
|
||||
# Unroll loops whose number of iterations can be determined at compile time or upon entry to the loop
|
||||
'-funroll-loops',
|
||||
@ -125,7 +126,7 @@ file_prefix = run_command(
|
||||
meson.current_source_dir(),
|
||||
meson.current_build_dir(),
|
||||
],
|
||||
check: true,
|
||||
# check: true, # This should be set when the minimum supported meson version is >= 0.47
|
||||
).stdout().strip()
|
||||
|
||||
add_project_arguments(cc.get_supported_arguments('-fmacro-prefix-map=@0@/src/=' . format(file_prefix)), language: 'c')
|
||||
@ -173,8 +174,8 @@ if cc.compiles('''int main(int arg, char **argv) {({ _Static_assert(1, "foo");})
|
||||
configuration.set('HAVE_STATIC_ASSERT', true, description: 'Does the compiler provide _Static_assert()?')
|
||||
endif
|
||||
|
||||
# Enable debug code
|
||||
if get_option('debug')
|
||||
# Enable debug code. We would prefer to use `get_option('debug')` when our minimum version is high enough to allow it.
|
||||
if get_option('buildtype') == 'debug' or get_option('buildtype') == 'debugoptimized'
|
||||
configuration.set('DEBUG', true, description: 'Enable debug code')
|
||||
endif
|
||||
|
||||
|
@ -1,20 +1,3 @@
|
||||
####################################################################################################################################
|
||||
# It is very easy to get into confusing states when the source directory contains an in-place build, e.g. the wrong build.auto.h
|
||||
# will be used. So just refuse to build in this case.
|
||||
####################################################################################################################################
|
||||
if import('fs').exists(meson.current_source_dir() / 'build.auto.h')
|
||||
error('''
|
||||
|
||||
Non-clean source code directory detected.
|
||||
|
||||
To build with meson the source tree may not have an in-place, ./configure
|
||||
style, build configured. Use a separate check out for meson based builds, or
|
||||
run 'make clean-all' in the source tree.
|
||||
|
||||
You can have both meson and ./configure style builds for the same source tree
|
||||
by building out-of-source / VPATH with configure as well.''')
|
||||
endif
|
||||
|
||||
####################################################################################################################################
|
||||
# Write configuration
|
||||
####################################################################################################################################
|
||||
@ -85,8 +68,6 @@ build_config = executable(
|
||||
build_by_default: false,
|
||||
)
|
||||
|
||||
alias_target('build-config', build_config)
|
||||
|
||||
####################################################################################################################################
|
||||
# Build error target
|
||||
####################################################################################################################################
|
||||
@ -108,8 +89,6 @@ build_error = executable(
|
||||
build_by_default: false,
|
||||
)
|
||||
|
||||
alias_target('build-error', build_error)
|
||||
|
||||
####################################################################################################################################
|
||||
# Build help target
|
||||
####################################################################################################################################
|
||||
@ -139,8 +118,6 @@ build_help = executable(
|
||||
# build help.auto.c.inc
|
||||
subdir('command/help')
|
||||
|
||||
alias_target('build-help', help_auto_c_inc)
|
||||
|
||||
####################################################################################################################################
|
||||
# Build postgres target
|
||||
####################################################################################################################################
|
||||
@ -164,8 +141,6 @@ build_postgres = executable(
|
||||
# build interface.auto.c.inc
|
||||
subdir('postgres')
|
||||
|
||||
alias_target('build-postgres', build_postgres)
|
||||
|
||||
####################################################################################################################################
|
||||
# pgBackRest target
|
||||
####################################################################################################################################
|
||||
@ -302,7 +277,7 @@ src_pgbackrest = [
|
||||
'main.c',
|
||||
]
|
||||
|
||||
pgbackrest = executable(
|
||||
executable(
|
||||
'pgbackrest',
|
||||
src_common,
|
||||
src_pgbackrest,
|
||||
@ -318,5 +293,3 @@ pgbackrest = executable(
|
||||
lib_zstd,
|
||||
]
|
||||
)
|
||||
|
||||
alias_target('pgbackrest', pgbackrest)
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Generate help
|
||||
####################################################################################################################################
|
||||
test_help_auto_c_inc = custom_target(
|
||||
'help.auto.c.inc',
|
||||
'test_help.auto.c.inc',
|
||||
output: 'help.auto.c.inc',
|
||||
depend_files: [
|
||||
'../../build/config/config.yaml',
|
||||
|
@ -9,16 +9,12 @@ configure_file(output: 'build.auto.h', configuration: configuration)
|
||||
# build parse.auto.c.inc
|
||||
subdir('config')
|
||||
|
||||
alias_target('test-build-config', test_parse_auto_c_inc)
|
||||
|
||||
####################################################################################################################################
|
||||
# Build help target
|
||||
####################################################################################################################################
|
||||
# build help.auto.c.inc
|
||||
subdir('command/help')
|
||||
|
||||
alias_target('test-build-help', test_help_auto_c_inc)
|
||||
|
||||
####################################################################################################################################
|
||||
# test target
|
||||
####################################################################################################################################
|
||||
@ -46,7 +42,7 @@ src_test = [
|
||||
'main.c',
|
||||
]
|
||||
|
||||
test_pgbackrest = executable(
|
||||
executable(
|
||||
'test-pgbackrest',
|
||||
src_common,
|
||||
src_test,
|
||||
@ -59,5 +55,3 @@ test_pgbackrest = executable(
|
||||
],
|
||||
build_by_default: false,
|
||||
)
|
||||
|
||||
alias_target('test-pgbackrest', test_pgbackrest)
|
||||
|
@ -536,7 +536,7 @@ eval
|
||||
|
||||
# Build code
|
||||
executeTest(
|
||||
"ninja -C ${strBuildPath}" . ($bMinGen ? '' : ' build-config build-error') . ' build-postgres' .
|
||||
"ninja -C ${strBuildPath}" . ($bMinGen ? '' : ' src/build-config src/build-error') . ' src/build-postgres' .
|
||||
($bMinGen ? '' : " && ${strBuildPath}/src/build-config ${strBackRestBase}/src") .
|
||||
($bMinGen ? '' : " && ${strBuildPath}/src/build-error ${strBackRestBase}/src") .
|
||||
" && cd $strRepoCachePath/src && ${strBuildPath}/src/build-postgres");
|
||||
|
Loading…
Reference in New Issue
Block a user