1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 01:24:11 +01:00

[build] Cleanup build system.

No changes except dropping support for msvc before 15.3.
This commit is contained in:
Georg Lehmann 2022-02-22 23:34:02 +01:00 committed by Joshie
parent f1efc9dc9f
commit 2550cff149
15 changed files with 122 additions and 136 deletions

View File

@ -1,57 +1,59 @@
project('dxvk', ['c', 'cpp'], version : 'v1.10', meson_version : '>= 0.47')
project('dxvk', ['c', 'cpp'], version : 'v1.10', meson_version : '>= 0.47', default_options : [ 'cpp_std=c++17' ])
cpu_family = target_machine.cpu_family()
add_project_arguments('-DNOMINMAX', language : 'cpp')
cpp = meson.get_compiler('cpp')
cc = meson.get_compiler('c')
dxvk_is_msvc = cpp.get_id() == 'msvc'
dxvk_compiler = meson.get_compiler('cpp')
dxvk_is_msvc = dxvk_compiler.get_id() == 'msvc'
# c++17 was added in 15.3, older version needs c++latest
if dxvk_is_msvc and dxvk_compiler.version().version_compare('<15.3')
dxvk_cpp_std='c++latest'
else
dxvk_cpp_std='c++17'
endif
if dxvk_is_msvc
add_project_arguments('/std:' + dxvk_cpp_std, language : 'cpp')
endif
if dxvk_compiler.get_id() == 'clang'
if dxvk_compiler.has_argument('-Wno-unused-private-field')
add_project_arguments('-Wno-unused-private-field', language: 'cpp')
endif
if dxvk_compiler.has_argument('-Wno-microsoft-exception-spec')
add_project_arguments('-Wno-microsoft-exception-spec', language: 'cpp')
endif
endif
if not dxvk_is_msvc
add_project_arguments('-D_WIN32_WINNT=0xa00', language : 'cpp')
if get_option('build_id') and dxvk_compiler.has_link_argument('-Wl,--build-id')
add_global_link_arguments('-Wl,--build-id', language: 'cpp')
endif
compiler_args = [
'-DNOMINMAX',
'-D_WIN32_WINNT=0xa00',
'-msse',
'-msse2',
'-msse3',
'-mfpmath=sse',
'-Wimplicit-fallthrough',
# clang
'-Wno-unused-private-field',
'-Wno-microsoft-exception-spec',
]
link_args = [
'-static',
'-static-libgcc',
'-static-libstdc++',
# We need to set the section alignment for debug symbols to
# work properly as well as avoiding a memcpy from the Wine loader.
if dxvk_compiler.has_link_argument('-Wl,--file-alignment=4096')
add_global_link_arguments('-Wl,--file-alignment=4096', language: 'cpp')
endif
'-Wl,--file-alignment=4096',
]
# Wine's built-in back traces only work with dwarf2 symbols
if get_option('debug') and target_machine.system() == 'windows'
if dxvk_compiler.has_argument('-gstrict-dwarf') and dxvk_compiler.has_argument('-gdwarf-2')
add_project_arguments('-gstrict-dwarf', '-gdwarf-2', language: ['c', 'cpp'])
endif
endif
# Wine's built-in back traces only work with dwarf2 symbols
if get_option('debug') and target_machine.system() == 'windows'
compiler_args += [
'-gstrict-dwarf',
'-gdwarf-2',
]
endif
if dxvk_compiler.has_argument('-Wimplicit-fallthrough')
add_project_arguments('-Wimplicit-fallthrough', language: 'cpp')
if get_option('build_id')
link_args += [
'-Wl,--build-id',
]
endif
if cpu_family == 'x86'
link_args += [
'-Wl,--enable-stdcall-fixup',
'-Wl,--add-stdcall-alias',
]
endif
add_project_arguments(cpp.get_supported_arguments(compiler_args), language: 'cpp')
add_project_arguments(cc.get_supported_arguments(compiler_args), language: 'c')
add_project_link_arguments(cpp.get_supported_link_arguments(link_args), language: 'cpp')
add_project_link_arguments(cc.get_supported_link_arguments(link_args), language: 'c')
dxvk_include_path = include_directories('./include')
if (cpu_family == 'x86_64')
@ -62,55 +64,21 @@ endif
dxvk_extradep = [ ]
if dxvk_is_msvc
wrc = find_program('rc')
else
add_global_link_arguments('-static', '-static-libgcc', language: 'c')
add_global_link_arguments('-static', '-static-libgcc', '-static-libstdc++', language: 'cpp')
wrc = find_program('windres')
endif
if cpu_family == 'x86_64'
if dxvk_compiler.has_argument('-msse3')
add_project_arguments('-msse3', language: ['c', 'cpp'])
endif
elif cpu_family == 'x86'
if dxvk_compiler.has_link_argument('-Wl,--add-stdcall-alias')
add_global_link_arguments('-Wl,--add-stdcall-alias', language: 'cpp')
endif
if dxvk_compiler.has_link_argument('-Wl,--enable-stdcall-fixup')
add_global_link_arguments('-Wl,--enable-stdcall-fixup', language: 'cpp')
endif
if dxvk_compiler.has_argument('-msse') and dxvk_compiler.has_argument('-msse2') and dxvk_compiler.has_argument('-msse3')
add_project_arguments('-msse', '-msse2', '-msse3', language: ['c', 'cpp'])
endif
if dxvk_compiler.has_argument('-mfpmath=sse')
add_project_arguments('-mfpmath=sse', language: ['c', 'cpp'])
endif
endif
lib_vulkan = dxvk_compiler.find_library('vulkan-1', dirs : dxvk_library_path)
lib_d3d9 = dxvk_compiler.find_library('d3d9')
lib_d3d11 = dxvk_compiler.find_library('d3d11')
lib_dxgi = dxvk_compiler.find_library('dxgi')
lib_d3dcompiler_43 = dxvk_compiler.find_library('d3dcompiler_43', dirs : dxvk_library_path)
lib_vulkan = cpp.find_library('vulkan-1', dirs : dxvk_library_path)
lib_d3d9 = cpp.find_library('d3d9')
lib_d3d11 = cpp.find_library('d3d11')
lib_dxgi = cpp.find_library('dxgi')
lib_d3dcompiler_43 = cpp.find_library('d3dcompiler_43', dirs : dxvk_library_path)
if dxvk_is_msvc
lib_d3dcompiler_47 = dxvk_compiler.find_library('d3dcompiler')
lib_d3dcompiler_47 = cpp.find_library('d3dcompiler')
else
lib_d3dcompiler_47 = dxvk_compiler.find_library('d3dcompiler_47')
lib_d3dcompiler_47 = cpp.find_library('d3dcompiler_47')
endif
exe_ext = ''
dll_ext = ''
if dxvk_is_msvc
res_ext = '.res'
else
res_ext = '.o'
endif
def_spec_ext = '.def'
glsl_compiler = find_program('glslangValidator')
@ -120,22 +88,30 @@ if run_command(glsl_compiler, [ '--quiet', '--version' ], check : false).returnc
endif
glsl_generator = generator(glsl_compiler,
output : [ '@BASENAME@.h' ],
arguments : glsl_args)
arguments : glsl_args,
)
if dxvk_is_msvc
res_ext = '.res'
wrc = find_program('rc')
wrc_generator = generator(wrc,
output : [ '@BASENAME@' + res_ext ],
arguments : [ '/fo', '@OUTPUT@', '@INPUT@' ])
output : [ '@BASENAME@' + res_ext ],
arguments : [ '/fo', '@OUTPUT@', '@INPUT@' ],
)
else
res_ext = '.o'
wrc = find_program('windres')
wrc_generator = generator(wrc,
output : [ '@BASENAME@' + res_ext ],
arguments : [ '-i', '@INPUT@', '-o', '@OUTPUT@' ])
output : [ '@BASENAME@' + res_ext ],
arguments : [ '-i', '@INPUT@', '-o', '@OUTPUT@' ],
)
endif
dxvk_version = vcs_tag(
command: ['git', 'describe', '--dirty=+'],
input: 'version.h.in',
output: 'version.h')
output: 'version.h',
)
subdir('src')

View File

@ -18,10 +18,11 @@ d3d10_core_dll = shared_library('d3d10core'+dll_ext, d3d10_core_src, d3d10_core_
include_directories : dxvk_include_path,
install : true,
vs_module_defs : 'd3d10core'+def_spec_ext,
override_options : ['cpp_std='+dxvk_cpp_std])
)
d3d10_core_dep = declare_dependency(
link_with : [ d3d10_core_dll ])
link_with : [ d3d10_core_dll ],
)
d3d10_deps = [ lib_d3dcompiler_43, lib_dxgi, dxbc_dep, dxvk_dep, d3d10_core_dep ]
@ -31,7 +32,7 @@ d3d10_dll = shared_library('d3d10'+dll_ext, d3d10_main_src, d3d10_res,
include_directories : dxvk_include_path,
install : true,
vs_module_defs : 'd3d10'+def_spec_ext,
override_options : ['cpp_std='+dxvk_cpp_std])
)
d3d10_1_dll = shared_library('d3d10_1'+dll_ext, d3d10_main_src, d3d10_1_res,
name_prefix : '',
@ -39,8 +40,9 @@ d3d10_1_dll = shared_library('d3d10_1'+dll_ext, d3d10_main_src, d3d10_1_res,
include_directories : dxvk_include_path,
install : true,
vs_module_defs : 'd3d10_1'+def_spec_ext,
override_options : ['cpp_std='+dxvk_cpp_std])
)
d3d10_dep = declare_dependency(
link_with : [ d3d10_dll, d3d10_1_dll, d3d10_core_dll ],
include_directories : [ dxvk_include_path ])
include_directories : [ dxvk_include_path ],
)

View File

@ -72,8 +72,9 @@ d3d11_dll = shared_library('d3d11'+dll_ext, dxgi_common_src + d3d11_src + d3d10_
include_directories : dxvk_include_path,
install : true,
vs_module_defs : 'd3d11'+def_spec_ext,
override_options : ['cpp_std='+dxvk_cpp_std])
)
d3d11_dep = declare_dependency(
link_with : [ d3d11_dll ],
include_directories : [ dxvk_include_path ])
include_directories : [ dxvk_include_path ],
)

View File

@ -47,8 +47,9 @@ d3d9_dll = shared_library('d3d9'+dll_ext, d3d9_src, glsl_generator.process(d3d9_
include_directories : dxvk_include_path,
install : true,
vs_module_defs : 'd3d9'+def_spec_ext,
override_options : ['cpp_std='+dxvk_cpp_std])
)
d3d9_dep = declare_dependency(
link_with : [ d3d9_dll ],
include_directories : [ dxvk_include_path ])
include_directories : [ dxvk_include_path ],
)

View File

@ -16,8 +16,9 @@ dxbc_src = files([
dxbc_lib = static_library('dxbc', dxbc_src,
include_directories : [ dxvk_include_path ],
override_options : ['cpp_std='+dxvk_cpp_std])
)
dxbc_dep = declare_dependency(
link_with : [ dxbc_lib ],
include_directories : [ dxvk_include_path ])
include_directories : [ dxvk_include_path ],
)

View File

@ -18,8 +18,9 @@ dxgi_dll = shared_library('dxgi'+dll_ext, dxgi_src, dxgi_res,
include_directories : dxvk_include_path,
install : true,
vs_module_defs : 'dxgi'+def_spec_ext,
override_options : ['cpp_std='+dxvk_cpp_std])
)
dxgi_dep = declare_dependency(
link_with : [ dxgi_dll ],
include_directories : [ dxvk_include_path ])
include_directories : [ dxvk_include_path ],
)

View File

@ -16,8 +16,9 @@ dxso_src = files([
dxso_lib = static_library('dxso', dxso_src,
include_directories : [ dxvk_include_path ],
override_options : ['cpp_std='+dxvk_cpp_std])
)
dxso_dep = declare_dependency(
link_with : [ dxso_lib ],
include_directories : [ dxvk_include_path ])
include_directories : [ dxvk_include_path ],
)

View File

@ -15,7 +15,7 @@ dxvk_shaders = files([
'shaders/dxvk_clear_image2darr_f.comp',
'shaders/dxvk_clear_image3d_u.comp',
'shaders/dxvk_clear_image3d_f.comp',
'shaders/dxvk_copy_buffer_image.comp',
'shaders/dxvk_copy_color_1d.frag',
'shaders/dxvk_copy_color_2d.frag',
@ -46,11 +46,11 @@ dxvk_shaders = files([
'shaders/dxvk_resolve_frag_f_amd.frag',
'shaders/dxvk_resolve_frag_i.frag',
'shaders/dxvk_resolve_frag_u.frag',
'shaders/dxvk_unpack_d24s8_as_d32s8.comp',
'shaders/dxvk_unpack_d24s8.comp',
'shaders/dxvk_unpack_d32s8.comp',
'hud/shaders/hud_graph_frag.frag',
'hud/shaders/hud_graph_vert.vert',
@ -108,7 +108,7 @@ dxvk_src = files([
'dxvk_util.cpp',
'platform/dxvk_win32_exts.cpp',
'hud/dxvk_hud.cpp',
'hud/dxvk_hud_font.cpp',
'hud/dxvk_hud_item.cpp',
@ -121,8 +121,9 @@ dxvk_lib = static_library('dxvk', dxvk_src, glsl_generator.process(dxvk_shaders)
link_with : [ util_lib, spirv_lib ],
dependencies : [ thread_dep, vkcommon_dep ] + dxvk_extradep,
include_directories : [ dxvk_include_path ],
override_options : ['cpp_std='+dxvk_cpp_std])
)
dxvk_dep = declare_dependency(
link_with : [ dxvk_lib ],
include_directories : [ dxvk_include_path ])
include_directories : [ dxvk_include_path ],
)

View File

@ -6,4 +6,4 @@ spirv_src = files([
spirv_lib = static_library('spirv', spirv_src,
include_directories : [ dxvk_include_path ],
override_options : ['cpp_std='+dxvk_cpp_std])
)

View File

@ -7,15 +7,15 @@ util_src = files([
'util_matrix.cpp',
'util_monitor.cpp',
'util_shared_res.cpp',
'com/com_guid.cpp',
'com/com_private_data.cpp',
'config/config.cpp',
'log/log.cpp',
'log/log_debug.cpp',
'sha1/sha1.c',
'sha1/sha1_util.cpp',
@ -24,7 +24,8 @@ util_src = files([
util_lib = static_library('util', util_src,
include_directories : [ dxvk_include_path ],
override_options : ['cpp_std='+dxvk_cpp_std])
)
util_dep = declare_dependency(
link_with : [ util_lib ])
link_with : [ util_lib ],
)

View File

@ -8,9 +8,10 @@ thread_dep = dependency('threads')
vkcommon_lib = static_library('vkcommon', vkcommon_src,
dependencies : [ thread_dep, lib_vulkan ],
override_options : ['cpp_std='+dxvk_cpp_std],
include_directories : [ dxvk_include_path ])
include_directories : [ dxvk_include_path ],
)
vkcommon_dep = declare_dependency(
link_with : [ vkcommon_lib ],
include_directories : [ dxvk_include_path ])
include_directories : [ dxvk_include_path ],
)

View File

@ -1,10 +1,10 @@
test_d3d11_deps = [ util_dep, lib_dxgi, lib_d3d11, lib_d3dcompiler_47 ]
executable('d3d11-compute'+exe_ext, files('test_d3d11_compute.cpp'), dependencies : test_d3d11_deps, install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('d3d11-formats'+exe_ext, files('test_d3d11_formats.cpp'), dependencies : test_d3d11_deps, install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('d3d11-map-read'+exe_ext, files('test_d3d11_map_read.cpp'), dependencies : test_d3d11_deps, install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('d3d11-streamout'+exe_ext, files('test_d3d11_streamout.cpp'), dependencies : test_d3d11_deps, install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('d3d11-triangle'+exe_ext, files('test_d3d11_triangle.cpp'), dependencies : test_d3d11_deps, install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('d3d11-video'+exe_ext, files('test_d3d11_video.cpp'), dependencies : test_d3d11_deps, install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('d3d11-compute'+exe_ext, files('test_d3d11_compute.cpp'), dependencies : test_d3d11_deps, install : true, gui_app : true)
executable('d3d11-formats'+exe_ext, files('test_d3d11_formats.cpp'), dependencies : test_d3d11_deps, install : true, gui_app : true)
executable('d3d11-map-read'+exe_ext, files('test_d3d11_map_read.cpp'), dependencies : test_d3d11_deps, install : true, gui_app : true)
executable('d3d11-streamout'+exe_ext, files('test_d3d11_streamout.cpp'), dependencies : test_d3d11_deps, install : true, gui_app : true)
executable('d3d11-triangle'+exe_ext, files('test_d3d11_triangle.cpp'), dependencies : test_d3d11_deps, install : true, gui_app : true)
executable('d3d11-video'+exe_ext, files('test_d3d11_video.cpp'), dependencies : test_d3d11_deps, install : true, gui_app : true)
install_data('video_image.raw', install_dir : get_option('bindir'))

View File

@ -1,9 +1,9 @@
test_d3d9_deps = [ util_dep, lib_d3d9, lib_d3dcompiler_47 ]
executable('d3d9-clear'+exe_ext, files('test_d3d9_clear.cpp'), dependencies : test_d3d9_deps, install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('d3d9-buffer'+exe_ext, files('test_d3d9_buffer.cpp'), dependencies : test_d3d9_deps, install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('d3d9-triangle'+exe_ext, files('test_d3d9_triangle.cpp'), dependencies : test_d3d9_deps, install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('d3d9-l6v5u5'+exe_ext, files('test_d3d9_l6v5u5.cpp'), dependencies : test_d3d9_deps, install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('d3d9-nv12'+exe_ext, files('test_d3d9_nv12.cpp'), dependencies : test_d3d9_deps, install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('d3d9-bc-update-surface'+exe_ext, files('test_d3d9_bc_update_surface.cpp'), dependencies : test_d3d9_deps, install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('d3d9-up'+exe_ext, files('test_d3d9_up.cpp'), dependencies : test_d3d9_deps, install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('d3d9-clear'+exe_ext, files('test_d3d9_clear.cpp'), dependencies : test_d3d9_deps, install : true, gui_app : true)
executable('d3d9-buffer'+exe_ext, files('test_d3d9_buffer.cpp'), dependencies : test_d3d9_deps, install : true, gui_app : true)
executable('d3d9-triangle'+exe_ext, files('test_d3d9_triangle.cpp'), dependencies : test_d3d9_deps, install : true, gui_app : true)
executable('d3d9-l6v5u5'+exe_ext, files('test_d3d9_l6v5u5.cpp'), dependencies : test_d3d9_deps, install : true, gui_app : true)
executable('d3d9-nv12'+exe_ext, files('test_d3d9_nv12.cpp'), dependencies : test_d3d9_deps, install : true, gui_app : true)
executable('d3d9-bc-update-surface'+exe_ext, files('test_d3d9_bc_update_surface.cpp'), dependencies : test_d3d9_deps, install : true, gui_app : true)
executable('d3d9-up'+exe_ext, files('test_d3d9_up.cpp'), dependencies : test_d3d9_deps, install : true, gui_app : true)

View File

@ -1,6 +1,6 @@
test_dxbc_deps = [ dxbc_dep, dxvk_dep ]
executable('dxbc-compiler'+exe_ext, files('test_dxbc_compiler.cpp'), dependencies : test_dxbc_deps, install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('dxbc-disasm'+exe_ext, files('test_dxbc_disasm.cpp'), dependencies : [ test_dxbc_deps, lib_d3dcompiler_47 ], install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('hlsl-compiler'+exe_ext, files('test_hlsl_compiler.cpp'), dependencies : [ test_dxbc_deps, lib_d3dcompiler_47 ], install : true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('dxbc-compiler'+exe_ext, files('test_dxbc_compiler.cpp'), dependencies : test_dxbc_deps, install : true, gui_app : true)
executable('dxbc-disasm'+exe_ext, files('test_dxbc_disasm.cpp'), dependencies : [ test_dxbc_deps, lib_d3dcompiler_47 ], install : true, gui_app : true)
executable('hlsl-compiler'+exe_ext, files('test_hlsl_compiler.cpp'), dependencies : [ test_dxbc_deps, lib_d3dcompiler_47 ], install : true, gui_app : true)

View File

@ -1,3 +1,3 @@
test_dxgi_deps = [ util_dep, lib_dxgi ]
executable('dxgi-factory'+exe_ext, files('test_dxgi_factory.cpp'), dependencies : test_dxgi_deps, install: true, gui_app : true, override_options: ['cpp_std='+dxvk_cpp_std])
executable('dxgi-factory'+exe_ext, files('test_dxgi_factory.cpp'), dependencies : test_dxgi_deps, install: true, gui_app : true)