Mark project source and library directories for CLion IDE // Resolve #1359 Resolve #897 Resolve #1345

This commit is contained in:
Ivan Kravets
2018-02-13 19:24:02 +02:00
parent 591e876660
commit 0c2f973412
5 changed files with 39 additions and 42 deletions

View File

@ -8,7 +8,7 @@ PlatformIO 3.0
~~~~~~~~~~~~~~~~~~
* Added aliases (off, light, strict) for
`LDF Compatibility Modes <http://docs.platformio.org/page/librarymanager/ldf.html>`__
`LDF Compatibility Mode <http://docs.platformio.org/page/librarymanager/ldf.html>`__
* Show device system information (MCU, Frequency, RAM, Flash, Debugging tools)
in a build log
* Show all available upload protocols before firmware uploading in a build log
@ -17,6 +17,10 @@ PlatformIO 3.0
* Fixed project generator for Qt Creator IDE
(`issue #1303 <https://github.com/platformio/platformio-core/issues/1303>`_,
`issue #1323 <https://github.com/platformio/platformio-core/issues/1323>`_)
* Mark project source and library directories for CLion IDE
(`issue #1359 <https://github.com/platformio/platformio-core/issues/1359>`_,
`issue #1345 <https://github.com/platformio/platformio-core/issues/1345>`_,
`issue #897 <https://github.com/platformio/platformio-core/issues/897>`_)
* Fixed issue with duplicated "include" records when generating data for IDE
(`issue #1301 <https://github.com/platformio/platformio-core/issues/1301>`_)

View File

@ -117,8 +117,8 @@ def PrintConfiguration(env): # pylint: disable=too-many-branches
debug_tools = board_config.get("debug", {}).get("tools")
ram = board_config.get("upload", {}).get("maximum_ram_size")
flash = board_config.get("upload", {}).get("maximum_size")
system_data.append("%s (%s Flash)" % (util.format_filesize(ram),
util.format_filesize(flash)))
system_data.append("%s RAM (%s Flash)" % (util.format_filesize(ram),
util.format_filesize(flash)))
if platform_data:
print " ".join(platform_data)

View File

@ -30,11 +30,8 @@ class ProjectGenerator(object):
self.project_dir = project_dir
self.ide = ide
self.env_name = env_name
self._tplvars = {}
with util.cd(self.project_dir):
self.project_src_dir = util.get_projectsrc_dir()
self._gather_tplvars()
@staticmethod
@ -92,7 +89,7 @@ class ProjectGenerator(object):
def get_src_files(self):
result = []
with util.cd(self.project_dir):
for root, _, files in os.walk(self.project_src_dir):
for root, _, files in os.walk(util.get_projectsrc_dir()):
for f in files:
result.append(relpath(join(root, f)))
return result
@ -153,26 +150,20 @@ class ProjectGenerator(object):
def _gather_tplvars(self):
self._tplvars.update(self.get_project_env())
self._tplvars.update(self.get_project_build_data())
self._tplvars.update({
"project_name":
self.get_project_name(),
"src_files":
self.get_src_files(),
"user_home_dir":
abspath(expanduser("~")),
"project_dir":
self.project_dir,
"project_src_dir":
self.project_src_dir,
"systype":
util.get_systype(),
"platformio_path":
self._fix_os_path(util.where_is_program("platformio")),
"env_pathsep":
os.pathsep,
"env_path":
self._fix_os_path(os.getenv("PATH"))
})
with util.cd(self.project_dir):
self._tplvars.update({
"project_name": self.get_project_name(),
"src_files": self.get_src_files(),
"user_home_dir": abspath(expanduser("~")),
"project_dir": self.project_dir,
"project_src_dir": util.get_projectsrc_dir(),
"project_lib_dir": util.get_projectlib_dir(),
"systype": util.get_systype(),
"platformio_path": self._fix_os_path(
util.where_is_program("platformio")),
"env_pathsep": os.pathsep,
"env_path": self._fix_os_path(os.getenv("PATH"))
}) # yapf: disable
@staticmethod
def _fix_os_path(path):

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="CidrRootsConfiguration">
<sourceRoots>
<file path="$PROJECT_DIR$/src" />
</sourceRoots>
<libraryRoots>
<file path="$PROJECT_DIR$/lib" />
<file path="$PROJECT_DIR$/.piolibdeps" />
</libraryRoots>
<excludeRoots>
<file path="$PROJECT_DIR$/.pioenvs" />
</excludeRoots>
</component>
</project>

View File

@ -51,18 +51,4 @@ add_custom_target(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)
add_custom_target(
CODE_COMPLETION_PIOLIB
SOURCES lib
)
endif()
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/.piolibdeps)
add_custom_target(
CODE_COMPLETION_PIOLIBDEPS
SOURCES .piolibdeps
)
endif()
add_executable(${PROJECT_NAME} ${SRC_LIST})