aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-09-11 23:03:43 -0400
committerEli Schwartz <eschwartz@archlinux.org>2022-09-19 15:19:00 -0400
commitab20eb5bbc21ae855bcd211131132d2778602bcf (patch)
tree3b58fbc9c1e950b04f919f6edf77e11e362cba68 /mesonbuild/compilers
parentcc5ef6478ffe871eda6ad90f21d8e9d05613101d (diff)
downloadmeson-ab20eb5bbc21ae855bcd211131132d2778602bcf.zip
meson-ab20eb5bbc21ae855bcd211131132d2778602bcf.tar.gz
meson-ab20eb5bbc21ae855bcd211131132d2778602bcf.tar.bz2
compilers: avoid importing compilers upfront for detect
We no longer need these upfront at all, since we now import the ones we need for the language we are detecting, at the time of actual detection. This avoids importing 28 files, consisting of just under 9,000 lines of code, at interpreter startup. Now, it is only imported depending on which languages are invoked by add_languages, which may not even be anything. And even if we do end up importing a fair chunk of it for C/C++ projects, spreading the import cost around the interpreter runtime helps responsiveness.
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/detect.py116
1 files changed, 2 insertions, 114 deletions
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py
index 021ae8e..cb978f6 100644
--- a/mesonbuild/compilers/detect.py
+++ b/mesonbuild/compilers/detect.py
@@ -20,118 +20,7 @@ from ..mesonlib import (
from ..envconfig import BinaryTable
from .. import mlog
-from ..linkers import (
- guess_win_linker,
- guess_nix_linker,
- AIXArLinker,
- AppleArLinker,
- ArLinker,
- ArmarLinker,
- ArmClangDynamicLinker,
- ArmDynamicLinker,
- CcrxLinker,
- CcrxDynamicLinker,
- CompCertLinker,
- CompCertDynamicLinker,
- C2000Linker,
- C2000DynamicLinker,
- TILinker,
- TIDynamicLinker,
- DLinker,
- NAGDynamicLinker,
- NvidiaHPC_DynamicLinker,
- PGIDynamicLinker,
- PGIStaticLinker,
- Xc16Linker,
- Xc16DynamicLinker,
- XilinkDynamicLinker,
- CudaLinker,
- IntelVisualStudioLinker,
- VisualStudioLinker,
- VisualStudioLikeLinkerMixin,
- WASMDynamicLinker,
-)
-from .c import (
- AppleClangCCompiler,
- ArmCCompiler,
- ArmclangCCompiler,
- ArmLtdClangCCompiler,
- ClangCCompiler,
- ClangClCCompiler,
- GnuCCompiler,
- ElbrusCCompiler,
- EmscriptenCCompiler,
- IntelCCompiler,
- IntelClCCompiler,
- NvidiaHPC_CCompiler,
- PGICCompiler,
- CcrxCCompiler,
- Xc16CCompiler,
- CompCertCCompiler,
- C2000CCompiler,
- TICCompiler,
- VisualStudioCCompiler,
-)
-from .cpp import (
- AppleClangCPPCompiler,
- ArmCPPCompiler,
- ArmclangCPPCompiler,
- ArmLtdClangCPPCompiler,
- ClangCPPCompiler,
- ClangClCPPCompiler,
- GnuCPPCompiler,
- ElbrusCPPCompiler,
- EmscriptenCPPCompiler,
- IntelCPPCompiler,
- IntelClCPPCompiler,
- NvidiaHPC_CPPCompiler,
- PGICPPCompiler,
- CcrxCPPCompiler,
- C2000CPPCompiler,
- TICPPCompiler,
- VisualStudioCPPCompiler,
-)
-from .cs import MonoCompiler, VisualStudioCsCompiler
-from .d import (
- DCompiler,
- DmdDCompiler,
- GnuDCompiler,
- LLVMDCompiler,
-)
-from .cuda import CudaCompiler
-from .fortran import (
- ArmLtdFlangFortranCompiler,
- G95FortranCompiler,
- GnuFortranCompiler,
- ElbrusFortranCompiler,
- FlangFortranCompiler,
- IntelFortranCompiler,
- IntelClFortranCompiler,
- NAGFortranCompiler,
- Open64FortranCompiler,
- PathScaleFortranCompiler,
- NvidiaHPC_FortranCompiler,
- PGIFortranCompiler,
- SunFortranCompiler,
-)
-from .java import JavaCompiler
-from .objc import (
- AppleClangObjCCompiler,
- ClangObjCCompiler,
- GnuObjCCompiler,
-)
-from .objcpp import (
- AppleClangObjCPPCompiler,
- ClangObjCPPCompiler,
- GnuObjCPPCompiler,
-)
-from .cython import CythonCompiler
-from .rust import RustCompiler, ClippyRustCompiler
-from .swift import SwiftCompiler
-from .vala import ValaCompiler
-from .mixins.visualstudio import VisualStudioLikeCompiler
-from .mixins.gnu import GnuCompiler
-from .mixins.clang import ClangCompiler
+from ..linkers import guess_win_linker, guess_nix_linker
import subprocess
import platform
@@ -146,8 +35,7 @@ if T.TYPE_CHECKING:
from .c import CCompiler
from .cpp import CPPCompiler
from .fortran import FortranCompiler
- from .objc import ObjCCompiler
- from .objcpp import ObjCPPCompiler
+ from .rust import RustCompiler
from ..linkers import StaticLinker
from ..environment import Environment
from ..programs import ExternalProgram