1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
|
# Copyright 2020 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
####
#### WARNING: This is an automatically generated file! Do not edit!
#### Generated by tools/gen_data.py
####
from ._pathlib import Path
import typing as T
if T.TYPE_CHECKING:
from .environment import Environment
######################
# BEGIN Data section #
######################
file_0_data_CMakeListsLLVM_txt = '''\
cmake_minimum_required(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} )
set(PACKAGE_FOUND FALSE)
while(TRUE)
find_package(LLVM REQUIRED CONFIG QUIET)
# ARCHS has to be set via the CMD interface
if(LLVM_FOUND OR "${ARCHS}" STREQUAL "")
break()
endif()
list(GET ARCHS 0 CMAKE_LIBRARY_ARCHITECTURE)
list(REMOVE_AT ARCHS 0)
endwhile()
if(LLVM_FOUND)
set(PACKAGE_FOUND TRUE)
foreach(mod IN LISTS LLVM_MESON_MODULES)
# Reset variables
set(out_mods)
set(real_mods)
# Generate a lower and upper case version
string(TOLOWER "${mod}" mod_L)
string(TOUPPER "${mod}" mod_U)
# Get the mapped components
llvm_map_components_to_libnames(out_mods ${mod} ${mod_L} ${mod_U})
list(SORT out_mods)
list(REMOVE_DUPLICATES out_mods)
# Make sure that the modules exist
foreach(i IN LISTS out_mods)
if(TARGET ${i})
list(APPEND real_mods ${i})
endif()
endforeach()
# Set the output variables
set(MESON_LLVM_TARGETS_${mod} ${real_mods})
foreach(i IN LISTS real_mods)
set(MESON_TARGET_TO_LLVM_${i} ${mod})
endforeach()
endforeach()
# Check the following variables:
# LLVM_PACKAGE_VERSION
# LLVM_VERSION
# LLVM_VERSION_STRING
if(NOT DEFINED PACKAGE_VERSION)
if(DEFINED LLVM_PACKAGE_VERSION)
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
elseif(DEFINED LLVM_VERSION)
set(PACKAGE_VERSION "${LLVM_VERSION}")
elseif(DEFINED LLVM_VERSION_STRING)
set(PACKAGE_VERSION "${LLVM_VERSION_STRING}")
endif()
endif()
# Check the following variables:
# LLVM_LIBRARIES
# LLVM_LIBS
set(libs)
if(DEFINED LLVM_LIBRARIES)
set(libs LLVM_LIBRARIES)
elseif(DEFINED LLVM_LIBS)
set(libs LLVM_LIBS)
endif()
# Check the following variables:
# LLVM_INCLUDE_DIRS
# LLVM_INCLUDES
# LLVM_INCLUDE_DIR
set(includes)
if(DEFINED LLVM_INCLUDE_DIRS)
set(includes LLVM_INCLUDE_DIRS)
elseif(DEFINED LLVM_INCLUDES)
set(includes LLVM_INCLUDES)
elseif(DEFINED LLVM_INCLUDE_DIR)
set(includes LLVM_INCLUDE_DIR)
endif()
# Check the following variables:
# LLVM_DEFINITIONS
set(definitions)
if(DEFINED LLVM_DEFINITIONS)
set(definitions LLVM_DEFINITIONS)
endif()
set(PACKAGE_INCLUDE_DIRS "${${includes}}")
set(PACKAGE_DEFINITIONS "${${definitions}}")
set(PACKAGE_LIBRARIES "${${libs}}")
endif()
'''
file_1_data_CMakePathInfo_txt = '''\
cmake_minimum_required(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION})
set(TMP_PATHS_LIST)
list(APPEND TMP_PATHS_LIST ${CMAKE_PREFIX_PATH})
list(APPEND TMP_PATHS_LIST ${CMAKE_FRAMEWORK_PATH})
list(APPEND TMP_PATHS_LIST ${CMAKE_APPBUNDLE_PATH})
list(APPEND TMP_PATHS_LIST $ENV{CMAKE_PREFIX_PATH})
list(APPEND TMP_PATHS_LIST $ENV{CMAKE_FRAMEWORK_PATH})
list(APPEND TMP_PATHS_LIST $ENV{CMAKE_APPBUNDLE_PATH})
list(APPEND TMP_PATHS_LIST ${CMAKE_SYSTEM_PREFIX_PATH})
list(APPEND TMP_PATHS_LIST ${CMAKE_SYSTEM_FRAMEWORK_PATH})
list(APPEND TMP_PATHS_LIST ${CMAKE_SYSTEM_APPBUNDLE_PATH})
set(LIB_ARCH_LIST)
if(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
file(GLOB implicit_dirs RELATIVE /lib /lib/*-linux-gnu* )
foreach(dir ${implicit_dirs})
if("${dir}" MATCHES "${CMAKE_LIBRARY_ARCHITECTURE_REGEX}")
list(APPEND LIB_ARCH_LIST "${dir}")
endif()
endforeach()
endif()
# "Export" these variables:
set(MESON_ARCH_LIST ${LIB_ARCH_LIST})
set(MESON_PATHS_LIST ${TMP_PATHS_LIST})
set(MESON_CMAKE_ROOT ${CMAKE_ROOT})
set(MESON_CMAKE_SYSROOT ${CMAKE_SYSROOT})
set(MESON_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH})
message(STATUS ${TMP_PATHS_LIST})
'''
file_2_data_CMakeLists_txt = '''\
# fail noisily if attempt to use this file without setting:
# cmake_minimum_required(VERSION ${CMAKE_VERSION})
# project(... LANGUAGES ...)
cmake_policy(SET CMP0000 NEW)
set(PACKAGE_FOUND FALSE)
set(_packageName "${NAME}")
string(TOUPPER "${_packageName}" PACKAGE_NAME)
while(TRUE)
find_package("${NAME}" QUIET COMPONENTS ${COMPS})
# ARCHS has to be set via the CMD interface
if(${_packageName}_FOUND OR ${PACKAGE_NAME}_FOUND OR "${ARCHS}" STREQUAL "")
break()
endif()
list(GET ARCHS 0 CMAKE_LIBRARY_ARCHITECTURE)
list(REMOVE_AT ARCHS 0)
endwhile()
if(${_packageName}_FOUND OR ${PACKAGE_NAME}_FOUND)
set(PACKAGE_FOUND TRUE)
# Check the following variables:
# FOO_VERSION
# Foo_VERSION
# FOO_VERSION_STRING
# Foo_VERSION_STRING
if(NOT DEFINED PACKAGE_VERSION)
if(DEFINED ${_packageName}_VERSION)
set(PACKAGE_VERSION "${${_packageName}_VERSION}")
elseif(DEFINED ${PACKAGE_NAME}_VERSION)
set(PACKAGE_VERSION "${${PACKAGE_NAME}_VERSION}")
elseif(DEFINED ${_packageName}_VERSION_STRING)
set(PACKAGE_VERSION "${${_packageName}_VERSION_STRING}")
elseif(DEFINED ${PACKAGE_NAME}_VERSION_STRING)
set(PACKAGE_VERSION "${${PACKAGE_NAME}_VERSION_STRING}")
endif()
endif()
# Check the following variables:
# FOO_LIBRARIES
# Foo_LIBRARIES
# FOO_LIBS
# Foo_LIBS
set(libs)
if(DEFINED ${_packageName}_LIBRARIES)
set(libs ${_packageName}_LIBRARIES)
elseif(DEFINED ${PACKAGE_NAME}_LIBRARIES)
set(libs ${PACKAGE_NAME}_LIBRARIES)
elseif(DEFINED ${_packageName}_LIBS)
set(libs ${_packageName}_LIBS)
elseif(DEFINED ${PACKAGE_NAME}_LIBS)
set(libs ${PACKAGE_NAME}_LIBS)
endif()
# Check the following variables:
# FOO_INCLUDE_DIRS
# Foo_INCLUDE_DIRS
# FOO_INCLUDES
# Foo_INCLUDES
# FOO_INCLUDE_DIR
# Foo_INCLUDE_DIR
set(includes)
if(DEFINED ${_packageName}_INCLUDE_DIRS)
set(includes ${_packageName}_INCLUDE_DIRS)
elseif(DEFINED ${PACKAGE_NAME}_INCLUDE_DIRS)
set(includes ${PACKAGE_NAME}_INCLUDE_DIRS)
elseif(DEFINED ${_packageName}_INCLUDES)
set(includes ${_packageName}_INCLUDES)
elseif(DEFINED ${PACKAGE_NAME}_INCLUDES)
set(includes ${PACKAGE_NAME}_INCLUDES)
elseif(DEFINED ${_packageName}_INCLUDE_DIR)
set(includes ${_packageName}_INCLUDE_DIR)
elseif(DEFINED ${PACKAGE_NAME}_INCLUDE_DIR)
set(includes ${PACKAGE_NAME}_INCLUDE_DIR)
endif()
# Check the following variables:
# FOO_DEFINITIONS
# Foo_DEFINITIONS
set(definitions)
if(DEFINED ${_packageName}_DEFINITIONS)
set(definitions ${_packageName}_DEFINITIONS)
elseif(DEFINED ${PACKAGE_NAME}_DEFINITIONS)
set(definitions ${PACKAGE_NAME}_DEFINITIONS)
endif()
set(PACKAGE_INCLUDE_DIRS "${${includes}}")
set(PACKAGE_DEFINITIONS "${${definitions}}")
set(PACKAGE_LIBRARIES "${${libs}}")
endif()
'''
file_3_data_preload_cmake = '''\
if(MESON_PS_LOADED)
return()
endif()
set(MESON_PS_LOADED ON)
# Dummy macros that have a special meaning in the meson code
macro(meson_ps_execute_delayed_calls)
endmacro()
macro(meson_ps_reload_vars)
endmacro()
# Helper macro to inspect the current CMake state
macro(meson_ps_inspect_vars)
set(MESON_PS_CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
set(MESON_PS_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
meson_ps_execute_delayed_calls()
endmacro()
# Override some system functions with custom code and forward the args
# to the original function
macro(add_custom_command)
meson_ps_inspect_vars()
_add_custom_command(${ARGV})
endmacro()
macro(add_custom_target)
meson_ps_inspect_vars()
_add_custom_target(${ARGV})
endmacro()
macro(set_property)
meson_ps_inspect_vars()
_set_property(${ARGV})
endmacro()
function(set_source_files_properties)
set(FILES)
set(I 0)
set(PROPERTIES OFF)
while(I LESS ARGC)
if(NOT PROPERTIES)
if("${ARGV${I}}" STREQUAL "PROPERTIES")
set(PROPERTIES ON)
else()
list(APPEND FILES "${ARGV${I}}")
endif()
math(EXPR I "${I} + 1")
else()
set(ID_IDX ${I})
math(EXPR PROP_IDX "${ID_IDX} + 1")
set(ID "${ARGV${ID_IDX}}")
set(PROP "${ARGV${PROP_IDX}}")
set_property(SOURCE ${FILES} PROPERTY "${ID}" "${PROP}")
math(EXPR I "${I} + 2")
endif()
endwhile()
endfunction()
set(MESON_PS_DELAYED_CALLS add_custom_command;add_custom_target;set_property)
meson_ps_reload_vars()
'''
####################
# END Data section #
####################
class DataFile:
def __init__(self, path: Path, sha256sum: str, data: str) -> None:
self.path = path
self.sha256sum = sha256sum
self.data = data
def write_once(self, path: Path) -> None:
if not path.exists():
path.write_text(self.data)
def write_to_private(self, env: 'Environment') -> Path:
out_file = Path(env.scratch_dir) / 'data' / self.path.name
out_file.parent.mkdir(exist_ok=True)
self.write_once(out_file)
return out_file
mesondata = {
'dependencies/data/CMakeListsLLVM.txt': DataFile(
Path('dependencies/data/CMakeListsLLVM.txt'),
'412cec3315597041a978d018cdaca282dcd47693793540da88ae2f80d0cbd7cd',
file_0_data_CMakeListsLLVM_txt,
),
'dependencies/data/CMakePathInfo.txt': DataFile(
Path('dependencies/data/CMakePathInfo.txt'),
'90da8b443982d9c87139b7dc84228eb58cab4315764949637208f25e2bda7db2',
file_1_data_CMakePathInfo_txt,
),
'dependencies/data/CMakeLists.txt': DataFile(
Path('dependencies/data/CMakeLists.txt'),
'71a2d58381f912bbfb1c8709884d34d721f682edf2fca001e1f582f0bffd0da7',
file_2_data_CMakeLists_txt,
),
'cmake/data/preload.cmake': DataFile(
Path('cmake/data/preload.cmake'),
'064d047b18a5c919ad016b838bed50c5d40aebe9e53da0e70eff9d52a2c1ca1f',
file_3_data_preload_cmake,
),
}
|