Fix relative path for includes when generating project for IDE // Resolve #243

This commit is contained in:
Ivan Kravets
2015-06-27 21:20:44 +03:00
parent a581ba9814
commit ae4918bdb7
5 changed files with 20 additions and 3 deletions

View File

@ -1,7 +1,7 @@
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
VERSION = (2, 2, "0.dev4")
VERSION = (2, 2, "0.dev5")
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"

View File

@ -103,5 +103,6 @@ class ProjectGenerator(object):
"defines": (build_data['defines']
if build_data and "defines" in build_data else []),
"srcfiles": self.get_srcfiles(),
"user_home_dir": abspath(expanduser("~")),
"project_dir": self.project_dir
})

View File

@ -24,8 +24,12 @@
<tool id="org.eclipse.cdt.build.core.settings.holder.1624502120" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.239157887" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
% for include in includes:
% if include.startswith(user_home_dir):
<listOptionValue builtIn="false" value="${HOME}{{include.replace(user_home_dir, '')}}"/>
% else:
<listOptionValue builtIn="false" value="{{include}}"/>
% end
% end
</option>
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.922107295" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
% for define in defines:
@ -37,8 +41,12 @@
<tool id="org.eclipse.cdt.build.core.settings.holder.54121539" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1096940598" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
% for include in includes:
% if include.startswith(user_home_dir):
<listOptionValue builtIn="false" value="${HOME}{{include.replace(user_home_dir, '')}}"/>
% else:
<listOptionValue builtIn="false" value="{{include}}"/>
% end
% end
</option>
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1198905600" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
% for define in defines:
@ -50,8 +58,12 @@
<tool id="org.eclipse.cdt.build.core.settings.holder.1310559623" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.41298875" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
% for include in includes:
% if include.startswith(user_home_dir):
<listOptionValue builtIn="false" value="${HOME}{{include.replace(user_home_dir, '')}}"/>
% else:
<listOptionValue builtIn="false" value="{{include}}"/>
% end
% end
</option>
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.884639970" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
% for define in defines:

View File

@ -6,8 +6,12 @@ else {
}
% for include in includes:
% if include.startswith(user_home_dir):
INCLUDEPATH += "${HOME}{{include.replace(user_home_dir, "")}}"
% else:
INCLUDEPATH += "{{include}}"
% end
% end
win32:INCLUDEPATH ~= s,/,\\,g

View File

@ -39,13 +39,13 @@
<NMakeBuildCommandLine>platformio --force run</NMakeBuildCommandLine>
<NMakeCleanCommandLine>platformio --force run --target clean</NMakeCleanCommandLine>
<NMakePreprocessorDefinitions>{{";".join(defines)}}</NMakePreprocessorDefinitions>
<NMakeIncludeSearchPath>{{";".join(includes)}}</NMakeIncludeSearchPath>
<NMakeIncludeSearchPath>{{";".join(["$(HOMEPATH)%s" % i.replace(user_home_dir, "") if i.startswith(user_home_dir) else i for i in includes])}}</NMakeIncludeSearchPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<NMakeBuildCommandLine>platformio run</NMakeBuildCommandLine>
<NMakeCleanCommandLine>platformio run --target clean</NMakeCleanCommandLine>
<NMakePreprocessorDefinitions>{";".join(defines)}}</NMakePreprocessorDefinitions>
<NMakeIncludeSearchPath>{{";".join(includes)}}</NMakeIncludeSearchPath>
<NMakeIncludeSearchPath>{{";".join(["$(HOMEPATH)%s" % i.replace(user_home_dir, "") if i.startswith(user_home_dir) else i for i in includes])}}</NMakeIncludeSearchPath>
</PropertyGroup>
<ItemDefinitionGroup>
</ItemDefinitionGroup>