VirtualBox

source: vbox/trunk/src/libs/dxvk-native-1.9.2a/meson.build@ 98879

Last change on this file since 98879 was 96497, checked in by vboxsync, 2 years ago

libs/dxvk-native-1.9.2a: export to OSE

  • Property svn:eol-style set to native
File size: 6.2 KB
Line 
1project('dxvk', ['c', 'cpp'], version : 'v1.9.2', meson_version : '>= 0.46')
2
3cpu_family = target_machine.cpu_family()
4
5add_project_arguments('-DNOMINMAX', language : 'cpp')
6
7dxvk_compiler = meson.get_compiler('cpp')
8dxvk_is_msvc = dxvk_compiler.get_id() == 'msvc'
9
10# c++17 was added in 15.3, older version needs c++latest
11if dxvk_is_msvc and dxvk_compiler.version().version_compare('<15.3')
12 dxvk_cpp_std='c++latest'
13else
14 dxvk_cpp_std='c++17'
15endif
16
17dxvk_native = (not meson.is_cross_build() and not dxvk_is_msvc) or get_option('dxvk_native_force')
18
19if dxvk_is_msvc
20 add_project_arguments('/std:' + dxvk_cpp_std, language : 'cpp')
21endif
22
23if 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
30endif
31
32if 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
51endif
52
53dxvk_include_path = include_directories('./include')
54
55if (cpu_family == 'x86_64')
56 dxvk_library_path = meson.source_root() + '/lib'
57else
58 dxvk_library_path = meson.source_root() + '/lib32'
59endif
60
61dxvk_extradep = [ ]
62
63dxvk_platform = 'windows'
64dxvk_wsi = 'win32'
65so_prefix = 'dxvk_'
66
67if 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'
120else
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'
153endif
154
155add_project_arguments('-DDXVK_WSI_' + dxvk_wsi.to_upper(), language : 'cpp')
156add_project_arguments('-DDXVK_PLATFORM_' + dxvk_platform.to_upper(), language : 'cpp')
157
158glsl_compiler = find_program('glslangValidator')
159glsl_args = [ '-V', '--vn', '@BASENAME@', '@INPUT@', '-o', '@OUTPUT@' ]
160if run_command(glsl_compiler, [ '--quiet', '--version' ]).returncode() == 0
161 glsl_args += [ '--quiet' ]
162endif
163glsl_generator = generator(glsl_compiler,
164 output : [ '@BASENAME@.h' ],
165 arguments : glsl_args)
166
167if dxvk_is_msvc
168 wrc_generator = generator(wrc,
169 output : [ '@BASENAME@' + res_ext ],
170 arguments : [ '/fo', '@OUTPUT@', '@INPUT@' ])
171elif dxvk_native
172 wrc_generator = generator(wrc,
173 output : [ '@BASENAME@_ignored.h' ],
174 arguments : [ 'Ignoring: ', '@INPUT@' ])
175else
176 wrc_generator = generator(wrc,
177 output : [ '@BASENAME@' + res_ext ],
178 arguments : [ '-i', '@INPUT@', '-o', '@OUTPUT@' ])
179endif
180
181dxvk_version = vcs_tag(
182 command: ['git', 'describe', '--dirty=+'],
183 input: 'version.h.in',
184 output: 'version.h')
185
186subdir('src')
187
188enable_tests = get_option('enable_tests')
189
190if enable_tests
191 subdir('tests')
192endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette