[Scons-users] Problem with multiple-variant MSVS project

Bill Deegan bill at baddogconsulting.com
Wed Apr 7 14:42:30 EDT 2021


Vegard,

Yup. Looks like a bug.
Please file an issue on github with your example?

-Bill

On Tue, Apr 6, 2021 at 11:30 PM Vegard Lillevoll <lilveg at gmail.com> wrote:

> Hi,
>
> That causes the error to disappear, but only the first variant (debug) is
> in the project file. Here's the output:
>
> scons: Reading SConscript files ...
>
> scons: warning: Two different environments were specified for target
> hello.vcxproj,
>         but they appear to have the same action: GenerateProject(target,
> source, env)
> File "SConstruct", line 9, in <module>
>
> scons: warning: Two different environments were specified for target
> hello.sln,
>         but they appear to have the same action: GenerateProject(target,
> source, env)
> File "SConstruct", line 9, in <module>
>
> scons: warning: Two different environments were specified for target
> hello.vcxproj.filters,
>         but they appear to have the same action: GenerateProject(target,
> source, env)
> File "\SConstruct", line 9, in <module>
> scons: done reading SConscript files.
> scons: Building targets ...
> Adding 'hello - debug|Win32' to 'hello.vcxproj'
> scons: done building targets.
>
> ons. 7. apr. 2021 kl. 00:54 skrev Bill Deegan <bill at baddogconsulting.com>:
>
>> Hmm. That might be a bug.
>>
>> Try the following:
>>
>> In your install find SCons/Tool/msvs.py
>> around line 2038 you should find:
>>
>> projectBuilder = SCons.Builder.Builder(action = '$MSVSPROJECTCOM',
>>                                        suffix = '$MSVSPROJECTSUFFIX',
>>                                        emitter = projectEmitter)
>>
>>
>> Add to that Builder() call multi=True
>>
>> Let us know if that works.
>>
>> Thanks,
>> Bill
>>
>> On Tue, Apr 6, 2021 at 12:46 AM Vegard Lillevoll <lilveg at gmail.com>
>> wrote:
>>
>>> Hi!
>>>
>>> I am trying to set up visual studio projects with debug and release
>>> builds in a large SCons project. The manual proclaims:
>>>
>>> > Multiple calls to MSVSProject with different variants are allowed; all
>>> variants will be added to the project file with their appropriate build
>>> targets and sources.
>>>
>>> However, when I try to do this, I get the error that "Multiple ways to
>>> build the same target were specified".
>>>
>>> Minimal example (SConstruct file)
>>>
>>>     import os
>>>     from SCons.Script import *
>>>
>>>     env = Environment()
>>>
>>>     for variant in ['debug', 'release']:
>>>         env.MSVSProject(
>>>             target = 'hello' + env['MSVSPROJECTSUFFIX'],
>>>             srcs = 'hello.cpp',
>>>             buildtarget = os.path.join(variant, 'hello.exe'),
>>>             variant = variant)
>>>
>>> This gives the following output:
>>>
>>>     scons: Reading SConscript files ...
>>>
>>>     scons: warning: Two different environments were specified for target
>>> hello.vcxproj,
>>>             but they appear to have the same action:
>>> GenerateProject(target, source, env)
>>>     File "SConstruct", line 7, in <module>
>>>
>>>     scons: *** Multiple ways to build the same target were specified
>>> for: hello.vcxproj  (from ['prj_inputs:"python.exe" -c "from os.path import
>>> join; import sys; sys.path = [ join(sys.prefix, \'Lib\', \'site-packages\',
>>> \'scons-4.1.0\'), join(sys.prefix, \'scons-4.1.0\'), join(sys.prefix,
>>> \'Lib\', \'site-packages\', \'scons\'), join(sys.prefix, \'scons\') ] +
>>> sys.path; import SCons.Script; SCons.Script.main()" -C "." -f
>>> SConstructutf-8; ppdefs: incpath: "debug\\hello.exe" "debug" "hello.cpp
>>> "hello.vcxproj"'] and from ['prj_inputs:"python.exe" -c "from os.path
>>> import join; import sys; sys.path = [ join(sys.prefix, \'Lib\',
>>> \'site-packages\', \'scons-4.1.0\'), join(sys.prefix, \'scons-4.1.0\'),
>>> join(sys.prefix, \'Lib\', \'site-packages\', \'scons\'), join(sys.prefix,
>>> \'scons\') ] + sys.path; import SCons.Script; SCons.Script.main()" -C "."
>>> -f SConstructutf-8; ppdefs: incpath: "release\\hello.exe" "release"
>>> "hello.cpp "hello.vcxproj"'])
>>>     File "SConstruct", line 7, in <module>
>>>
>>> Is this a bug in SCons, or am I not understanding how this is supposed
>>> to work? I have tried both versions 3.1.2 and 4.1.0.
>>>
>>> I realize that the variants can be passed in a list as a single call,
>>> but maintaining separate lists of sources and targets for different build
>>> types would not be possible without a major rewrite of the existing build
>>> infrastructure. I was hoping to use one environment per build type, and the
>>> quote from the manual makes it seem like SCons should be able to combine
>>> them into one MSVS project.
>>>
>>> Any help would be greatly appreciated!
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20210407/174dd5fc/attachment-0001.htm>


More information about the Scons-users mailing list