1
1
import os
2
2
from conan import ConanFile
3
- from conan .errors import ConanInvalidConfiguration
4
3
from conan .tools .build import check_min_cppstd
5
4
from conan .tools .scm import Version
6
5
from conan .tools .files import apply_conandata_patches , export_conandata_patches , get , rmdir , copy
@@ -36,28 +35,12 @@ class RotorConan(ConanFile):
36
35
"enable_fltk" : False ,
37
36
}
38
37
39
- @property
40
- def _min_cppstd (self ):
41
- return 17
42
-
43
- @property
44
- def _compilers_minimum_version (self ):
45
- return {
46
- "Visual Studio" : "16" ,
47
- "msvc" : "192" ,
48
- "gcc" : "8" ,
49
- "clang" : "7" ,
50
- "apple-clang" : "12" ,
51
- }
52
-
53
38
def export_sources (self ):
54
39
export_conandata_patches (self )
55
40
56
41
def config_options (self ):
57
42
if self .settings .os == "Windows" :
58
43
del self .options .fPIC
59
- if Version (self .version ) < "0.26" :
60
- del self .options .enable_ev
61
44
if Version (self .version ) < "0.30" :
62
45
del self .options .enable_fltk
63
46
@@ -77,28 +60,19 @@ def layout(self):
77
60
78
61
def generate (self ):
79
62
tc = CMakeToolchain (self )
80
- tc .variables ["BUILD_BOOST_ASIO" ] = self .options .enable_asio
81
- tc .variables ["BUILD_THREAD" ] = self .options .enable_thread
82
- tc .variables ["BUILD_THREAD_UNSAFE" ] = not self .options .multithreading
83
- tc .variables ["BUILD_TESTING" ] = False
84
- if Version (self .version ) >= "0.26" :
85
- tc .variables ["BUILD_EV" ] = self .options .enable_ev
63
+ tc .cache_variables ["BUILD_BOOST_ASIO" ] = self .options .enable_asio
64
+ tc .cache_variables ["BUILD_THREAD" ] = self .options .enable_thread
65
+ tc .cache_variables ["BUILD_THREAD_UNSAFE" ] = not self .options .multithreading
66
+ tc .cache_variables ["BUILD_TESTING" ] = False
67
+ tc .cache_variables ["BUILD_EV" ] = self .options .enable_ev
86
68
if Version (self .version ) >= "0.30" :
87
- tc .variables ["BUILD_FLTK" ] = self .options .enable_fltk
69
+ tc .cache_variables ["BUILD_FLTK" ] = self .options .enable_fltk
88
70
tc .generate ()
89
71
tc = CMakeDeps (self )
90
72
tc .generate ()
91
73
92
74
def validate (self ):
93
- if self .settings .compiler .cppstd :
94
- check_min_cppstd (self , self ._min_cppstd )
95
- minimum_version = self ._compilers_minimum_version .get (str (self .settings .compiler ), False )
96
- if minimum_version and Version (self .settings .compiler .version ) < minimum_version :
97
- raise ConanInvalidConfiguration (f"{ self .ref } requires C++{ self ._min_cppstd } , which your compiler does not support." )
98
-
99
- if self .options .shared and Version (self .version ) < "0.23" :
100
- raise ConanInvalidConfiguration ("shared option is available from v0.23" )
101
-
75
+ check_min_cppstd (self , 17 )
102
76
103
77
def build (self ):
104
78
apply_conandata_patches (self )
@@ -126,6 +100,8 @@ def package_info(self):
126
100
if self .options .enable_asio :
127
101
self .cpp_info .components ["asio" ].libs = ["rotor_asio" ]
128
102
self .cpp_info .components ["asio" ].requires = ["core" ]
103
+ if self .settings .os == "Windows" :
104
+ self .cpp_info .components ["asio" ].system_libs = ["ws2_32" ]
129
105
130
106
if self .options .enable_thread :
131
107
self .cpp_info .components ["thread" ].libs = ["rotor_thread" ]
0 commit comments