mirror of
https://github.com/conan-io/conan-center-index
synced 2025-01-31 01:41:19 +00:00
gn: add support to macos x86_64 and fix cross compilation
Co-authored-by: Abril Rincón Blanco <git@rinconblanco.es>
This commit is contained in:
@ -2,10 +2,8 @@ import os
|
||||
import shutil
|
||||
import sys
|
||||
import textwrap
|
||||
import time
|
||||
|
||||
from conan import ConanFile
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
from conan.tools.apple import is_apple_os, XCRun
|
||||
from conan.tools.build import check_min_cppstd
|
||||
from conan.tools.env import VirtualBuildEnv, Environment
|
||||
@ -14,7 +12,7 @@ from conan.tools.layout import basic_layout
|
||||
from conan.tools.microsoft import is_msvc, VCVars
|
||||
from conan.tools.scm import Version
|
||||
|
||||
required_conan_version = ">=1.47.0"
|
||||
required_conan_version = ">=2.0.9"
|
||||
|
||||
|
||||
class GnConan(ConanFile):
|
||||
@ -36,36 +34,13 @@ class GnConan(ConanFile):
|
||||
|
||||
@property
|
||||
def _min_cppstd(self):
|
||||
if self.version == "cci.20210429":
|
||||
if Version(self.version) == "cci.20210429":
|
||||
return 17
|
||||
else:
|
||||
return 20
|
||||
|
||||
@property
|
||||
def _minimum_compiler_version(self):
|
||||
if self._min_cppstd == 17:
|
||||
return {
|
||||
"Visual Studio": 15,
|
||||
"msvc": 191,
|
||||
"gcc": 7,
|
||||
"clang": 4,
|
||||
"apple-clang": 10,
|
||||
}.get(str(self.settings.compiler))
|
||||
else:
|
||||
return {
|
||||
"gcc": "11",
|
||||
"clang": "12",
|
||||
"apple-clang": "15",
|
||||
"msvc": "192",
|
||||
"Visual Studio": "16",
|
||||
}.get(str(self.settings.compiler))
|
||||
|
||||
def validate_build(self):
|
||||
if self.settings.compiler.cppstd:
|
||||
check_min_cppstd(self, self._min_cppstd)
|
||||
if self._minimum_compiler_version and Version(self.settings.compiler.version) < self._minimum_compiler_version:
|
||||
raise ConanInvalidConfiguration(f"gn requires a compiler supporting C++{self._min_cppstd}")
|
||||
|
||||
check_min_cppstd(self, self._min_cppstd)
|
||||
|
||||
def build_requirements(self):
|
||||
# FIXME: add cpython build requirements for `build/gen.py`.
|
||||
@ -168,7 +143,3 @@ class GnConan(ConanFile):
|
||||
self.cpp_info.frameworkdirs = []
|
||||
self.cpp_info.libdirs = []
|
||||
self.cpp_info.resdirs = []
|
||||
|
||||
bin_path = os.path.join(self.package_folder, "bin")
|
||||
self.output.info(f"Appending PATH environment variable: {bin_path}")
|
||||
self.env_info.PATH.append(bin_path)
|
||||
|
@ -13,8 +13,10 @@ class TestPackageConan(ConanFile):
|
||||
generators = "VCVars"
|
||||
test_type = "explicit"
|
||||
|
||||
def requirements(self):
|
||||
self.requires(self.tested_reference_str)
|
||||
|
||||
def build_requirements(self):
|
||||
self.tool_requires(self.tested_reference_str)
|
||||
self.tool_requires("ninja/1.11.1")
|
||||
|
||||
def layout(self):
|
||||
@ -47,7 +49,7 @@ class TestPackageConan(ConanFile):
|
||||
rel_bindir,
|
||||
f'--args="target_os=\\"{self._target_os}\\" target_cpu=\\"{self._target_cpu}\\""',
|
||||
]
|
||||
self.run("gn gen " + " ".join(gn_args))
|
||||
self.run("gn gen " + " ".join(gn_args), env="conanrun")
|
||||
self.run(f"ninja -v -j{os.cpu_count()} -C {rel_bindir}")
|
||||
|
||||
def test(self):
|
||||
|
Reference in New Issue
Block a user