Skip to content

Commit

Permalink
🚧 fix meson build
Browse files Browse the repository at this point in the history
  • Loading branch information
vnepogodin committed Jun 25, 2024
1 parent 2e1e4fa commit 892bc83
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 24 deletions.
15 changes: 15 additions & 0 deletions gucc/meson.build
Original file line number Diff line number Diff line change
@@ -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
21 changes: 4 additions & 17 deletions gucc/tests/meson.build
Original file line number Diff line number Diff line change
@@ -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(
'test-initcpio',
files('unit-initcpio.cpp'),
dependencies: deps,
link_with: [test_libreq],
include_directories: [include_directories(source_path)],
link_with: [gucc_lib],
include_directories: [include_directories('../src')],
install: false)

executable(
'test-pacmanconf',
files('unit-pacmanconf.cpp'),
dependencies: deps,
link_with: [test_libreq],
include_directories: [include_directories(source_path)],
link_with: [gucc_lib],
include_directories: [include_directories('../src')],
install: false)
13 changes: 8 additions & 5 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ project('cachyos-installer', 'cpp',
is_debug_build = get_option('buildtype').startswith('debug')
is_dev_environment = get_option('devenv')
is_tests_build = get_option('build_tests')
do_build_static = get_option('build_static')
cc = meson.get_compiler('cpp')
if cc.get_id() == 'clang'
specific_cc_flags = [
Expand Down Expand Up @@ -68,9 +69,6 @@ src_files = files(
'src/definitions.hpp',
'src/config.cpp', 'src/config.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/disk.cpp', 'src/disk.hpp',
'src/drivers.cpp', 'src/drivers.hpp',
Expand Down Expand Up @@ -152,7 +150,9 @@ if not is_debug_build
endif

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')
endif

Expand All @@ -163,11 +163,14 @@ if not is_dev_environment
deps += [cpr]
endif

subdir('gucc')

executable(
'cachyos-installer',
src_files,
dependencies: deps,
include_directories: [include_directories('src')],
link_with: gucc_lib,
include_directories: [include_directories('src'), include_directories('gucc/src')],
install: true)

install_data(
Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
option('devenv', type: 'boolean', value: true, description: 'enable dev environment')
option('build_tests', type: 'boolean', value: false, description: 'enable tests')
option('build_static', type: 'boolean', value: false, description: 'build all static')
5 changes: 3 additions & 2 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ test_libreq = shared_library('test_libreq',
source_path + 'simple_tui.cpp',
source_path + 'tui.cpp',
],
include_directories : [include_directories(source_path)],
dependencies: deps
include_directories : [include_directories(source_path), include_directories('../gucc/src')],
dependencies: deps,
link_with: [gucc_lib]
)

executable(
Expand Down

0 comments on commit 892bc83

Please sign in to comment.