2021-09-20 05:54:03 +05:00
|
|
|
project('cachyos-hello', 'cpp',
|
2022-03-10 03:54:10 +05:00
|
|
|
version: '0.6.10',
|
2021-09-20 05:54:03 +05:00
|
|
|
license: 'GPLv3',
|
2021-09-21 04:46:45 +05:00
|
|
|
meson_version: '>=0.55.0',
|
2022-05-22 05:31:35 +05:00
|
|
|
default_options: ['cpp_std=c++20',
|
2021-09-21 04:46:45 +05:00
|
|
|
'buildtype=debugoptimized',
|
|
|
|
'warning_level=3',
|
2021-09-20 05:54:03 +05:00
|
|
|
'werror=true',
|
|
|
|
'b_ndebug=if-release'])
|
|
|
|
|
2021-09-21 04:46:45 +05:00
|
|
|
cc = meson.get_compiler('cpp')
|
|
|
|
|
2021-09-20 05:54:03 +05:00
|
|
|
# Common dependencies
|
|
|
|
fmt = dependency('fmt', version : ['>=8.0.0'], fallback : ['fmt', 'fmt_dep'])
|
|
|
|
gtkmm = dependency('gtkmm-3.0', version : ['>=3.22.0'])
|
|
|
|
|
|
|
|
src_files = files(
|
|
|
|
'src/hello.cpp', 'src/hello.hpp',
|
|
|
|
'src/main.cpp',
|
|
|
|
)
|
|
|
|
|
2021-09-21 04:46:45 +05:00
|
|
|
possible_cc_flags = [
|
|
|
|
'-Wshadow',
|
|
|
|
|
|
|
|
'-Wnon-virtual-dtor',
|
|
|
|
|
|
|
|
'-Wcast-align',
|
|
|
|
'-Wunused',
|
|
|
|
'-Woverloaded-virtual',
|
|
|
|
|
|
|
|
'-Wpedantic', # non-standard C++
|
|
|
|
'-Wconversion', # type conversion that may lose data
|
|
|
|
'-Wnull-dereference',
|
|
|
|
'-Wdouble-promotion', # float to double
|
|
|
|
|
|
|
|
'-Wformat=2',
|
|
|
|
]
|
|
|
|
|
|
|
|
if cc.get_id() == 'gcc'
|
|
|
|
possible_cc_flags += [
|
|
|
|
'-Wmisleading-indentation',
|
|
|
|
|
|
|
|
'-Wduplicated-cond',
|
|
|
|
'-Wduplicated-branches',
|
|
|
|
'-Wlogical-op',
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
|
|
|
if get_option('buildtype') != 'debug'
|
|
|
|
if cc.get_id() == 'gcc'
|
|
|
|
possible_cc_flags += [
|
|
|
|
'-flto',
|
|
|
|
'-fwhole-program',
|
|
|
|
]
|
|
|
|
else
|
|
|
|
possible_cc_flags += [
|
|
|
|
'-flto=thin',
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'cpp')
|
|
|
|
|
2021-09-20 05:54:03 +05:00
|
|
|
executable(
|
|
|
|
'cachyos-hello',
|
|
|
|
src_files,
|
|
|
|
dependencies: [fmt, gtkmm],
|
|
|
|
include_directories: [include_directories('src')],
|
|
|
|
install: true)
|
|
|
|
|
2021-09-22 04:44:34 +05:00
|
|
|
install_data (
|
|
|
|
meson.project_name () + '.desktop',
|
|
|
|
install_dir: join_paths(get_option('datadir'), 'applications')
|
|
|
|
)
|
|
|
|
|
|
|
|
meson.add_install_script('postinstall.sh')
|
|
|
|
|
2021-09-20 05:54:03 +05:00
|
|
|
summary(
|
|
|
|
{
|
|
|
|
'Build type': get_option('buildtype'),
|
|
|
|
},
|
|
|
|
bool_yn: true
|
|
|
|
)
|
|
|
|
|
|
|
|
clangtidy = find_program('clang-tidy', required: false)
|
|
|
|
|
|
|
|
if clangtidy.found()
|
|
|
|
run_target(
|
|
|
|
'tidy',
|
|
|
|
command: [
|
|
|
|
clangtidy,
|
|
|
|
'-checks=*,-fuchsia-default-arguments',
|
|
|
|
'-p', meson.build_root()
|
|
|
|
] + src_files)
|
|
|
|
endif
|