1# Stubs for distutils.ccompiler
2
3from typing import Any, Callable, List, Optional, Tuple, Union
4
5
6_Macro = Union[Tuple[str], Tuple[str, str]]
7
8
9def gen_lib_options(compiler: CCompiler, library_dirs: List[str],
10                    runtime_library_dirs: List[str],
11                    libraries: List[str]) -> List[str]: ...
12def gen_preprocess_options(macros: List[_Macro],
13                           include_dirs: List[str]) -> List[str]: ...
14def get_default_compiler(osname: Optional[str] = ...,
15                         platform: Optional[str] = ...) -> str: ...
16def new_compiler(plat: Optional[str] = ..., compiler: Optional[str] = ...,
17                 verbose: int = ..., dry_run: int = ...,
18                 force: int = ...) -> CCompiler: ...
19def show_compilers() -> None: ...
20
21class CCompiler:
22    def __init__(self, verbose: int = ..., dry_run: int = ...,
23                 force: int = ...) -> None: ...
24    def add_include_dir(self, dir: str) -> None: ...
25    def set_include_dirs(self, dirs: List[str]) -> None: ...
26    def add_library(self, libname: str) -> None: ...
27    def set_libraries(self, libnames: List[str]) -> None: ...
28    def add_library_dir(self, dir: str) -> None: ...
29    def set_library_dirs(self, dirs: List[str]) -> None: ...
30    def add_runtime_library_dir(self, dir: str) -> None: ...
31    def set_runtime_library_dirs(self, dirs: List[str]) -> None: ...
32    def define_macro(self, name: str, value: Optional[str] = ...) -> None: ...
33    def undefine_macro(self, name: str) -> None: ...
34    def add_link_object(self, object: str) -> None: ...
35    def set_link_objects(self, objects: List[str]) -> None: ...
36    def detect_language(self, sources: Union[str, List[str]]) -> Optional[str]: ...
37    def find_library_file(self, dirs: List[str], lib: str,
38                          debug: bool = ...) -> Optional[str]: ...
39    def has_function(self, funcname: str, includes: Optional[List[str]] = ...,
40                     include_dirs: Optional[List[str]] = ...,
41                     libraries: Optional[List[str]] = ...,
42                     library_dirs: Optional[List[str]] = ...) -> bool: ...
43    def library_dir_option(self, dir: str) -> str: ...
44    def library_option(self, lib: str) -> str: ...
45    def runtime_library_dir_option(self, dir: str) -> str: ...
46    def set_executables(self, **args: str) -> None: ...
47    def compile(self, sources: List[str], output_dir: Optional[str] = ...,
48                macros: Optional[_Macro] = ...,
49                include_dirs: Optional[List[str]] = ..., debug: bool = ...,
50                extra_preargs: Optional[List[str]] = ...,
51                extra_postargs: Optional[List[str]] = ...,
52                depends: Optional[List[str]] = ...) -> List[str]: ...
53    def create_static_lib(self, objects: List[str], output_libname: str,
54                          output_dir: Optional[str] = ..., debug: bool = ...,
55                          target_lang: Optional[str] = ...) -> None: ...
56    def link(self, target_desc: str, objects: List[str], output_filename: str,
57             output_dir: Optional[str] = ...,
58             libraries: Optional[List[str]] = ...,
59             library_dirs: Optional[List[str]] = ...,
60             runtime_library_dirs: Optional[List[str]] = ...,
61             export_symbols: Optional[List[str]] = ..., debug: bool = ...,
62             extra_preargs: Optional[List[str]] = ...,
63             extra_postargs: Optional[List[str]] = ...,
64             build_temp: Optional[str] = ...,
65             target_lang: Optional[str] = ...) -> None: ...
66    def link_executable(self, objects: List[str], output_progname: str,
67                        output_dir: Optional[str] = ...,
68                        libraries: Optional[List[str]] = ...,
69                        library_dirs: Optional[List[str]] = ...,
70                        runtime_library_dirs: Optional[List[str]] = ...,
71                        debug: bool = ...,
72                        extra_preargs: Optional[List[str]] = ...,
73                        extra_postargs: Optional[List[str]] = ...,
74                        target_lang: Optional[str] = ...) -> None: ...
75    def link_shared_lib(self, objects: List[str], output_libname: str,
76                        output_dir: Optional[str] = ...,
77                        libraries: Optional[List[str]] = ...,
78                        library_dirs: Optional[List[str]] = ...,
79                        runtime_library_dirs: Optional[List[str]] = ...,
80                        export_symbols: Optional[List[str]] = ...,
81                        debug: bool = ...,
82                        extra_preargs: Optional[List[str]] = ...,
83                        extra_postargs: Optional[List[str]] = ...,
84                        build_temp: Optional[str] = ...,
85                        target_lang: Optional[str] = ...) -> None: ...
86    def link_shared_object(self, objects: List[str], output_filename: str,
87                           output_dir: Optional[str] = ...,
88                           libraries: Optional[List[str]] = ...,
89                           library_dirs: Optional[List[str]] = ...,
90                           runtime_library_dirs: Optional[List[str]] = ...,
91                           export_symbols: Optional[List[str]] = ...,
92                           debug: bool = ...,
93                           extra_preargs: Optional[List[str]] = ...,
94                           extra_postargs: Optional[List[str]] = ...,
95                           build_temp: Optional[str] = ...,
96                           target_lang: Optional[str] = ...) -> None: ...
97    def preprocess(self, source: str, output_file: Optional[str] = ...,
98                   macros: Optional[List[_Macro]] = ...,
99                   include_dirs: Optional[List[str]] = ...,
100                   extra_preargs: Optional[List[str]] = ...,
101                   extra_postargs: Optional[List[str]] = ...) -> None: ...
102    def executable_filename(self, basename: str, strip_dir: int = ...,
103                            output_dir: str = ...) -> str: ...
104    def library_filename(self, libname: str, lib_type: str = ...,
105                         strip_dir: int = ...,
106                         output_dir: str = ...) -> str: ...
107    def object_filenames(self, source_filenames: List[str],
108                         strip_dir: int = ...,
109                         output_dir: str = ...) -> List[str]: ...
110    def shared_object_filename(self, basename: str, strip_dir: int = ...,
111                               output_dir: str = ...) -> str: ...
112    def execute(self, func: Callable[..., None], args: Tuple[Any, ...],
113                msg: Optional[str] = ..., level: int = ...) -> None: ...
114    def spawn(self, cmd: List[str]) -> None: ...
115    def mkpath(self, name: str, mode: int = ...) -> None: ...
116    def move_file(self, src: str, dst: str) -> str: ...
117    def announce(self, msg: str, level: int = ...) -> None: ...
118    def warn(self, msg: str) -> None: ...
119    def debug_print(self, msg: str) -> None: ...
120