11from conan import ConanFile
2- from conan .errors import ConanInvalidConfiguration
32from conan .tools .build import check_min_cppstd
43from conan .tools .cmake import CMake , CMakeToolchain , cmake_layout
54from conan .tools .files import apply_conandata_patches , copy , export_conandata_patches , get , rmdir
6- from conan .tools .microsoft import is_msvc
75from conan .tools .scm import Version
6+ from conan .errors import ConanInvalidConfiguration
87import os
98
10- required_conan_version = ">=1.53.0 "
9+ required_conan_version = ">=2.1 "
1110
1211
1312class ConcurrencppConan (ConanFile ):
@@ -27,53 +26,26 @@ class ConcurrencppConan(ConanFile):
2726 "shared" : False ,
2827 "fPIC" : True ,
2928 }
30-
31- @property
32- def _min_cppstd (self ):
33- return "20"
29+ implements = ["auto_shared_fpic" ]
3430
3531 @property
3632 def _minimum_compilers_version (self ):
3733 return {
38- "Visual Studio" : "16" ,
39- "msvc" : "192" ,
40- "clang" : "11" ,
41- "gcc" : "13" ,
34+ "clang" : "14" , # Until clang-14 coroutines are not fully supported
35+ "gcc" : "13" , # Until gcc-13 alignas specifier is not supported
4236 }
4337
4438 def export_sources (self ):
4539 export_conandata_patches (self )
4640
47- def config_options (self ):
48- if self .settings .os == "Windows" :
49- del self .options .fPIC
50-
51- def configure (self ):
52- if self .options .shared :
53- self .options .rm_safe ("fPIC" )
54-
5541 def layout (self ):
5642 cmake_layout (self , src_folder = "src" )
5743
5844 def validate (self ):
59- if self .settings .compiler .get_safe ("cppstd" ):
60- check_min_cppstd (self , self ._min_cppstd )
61- if Version (self .version ) <= "0.1.5" and self .options .shared and is_msvc (self ):
62- # see https://github.com/David-Haim/concurrencpp/issues/75
63- raise ConanInvalidConfiguration (f"{ self .ref } does not support shared builds with Visual Studio" )
64- if Version (self .version ) <= "0.1.6" and self .settings .compiler == "gcc" :
65- raise ConanInvalidConfiguration ("gcc is not supported by concurrencpp" )
66- if Version (self .version ) >= "0.1.5" and self .settings .compiler == "apple-clang" :
67- # apple-clang does not seem to support the C++20 synchronization library which concurrencpp 0.1.5 depends on
68- raise ConanInvalidConfiguration ("apple-clang is not supported by concurrencpp 0.1.5 and higher" )
69-
45+ check_min_cppstd (self , 20 )
7046 minimum_version = self ._minimum_compilers_version .get (str (self .settings .compiler ), False )
7147 if minimum_version and Version (self .settings .compiler .version ) < minimum_version :
72- raise ConanInvalidConfiguration (
73- f"{ self .ref } requires C++{ self ._min_cppstd } , which your compiler does not support."
74- )
75- if self .settings .compiler == "clang" and self .settings .compiler .libcxx != "libc++" :
76- raise ConanInvalidConfiguration ("libc++ required" )
48+ raise ConanInvalidConfiguration (f"{ self .ref } requires C++20, which your compiler does not support." )
7749
7850 def source (self ):
7951 get (self , ** self .conan_data ["sources" ][self .version ], strip_root = True )
@@ -95,8 +67,6 @@ def package(self):
9567 rmdir (self , os .path .join (self .package_folder , "lib" , "cmake" ))
9668
9769 def package_info (self ):
98- self .cpp_info .set_property ("cmake_file_name" , "concurrencpp" )
99- self .cpp_info .set_property ("cmake_target_name" , "concurrencpp::concurrencpp" )
10070 self .cpp_info .libs = ["concurrencpp" ]
10171 if self .settings .os in ["Linux" , "FreeBSD" ]:
10272 self .cpp_info .system_libs = ["m" , "pthread" , "rt" ]
0 commit comments