Skip to content

Commit

Permalink
Merge branch 'release/0.20.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
lasote committed Mar 1, 2017
2 parents 2bcca1b + 4be59cf commit 41b9ab0
Show file tree
Hide file tree
Showing 16 changed files with 334 additions and 209 deletions.
3 changes: 1 addition & 2 deletions conans/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@
COMPLEX_SEARCH_CAPABILITY = "complex_search"
SERVER_CAPABILITIES = [COMPLEX_SEARCH_CAPABILITY, ]

__version__ = '0.20.0'

__version__ = '0.20.1'
2 changes: 1 addition & 1 deletion conans/client/client_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def read_put_headers(self):
try:
contents = load(self.put_headers_path)
for line in contents.splitlines():
if line:
if line and not line.strip().startswith("#"):
tmp = line.split("=", 1)
if len(tmp) != 2:
raise Exception()
Expand Down
66 changes: 33 additions & 33 deletions conans/client/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from conans.model.settings import Settings
from conans.util.files import mkdir
import os
import platform
import subprocess
import sys

Expand Down Expand Up @@ -59,30 +60,34 @@ def _generator(self):
return base

if operating_system == "Windows":
if compiler == "gcc":
return "MinGW Makefiles"
if compiler in ["clang", "apple-clang"]:
return "MinGW Makefiles"
if operating_system == "Linux":
if compiler in ["gcc", "clang", "apple-clang"]:
return "Unix Makefiles"
if operating_system == "Macos":
if compiler in ["gcc", "clang", "apple-clang"]:
return "Unix Makefiles"
if operating_system == "FreeBSD":
if compiler in ["gcc", "clang", "apple-clang"]:
return "Unix Makefiles"
if operating_system == "SunOS":
if compiler in ["sun-cc", "gcc"]:
return "Unix Makefiles"

raise ConanException("Unknown cmake generator for these settings")
return "MinGW Makefiles" # it is valid only under Windows

return "Unix Makefiles"

def _cmake_compiler_options(self, os, os_ver, arch):
cmake_flags = []

if str(os).lower() == "macos":
if arch == "x86":
cmake_flags.append("-DCMAKE_OSX_ARCHITECTURES=i386")
# CMake defines MacOS as Darwin
os = "Darwin"

if platform.system() != os or os_ver:
if os:
cmake_flags.append("-DCMAKE_SYSTEM_NAME=%s" % os)
if os_ver:
cmake_flags.append("-DCMAKE_SYSTEM_VERSION=%s" % os_ver)
else:
cmake_flags.append("-DCMAKE_SYSTEM_NAME=Generic")

return cmake_flags

@property
def is_multi_configuration(self):
""" some IDEs are multi-configuration, as Visual. Makefiles or Ninja are single-conf
"""
if "Visual" in self.generator:
if "Visual" in self.generator or "Xcode" in self.generator:
return True
# TODO: complete logic
return False
Expand Down Expand Up @@ -125,17 +130,16 @@ def flags(self):
arch = str(self._settings.arch) if self._settings.arch else None
comp = str(self._settings.compiler) if self._settings.compiler else None
comp_version = self._settings.compiler.version
op_system_version = self._settings.get_safe("os.version")

flags = ["-DCONAN_EXPORTED=1"]
if op_system == "Windows":
if comp == "clang":
flags.append("-DCMAKE_C_COMPILER=clang")
flags.append("-DCMAKE_CXX_COMPILER=clang++")
flags = self._cmake_compiler_options(os=op_system, os_ver=op_system_version, arch=arch)
flags.append("-DCONAN_EXPORTED=1")
if comp:
flags.append('-DCONAN_COMPILER="%s"' % comp)
if comp_version:
flags.append('-DCONAN_COMPILER_VERSION="%s"' % comp_version)

# Force compiler flags -- TODO: give as environment/setting parameter?
if op_system == "Linux" or op_system == "FreeBSD" or op_system == "SunOS":
if arch == "x86":
flags.extend(["-DCONAN_CXX_FLAGS=-m32",
Expand All @@ -145,10 +149,6 @@ def flags(self):
flags.extend(["-DCONAN_CXX_FLAGS=-m64",
"-DCONAN_SHARED_LINKER_FLAGS=-m64",
"-DCONAN_C_FLAGS=-m64"])
elif op_system == "Macos":
if arch == "x86":
flags.append("-DCMAKE_OSX_ARCHITECTURES=i386")

try:
libcxx = self._settings.compiler.libcxx
flags.append('-DCONAN_LIBCXX="%s"' % libcxx)
Expand All @@ -166,17 +166,17 @@ def runtime(self):
return "-DCONAN_LINK_RUNTIME=/%s" % runtime
return ""

def configure(self, conan_file, args=None, vars=None, source_dir=None, build_dir=None):
def configure(self, conan_file, args=None, defs=None, source_dir=None, build_dir=None):
args = args or []
vars = vars or {}
defs = defs or {}
source_dir = source_dir or conan_file.conanfile_directory
self.build_dir = build_dir or self.build_dir or conan_file.conanfile_directory

mkdir(self.build_dir)
arg_list = _join_arguments([
self.command_line,
_args_to_string(args),
_vars_to_string(vars),
_vars_to_string(defs),
_args_to_string([source_dir])
])
command = "cd %s && cmake %s" % (_args_to_string([self.build_dir]), arg_list)
Expand All @@ -197,8 +197,8 @@ def build(self, conan_file, args=None, build_dir=None, target=None):
conan_file.run(command)


def _vars_to_string(vars):
return _args_to_string('-D{0}={1}'.format(k, v) for k,v in vars.items())
def _vars_to_string(defs):
return _args_to_string('-D{0}={1}'.format(k, v) for k, v in defs.items())


def _args_to_string(args):
Expand Down
16 changes: 8 additions & 8 deletions conans/client/generators/cmake_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
set(CONAN_DEFINES_{dep}{build_type} {deps.defines})
# COMPILE_DEFINITIONS are equal to CONAN_DEFINES without -D, for targets
set(CONAN_COMPILE_DEFINITIONS_{dep}{build_type} {deps.compile_definitions})
set(CONAN_CXX_FLAGS_{dep}{build_type} {deps.cppflags})
set(CONAN_SHARED_LINKER_FLAGS_{dep}{build_type} {deps.sharedlinkflags})
set(CONAN_EXE_LINKER_FLAGS_{dep}{build_type} {deps.exelinkflags})
set(CONAN_C_FLAGS_{dep}{build_type} {deps.cflags})
set(CONAN_CXX_FLAGS_{dep}{build_type} "{deps.cppflags}")
set(CONAN_SHARED_LINKER_FLAGS_{dep}{build_type} "{deps.sharedlinkflags}")
set(CONAN_EXE_LINKER_FLAGS_{dep}{build_type} "{deps.exelinkflags}")
set(CONAN_C_FLAGS_{dep}{build_type} "{deps.cflags}")
"""


Expand Down Expand Up @@ -49,10 +49,10 @@ def cmake_dependencies(dependencies, build_type=""):
set(CONAN_RES_DIRS{build_type} {deps.res_paths} ${{CONAN_RES_DIRS{build_type}}})
set(CONAN_LIBS{build_type} {deps.libs} ${{CONAN_LIBS{build_type}}})
set(CONAN_DEFINES{build_type} {deps.defines} ${{CONAN_DEFINES{build_type}}})
set(CONAN_CXX_FLAGS{build_type} {deps.cppflags} ${{CONAN_CXX_FLAGS{build_type}}})
set(CONAN_SHARED_LINKER_FLAGS{build_type} {deps.sharedlinkflags} ${{CONAN_SHARED_LINKER_FLAGS{build_type}}})
set(CONAN_EXE_LINKER_FLAGS{build_type} {deps.exelinkflags} ${{CONAN_EXE_LINKER_FLAGS{build_type}}})
set(CONAN_C_FLAGS{build_type} {deps.cflags} ${{CONAN_C_FLAGS{build_type}}})
set(CONAN_CXX_FLAGS{build_type} "{deps.cppflags} ${{CONAN_CXX_FLAGS{build_type}}}")
set(CONAN_SHARED_LINKER_FLAGS{build_type} "{deps.sharedlinkflags} ${{CONAN_SHARED_LINKER_FLAGS{build_type}}}")
set(CONAN_EXE_LINKER_FLAGS{build_type} "{deps.exelinkflags} ${{CONAN_EXE_LINKER_FLAGS{build_type}}}")
set(CONAN_C_FLAGS{build_type} "{deps.cflags} ${{CONAN_C_FLAGS{build_type}}}")
set(CONAN_CMAKE_MODULE_PATH{build_type} {deps.build_paths} ${{CONAN_CMAKE_MODULE_PATH{build_type}}})
"""

Expand Down
7 changes: 4 additions & 3 deletions conans/client/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, client_cache, user_io, runner, remote_manager, search_manager
self._search_manager = search_manager

def _loader(self, current_path=None, user_settings_values=None, package_settings=None,
user_options_values=None, scopes=None, env_values=None):
user_options_values=None, scopes=None, env_values=None, use_conaninfo=True):

# The disk settings definition, already including the default disk values
settings = self._client_cache.settings
Expand All @@ -74,7 +74,7 @@ def _loader(self, current_path=None, user_settings_values=None, package_settings

if current_path:
conan_info_path = os.path.join(current_path, CONANINFO)
if os.path.exists(conan_info_path):
if use_conaninfo and os.path.exists(conan_info_path):
existing_info = ConanInfo.load_file(conan_info_path)
settings.values = existing_info.full_settings
options = existing_info.full_options # Take existing options from conaninfo.txt
Expand Down Expand Up @@ -153,7 +153,8 @@ def download(self, reference, package_ids, remote=None):
def _get_graph(self, reference, current_path, remote, options, settings, filename, update,
check_updates, manifest_manager, scopes, package_settings, env_values):

loader = self._loader(current_path, settings, package_settings, options, scopes, env_values)
loader = self._loader(current_path, settings, package_settings, options,
scopes, env_values, use_conaninfo=False)
# Not check for updates for info command, it'll be checked when dep graph is built

remote_proxy = ConanProxy(self._client_cache, self._user_io, self._remote_manager, remote,
Expand Down
Loading

0 comments on commit 41b9ab0

Please sign in to comment.