@@ -58,6 +58,27 @@ def netcdf_factory(env: 'Environment',
5858 return candidates
5959
6060
61+ class AtomicBuiltinDependency (BuiltinDependency ):
62+ def __init__ (self , name : str , env : 'Environment' , kwargs : T .Dict [str , T .Any ]):
63+ super ().__init__ (name , env , kwargs )
64+ self .feature_since = ('1.1.0' , "consider checking for `atomic_flag_clear` with and without `find_library('atomic')`" )
65+
66+ if self .clib_compiler .has_function ('atomic_flag_clear' , '#include <stdatomic.h>' , env )[0 ]:
67+ self .is_found = True
68+
69+
70+ class AtomicSystemDependency (SystemDependency ):
71+ def __init__ (self , name : str , env : 'Environment' , kwargs : T .Dict [str , T .Any ]):
72+ super ().__init__ (name , env , kwargs )
73+ self .feature_since = ('1.1.0' , "consider checking for `atomic_flag_clear` with and without `find_library('atomic')`" )
74+
75+ h = self .clib_compiler .has_header ('stdatomic.h' , '' , env )
76+ self .link_args = self .clib_compiler .find_library ('atomic' , env , [], self .libtype )
77+
78+ if h [0 ] and self .link_args :
79+ self .is_found = True
80+
81+
6182class DlBuiltinDependency (BuiltinDependency ):
6283 def __init__ (self , name : str , env : 'Environment' , kwargs : T .Dict [str , T .Any ]):
6384 super ().__init__ (name , env , kwargs )
@@ -526,6 +547,13 @@ def shaderc_factory(env: 'Environment',
526547 return candidates
527548
528549
550+ atomic_factory = DependencyFactory (
551+ 'atomic' ,
552+ [DependencyMethods .BUILTIN , DependencyMethods .SYSTEM ],
553+ builtin_class = AtomicBuiltinDependency ,
554+ system_class = AtomicSystemDependency ,
555+ )
556+
529557cups_factory = DependencyFactory (
530558 'cups' ,
531559 [DependencyMethods .PKGCONFIG , DependencyMethods .CONFIG_TOOL , DependencyMethods .EXTRAFRAMEWORK , DependencyMethods .CMAKE ],
0 commit comments