1 | project('dxvk', ['c', 'cpp'], version : 'v1.9.2', meson_version : '>= 0.46')
|
---|
2 |
|
---|
3 | cpu_family = target_machine.cpu_family()
|
---|
4 |
|
---|
5 | add_project_arguments('-DNOMINMAX', language : 'cpp')
|
---|
6 |
|
---|
7 | dxvk_compiler = meson.get_compiler('cpp')
|
---|
8 | dxvk_is_msvc = dxvk_compiler.get_id() == 'msvc'
|
---|
9 |
|
---|
10 | # c++17 was added in 15.3, older version needs c++latest
|
---|
11 | if dxvk_is_msvc and dxvk_compiler.version().version_compare('<15.3')
|
---|
12 | dxvk_cpp_std='c++latest'
|
---|
13 | else
|
---|
14 | dxvk_cpp_std='c++17'
|
---|
15 | endif
|
---|
16 |
|
---|
17 | dxvk_native = (not meson.is_cross_build() and not dxvk_is_msvc) or get_option('dxvk_native_force')
|
---|
18 |
|
---|
19 | if dxvk_is_msvc
|
---|
20 | add_project_arguments('/std:' + dxvk_cpp_std, language : 'cpp')
|
---|
21 | endif
|
---|
22 |
|
---|
23 | if dxvk_compiler.get_id() == 'clang'
|
---|
24 | if dxvk_compiler.has_argument('-Wno-unused-private-field')
|
---|
25 | add_project_arguments('-Wno-unused-private-field', language: 'cpp')
|
---|
26 | endif
|
---|
27 | if dxvk_compiler.has_argument('-Wno-microsoft-exception-spec')
|
---|
28 | add_project_arguments('-Wno-microsoft-exception-spec', language: 'cpp')
|
---|
29 | endif
|
---|
30 | endif
|
---|
31 |
|
---|
32 | if not dxvk_is_msvc
|
---|
33 | add_project_arguments('-D_WIN32_WINNT=0xa00', language : 'cpp')
|
---|
34 |
|
---|
35 | if get_option('build_id') and dxvk_compiler.has_link_argument('-Wl,--build-id')
|
---|
36 | add_global_link_arguments('-Wl,--build-id', language: 'cpp')
|
---|
37 | endif
|
---|
38 |
|
---|
39 | # We need to set the section alignment for debug symbols to
|
---|
40 | # work properly as well as avoiding a memcpy from the Wine loader.
|
---|
41 | if dxvk_compiler.has_link_argument('-Wl,--file-alignment=4096')
|
---|
42 | add_global_link_arguments('-Wl,--file-alignment=4096', language: 'cpp')
|
---|
43 | endif
|
---|
44 |
|
---|
45 | # Wine's built-in back traces only work with dwarf2 symbols
|
---|
46 | if get_option('debug') and target_machine.system() == 'windows'
|
---|
47 | if dxvk_compiler.has_argument('-gstrict-dwarf') and dxvk_compiler.has_argument('-gdwarf-2')
|
---|
48 | add_project_arguments('-gstrict-dwarf', '-gdwarf-2', language: ['c', 'cpp'])
|
---|
49 | endif
|
---|
50 | endif
|
---|
51 | endif
|
---|
52 |
|
---|
53 | dxvk_include_path = include_directories('./include')
|
---|
54 |
|
---|
55 | if (cpu_family == 'x86_64')
|
---|
56 | dxvk_library_path = meson.source_root() + '/lib'
|
---|
57 | else
|
---|
58 | dxvk_library_path = meson.source_root() + '/lib32'
|
---|
59 | endif
|
---|
60 |
|
---|
61 | dxvk_extradep = [ ]
|
---|
62 |
|
---|
63 | dxvk_platform = 'windows'
|
---|
64 | dxvk_wsi = 'win32'
|
---|
65 | so_prefix = 'dxvk_'
|
---|
66 |
|
---|
67 | if not dxvk_native
|
---|
68 | if dxvk_compiler.get_id() == 'msvc'
|
---|
69 | wrc = find_program('rc')
|
---|
70 | else
|
---|
71 | add_global_link_arguments('-static', '-static-libgcc', language: 'c')
|
---|
72 | add_global_link_arguments('-static', '-static-libgcc', '-static-libstdc++', language: 'cpp')
|
---|
73 |
|
---|
74 | if cpu_family == 'x86_64'
|
---|
75 | wrc = find_program('x86_64-w64-mingw32-windres')
|
---|
76 | elif cpu_family == 'x86'
|
---|
77 | wrc = find_program('i686-w64-mingw32-windres')
|
---|
78 | else
|
---|
79 | error('Unsupported target architecture')
|
---|
80 | endif
|
---|
81 | endif
|
---|
82 |
|
---|
83 | if cpu_family == 'x86'
|
---|
84 | if dxvk_compiler.has_link_argument('-Wl,--add-stdcall-alias')
|
---|
85 | add_global_link_arguments('-Wl,--add-stdcall-alias', language: 'cpp')
|
---|
86 | endif
|
---|
87 | if dxvk_compiler.has_link_argument('-Wl,--enable-stdcall-fixup')
|
---|
88 | add_global_link_arguments('-Wl,--enable-stdcall-fixup', language: 'cpp')
|
---|
89 | endif
|
---|
90 | if dxvk_compiler.has_argument('-msse') and dxvk_compiler.has_argument('-msse2')
|
---|
91 | add_project_arguments('-msse', '-msse2', language: ['c', 'cpp'])
|
---|
92 | endif
|
---|
93 | if dxvk_compiler.has_argument('-mfpmath=sse')
|
---|
94 | add_project_arguments('-mfpmath=sse', language: ['c', 'cpp'])
|
---|
95 | endif
|
---|
96 | endif
|
---|
97 |
|
---|
98 | lib_vulkan = dxvk_compiler.find_library('vulkan-1', dirs : dxvk_library_path)
|
---|
99 | lib_d3d9 = dxvk_compiler.find_library('d3d9')
|
---|
100 | lib_d3d11 = dxvk_compiler.find_library('d3d11')
|
---|
101 | lib_dxgi = dxvk_compiler.find_library('dxgi')
|
---|
102 | lib_d3dcompiler_43 = dxvk_compiler.find_library('d3dcompiler_43', dirs : dxvk_library_path)
|
---|
103 |
|
---|
104 | if dxvk_compiler.get_id() == 'msvc'
|
---|
105 | lib_d3dcompiler_47 = dxvk_compiler.find_library('d3dcompiler')
|
---|
106 | else
|
---|
107 | lib_d3dcompiler_47 = dxvk_compiler.find_library('d3dcompiler_47')
|
---|
108 | endif
|
---|
109 |
|
---|
110 | exe_ext = ''
|
---|
111 | dll_ext = ''
|
---|
112 |
|
---|
113 | if dxvk_is_msvc
|
---|
114 | res_ext = '.res'
|
---|
115 | else
|
---|
116 | res_ext = '.o'
|
---|
117 | endif
|
---|
118 |
|
---|
119 | def_spec_ext = '.def'
|
---|
120 | else
|
---|
121 | add_project_arguments('-DDXVK_NATIVE', language : 'cpp')
|
---|
122 |
|
---|
123 | dxvk_wsi = get_option('dxvk_native_wsi')
|
---|
124 | dxvk_platform = target_machine.system()
|
---|
125 |
|
---|
126 | if cpu_family == 'x86'
|
---|
127 | if dxvk_compiler.has_argument('-msse') and dxvk_compiler.has_argument('-msse2')
|
---|
128 | add_project_arguments('-msse', '-msse2', language: 'c')
|
---|
129 | add_project_arguments('-msse', '-msse2', language: 'cpp')
|
---|
130 | endif
|
---|
131 | if dxvk_compiler.has_argument('-mfpmath=sse')
|
---|
132 | add_project_arguments('-mfpmath=sse', language: ['c', 'cpp'])
|
---|
133 | endif
|
---|
134 | endif
|
---|
135 |
|
---|
136 | if dxvk_platform == 'windows'
|
---|
137 | dxvk_include_path = include_directories('./include', './include/native/')
|
---|
138 | lib_vulkan = dxvk_compiler.find_library('vulkan-1', dirs : dxvk_library_path)
|
---|
139 | lib_sdl2 = dxvk_compiler.find_library('SDL2', dirs : dxvk_library_path)
|
---|
140 | wrc = find_program('rc')
|
---|
141 | else
|
---|
142 | dxvk_include_path = include_directories('./include', './include/native/', './include/native/windows', './include/native/directx')
|
---|
143 | lib_vulkan = dxvk_compiler.find_library('vulkan')
|
---|
144 | lib_sdl2 = dxvk_compiler.find_library('SDL2')
|
---|
145 | wrc = find_program('echo')
|
---|
146 | so_prefix = 'libdxvk_'
|
---|
147 | endif
|
---|
148 |
|
---|
149 | res_ext = ''
|
---|
150 | exe_ext = ''
|
---|
151 | dll_ext = ''
|
---|
152 | def_spec_ext = '.def'
|
---|
153 | endif
|
---|
154 |
|
---|
155 | add_project_arguments('-DDXVK_WSI_' + dxvk_wsi.to_upper(), language : 'cpp')
|
---|
156 | add_project_arguments('-DDXVK_PLATFORM_' + dxvk_platform.to_upper(), language : 'cpp')
|
---|
157 |
|
---|
158 | glsl_compiler = find_program('glslangValidator')
|
---|
159 | glsl_args = [ '-V', '--vn', '@BASENAME@', '@INPUT@', '-o', '@OUTPUT@' ]
|
---|
160 | if run_command(glsl_compiler, [ '--quiet', '--version' ]).returncode() == 0
|
---|
161 | glsl_args += [ '--quiet' ]
|
---|
162 | endif
|
---|
163 | glsl_generator = generator(glsl_compiler,
|
---|
164 | output : [ '@BASENAME@.h' ],
|
---|
165 | arguments : glsl_args)
|
---|
166 |
|
---|
167 | if dxvk_is_msvc
|
---|
168 | wrc_generator = generator(wrc,
|
---|
169 | output : [ '@BASENAME@' + res_ext ],
|
---|
170 | arguments : [ '/fo', '@OUTPUT@', '@INPUT@' ])
|
---|
171 | elif dxvk_native
|
---|
172 | wrc_generator = generator(wrc,
|
---|
173 | output : [ '@BASENAME@_ignored.h' ],
|
---|
174 | arguments : [ 'Ignoring: ', '@INPUT@' ])
|
---|
175 | else
|
---|
176 | wrc_generator = generator(wrc,
|
---|
177 | output : [ '@BASENAME@' + res_ext ],
|
---|
178 | arguments : [ '-i', '@INPUT@', '-o', '@OUTPUT@' ])
|
---|
179 | endif
|
---|
180 |
|
---|
181 | dxvk_version = vcs_tag(
|
---|
182 | command: ['git', 'describe', '--dirty=+'],
|
---|
183 | input: 'version.h.in',
|
---|
184 | output: 'version.h')
|
---|
185 |
|
---|
186 | subdir('src')
|
---|
187 |
|
---|
188 | enable_tests = get_option('enable_tests')
|
---|
189 |
|
---|
190 | if enable_tests
|
---|
191 | subdir('tests')
|
---|
192 | endif
|
---|