1 | project('dxvk', ['c', 'cpp'], version : 'v2.3.1', meson_version : '>= 0.58', default_options : [ 'cpp_std=c++17', 'warning_level=2' ])
|
---|
2 |
|
---|
3 | cpu_family = target_machine.cpu_family()
|
---|
4 | platform = target_machine.system()
|
---|
5 | fs = import('fs')
|
---|
6 |
|
---|
7 | cpp = meson.get_compiler('cpp')
|
---|
8 | cc = meson.get_compiler('c')
|
---|
9 | dxvk_is_msvc = cpp.get_argument_syntax() == 'msvc'
|
---|
10 |
|
---|
11 | compiler_args = [
|
---|
12 | '-msse',
|
---|
13 | '-msse2',
|
---|
14 | '-msse3',
|
---|
15 | '-mfpmath=sse',
|
---|
16 | '-Wimplicit-fallthrough',
|
---|
17 | # gcc
|
---|
18 | '-Wno-missing-field-initializers',
|
---|
19 | '-Wno-unused-parameter',
|
---|
20 | '-Wno-cast-function-type', # Needed for GetProcAddress.
|
---|
21 | # clang
|
---|
22 | '-Wno-unused-private-field',
|
---|
23 | '-Wno-microsoft-exception-spec',
|
---|
24 | '-Wno-extern-c-compat',
|
---|
25 | '-Wno-unused-const-variable',
|
---|
26 | '-Wno-missing-braces',
|
---|
27 | ]
|
---|
28 |
|
---|
29 | link_args = []
|
---|
30 |
|
---|
31 | if get_option('build_id')
|
---|
32 | link_args += [
|
---|
33 | '-Wl,--build-id',
|
---|
34 | ]
|
---|
35 | endif
|
---|
36 |
|
---|
37 | dxvk_include_dirs = ['./include']
|
---|
38 | if fs.is_dir('./include/vulkan/include')
|
---|
39 | dxvk_include_dirs += ['./include/vulkan/include']
|
---|
40 | elif not cpp.check_header('vulkan/vulkan.h')
|
---|
41 | error('Missing Vulkan-Headers')
|
---|
42 | endif
|
---|
43 | if fs.is_dir('./include/spirv/include')
|
---|
44 | dxvk_include_dirs += ['./include/spirv/include']
|
---|
45 | elif not cpp.check_header('spirv/unified1/spirv.hpp')
|
---|
46 | error('Missing SPIRV-Headers')
|
---|
47 | endif
|
---|
48 |
|
---|
49 | dep_displayinfo = dependency(
|
---|
50 | 'libdisplay-info',
|
---|
51 | version: ['>= 0.0.0', '< 0.2.0'],
|
---|
52 | fallback: ['libdisplay-info', 'di_dep'],
|
---|
53 | default_options: ['default_library=static'],
|
---|
54 | )
|
---|
55 |
|
---|
56 | if platform == 'windows'
|
---|
57 | compiler_args += [
|
---|
58 | '-DNOMINMAX',
|
---|
59 | '-D_WIN32_WINNT=0xa00',
|
---|
60 | ]
|
---|
61 |
|
---|
62 | if not dxvk_is_msvc
|
---|
63 | link_args += [
|
---|
64 | '-static',
|
---|
65 | '-static-libgcc',
|
---|
66 | '-static-libstdc++',
|
---|
67 | # We need to set the section alignment for debug symbols to
|
---|
68 | # work properly as well as avoiding a memcpy from the Wine loader.
|
---|
69 | '-Wl,--file-alignment=4096',
|
---|
70 | ]
|
---|
71 |
|
---|
72 | # Wine's built-in back traces only work with dwarf4 symbols
|
---|
73 | if get_option('debug')
|
---|
74 | compiler_args += [
|
---|
75 | '-gdwarf-4',
|
---|
76 | ]
|
---|
77 | endif
|
---|
78 |
|
---|
79 | # Enable stdcall fixup on 32-bit
|
---|
80 | if cpu_family == 'x86'
|
---|
81 | link_args += [
|
---|
82 | '-Wl,--enable-stdcall-fixup',
|
---|
83 | '-Wl,--kill-at',
|
---|
84 | ]
|
---|
85 | endif
|
---|
86 | else
|
---|
87 | link_args += [
|
---|
88 | '/FILEALIGN:4096',
|
---|
89 | ]
|
---|
90 | endif
|
---|
91 |
|
---|
92 | lib_d3d9 = cpp.find_library('d3d9')
|
---|
93 | lib_d3d11 = cpp.find_library('d3d11')
|
---|
94 | lib_dxgi = cpp.find_library('dxgi')
|
---|
95 |
|
---|
96 | if dxvk_is_msvc
|
---|
97 | lib_d3dcompiler_47 = cpp.find_library('d3dcompiler')
|
---|
98 | else
|
---|
99 | lib_d3dcompiler_47 = cpp.find_library('d3dcompiler_47')
|
---|
100 | endif
|
---|
101 |
|
---|
102 | if dxvk_is_msvc
|
---|
103 | res_ext = '.res'
|
---|
104 | wrc = find_program('rc')
|
---|
105 | wrc_generator = generator(wrc,
|
---|
106 | output : [ '@BASENAME@' + res_ext ],
|
---|
107 | arguments : [ '/fo', '@OUTPUT@', '@INPUT@' ],
|
---|
108 | )
|
---|
109 | else
|
---|
110 | res_ext = '.o'
|
---|
111 | wrc = find_program('windres')
|
---|
112 | wrc_generator = generator(wrc,
|
---|
113 | output : [ '@BASENAME@' + res_ext ],
|
---|
114 | arguments : [ '-i', '@INPUT@', '-o', '@OUTPUT@' ],
|
---|
115 | )
|
---|
116 | endif
|
---|
117 |
|
---|
118 | dxvk_wsi = 'win32'
|
---|
119 | dxvk_name_prefix = ''
|
---|
120 | compiler_args += ['-DDXVK_WSI_WIN32']
|
---|
121 | else
|
---|
122 | wrc = find_program('touch')
|
---|
123 | wrc_generator = generator(wrc, output : [ '@BASENAME@_ignored.h' ], arguments : [ '@OUTPUT@' ] )
|
---|
124 |
|
---|
125 | dxvk_include_dirs += [
|
---|
126 | './include/native',
|
---|
127 | './include/native/windows',
|
---|
128 | './include/native/directx'
|
---|
129 | ]
|
---|
130 |
|
---|
131 | dxvk_wsi = get_option('dxvk_native_wsi')
|
---|
132 |
|
---|
133 | if dxvk_wsi == 'sdl2'
|
---|
134 | lib_sdl2 = cpp.find_library('SDL2')
|
---|
135 | compiler_args += ['-DDXVK_WSI_SDL2']
|
---|
136 | elif dxvk_wsi == 'glfw'
|
---|
137 | lib_glfw = cpp.find_library('glfw')
|
---|
138 | compiler_args += ['-DDXVK_WSI_GLFW']
|
---|
139 | endif
|
---|
140 |
|
---|
141 | dxvk_name_prefix = 'libdxvk_'
|
---|
142 |
|
---|
143 | link_args += [
|
---|
144 | '-static-libgcc',
|
---|
145 | '-static-libstdc++',
|
---|
146 | ]
|
---|
147 | endif
|
---|
148 |
|
---|
149 | dxvk_include_path = include_directories(dxvk_include_dirs)
|
---|
150 |
|
---|
151 | add_project_arguments(cpp.get_supported_arguments(compiler_args), language: 'cpp')
|
---|
152 | add_project_arguments(cc.get_supported_arguments(compiler_args), language: 'c')
|
---|
153 | add_project_link_arguments(cpp.get_supported_link_arguments(link_args), language: 'cpp')
|
---|
154 | add_project_link_arguments(cc.get_supported_link_arguments(link_args), language: 'c')
|
---|
155 |
|
---|
156 | exe_ext = ''
|
---|
157 | dll_ext = ''
|
---|
158 | def_spec_ext = '.def'
|
---|
159 |
|
---|
160 | glsl_compiler = find_program('glslang', 'glslangValidator')
|
---|
161 | glsl_args = [
|
---|
162 | '--quiet',
|
---|
163 | '--target-env', 'vulkan1.2',
|
---|
164 | '--vn', '@BASENAME@',
|
---|
165 | '--depfile', '@DEPFILE@',
|
---|
166 | '@INPUT@',
|
---|
167 | '-o', '@OUTPUT@',
|
---|
168 | ]
|
---|
169 | glsl_generator = generator(
|
---|
170 | glsl_compiler,
|
---|
171 | output : [ '@BASENAME@.h' ],
|
---|
172 | depfile : '@BASENAME@.h.d',
|
---|
173 | arguments : glsl_args,
|
---|
174 | )
|
---|
175 |
|
---|
176 | dxvk_version = vcs_tag(
|
---|
177 | command: ['git', 'describe', '--dirty=+'],
|
---|
178 | input: 'version.h.in',
|
---|
179 | output: 'version.h',
|
---|
180 | )
|
---|
181 |
|
---|
182 | subdir('src')
|
---|