Skip to content

Commit

Permalink
Merge branch 'develop2' into release/2.0-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
czoido committed Mar 28, 2022
2 parents b9425be + 48265d1 commit df3c452
Show file tree
Hide file tree
Showing 239 changed files with 5,025 additions and 3,419 deletions.
13 changes: 9 additions & 4 deletions .ci/jenkins/testsv2.jenkins
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
def branchName = env.BRANCH_NAME
def jobName = env.JOB_NAME

void cancelPrevious() {
stage("Cancelling previous") {
def buildNumber = env.BUILD_NUMBER as int
Expand Down Expand Up @@ -176,9 +179,7 @@ void deployToPypiTest() {
try {
cancelPrevious()

def branchName = env.BRANCH_NAME
def jobName = env.JOB_NAME


testModules.each { moduleName ->
runTestsModule(moduleName, branchName, jobName)
}
Expand All @@ -188,6 +189,10 @@ try {
}
}
catch(e){
echo "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'"
if (branchName == "develop2") {
def subject = "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'"
def summary = "${subject} (${env.BUILD_URL}), Conan Branch: ${branchName}"
slackSend (color: '#FF0000', message: summary)
}
throw e
}
1 change: 1 addition & 0 deletions conan/errors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from conans.errors import ConanException
from conans.errors import ConanInvalidConfiguration
from conans.errors import ConanErrorConfiguration
from conans.errors import ConanInvalidSystemRequirements
6 changes: 4 additions & 2 deletions conan/tools/apple/xcodebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def _sdkroot(self):
sdk = "{}{}".format(self._sdk, self._sdk_version)
return "SDKROOT={}".format(sdk) if sdk else ""

def build(self, xcodeproj):
def build(self, xcodeproj, target=None):
target = "-target {}".format(target) if target else "-alltargets"
cmd = "xcodebuild -project {} -configuration {} -arch {} " \
"{} {}".format(xcodeproj, self._build_type, self._arch, self._sdkroot, self._verbosity)
"{} {} {}".format(xcodeproj, self._build_type, self._arch, self._sdkroot,
self._verbosity, target)
self._conanfile.run(cmd)
1 change: 1 addition & 0 deletions conan/tools/build/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from conan.tools.build.cpu import build_jobs
from conan.tools.build.cross_building import cross_building
from conan.tools.build.cppstd import check_min_cppstd, valid_min_cppstd


def use_win_mingw(conanfile):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ def add_millennium(_cppstd):
rhs = add_millennium(extract_cpp_version(rhs))
return lhs < rhs

current_cppstd = conanfile.settings.get_safe("compiler.cppstd")
current_cppstd = conanfile.info.settings.get_safe("compiler.cppstd")
if current_cppstd is None:
raise ConanInvalidConfiguration("The compiler.cppstd is not defined for this configuration")

if gnu_extensions and "gnu" not in current_cppstd:
raise ConanInvalidConfiguration("The cppstd GNU extension is required")

Expand Down
29 changes: 4 additions & 25 deletions conan/tools/build/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def architecture_flag(settings):
arch = settings.get_safe("arch")
the_os = settings.get_safe("os")
subsystem = settings.get_safe("os.subsystem")
subsystem_ios_version = settings.get_safe("os.subsystem.ios_version")
if not compiler or not arch:
return ""

Expand All @@ -24,7 +25,7 @@ def architecture_flag(settings):
if apple_arch:
# TODO: Could we define anything like `to_apple_target()`?
# Check https://github.com/rust-lang/rust/issues/48862
return '--target=%s-apple-ios-macabi' % apple_arch
return '--target=%s-apple-ios%s-macabi' % (apple_arch, subsystem_ios_version)
elif arch in ['x86_64', 'sparcv9', 's390x']:
return '-m64'
elif arch in ['x86', 'sparc']:
Expand Down Expand Up @@ -64,7 +65,7 @@ def build_type_link_flags(settings):

# https://github.com/Kitware/CMake/blob/d7af8a34b67026feaee558433db3a835d6007e06/
# Modules/Platform/Windows-MSVC.cmake
if compiler in ["msvc", "Visual Studio"]:
if compiler == "msvc":
if build_type in ("Debug", "RelWithDebInfo"):
return ["-debug"]

Expand All @@ -85,7 +86,7 @@ def build_type_flags(settings):

# https://github.com/Kitware/CMake/blob/d7af8a34b67026feaee558433db3a835d6007e06/
# Modules/Platform/Windows-MSVC.cmake
if compiler in ['Visual Studio', 'msvc']:
if compiler == "msvc":
if vs_toolset and "clang" in vs_toolset:
flags = {"Debug": ["-gline-tables-only", "-fno-inline", "-O0"],
"Release": ["-O2"],
Expand Down Expand Up @@ -164,7 +165,6 @@ def cppstd_flag(settings):
func = {"gcc": _cppstd_gcc,
"clang": _cppstd_clang,
"apple-clang": _cppstd_apple_clang,
"Visual Studio": _cppstd_visualstudio,
"msvc": _cppstd_msvc,
"intel-cc": _cppstd_intel_cc,
"mcst-lcc": _cppstd_mcst_lcc}.get(compiler, None)
Expand All @@ -174,27 +174,6 @@ def cppstd_flag(settings):
return flag


def _cppstd_visualstudio(visual_version, cppstd):
# https://docs.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version
v14 = None
v17 = None
v20 = None
v23 = None

if visual_version >= "14":
v14 = "c++14"
v17 = "c++latest"
if visual_version >= "15":
v17 = "c++17"
v20 = "c++latest"
if visual_version >= "17":
v20 = "c++20"
v23 = "c++latest"

flag = {"14": v14, "17": v17, "20": v20, "23": v23}.get(str(cppstd), None)
return "/std:%s" % flag if flag else None


def _cppstd_msvc(visual_version, cppstd):
# https://docs.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version
v14 = None
Expand Down
2 changes: 1 addition & 1 deletion conan/tools/cmake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from conan.tools.cmake.cmake import CMake
from conan.tools.cmake.cmakedeps.cmakedeps import CMakeDeps
from conan.tools.cmake.file_api import CMakeFileAPI
from conan.tools.cmake.layout import cmake_layout, clion_layout
from conan.tools.cmake.layout import cmake_layout
7 changes: 6 additions & 1 deletion conan/tools/cmake/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,13 @@ def configure(self, variables=None, build_script_folder=None):
pkg_folder = self._conanfile.package_folder.replace("\\", "/")
arg_list.append('-DCMAKE_INSTALL_PREFIX="{}"'.format(pkg_folder))
if platform.system() == "Windows" and self._generator == "MinGW Makefiles":
# It seems this doesn't work in the toolchain file, it needs to be here in command line
# It seems these don't work in the toolchain file, they need to be here in command line
arg_list.append('-DCMAKE_SH="CMAKE_SH-NOTFOUND"')
cmake_make_program = self._conanfile.conf.get("tools.gnu:make_program", default=None)
if cmake_make_program:
cmake_make_program = cmake_make_program.replace("\\", "/")
arg_list.append('-DCMAKE_MAKE_PROGRAM="{}"'.format(cmake_make_program))

if variables:
arg_list.extend(["-D{}={}".format(k, v) for k, v in variables.items()])
arg_list.append('"{}"'.format(cmakelist_folder))
Expand Down
13 changes: 1 addition & 12 deletions conan/tools/cmake/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def cmake_layout(conanfile, generator=None, src_folder="."):
multi = "Visual" in gen or "Xcode" in gen or "Multi-Config" in gen
else:
compiler = conanfile.settings.get_safe("compiler")
if compiler in ("Visual Studio", "msvc"):
if compiler == "msvc":
multi = True
else:
multi = False
Expand All @@ -35,14 +35,3 @@ def cmake_layout(conanfile, generator=None, src_folder="."):
else:
conanfile.cpp.build.libdirs = ["."]
conanfile.cpp.build.bindirs = ["."]


def clion_layout(conanfile):
if not conanfile.settings.get_safe("build_type"):
raise ConanException("The 'clion_layout' requires the 'build_type' setting")
base = "cmake-build-{}".format(str(conanfile.settings.build_type).lower())
conanfile.folders.build = base
conanfile.cpp.build.libdirs = ["."]
conanfile.folders.generators = os.path.join(base, "generators")
conanfile.folders.source = "."
conanfile.cpp.source.includedirs = ["."]
39 changes: 37 additions & 2 deletions conan/tools/cmake/toolchain/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from conan.tools.cmake.utils import is_multi_configuration
from conan.tools.build.cross_building import cross_building
from conan.tools.intel import IntelCC
from conan.tools.microsoft.visual import is_msvc
from conan.tools.microsoft.visual import is_msvc, msvc_version_to_toolset_version
from conans.errors import ConanException
from conans.util.files import load

Expand Down Expand Up @@ -448,6 +448,38 @@ def context(self):
return {"paths": [ut.replace("\\", "/") for ut in user_toolchain]}


class ExtraFlagsBlock(Block):
"""This block is adding flags directly from user [conf] section"""

template = textwrap.dedent("""
{% if cxxflags %}
string(APPEND CONAN_CXX_FLAGS "{% for cxxflag in cxxflags %} {{ cxxflag }}{% endfor %}")
{% endif %}
{% if cflags %}
string(APPEND CONAN_C_FLAGS "{% for cflag in cflags %} {{ cflag }}{% endfor %}")
{% endif %}
{% if sharedlinkflags %}
string(APPEND CONAN_SHARED_LINKER_FLAGS "{% for sharedlinkflag in sharedlinkflags %} {{ sharedlinkflag }}{% endfor %}")
{% endif %}
{% if exelinkflags %}
string(APPEND CONAN_EXE_LINKER_FLAGS "{% for exelinkflag in exelinkflags %} {{ exelinkflag }}{% endfor %}")
{% endif %}
""")

def context(self):
# Now, it's time to get all the flags defined by the user
cxxflags = self._conanfile.conf.get("tools.build:cxxflags", default=[], check_type=list)
cflags = self._conanfile.conf.get("tools.build:cflags", default=[], check_type=list)
sharedlinkflags = self._conanfile.conf.get("tools.build:sharedlinkflags", default=[], check_type=list)
exelinkflags = self._conanfile.conf.get("tools.build:exelinkflags", default=[], check_type=list)
return {
"cxxflags": cxxflags,
"cflags": cflags,
"sharedlinkflags": sharedlinkflags,
"exelinkflags": exelinkflags
}


class CMakeFlagsInitBlock(Block):
template = textwrap.dedent("""
if(DEFINED CONAN_CXX_FLAGS)
Expand Down Expand Up @@ -527,13 +559,16 @@ def _get_toolset(self, generator):
elif compiler == "intel-cc":
return IntelCC(self._conanfile).ms_toolset
elif compiler == "msvc":
subs_toolset = settings.get_safe("compiler.toolset")
if subs_toolset:
return subs_toolset
compiler_version = str(settings.compiler.version)
compiler_update = str(settings.compiler.update)
if compiler_update != "None": # It is full one(19.28), not generic 19.2X
# The equivalent of compiler 19.26 is toolset 14.26
return "version=14.{}{}".format(compiler_version[-1], compiler_update)
else:
return "v14{}".format(compiler_version[-1])
return msvc_version_to_toolset_version(compiler_version)
elif compiler == "clang":
if generator and "Visual" in generator:
if "Visual Studio 16" in generator:
Expand Down
9 changes: 2 additions & 7 deletions conan/tools/cmake/toolchain/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from conan.tools.cmake.toolchain.blocks import ToolchainBlocks, UserToolchain, GenericSystemBlock, \
AndroidSystemBlock, AppleSystemBlock, FPicBlock, ArchitectureBlock, GLibCXXBlock, VSRuntimeBlock, \
CppStdBlock, ParallelBlock, CMakeFlagsInitBlock, TryCompileBlock, FindFiles, SkipRPath, \
SharedLibBock, OutputDirsBlock
SharedLibBock, OutputDirsBlock, ExtraFlagsBlock
from conan.tools.files.files import save_toolchain_args
from conan.tools.intel import IntelCC
from conan.tools.microsoft import VCVars
Expand Down Expand Up @@ -124,6 +124,7 @@ def __init__(self, conanfile, generator=None, namespace=None):
("vs_runtime", VSRuntimeBlock),
("cppstd", CppStdBlock),
("parallel", ParallelBlock),
("extra_flags", ExtraFlagsBlock),
("cmake_flags_init", CMakeFlagsInitBlock),
("try_compile", TryCompileBlock),
("find_paths", FindFiles),
Expand Down Expand Up @@ -211,12 +212,6 @@ def _get_generator(self, recipe_generator):
vs_version = vs_ide_version(self._conanfile)
return "Visual Studio %s" % cmake_years[vs_version]

if compiler == "Visual Studio":
version = compiler_version
major_version = version.split('.', 1)[0]
base = "Visual Studio %s" % cmake_years[major_version]
return base

if use_win_mingw(conanfile):
return "MinGW Makefiles"

Expand Down
4 changes: 1 addition & 3 deletions conan/tools/env/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from collections import OrderedDict
from contextlib import contextmanager

from conan.tools.microsoft.subsystems import deduce_subsystem, WINDOWS
from conans.client.subsystems import deduce_subsystem, WINDOWS, subsystem_path
from conans.errors import ConanException
from conans.model.recipe_ref import ref_matches
from conans.util.files import save
Expand All @@ -14,7 +14,6 @@ class _EnvVarPlaceHolder:


def environment_wrap_command(env_filenames, cmd, subsystem=None, cwd=None):
from conan.tools.microsoft.subsystems import subsystem_path
assert env_filenames
filenames = [env_filenames] if not isinstance(env_filenames, list) else env_filenames
bats, shs = [], []
Expand Down Expand Up @@ -131,7 +130,6 @@ def get_str(self, placeholder, subsystem, pathsep):
values.append(placeholder.format(name=self._name))
else:
if self._path:
from conan.tools.microsoft.subsystems import subsystem_path
v = subsystem_path(subsystem, v)
values.append(v)
if self._path:
Expand Down
2 changes: 1 addition & 1 deletion conan/tools/files/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from conan.tools.files.files import load, save, mkdir, ftp_download, download, get, rename, \
from conan.tools.files.files import load, save, mkdir, rmdir, ftp_download, download, get, rename, \
chdir, unzip, replace_in_file, collect_libs, check_md5, check_sha1, check_sha256

from conan.tools.files.patches import patch, apply_conandata_patches
Expand Down
10 changes: 7 additions & 3 deletions conan/tools/files/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from conans.client.downloaders.download import run_downloader
from conans.errors import ConanException
from conans.util.sha import check_with_algorithm_sum
from conans.util.files import rmdir
from conans.util.files import rmdir as _internal_rmdir


def load(conanfile, path, encoding="utf-8"):
Expand Down Expand Up @@ -59,6 +59,10 @@ def mkdir(conanfile, path):
os.makedirs(path)


def rmdir(conanfile, path):
_internal_rmdir(path)


def get(conanfile, url, md5='', sha1='', sha256='', destination=".", filename="",
keep_permissions=False, pattern=None, verify=True, retry=None, retry_wait=None,
auth=None, headers=None, strip_root=False):
Expand Down Expand Up @@ -126,7 +130,7 @@ def download(conanfile, url, filename, verify=True, retry=None, retry_wait=None,
:return: None
"""
# TODO: Add all parameters to the new conf
requester = conanfile._conan_requester
requester = conanfile._conan_helpers.requester
config = conanfile.conf
out = ConanOutput()
overwrite = True
Expand Down Expand Up @@ -474,7 +478,7 @@ def swap_child_folder(parent_folder, child_folder):
if os.path.isfile(path):
os.remove(path)
else:
rmdir(path)
_internal_rmdir(path)
child = os.path.join(parent_folder, child_folder)
for f in os.listdir(child):
shutil.move(os.path.join(child, f), os.path.join(parent_folder, f))
2 changes: 1 addition & 1 deletion conan/tools/gnu/autotools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from conan.tools.build import build_jobs
from conan.tools.files.files import load_toolchain_args
from conan.tools.microsoft.subsystems import subsystem_path, deduce_subsystem
from conans.client.subsystems import subsystem_path, deduce_subsystem


def join_arguments(args):
Expand Down
Loading

0 comments on commit df3c452

Please sign in to comment.