compile_types.bzl
1 # prelude/cxx/compile_types.bzl 2 # 3 # Extracted from buck2-prelude 4 5 load(":argsfiles.bzl", "CompileArgsfile", "CompileArgsfiles") 6 load(":cxx_toolchain_types.bzl", "CxxObjectFormat", "DepTrackingMode") 7 8 AsmExtensions = enum( 9 ".s", 10 ".sx", 11 ".S", 12 ".asm", 13 ".asmpp", 14 ) 15 16 CxxExtension = enum( 17 ".cpp", 18 ".cc", 19 ".cl", 20 ".cxx", 21 ".c++", 22 ".c", 23 ".m", 24 ".mm", 25 ".cu", 26 ".hip", 27 ".h", 28 ".hpp", 29 ".hh", 30 ".h++", 31 ".hxx", 32 ".bc", 33 *AsmExtensions.values() 34 ) 35 36 HeaderExtension = enum( 37 ".h", 38 ".hpp", 39 ".hh", 40 ".h++", 41 ".hxx", 42 ".cuh", 43 ) 44 45 DepFileType = enum( 46 "cpp", 47 "c", 48 "cuda", 49 "asm", 50 ) 51 52 HeadersDepFiles = record( 53 processor = field(cmd_args), 54 tag = field(ArtifactTag), 55 mk_flags = field(typing.Callable), 56 dep_tracking_mode = field(DepTrackingMode), 57 ) 58 59 CxxCompileCommand = record( 60 base_compile_cmd = field(cmd_args), 61 argsfile = field(CompileArgsfile), 62 xcode_argsfile = field(CompileArgsfile), 63 header_units_argsfile = field(CompileArgsfile | None), 64 headers_dep_files = field([HeadersDepFiles, None]), 65 compiler_type = field(str), 66 category = field(str), 67 allow_cache_upload = field(bool), 68 ) 69 70 CxxSrcCompileCommand = record( 71 src = field(Artifact), 72 index = field([int, None], None), 73 cxx_compile_cmd = field(CxxCompileCommand), 74 args = field(list[typing.Any]), 75 is_header = field(bool, False), 76 index_store_factory = field(typing.Callable | None, None), 77 error_handler = field([typing.Callable, None], None), 78 ) 79 80 CxxSrcPrecompileCommand = record( 81 src = field(Artifact), 82 cxx_compile_cmd = field(CxxCompileCommand), 83 args = field(list[typing.Any]), 84 extra_argsfile = field([CompileArgsfile, None], None), 85 ) 86 87 CxxCompileCommandOutput = record( 88 src_compile_cmds = field(list[CxxSrcCompileCommand], default = []), 89 base_compile_cmds = field(dict[CxxExtension, CxxCompileCommand], default = {}), 90 argsfiles = field(CompileArgsfiles, default = CompileArgsfiles()), 91 comp_db_compile_cmds = field(list[CxxSrcCompileCommand], default = []), 92 ) 93 94 CxxCompileOutput = record( 95 object = field(Artifact), 96 object_format = field(CxxObjectFormat, CxxObjectFormat("native")), 97 object_has_external_debug_info = field(bool, False), 98 external_debug_info = field(Artifact | None, None), 99 clang_remarks = field(Artifact | None, None), 100 clang_trace = field(Artifact | None, None), 101 gcno_file = field(Artifact | None, None), 102 index_store = field(Artifact | None, None), 103 assembly = field(Artifact | None, None), 104 diagnostics = field(Artifact | None, None), 105 preproc = field(Artifact | None, None), 106 nvcc_dag = field(Artifact | None, None), 107 nvcc_env = field(Artifact | None, None), 108 ) 109 110 CxxCompileFlavor = enum( 111 "default", 112 "pic", 113 "pic_optimized", 114 )