draconisplusplus/meson.build

146 lines
3.8 KiB
Meson
Raw Normal View History

2024-09-05 00:13:30 -04:00
project(
2025-01-30 00:29:07 -05:00
'draconis++',
'cpp',
2024-09-05 00:13:30 -04:00
version: '0.1.0',
default_options: [
'default_library=static',
'warning_level=everything',
2025-01-30 00:29:07 -05:00
'buildtype=debugoptimized',
],
2024-09-05 00:13:30 -04:00
)
cpp = meson.get_compiler('cpp')
if host_machine.system() == 'darwin'
add_languages('objcpp')
objcpp = meson.get_compiler('objcpp')
add_project_arguments(
2025-01-30 00:29:07 -05:00
objcpp.get_supported_arguments(
[
'-std=c++2b',
'-Wno-c++20-compat',
'-Wno-c++20-extensions',
'-Wno-c++98-compat',
'-Wno-c++98-compat-pedantic',
'-Wno-disabled-macro-expansion',
'-Wno-missing-prototypes',
'-Wno-padded',
'-Wno-pre-c++20-compat-pedantic',
'-Wno-switch-default',
'-Wunused-function',
'-fvisibility=hidden',
],
),
language: 'objcpp',
2024-09-05 00:13:30 -04:00
)
endif
common_cpp_args = [
2025-01-29 17:08:40 -05:00
'-std=c++26',
2024-09-05 00:13:30 -04:00
'-Wno-c++20-compat',
'-Wno-c++20-extensions',
'-Wno-c++98-compat',
'-Wno-c++98-compat-pedantic',
'-Wno-disabled-macro-expansion',
'-Wno-missing-prototypes',
'-Wno-padded',
'-Wno-pre-c++20-compat-pedantic',
'-Wno-switch-default',
'-Wunused-function',
2025-01-30 00:29:07 -05:00
'-fvisibility=hidden',
2025-02-18 13:28:51 -05:00
'-fno-strict-enums',
2025-02-19 21:49:57 -05:00
'-nostdlib++',
2024-09-05 00:13:30 -04:00
]
if host_machine.system() == 'windows'
common_cpp_args += ['-DCURL_STATICLIB']
endif
2025-01-30 00:29:07 -05:00
add_project_arguments(cpp.get_supported_arguments(common_cpp_args), language: 'cpp')
2024-09-05 00:13:30 -04:00
2025-01-30 00:29:07 -05:00
source_file_names = ['src/main.cpp', 'src/config/config.cpp', 'src/config/weather.cpp']
2024-09-05 00:13:30 -04:00
if host_machine.system() == 'linux'
2025-02-19 21:49:57 -05:00
source_file_names += ['src/os/linux.cpp', 'src/os/linux/issetugid_stub.cpp']
2024-09-05 00:13:30 -04:00
elif host_machine.system() == 'freebsd'
source_file_names += ['src/os/freebsd.cpp']
elif host_machine.system() == 'darwin'
source_file_names += [
'src/os/macos.cpp',
'src/os/macos/bridge.mm',
]
elif host_machine.system() == 'windows'
source_file_names += ['src/os/windows.cpp']
endif
sources = []
foreach file : source_file_names
sources += files(file)
endforeach
deps = [
2025-02-19 18:31:40 -05:00
dependency('fmt', include_type: 'system', static: true),
2025-02-20 14:49:18 -05:00
dependency('openssl', include_type: 'system', static: true),
2025-02-19 18:31:40 -05:00
dependency('libcurl', include_type: 'system', static: true),
2025-02-20 14:49:18 -05:00
dependency('tomlplusplus', include_type: 'system', static: true),
2024-09-05 00:13:30 -04:00
]
2025-02-20 14:49:18 -05:00
ftxui_dep = dependency(
'ftxui',
modules: ['ftxui::screen', 'ftxui::dom', 'ftxui::component'],
include_type: 'system',
static: true,
required: false,
)
if not ftxui_dep.found()
ftxui_dom = dependency('ftxui-dom', fallback: ['ftxui', 'dom_dep'])
ftxui_screen = dependency('ftxui-screen', fallback: ['ftxui', 'screen_dep'])
ftxui_component = dependency('ftxui-component', fallback: ['ftxui', 'component_dep'])
ftxui_dep = declare_dependency(dependencies: [ftxui_dom, ftxui_screen, ftxui_component])
2025-02-19 18:31:40 -05:00
endif
2025-02-20 14:49:18 -05:00
deps += ftxui_dep
cmake = import('cmake')
reflectcpp_proj = cmake.subproject('reflectcpp')
reflectcpp_dep = reflectcpp_proj.dependency('reflectcpp')
deps += reflectcpp_dep
2024-09-05 00:13:30 -04:00
if host_machine.system() == 'darwin'
deps += dependency('Foundation')
deps += dependency('MediaPlayer')
deps += dependency('SystemConfiguration')
deps += dependency('iconv')
elif host_machine.system() == 'linux' or host_machine.system() == 'freebsd'
2025-02-03 19:22:02 -05:00
deps += dependency('SQLiteCpp')
2024-09-05 00:13:30 -04:00
deps += dependency('sdbus-c++')
2025-01-30 19:06:46 -05:00
deps += dependency('x11')
2025-02-19 21:49:57 -05:00
deps += dependency('xcb')
deps += dependency('xau')
deps += dependency('xdmcp')
2025-01-30 19:06:46 -05:00
deps += dependency('wayland-client')
2024-09-05 00:13:30 -04:00
endif
objc_args = []
link_args = []
if host_machine.system() == 'darwin'
objc_args += ['-fobjc-arc']
2025-02-19 21:49:57 -05:00
elif host_machine.system() == 'linux'
link_args += ['-static-libgcc', '-static-libstdc++']
2024-09-05 00:13:30 -04:00
elif host_machine.system() == 'windows'
windows_sdk_lib_dir = 'C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22621.0/um/x64'
2025-02-01 15:32:28 -05:00
link_args += ['-L' + windows_sdk_lib_dir, '-lwindowsapp', '-ldwmapi', '-static']
2024-09-05 00:13:30 -04:00
endif
executable(
'draconis++',
sources,
objc_args: objc_args,
link_args: link_args,
2025-01-30 00:29:07 -05:00
dependencies: deps,
2025-02-19 21:49:57 -05:00
)