Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More layouts: Generators folder, CMake Toolchain, Editable packages and more #8554

Merged
merged 135 commits into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from 130 commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
f1d92f6
Minimum changes
lasote Dec 21, 2020
c885258
Fixed mock value install folder
lasote Dec 21, 2020
8067cd5
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote Dec 21, 2020
f1320be
litle review changes
lasote Dec 28, 2020
c175853
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote Dec 28, 2020
602dcf4
Changed data structure
lasote Dec 28, 2020
409e08f
Clean code
lasote Dec 29, 2020
a23a286
Local methods
lasote Dec 30, 2020
a99659f
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote Dec 30, 2020
0b30f71
Introducing generators folder
lasote Dec 31, 2020
ff98fa6
Build helpers using generators folder
lasote Dec 31, 2020
6ba8ab9
Build helpers with generators folder
lasote Dec 31, 2020
e9088f6
in cache layout
lasote Jan 4, 2021
0200c52
Toolchain using layouts
lasote Jan 4, 2021
5bbdd23
Toolchains apple and windows
lasote Jan 4, 2021
34fc2fc
Fixed tests
lasote Jan 4, 2021
3eafcd0
Fix cmake path to toolchain
lasote Jan 4, 2021
e511876
Windows slash
lasote Jan 4, 2021
be6aaed
Windows tests
lasote Jan 4, 2021
65a06c5
Move generators folder to following PR
lasote Jan 4, 2021
ac87f75
Generators folder
lasote Jan 4, 2021
dd3bdb1
More tests
lasote Jan 5, 2021
3f1ce45
Review
lasote Jan 8, 2021
d727863
Add test
lasote Jan 8, 2021
12064f5
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote Jan 8, 2021
549bd96
merged develop
memsharded Jan 9, 2021
64c728e
Fix packages in cache and refactor to clean directory passing as argu…
lasote Jan 11, 2021
5047173
New test, different layout in cache
lasote Jan 11, 2021
1685065
Fix windows \r\n
lasote Jan 11, 2021
427f91b
fix windows crlf
lasote Jan 12, 2021
c36862f
Fix win test again
lasote Jan 12, 2021
c77ba13
Again, tests windows
lasote Jan 12, 2021
95ec8bc
Default not package layout in cache
lasote Jan 25, 2021
7c655de
Removed package layout
lasote Jan 26, 2021
f4aea72
Improved access to layout
lasote Jan 27, 2021
b2a1a64
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote Jan 28, 2021
01d00d2
Review
lasote Jan 28, 2021
3c692f6
Merged develop
lasote Jan 28, 2021
bbac705
Merged part1
lasote Jan 28, 2021
6e93718
Auto review
lasote Jan 28, 2021
a6e4ca0
editables kind of working
lasote Jan 31, 2021
b31f346
Merge part2
lasote Jan 31, 2021
a4b14c1
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote Jan 31, 2021
0644d32
Extracted defaults
lasote Feb 3, 2021
6547caf
editables
lasote Feb 5, 2021
601b496
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote Feb 5, 2021
68db2f8
Trying clion
lasote Feb 8, 2021
dc4b221
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote Feb 8, 2021
d2afa68
Moved tests
lasote Feb 8, 2021
5d16c97
Auto pacakge
lasote Feb 11, 2021
3549c1f
some tests
lasote Feb 15, 2021
5db38d0
Merged develop
lasote Feb 15, 2021
4c86e9d
Filter empty default False
lasote Feb 15, 2021
764d49a
simplify
lasote Feb 15, 2021
0403c48
Fixed test
lasote Feb 16, 2021
55a2d9f
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote Feb 16, 2021
2d1c964
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote Feb 16, 2021
e0b8440
Merge branch 'feature/base_layout_part1' into feature/base_layout_edi…
lasote Feb 16, 2021
5f3b2b5
clion test
lasote Feb 18, 2021
d7e993d
Merge develop
lasote Feb 19, 2021
7699443
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote Feb 24, 2021
74279b7
Self review
lasote Feb 25, 2021
b89ec51
less change
lasote Feb 25, 2021
5bea04d
remove comment
lasote Feb 25, 2021
11e8cbb
python 2 fix
lasote Feb 26, 2021
4f2bb5c
Try to fix windows
lasote Feb 26, 2021
6c1ea60
More win
lasote Feb 26, 2021
b26aa36
Partial review
lasote Mar 3, 2021
ff2b922
Review
lasote Mar 8, 2021
4b9cbb0
removed comments
lasote Mar 8, 2021
4414958
Merged develop
lasote Mar 8, 2021
d833395
Fix merge, remove unused tests, removed unnecessay rename
lasote Mar 9, 2021
132e19d
Fixing test
lasote Mar 9, 2021
3a4de64
base path
lasote Mar 9, 2021
27cf644
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote Mar 9, 2021
0561d47
Fix test package
lasote Mar 9, 2021
b81ccde
One more test of test_package using generators folder
lasote Mar 9, 2021
6899061
Removed comments
lasote Mar 9, 2021
eb5d357
Merged develop
lasote Apr 20, 2021
2102624
introducing cpp info, preliminar changes
lasote Apr 20, 2021
efa22f7
integrated new cppinfo
lasote Apr 21, 2021
c7799f2
Merged develop
lasote Apr 21, 2021
b40de68
Fix cmake toolchain tests
lasote Apr 21, 2021
a5b0397
removed unnecesary test
lasote Apr 21, 2021
461ba22
get_name from cmake_find_package_multi too
lasote Apr 21, 2021
e89e08e
Fix bug
lasote Apr 22, 2021
2643f4d
Name from cmake_find_package_multi but not from CMakeDeps
lasote Apr 22, 2021
a84c701
Merge branch 'feature/print_cmake_targets' into feature/base_layout_e…
lasote Apr 22, 2021
dda13b6
refactored model, pending fix editables and tests
lasote Apr 22, 2021
a7c436e
remove new generators output_path
memsharded Apr 22, 2021
3b3f768
Update conans/test/functional/layout/test_in_cache.py
lasote Apr 23, 2021
cdc9ef3
Editables example working, missing tests
lasote Apr 23, 2021
7207b1b
Editables working, simplified code, missing more tests
lasote Apr 23, 2021
32b877e
Fixed test
lasote Apr 26, 2021
632c4a1
imports and package working and tested
lasote Apr 26, 2021
f26fae3
more tests, better merge logic
lasote Apr 27, 2021
2be84bc
Windows test
lasote Apr 27, 2021
1cab252
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote Apr 27, 2021
a3bac36
Debug win test failing
lasote Apr 27, 2021
b25b0e8
win
lasote Apr 27, 2021
1adec1d
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote Apr 27, 2021
1572840
Function instead of static
lasote Apr 27, 2021
4d0240d
Empty lists in editable are explicit declared priority values
lasote Apr 28, 2021
517b4de
Simplified model, values always none
lasote Apr 28, 2021
1c6ae96
Fixed aggregration
lasote Apr 28, 2021
fec0d83
Test package layout in cache
lasote Apr 28, 2021
f06aead
clear none
lasote Apr 28, 2021
775c10b
unnecessary code
lasote Apr 28, 2021
2948992
Review
lasote Apr 30, 2021
1732656
Remove unnecessary
lasote Apr 30, 2021
efa0c86
vs_layout
lasote Apr 30, 2021
7431ab3
Renamed infos to cpp
lasote Apr 30, 2021
bc55120
fix test
lasote Apr 30, 2021
f6473af
removed comment
lasote May 4, 2021
129e2c9
Fixed build modules propagation to new model
lasote May 5, 2021
0482831
Better CMakeDeps with constant files except -release
lasote May 6, 2021
d23ac4d
same code for components and no components
lasote May 6, 2021
c79a994
Refactor cmake deps
lasote May 10, 2021
7e13081
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote May 10, 2021
de0009a
CMakeDeps tests running in OSX
lasote May 10, 2021
4e4a5ef
Fixed test
lasote May 10, 2021
a1e6716
Fix order in build modules
lasote May 11, 2021
9efdfa5
Multi config windows fixed
lasote May 11, 2021
025fc3d
fixed test package folder var name
lasote May 11, 2021
e098abe
Apple frameworks test migrated to CMakeDeps
lasote May 12, 2021
e024614
Adapted link order test
lasote May 12, 2021
43365df
Merge remote-tracking branch 'origin/develop' into feature/base_layou…
lasote May 12, 2021
8c42d36
Ported konstantin test about m1 to toolchain and cmakedeps
lasote May 12, 2021
f56f1ed
Fix test, non-existent libs cause CMake FATAL_ERROR
lasote May 12, 2021
9b56129
CMake 3.19
lasote May 12, 2021
45c2f3b
Dead code and comments
lasote May 12, 2021
ffaa4cb
review
memsharded May 12, 2021
87d315a
Moved test
lasote May 13, 2021
b4e6aed
Merge branch 'feature/base_layout_editables' of github.com:lasote/con…
lasote May 13, 2021
10a4bcb
Comment
lasote May 13, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 4 additions & 10 deletions conan/tools/cmake/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from conan.tools.microsoft.msbuild import msbuild_verbosity_cmd_line_arg, \
msbuild_max_cpu_count_cmd_line_arg
from conans.client import tools

from conans.client.tools.files import chdir
from conans.client.tools.oss import cpu_count, args_to_string
from conans.errors import ConanException
Expand Down Expand Up @@ -62,17 +61,16 @@ class CMake(object):
are passed to the command line, plus the ``--config Release`` for builds in multi-config
"""

def __init__(self, conanfile, build_folder=None, parallel=True):
def __init__(self, conanfile, parallel=True):
_validate_recipe(conanfile)

# Store a reference to useful data
self._conanfile = conanfile
self._parallel = parallel

self._generator = None
if os.path.exists(CONAN_TOOLCHAIN_ARGS_FILE):
self._generator = json.loads(load(CONAN_TOOLCHAIN_ARGS_FILE))["cmake_generator"]
self._build_folder = build_folder

self._cmake_program = "cmake" # Path to CMake should be handled by environment

def configure(self, source_folder=None):
Expand All @@ -85,12 +83,11 @@ def configure(self, source_folder=None):
source = os.path.join(self._conanfile.source_folder, source_folder)

build_folder = self._conanfile.build_folder
if self._build_folder:
build_folder = os.path.join(self._conanfile.build_folder, self._build_folder)
generator_folder = self._conanfile.generators_folder

mkdir(build_folder)
arg_list = '-DCMAKE_TOOLCHAIN_FILE="{}" -DCMAKE_INSTALL_PREFIX="{}" "{}"'.format(
CMakeToolchain.filename,
os.path.join(generator_folder, CMakeToolchain.filename).replace("\\", "/"),
self._conanfile.package_folder.replace("\\", "/"),
source)

Expand All @@ -107,9 +104,6 @@ def configure(self, source_folder=None):

def _build(self, build_type=None, target=None):
bf = self._conanfile.build_folder
if self._build_folder:
bf = os.path.join(self._conanfile.build_folder, self._build_folder)

is_multi = is_multi_configuration(self._generator)
if build_type and not is_multi:
self._conanfile.output.error("Don't specify 'build_type' at build time for "
Expand Down
502 changes: 218 additions & 284 deletions conan/tools/cmake/cmakedeps.py

Large diffs are not rendered by default.

20 changes: 9 additions & 11 deletions conan/tools/cmake/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@ class IOSSystemBlock(Block):
set(CMAKE_SYSTEM_VERSION {{ CMAKE_SYSTEM_VERSION }})
set(DEPLOYMENT_TARGET ${CONAN_SETTINGS_HOST_MIN_OS_VERSION})
# Set the architectures for which to build.
set(CMAKE_OSX_ARCHITECTURES {{ CMAKE_OSX_ARCHITECTURES }})
set(CMAKE_OSX_ARCHITECTURES {{ CMAKE_OSX_ARCHITECTURES }} CACHE STRING "" FORCE)
# Setting CMAKE_OSX_SYSROOT SDK, when using Xcode generator the name is enough
# but full path is necessary for others
set(CMAKE_OSX_SYSROOT {{ CMAKE_OSX_SYSROOT }})
set(CMAKE_OSX_SYSROOT {{ CMAKE_OSX_SYSROOT }} CACHE STRING "" FORCE)
""")

def _get_architecture(self):
Expand Down Expand Up @@ -342,8 +342,8 @@ def context(self):
host_sdk_name = self._apple_sdk_name()

# TODO: Discuss how to handle CMAKE_OSX_DEPLOYMENT_TARGET to set min-version
# add a setting? check an option and if not present set a default?
# default to os.version?
# add a setting? check an option and if not present set a default?
# default to os.version?
ctxt_toolchain = {
"CMAKE_OSX_ARCHITECTURES": host_architecture,
"CMAKE_SYSTEM_NAME": host_os,
Expand All @@ -358,12 +358,12 @@ class FindConfigFiles(Block):
{% if find_package_prefer_config %}
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG {{ find_package_prefer_config }})
{% endif %}
# To support the cmake_find_package generators
# To support the generators based on find_package()
{% if cmake_module_path %}
set(CMAKE_MODULE_PATH {{ cmake_module_path }} ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH "{{ cmake_module_path }}" ${CMAKE_MODULE_PATH})
{% endif %}
{% if cmake_prefix_path %}
set(CMAKE_PREFIX_PATH {{ cmake_prefix_path }} ${CMAKE_PREFIX_PATH})
set(CMAKE_PREFIX_PATH "{{ cmake_prefix_path }}" ${CMAKE_PREFIX_PATH})
{% endif %}
{% if android_prefix_path %}
set(CMAKE_FIND_ROOT_PATH {{ android_prefix_path }} ${CMAKE_FIND_ROOT_PATH})
Expand All @@ -373,8 +373,6 @@ class FindConfigFiles(Block):
def context(self):
# To find the generated cmake_find_package finders
# TODO: Change this for parameterized output location of CMakeDeps
cmake_prefix_path = "${CMAKE_CURRENT_LIST_DIR}"
cmake_module_path = "${CMAKE_CURRENT_LIST_DIR}"
find_package_prefer_config = "ON" # assume ON by default if not specified in conf
prefer_config = self._conanfile.conf["tools.cmake.cmaketoolchain:find_package_prefer_config"]
if prefer_config is not None and prefer_config.lower() in ("false", "0", "off"):
Expand All @@ -383,8 +381,8 @@ def context(self):
os_ = self._conanfile.settings.get_safe("os")
android_prefix = "${CMAKE_CURRENT_LIST_DIR}" if os_ == "Android" else None
return {"find_package_prefer_config": find_package_prefer_config,
"cmake_prefix_path": cmake_prefix_path,
"cmake_module_path": cmake_module_path,
"cmake_prefix_path": "${CMAKE_CURRENT_LIST_DIR}",
"cmake_module_path": "${CMAKE_CURRENT_LIST_DIR}",
"android_prefix_path": android_prefix}


Expand Down
4 changes: 2 additions & 2 deletions conan/tools/files/files.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import errno
import os

from conans.client.downloaders.download import run_downloader
from conans.client.tools.files import unzip
from conans.errors import ConanException
from conans.util.files import decode_text, to_file_bytes
from conans.client.tools.files import unzip
from conans.client.downloaders.download import run_downloader


def load(conanfile, path, binary=False, encoding="auto"):
Expand Down
98 changes: 98 additions & 0 deletions conan/tools/layout/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import os

from conan.tools.microsoft.msbuild import msbuild_arch
from conans.client.file_copier import FileCopier
from conans.errors import ConanException


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 = ["."]


def vs_layout(conanfile):
if not conanfile.settings.get_safe("build_type"):
raise ConanException("The 'vs_layout' requires the 'build_type' setting")
if not conanfile.settings.get_safe("arch"):
raise ConanException("The 'vs_layout' requires the 'arch' setting")

if conanfile.settings.arch != "x86":
arch = msbuild_arch(conanfile.settings.arch)
if not arch:
raise ConanException("The 'vs_layout' doesn't "
"work with the arch '{}'".format(conanfile.settings.arch))
base = "{}/{}".format(arch, str(conanfile.settings.build_type))
else:
base = str(conanfile.settings.build_type)

conanfile.folders.build = base
conanfile.cpp.build.libdirs = ["."]
conanfile.folders.generators = os.path.join(base, "generators")
conanfile.folders.source = "."
conanfile.cpp.source.includedirs = ["."]


class LayoutPackager(object):

def __init__(self, conanfile):
self._conanfile = conanfile

def package(self):
cf = self._conanfile

# Check that the components declared in source/build are in package
cnames = set(cf.cpp.source.component_names)
cnames = cnames.union(set(cf.cpp.build.component_names))
if cnames.difference(set(cf.cpp.package.component_names)):
# TODO: Raise? Warning? Ignore?
raise ConanException("There are components declared in source_cpp_info.components"
" or in build_cpp_info.components that are not declared in"
" package_cpp_info.components")


if cnames:
for cname in cnames:
if cname in cf.cpp.source.components:
self._package_cppinfo("source", cf.cpp.source.components[cname],
cf.cpp.package.components[cname])
if cname in cf.cpp.build.components:
self._package_cppinfo("build", cf.cpp.build.components[cname],
cf.cpp.package.components[cname])
else: # No components declared
self._package_cppinfo("source", cf.cpp.source, cf.cpp.package)
self._package_cppinfo("build", cf.cpp.build, cf.cpp.package)

def _package_cppinfo(self, origin_name, origin_cppinfo, dest_cppinfo):
"""
@param origin_name: one from ["source", "build"]
@param origin_cppinfo: cpp_info object of an origin (can be a component cppinfo too)
@param dest_cppinfo: cpp_info object of the package or a component from package
"""
patterns_var = getattr(self._conanfile.patterns, origin_name)
base_folder = getattr(self._conanfile, "{}_folder".format(origin_name))
for var in ["include", "lib", "bin", "framework", "src", "build", "res"]:
dirs_var_name = "{}dirs".format(var)
origin_paths = getattr(origin_cppinfo, dirs_var_name)
if not origin_paths:
continue
patterns = getattr(patterns_var, var)
destinations = getattr(dest_cppinfo, dirs_var_name)
if not destinations: # For example: Not declared "includedirs" in package.cpp_info
continue
if len(destinations) > 1:
# Check if there is only one possible destination at package, otherwise the
# copy would need to be done manually
err_msg = "The package has more than 1 cpp_info.{}, cannot package automatically"
raise ConanException(err_msg.format(dirs_var_name))

for d in origin_paths:
copier = FileCopier([os.path.join(base_folder, d)],
self._conanfile.folders.base_package)
for pattern in patterns:
copier(pattern, dst=destinations[0])
15 changes: 9 additions & 6 deletions conan/tools/microsoft/msbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,21 @@ def msbuild_max_cpu_count_cmd_line_arg(conanfile):
return "/m:{}".format(max_cpu_count)


def msbuild_arch(arch):
return {'x86': 'x86',
'x86_64': 'x64',
'armv7': 'ARM',
'armv8': 'ARM64'}.get(str(arch))


class MSBuild(object):
def __init__(self, conanfile):
self._conanfile = conanfile
self.build_type = conanfile.settings.get_safe("build_type")
msvc_arch = {'x86': 'x86',
'x86_64': 'x64',
'armv7': 'ARM',
'armv8': 'ARM64'}
# if platforms:
# msvc_arch.update(platforms)
arch = conanfile.settings.get_safe("arch")
msvc_arch = msvc_arch.get(str(arch))
msvc_arch = msbuild_arch(arch)
if conanfile.settings.get_safe("os") == "WindowsCE":
msvc_arch = conanfile.settings.get_safe("os.platform")
self.platform = msvc_arch
Expand All @@ -50,7 +53,7 @@ def command(self, sln):

def build(self, sln):
cmd = self.command(sln)
vcvars = os.path.join(self._conanfile.install_folder, "conanvcvars")
vcvars = os.path.join(self._conanfile.generators_folder, "conanvcvars")
self._conanfile.run(cmd, env=["conanbuildenv", vcvars])

@staticmethod
Expand Down
11 changes: 5 additions & 6 deletions conan/tools/microsoft/msbuilddeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ def __init__(self, conanfile):
self.configuration = conanfile.settings.build_type
self.platform = {'x86': 'Win32',
'x86_64': 'x64'}.get(str(conanfile.settings.arch))
# TODO: this is ugly, improve this
self.output_path = os.getcwd()
# ca_exclude section
self.exclude_code_analysis = None
ca_exclude = self._conanfile.conf["tools.microsoft.msbuilddeps:exclude_code_analysis"]
Expand All @@ -126,8 +124,7 @@ def generate(self):
raise ConanException("MSBuildDeps.platform is None, it should have a value")
generator_files = self._content()
for generator_file, content in generator_files.items():
generator_file_path = os.path.join(self.output_path, generator_file)
save(generator_file_path, content)
save(generator_file, content)

def _config_filename(self):
# Default name
Expand Down Expand Up @@ -190,7 +187,8 @@ def _conf_props_file(self, dep_name, vars_props_name, deps):
return content_multi

def _dep_props_file(self, name, name_general, dep_props_filename, condition):
multi_path = os.path.join(self.output_path, name_general)
# Current directory is the generators_folder
multi_path = name_general
if os.path.isfile(multi_path):
content_multi = load(multi_path)
else:
Expand Down Expand Up @@ -220,7 +218,8 @@ def _dep_props_file(self, name, name_general, dep_props_filename, condition):
def _all_props_file(self, name_general, deps):
""" this is a .props file including all declared dependencies
"""
multi_path = os.path.join(self.output_path, name_general)
# Current directory is the generators_folder
multi_path = name_general
if os.path.isfile(multi_path):
content_multi = load(multi_path)
else:
Expand Down
6 changes: 3 additions & 3 deletions conan/tools/microsoft/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def write_conanvcvars(conanfile):
@echo off
{}
""".format(cvars))
save(CONAN_VCVARS_FILE, content)
save(os.path.join(conanfile.generators_folder, CONAN_VCVARS_FILE), content)


def vs_ide_version(conanfile):
Expand Down Expand Up @@ -168,12 +168,12 @@ def format_macro(key, value):
for k, v in self.compile_options.items())
config_props = toolchain_file.format(preprocessor_definitions, runtime_library, cppstd,
compile_options, toolset)
config_filepath = os.path.abspath(config_filename)
config_filepath = os.path.join(self._conanfile.generators_folder, config_filename)
self._conanfile.output.info("MSBuildToolchain created %s" % config_filename)
save(config_filepath, config_props)

def _write_main_toolchain(self, config_filename, condition):
main_toolchain_path = os.path.abspath(self.filename)
main_toolchain_path = os.path.join(self._conanfile.generators_folder, self.filename)
if os.path.isfile(main_toolchain_path):
content = load(main_toolchain_path)
else:
Expand Down
16 changes: 9 additions & 7 deletions conans/client/cmd/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from conans.util.log import logger


def cmd_build(app, conanfile_path, source_folder, build_folder, package_folder, install_folder,
test=False, should_configure=True, should_build=True, should_install=True,
should_test=True):
def cmd_build(app, conanfile_path, base_path, source_folder, build_folder, package_folder,
memsharded marked this conversation as resolved.
Show resolved Hide resolved
install_folder, test=False, should_configure=True, should_build=True,
should_install=True, should_test=True):
""" Call to build() method saved on the conanfile.py
param conanfile_path: path to a conanfile.py
"""
Expand Down Expand Up @@ -41,10 +41,12 @@ def cmd_build(app, conanfile_path, source_folder, build_folder, package_folder,
try:
# FIXME: Conan 2.0 all these build_folder, source_folder will disappear
# Only base_path and conanfile_path will remain
conan_file.layout.set_base_build_folder(build_folder)
conan_file.layout.set_base_source_folder(source_folder)
conan_file.layout.set_base_package_folder(package_folder)
conan_file.layout.set_base_install_folder(install_folder)
conan_file.folders.set_base_build(build_folder)
conan_file.folders.set_base_source(source_folder)
conan_file.folders.set_base_package(package_folder)
conan_file.folders.set_base_generators(base_path)

conan_file.folders.set_base_install(install_folder)

mkdir(conan_file.build_folder)
os.chdir(conan_file.build_folder)
Expand Down
9 changes: 6 additions & 3 deletions conans/client/cmd/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def create(app, ref, graph_info, remotes, update, build_modes,
deps_install(app=app,
ref_or_path=ref,
create_reference=ref,
install_folder=None, # Not output anything
install_folder=None, # Not output conaninfo etc
base_folder=None, # Not output generators
manifest_folder=manifest_folder,
manifest_verify=manifest_verify,
manifest_interactive=manifest_interactive,
Expand All @@ -67,7 +68,8 @@ def create(app, ref, graph_info, remotes, update, build_modes,
% (str(ref), str(e)))

else:
install_build_and_test(app, test_conanfile_path, ref, graph_info, remotes, update,
install_build_and_test(app, test_conanfile_path,
ref, graph_info, remotes, update,
build_modes=build_modes,
manifest_folder=manifest_folder,
manifest_verify=manifest_verify,
Expand All @@ -79,7 +81,8 @@ def create(app, ref, graph_info, remotes, update, build_modes,
deps_install(app=app,
ref_or_path=ref,
create_reference=ref,
install_folder=None, # Not output anything
install_folder=None, # Not output infos etc
base_folder=None, # Not output generators
manifest_folder=manifest_folder,
manifest_verify=manifest_verify,
manifest_interactive=manifest_interactive,
Expand Down
8 changes: 4 additions & 4 deletions conans/client/cmd/export_pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ def _init_conanfile_infos():
recipe_hash = layout.recipe_manifest().summary_hash
conanfile.info.recipe_hash = recipe_hash
conanfile.develop = True
conanfile.layout.set_base_build_folder(build_folder)
conanfile.layout.set_base_source_folder(source_folder)
conanfile.layout.set_base_package_folder(dest_package_folder)
conanfile.layout.set_base_install_folder(install_folder)
conanfile.folders.set_base_build(build_folder)
conanfile.folders.set_base_source(source_folder)
conanfile.folders.set_base_package(dest_package_folder)
conanfile.folders.set_base_install(install_folder)

with layout.set_dirty_context_manager(pref):
if package_folder:
Expand Down