78 lines
1.6 KiB
Meson
78 lines
1.6 KiB
Meson
|
project(
|
||
|
'graphics-test',
|
||
|
'cpp',
|
||
|
version: '0.1.0',
|
||
|
default_options: [
|
||
|
'cpp_std=c++20',
|
||
|
'warning_level=everything',
|
||
|
],
|
||
|
)
|
||
|
|
||
|
cpp = meson.get_compiler('cpp')
|
||
|
|
||
|
common_cpp_args = [
|
||
|
'-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',
|
||
|
'-Wno-unsafe-buffer-usage',
|
||
|
'-Wunused-function',
|
||
|
'-fvisibility=hidden',
|
||
|
]
|
||
|
|
||
|
add_project_arguments(cpp.get_supported_arguments(common_cpp_args), language: 'cpp')
|
||
|
|
||
|
source_file_names = [
|
||
|
'src/main.cpp',
|
||
|
]
|
||
|
|
||
|
sources = []
|
||
|
|
||
|
foreach file : source_file_names
|
||
|
sources += files(file)
|
||
|
endforeach
|
||
|
|
||
|
deps = [
|
||
|
dependency('fmt', static: true),
|
||
|
dependency('glfw3'),
|
||
|
dependency('glm'),
|
||
|
]
|
||
|
|
||
|
if build_machine.system() == 'darwin'
|
||
|
molten_dirs = []
|
||
|
|
||
|
pymodule = import('python3')
|
||
|
|
||
|
python3 = pymodule.find_python()
|
||
|
|
||
|
res = run_command(python3, '-c', 'import os; print(os.environ["MOLTENVK_LIBRARY_PATH"])', check: false)
|
||
|
|
||
|
if res.returncode() == 0
|
||
|
molten_dirs += res.stdout().strip()
|
||
|
elif import('fs').exists('/opt/homebrew/lib/libMoltenVK.a')
|
||
|
molten_dirs += '/opt/homebrew/lib'
|
||
|
endif
|
||
|
|
||
|
deps += cpp.find_library('MoltenVK', required: true, dirs: molten_dirs)
|
||
|
|
||
|
res = run_command(python3, '-c', 'import os; print(os.environ["VULKAN_INCLUDE_DIRS"])', check: false)
|
||
|
|
||
|
if res.returncode() == 0
|
||
|
include_dirs = include_directories(res.stdout().strip().split(':'), is_system: true)
|
||
|
endif
|
||
|
else
|
||
|
deps += dependency('vulkan')
|
||
|
endif
|
||
|
|
||
|
executable(
|
||
|
'graphics-test',
|
||
|
sources,
|
||
|
include_directories: include_dirs,
|
||
|
dependencies: deps,
|
||
|
)
|