Skip to content

Commit dd244bb

Browse files
committed
Add Virtualbuildenv for cmake
Signed-off-by: Uilian Ries <[email protected]>
1 parent cd41697 commit dd244bb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

recipes/opus/all/conanfile.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
44
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
55
from conan.tools.microsoft import check_min_vs, is_msvc, is_msvc_static_runtime
6+
from conan.tools.env import VirtualBuildEnv
67
from conan.tools.scm import Version
78
import os
89

@@ -31,7 +32,7 @@ class OpusConan(ConanFile):
3132
}
3233

3334
def build_requirements(self):
34-
if self.version == "1.5.2":
35+
if self.version >= "1.5.2":
3536
self.tool_requires("cmake/[>=3.16 <4]")
3637

3738
def export_sources(self):
@@ -52,16 +53,18 @@ def layout(self):
5253

5354
def validate(self):
5455
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.")
5758

5859
def source(self):
5960
get(self, **self.conan_data["sources"][self.version],
6061
destination=self.source_folder, strip_root=True)
6162

6263
def generate(self):
64+
if Version(self.version) >= "1.5.2":
65+
env = VirtualBuildEnv(self)
66+
env.generate()
6367
tc = CMakeToolchain(self)
64-
6568
tc.cache_variables["OPUS_BUILD_SHARED_LIBRARY"] = self.options.shared
6669
tc.cache_variables["OPUS_FIXED_POINT"] = self.options.fixed_point
6770
tc.cache_variables["OPUS_STACK_PROTECTOR"] = self.options.stack_protector

0 commit comments

Comments
 (0)