问题
Building a windows xp application using Visual Studio 2015 IDE isn't hard at all, you just need to use the right platform toolset (v120_xp or v140_xp) and just make sure you install the proper redistributable visual studio runtime dlls on the target machine, easy peasy.
Now, I've been trying to figure out how to build a windows xp application targetting windows xp without using the VS GUI but using VS2015 command line + SCons
All the SCons flags are docummented here but I don't see anything that allows me to change the platform toolset.
If you wonder what's the real meaning of the platform toolset flag... after some research I've been able to figure out what that flag really does is basically producing different PE headers that are suitable for the target machine loader, you can see a little comparison between 4 different cases below (v120, v120_xp, v140, v140_xp):
Question: How can i change the visual studio platform toolset when using visual studio command line
or when using visual studio command line + SCons
?
EDIT: I've found this Can I set the platform toolset from the command line when building with VS2010's msbuild? but I'm not sure whether that could be used via SCons :/
回答1:
After a lot of digging I've found out the best strategy to know more about the platform toolset meaning was comparing manually how this flag would affect both cl
and link
, I've already done that and here's my findings:
v120_xp
-------
link: /SUBSYSTEM:CONSOLE",5.01"
cl: /D "_USING_V110_SDK71_"
v120
----
link: /SUBSYSTEM:CONSOLE
cl:
v140_xp
--------
link: /SUBSYSTEM:CONSOLE",5.01"
cl: /D "_USING_V110_SDK71_" /Zc:inline
v140
-------
link: /SUBSYSTEM:CONSOLE
cl: /Zc:inline
I've extracted out all common parameters and left only the relevant ones affected by platform toolset. In order to know more about this whole subject I'd recommend you to read specially about the /SUBSYSTEM flags from official docs.
Also, the Executable/Include/Library/Exclude
directories will be adjusted to use windows SDK 7.
Remaining thing is to integrate these flags with SCons, that should be easy enough, for instance, you just need to adds these flags to the nuitka environment
来源:https://stackoverflow.com/questions/52152135/how-to-build-windows-xp-application-using-visual-studio-command-line-scons