2020-11-24 07:50:58 +08:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
|
|
|
# Licensed under the MIT License.
|
|
|
|
|
2024-09-07 06:09:56 +08:00
|
|
|
project('DirectX-Headers', 'cpp', version : '1.614.1',
|
2020-12-29 01:02:08 +08:00
|
|
|
default_options : ['cpp_std=c++14'])
|
2020-11-24 07:50:58 +08:00
|
|
|
|
2023-05-31 16:25:18 +08:00
|
|
|
cpp = meson.get_compiler('cpp')
|
|
|
|
compiler_id = cpp.get_id()
|
2023-06-10 04:49:54 +08:00
|
|
|
#d3d12_lib is not available in linux
|
|
|
|
d3d12_lib = cpp.find_library('d3d12', required : host_machine.system() == 'windows')
|
2023-05-31 16:25:18 +08:00
|
|
|
#dxcore is not available in Mingw-w64
|
2023-06-01 11:12:21 +08:00
|
|
|
dxcore_lib = cpp.find_library('dxcore', required: compiler_id == 'msvc')
|
2023-05-31 16:25:18 +08:00
|
|
|
test_compile_opts = []
|
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
test_compile_opts = ['-DUNICODE', '-D_WIN32_WINNT=0x0A00']
|
|
|
|
endif
|
|
|
|
if (compiler_id == 'gcc') or (compiler_id == 'clang')
|
|
|
|
test_compile_opts += ['-Wno-unused-variable']
|
|
|
|
endif
|
|
|
|
|
2020-11-24 07:50:58 +08:00
|
|
|
inc_dirs = [include_directories('include', is_system : true)]
|
|
|
|
install_inc_subdirs = ['']
|
2023-04-17 23:15:12 +08:00
|
|
|
compile_options = []
|
2020-11-24 07:50:58 +08:00
|
|
|
|
|
|
|
if host_machine.system() != 'windows'
|
|
|
|
inc_dirs += include_directories('include/wsl/stubs', is_system : true)
|
|
|
|
install_inc_subdirs += ['', 'wsl/stubs', 'directx']
|
2023-04-17 23:15:12 +08:00
|
|
|
elif meson.get_compiler('cpp').get_id() != 'msvc' and meson.get_compiler('cpp').get_id() != 'clang-cl'
|
|
|
|
# MinGW has RPC headers which define old versions, and complain if D3D
|
|
|
|
# headers are included before the RPC headers, since D3D headers were
|
|
|
|
# generated with new MIDL and "require" new RPC headers.
|
|
|
|
compile_options = ['-D__REQUIRED_RPCNDR_H_VERSION__=475']
|
2020-11-24 07:50:58 +08:00
|
|
|
endif
|
|
|
|
|
2022-11-22 04:50:57 +08:00
|
|
|
format_properties_lib = static_library(
|
|
|
|
'd3dx12-format-properties',
|
|
|
|
'src/d3dx12_property_format_table.cpp',
|
|
|
|
include_directories : [inc_dirs, 'include/directx'],
|
2023-04-17 23:15:12 +08:00
|
|
|
cpp_args : compile_options,
|
2022-11-22 04:50:57 +08:00
|
|
|
install : true)
|
2020-11-24 07:50:58 +08:00
|
|
|
guids_lib = static_library('DirectX-Guids', 'src/dxguids.cpp', include_directories : inc_dirs, install : true)
|
|
|
|
|
|
|
|
dep_dxheaders = declare_dependency(
|
2022-11-22 04:50:57 +08:00
|
|
|
link_with : [format_properties_lib, guids_lib],
|
2023-04-17 23:15:12 +08:00
|
|
|
include_directories : inc_dirs,
|
|
|
|
compile_args : compile_options)
|
2020-11-24 07:50:58 +08:00
|
|
|
|
2021-03-24 02:21:38 +08:00
|
|
|
if meson.version().version_compare('>=0.54.0')
|
|
|
|
meson.override_dependency('DirectX-Headers', dep_dxheaders)
|
|
|
|
endif
|
|
|
|
|
2020-12-29 03:54:18 +08:00
|
|
|
if not meson.is_subproject() and get_option('build-test')
|
2023-05-31 16:25:18 +08:00
|
|
|
subdir('googletest')
|
2020-12-08 07:55:14 +08:00
|
|
|
subdir('test')
|
|
|
|
endif
|
2020-11-24 07:50:58 +08:00
|
|
|
|
|
|
|
pkg = import('pkgconfig')
|
|
|
|
pkg.generate(name : 'DirectX-Headers',
|
|
|
|
description : 'Headers for using D3D12',
|
2023-05-31 09:12:11 +08:00
|
|
|
url: 'https://github.com/microsoft/DirectX-Headers',
|
2022-11-22 04:50:57 +08:00
|
|
|
libraries : [format_properties_lib, guids_lib],
|
2020-11-24 07:50:58 +08:00
|
|
|
version : meson.project_version(),
|
|
|
|
subdirs : install_inc_subdirs)
|
2020-12-29 01:02:08 +08:00
|
|
|
install_subdir('include', install_dir : '')
|