🚧 fix meson build

This commit is contained in:
Vladislav Nepogodin 2024-06-26 02:48:27 +04:00
parent 2e1e4fae32
commit 892bc83df7
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
5 changed files with 31 additions and 24 deletions

15
gucc/meson.build Normal file
View File

@ -0,0 +1,15 @@
gucc_lib = library('gucc',
sources : [
'src/file_utils.cpp',
'src/string_utils.cpp',
'src/cpu.cpp',
'src/pacmanconf_repo.cpp',
'src/initcpio.cpp',
],
include_directories : [include_directories('src')],
dependencies: deps
)
if is_tests_build
subdir('tests')
endif

View File

@ -1,28 +1,15 @@
source_path = '../src/'
test_libreq = shared_library('test_libreq',
sources : [
source_path + 'file_utils.cpp',
source_path + 'cpu.cpp',
source_path + 'pacmanconf_repo.cpp',
source_path + 'initcpio.cpp',
],
include_directories : [include_directories(source_path)],
dependencies: deps
)
executable( executable(
'test-initcpio', 'test-initcpio',
files('unit-initcpio.cpp'), files('unit-initcpio.cpp'),
dependencies: deps, dependencies: deps,
link_with: [test_libreq], link_with: [gucc_lib],
include_directories: [include_directories(source_path)], include_directories: [include_directories('../src')],
install: false) install: false)
executable( executable(
'test-pacmanconf', 'test-pacmanconf',
files('unit-pacmanconf.cpp'), files('unit-pacmanconf.cpp'),
dependencies: deps, dependencies: deps,
link_with: [test_libreq], link_with: [gucc_lib],
include_directories: [include_directories(source_path)], include_directories: [include_directories('../src')],
install: false) install: false)

View File

@ -11,6 +11,7 @@ project('cachyos-installer', 'cpp',
is_debug_build = get_option('buildtype').startswith('debug') is_debug_build = get_option('buildtype').startswith('debug')
is_dev_environment = get_option('devenv') is_dev_environment = get_option('devenv')
is_tests_build = get_option('build_tests') is_tests_build = get_option('build_tests')
do_build_static = get_option('build_static')
cc = meson.get_compiler('cpp') cc = meson.get_compiler('cpp')
if cc.get_id() == 'clang' if cc.get_id() == 'clang'
specific_cc_flags = [ specific_cc_flags = [
@ -68,9 +69,6 @@ src_files = files(
'src/definitions.hpp', 'src/definitions.hpp',
'src/config.cpp', 'src/config.hpp', 'src/config.cpp', 'src/config.hpp',
'src/utils.cpp', 'src/utils.hpp', 'src/utils.cpp', 'src/utils.hpp',
'src/cpu.cpp', 'src/cpu.hpp',
'src/pacmanconf_repo.cpp', 'src/pacmanconf_repo.hpp',
'src/initcpio.cpp', 'src/initcpio.hpp',
'src/chwd_profiles.cpp', 'src/chwd_profiles.hpp', 'src/chwd_profiles.cpp', 'src/chwd_profiles.hpp',
'src/disk.cpp', 'src/disk.hpp', 'src/disk.cpp', 'src/disk.hpp',
'src/drivers.cpp', 'src/drivers.hpp', 'src/drivers.cpp', 'src/drivers.hpp',
@ -152,7 +150,9 @@ if not is_debug_build
endif endif
possible_cc_flags += ['-fdata-sections', '-ffunction-sections'] possible_cc_flags += ['-fdata-sections', '-ffunction-sections']
possible_link_flags = ['-Wl,--gc-sections', '-static-libgcc', '-static-libstdc++'] if do_build_static
possible_link_flags = ['-Wl,--gc-sections', '-static-libgcc', '-static-libstdc++']
endif
add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'cpp') add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'cpp')
endif endif
@ -163,11 +163,14 @@ if not is_dev_environment
deps += [cpr] deps += [cpr]
endif endif
subdir('gucc')
executable( executable(
'cachyos-installer', 'cachyos-installer',
src_files, src_files,
dependencies: deps, dependencies: deps,
include_directories: [include_directories('src')], link_with: gucc_lib,
include_directories: [include_directories('src'), include_directories('gucc/src')],
install: true) install: true)
install_data( install_data(

View File

@ -1,2 +1,3 @@
option('devenv', type: 'boolean', value: true, description: 'enable dev environment') option('devenv', type: 'boolean', value: true, description: 'enable dev environment')
option('build_tests', type: 'boolean', value: false, description: 'enable tests') option('build_tests', type: 'boolean', value: false, description: 'enable tests')
option('build_static', type: 'boolean', value: false, description: 'build all static')

View File

@ -14,8 +14,9 @@ test_libreq = shared_library('test_libreq',
source_path + 'simple_tui.cpp', source_path + 'simple_tui.cpp',
source_path + 'tui.cpp', source_path + 'tui.cpp',
], ],
include_directories : [include_directories(source_path)], include_directories : [include_directories(source_path), include_directories('../gucc/src')],
dependencies: deps dependencies: deps,
link_with: [gucc_lib]
) )
executable( executable(