Improvements primarily for testing

1. Minor fix - add URL to pkg-config file
2. When building tests, make dxcore optional if not using "msvc"
3. programs in test directory now build even on Windows.
4. Compile DirectX-Headers-Check-Feature-Support-Test.exe if tests are on
5. Use test() statements to add DirectX-Headers-Test.exe and DirectX-Headers-Check-Feature-Support-Test.exe to "test" build target (typically invoked with something like "ninja test" or "make test".
This commit is contained in:
MARINA\jpmug 2023-05-30 21:12:11 -04:00
parent 6237138c0f
commit 25e84fa41e
2 changed files with 30 additions and 2 deletions

View File

@ -42,6 +42,7 @@ endif
pkg = import('pkgconfig')
pkg.generate(name : 'DirectX-Headers',
description : 'Headers for using D3D12',
url: 'https://github.com/microsoft/DirectX-Headers',
libraries : [format_properties_lib, guids_lib],
version : meson.project_version(),
subdirs : install_inc_subdirs)

View File

@ -3,7 +3,34 @@
cpp = meson.get_compiler('cpp')
d3d12_lib = cpp.find_library('d3d12')
dxcore_lib = cpp.find_library('dxcore')
compiler_id = cpp.get_id()
#dxcore is not available in Mingw-w64
if compiler_id == 'msvc'
dxcore_lib = cpp.find_library('dxcore')
else
dxcore_lib = cpp.find_library('dxcore', required: false)
endif
t_compile_opts = []
if host_machine.system() == 'windows'
t_compile_opts = ['-DUNICODE', '-D_WIN32_WINNT=0x0A00']
endif
if (compiler_id == 'gcc') or (compiler_id == 'clang')
t_compile_opts += ['-Wno-unused-variable']
endif
headers_test = executable('DirectX-Headers-Test', 'test.cpp',
dependencies : [dep_dxheaders, d3d12_lib, dxcore_lib])
dependencies : [dep_dxheaders, d3d12_lib, dxcore_lib],
cpp_args : t_compile_opts,
c_args : t_compile_opts)
test('DirectX-Headers-Testz', headers_test)
headers_features_test = executable('DirectX-Headers-Check-Feature-Support-Test', 'feature_check_test.cpp',
dependencies : [dep_dxheaders, d3d12_lib, dxcore_lib],
cpp_args : t_compile_opts,
c_args : t_compile_opts)
test('DirectX-Headers-Check-Feature-Support-Test', headers_features_test)