Added support for multi-environment PlatformIO project for CLion IDE // Resolve #2824 Resolve #2944

This commit is contained in:
Ivan Kravets
2019-08-29 16:26:51 +03:00
parent 83bf34fb77
commit 4a6d5e8395
3 changed files with 23 additions and 6 deletions

View File

@ -9,8 +9,9 @@ PlatformIO 4.0
4.0.3 (2019-??-??)
~~~~~~~~~~~~~~~~~~
* Support `PLATFORMIO_DISABLE_COLOR <http://docs.platformio.org/en/latest/envvars.html#envvar-PLATFORMIO_DISABLE_COLOR>`__ system environment variable which disables color ANSI-codes in a terminal output (`issue #2956 <https://github.com/platformio/platformio-core/issues/2956>`_)
* Added support for multi-environment PlatformIO project for `CLion IDE <http://docs.platformio.org/page/ide/clion.html>`__ (`issue #2824 <https://github.com/platformio/platformio-core/issues/2824>`_)
* Generate ``.ccls`` LSP file for `Vim <http://docs.platformio.org/en/page/vim.html>`__ cross references, hierarchies, completion and semantic highlighting (`issue #2952 <https://github.com/platformio/platformio-core/issues/2952>`_)
* Added support for `PLATFORMIO_DISABLE_COLOR <http://docs.platformio.org/page/envvars.html#envvar-PLATFORMIO_DISABLE_COLOR>`__ system environment variable which disables color ANSI-codes in a terminal output (`issue #2956 <https://github.com/platformio/platformio-core/issues/2956>`_)
* Updated SCons tool to 3.1.1
* Remove ProjectConfig cache when "platformio.ini" was modified outside
* Fixed an issue with PIO Unified Debugger on Windows OS when debug server is piped

View File

@ -47,14 +47,30 @@ SET(CMAKE_C_STANDARD {{ cc_stds[-1] }})
set(CMAKE_CXX_STANDARD {{ cxx_stds[-1] }})
% end
% for env in envs:
if (CMAKE_BUILD_TYPE MATCHES {{ env_name }})
%for define in defines:
add_definitions(-D'{{!re.sub(r"([\"\(\)#])", r"\\\1", define)}}')
%end
%for include in includes:
include_directories("{{ _normalize_path(to_unix_path(include)) }}")
%end
endif()
% leftover_envs = set(envs) ^ set([env_name])
%
% if leftover_envs:
% ide_data = load_project_ide_data(project_dir, leftover_envs)
% end
%
% for env in leftover_envs:
if (CMAKE_BUILD_TYPE MATCHES {{ env }})
% items = load_project_ide_data(project_dir,env)
% for define in items["defines"]:
% data = ide_data[env]
% for define in data["defines"]:
add_definitions(-D'{{!re.sub(r"([\"\(\)#])", r"\\\1", define)}}')
% end
% for include in items["includes"]:
% for include in data["includes"]:
include_directories("{{ _normalize_path(to_unix_path(include)) }}")
% end
endif()

View File

@ -197,7 +197,7 @@ def compute_project_checksum(config):
def load_project_ide_data(project_dir, envs):
from platformio.commands.run import cli as cmd_run
assert envs
if not isinstance(envs, (list, tuple)):
if not isinstance(envs, (list, tuple, set)):
envs = [envs]
args = ["--project-dir", project_dir, "--target", "idedata"]
for env in envs: