diff options
author | stopiccot <devnull@localhost> | 2012-02-12 12:37:34 (GMT) |
---|---|---|
committer | stopiccot <devnull@localhost> | 2012-02-12 12:37:34 (GMT) |
commit | 7db7f301f6b29b9e739b632535cb138a5d146121 (patch) | |
tree | 8bd9aeef8d2f6f697bf1bd66530701f3947b0084 | |
parent | f6e68423b7d7a8173bc8868b982e57a11826f51e (diff) | |
download | SCons-7db7f301f6b29b9e739b632535cb138a5d146121.zip SCons-7db7f301f6b29b9e739b632535cb138a5d146121.tar.gz SCons-7db7f301f6b29b9e739b632535cb138a5d146121.tar.bz2 |
Fix in Visual Studio project generation. When project contains only one *.cpp or only one *.h file, incorrect paths are generated.
-rw-r--r-- | QMTest/TestSConsMSVS.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Tool/msvs.py | 66 |
2 files changed, 29 insertions, 41 deletions
diff --git a/QMTest/TestSConsMSVS.py b/QMTest/TestSConsMSVS.py index 604f191..1cff81d 100644 --- a/QMTest/TestSConsMSVS.py +++ b/QMTest/TestSConsMSVS.py @@ -710,7 +710,7 @@ expected_vcprojfile_10_0 = """\ \t\t<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies> \t</PropertyGroup> \t<ItemGroup> -\t\t<ClInclude Include="sdk.h" /> +\t\t<ClInclude Include="sdk_dir\sdk.h" /> \t</ItemGroup> \t<ItemGroup> \t\t<ClInclude Include="test.h" /> @@ -787,7 +787,7 @@ env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='10.0', HOST_ARCH='%(HOST_ARCH)s') testsrc = ['test1.cpp', 'test2.cpp'] -testincs = ['sdk.h'] +testincs = ['sdk_dir\sdk.h'] testlocalincs = ['test.h'] testresources = ['test.rc'] testmisc = ['readme.txt'] diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index 6c273a7..4077324 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -786,19 +786,15 @@ class _GenerateV7DSP(_DSPGenerator): # First remove any common prefix commonprefix = None - if len(sources) > 1: - s = list(map(os.path.normpath, sources)) - # take the dirname because the prefix may include parts - # of the filenames (e.g. if you have 'dir\abcd' and - # 'dir\acde' then the cp will be 'dir\a' ) - cp = os.path.dirname( os.path.commonprefix(s) ) - if cp and s[0][len(cp)] == os.sep: - # +1 because the filename starts after the separator - sources = [s[len(cp)+1:] for s in sources] - commonprefix = cp - elif len(sources) == 1: - commonprefix = os.path.dirname( sources[0] ) - sources[0] = os.path.basename( sources[0] ) + s = list(map(os.path.normpath, sources)) + # take the dirname because the prefix may include parts + # of the filenames (e.g. if you have 'dir\abcd' and + # 'dir\acde' then the cp will be 'dir\a' ) + cp = os.path.dirname( os.path.commonprefix(s) ) + if cp and s[0][len(cp)] == os.sep: + # +1 because the filename starts after the separator + sources = [s[len(cp)+1:] for s in sources] + commonprefix = cp hierarchy = makeHierarchy(sources) self.printSources(hierarchy, commonprefix=commonprefix) @@ -1116,19 +1112,15 @@ class _GenerateV10DSP(_DSPGenerator): # First remove any common prefix sources = self.sources[kind] commonprefix = None - if len(sources) > 1: - s = list(map(os.path.normpath, sources)) - # take the dirname because the prefix may include parts - # of the filenames (e.g. if you have 'dir\abcd' and - # 'dir\acde' then the cp will be 'dir\a' ) - cp = os.path.dirname( os.path.commonprefix(s) ) - if cp and s[0][len(cp)] == os.sep: - # +1 because the filename starts after the separator - sources = [s[len(cp)+1:] for s in sources] - commonprefix = cp - elif len(sources) == 1: - commonprefix = os.path.dirname( sources[0] ) - sources[0] = os.path.basename( sources[0] ) + s = list(map(os.path.normpath, sources)) + # take the dirname because the prefix may include parts + # of the filenames (e.g. if you have 'dir\abcd' and + # 'dir\acde' then the cp will be 'dir\a' ) + cp = os.path.dirname( os.path.commonprefix(s) ) + if cp and s[0][len(cp)] == os.sep: + # +1 because the filename starts after the separator + sources = [s[len(cp)+1:] for s in sources] + commonprefix = cp hierarchy = makeHierarchy(sources) self.printFilters(hierarchy, kind) @@ -1143,19 +1135,15 @@ class _GenerateV10DSP(_DSPGenerator): # First remove any common prefix sources = self.sources[kind] commonprefix = None - if len(sources) > 1: - s = list(map(os.path.normpath, sources)) - # take the dirname because the prefix may include parts - # of the filenames (e.g. if you have 'dir\abcd' and - # 'dir\acde' then the cp will be 'dir\a' ) - cp = os.path.dirname( os.path.commonprefix(s) ) - if cp and s[0][len(cp)] == os.sep: - # +1 because the filename starts after the separator - sources = [s[len(cp)+1:] for s in sources] - commonprefix = cp - elif len(sources) == 1: - commonprefix = os.path.dirname( sources[0] ) - sources[0] = os.path.basename( sources[0] ) + s = list(map(os.path.normpath, sources)) + # take the dirname because the prefix may include parts + # of the filenames (e.g. if you have 'dir\abcd' and + # 'dir\acde' then the cp will be 'dir\a' ) + cp = os.path.dirname( os.path.commonprefix(s) ) + if cp and s[0][len(cp)] == os.sep: + # +1 because the filename starts after the separator + sources = [s[len(cp)+1:] for s in sources] + commonprefix = cp hierarchy = makeHierarchy(sources) self.printSources(hierarchy, kind, commonprefix, kind) |