build: use default meson buildtype
In autotools we had `package_status` which we set to either
`release` or `development`.
When converting from autotools to meson we used that mechanism
as well. But actually meson has a default way of handling this
with the option `buildtype`.
The following values are possible:
debug, debugoptimized, release, plain
So our `package_status = development` will now be
`if get_option('buildtype') == 'debug' or get_option('buildtype') ==
'debugoptimized'`. Probably we could also use
`if get_option('buildtype') == 'release'. But like this the
`plain` will be really plain.
Usage:
```
meson setup build --buildtype=debug
meson compile -C build
```
This commit is contained in:
20
meson.build
20
meson.build
@@ -8,9 +8,6 @@ project('profanity', 'c',
|
||||
]
|
||||
)
|
||||
|
||||
# 'development' or 'release'
|
||||
package_status = 'development'
|
||||
|
||||
# Determine platform
|
||||
host_system = host_machine.system()
|
||||
platform = 'unknown'
|
||||
@@ -35,7 +32,14 @@ conf_data.set_quoted('PACKAGE_NAME', meson.project_name())
|
||||
conf_data.set_quoted('PACKAGE_VERSION', meson.project_version())
|
||||
conf_data.set_quoted('PACKAGE_BUGREPORT', 'jubalh@iodoru.org')
|
||||
conf_data.set_quoted('PACKAGE_URL', 'https://profanity-im.github.io/')
|
||||
conf_data.set_quoted('PACKAGE_STATUS', package_status)
|
||||
|
||||
# possible options from meson:
|
||||
# debug, debugoptimized, release, plain
|
||||
if get_option('buildtype') == 'release'
|
||||
conf_data.set_quoted('PACKAGE_STATUS', 'release')
|
||||
else
|
||||
conf_data.set_quoted('PACKAGE_STATUS', 'development')
|
||||
endif
|
||||
|
||||
if platform == 'cygwin'
|
||||
conf_data.set('PLATFORM_CYGWIN', 1)
|
||||
@@ -46,7 +50,7 @@ if platform == 'osx'
|
||||
endif
|
||||
|
||||
# Get git version if in development
|
||||
if package_status == 'development'
|
||||
if get_option('buildtype') == 'debug' or get_option('buildtype') == 'debugoptimized'
|
||||
git = find_program('git', required: false)
|
||||
if git.found()
|
||||
conf_data.set('HAVE_GIT_VERSION', 1)
|
||||
@@ -59,7 +63,7 @@ cc = meson.get_compiler('c')
|
||||
# Common compiler flags
|
||||
add_project_arguments('-Wno-deprecated-declarations', language: 'c')
|
||||
|
||||
if get_option('buildtype') == 'debug' or package_status == 'development'
|
||||
if get_option('buildtype') == 'debug' or get_option('buildtype') == 'debugoptimized'
|
||||
add_project_arguments('-Wunused', language: 'c')
|
||||
endif
|
||||
|
||||
@@ -605,7 +609,7 @@ endif
|
||||
main_source = files('src/main.c')
|
||||
|
||||
# Generate git version header if in development
|
||||
if package_status == 'development'
|
||||
if get_option('buildtype') == 'release' or get_option('buildtype') == 'debugoptimized'
|
||||
git_branch = run_command('git', 'rev-parse', '--symbolic-full-name', '--abbrev-ref', 'HEAD',
|
||||
check: false).stdout().strip()
|
||||
git_revision = run_command('git', 'log', '--pretty=format:%h', '-n', '1',
|
||||
@@ -812,7 +816,7 @@ endif
|
||||
|
||||
summary({
|
||||
'Platform': platform,
|
||||
'Package status': package_status,
|
||||
'Package status': get_option('buildtype'),
|
||||
'GTK version': gtk_version,
|
||||
'Install themes': get_option('install_themes'),
|
||||
'Themes path': themes_path,
|
||||
|
||||
Reference in New Issue
Block a user