3
3
from conan .tools .cmake import CMake , CMakeToolchain , cmake_layout
4
4
from conan .tools .files import apply_conandata_patches , copy , export_conandata_patches , get , rmdir
5
5
from conan .tools .microsoft import check_min_vs , is_msvc , is_msvc_static_runtime
6
+ from conan .tools .env import VirtualBuildEnv
6
7
from conan .tools .scm import Version
7
8
import os
8
9
@@ -31,7 +32,7 @@ class OpusConan(ConanFile):
31
32
}
32
33
33
34
def build_requirements (self ):
34
- if self .version = = "1.5.2" :
35
+ if self .version > = "1.5.2" :
35
36
self .tool_requires ("cmake/[>=3.16 <4]" )
36
37
37
38
def export_sources (self ):
@@ -52,16 +53,18 @@ def layout(self):
52
53
53
54
def validate (self ):
54
55
check_min_vs (self , 190 )
55
- if self .version == "1.5.2" and self .settings .compiler == "gcc" and self .settings .compiler .version in [ "5" , "7" ] :
56
- raise ConanInvalidConfiguration (f"GCC { self .settings .compiler .version } not supported due to lack of AVX2 support" )
56
+ if self .version >= "1.5.2" and self .settings .compiler == "gcc" and Version ( self .settings .compiler .version ) < "8" :
57
+ raise ConanInvalidConfiguration (f"{ self . ref } GCC- { self .settings .compiler .version } not supported due to lack of AVX2 support. Use GCC >=8. " )
57
58
58
59
def source (self ):
59
60
get (self , ** self .conan_data ["sources" ][self .version ],
60
61
destination = self .source_folder , strip_root = True )
61
62
62
63
def generate (self ):
64
+ if Version (self .version ) >= "1.5.2" :
65
+ env = VirtualBuildEnv (self )
66
+ env .generate ()
63
67
tc = CMakeToolchain (self )
64
-
65
68
tc .cache_variables ["OPUS_BUILD_SHARED_LIBRARY" ] = self .options .shared
66
69
tc .cache_variables ["OPUS_FIXED_POINT" ] = self .options .fixed_point
67
70
tc .cache_variables ["OPUS_STACK_PROTECTOR" ] = self .options .stack_protector
0 commit comments