7

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):

enter image description here

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 :/

BPL
  • 9,632
  • 9
  • 59
  • 117
  • This question is really about how Nutika uses SCons (and not specifically about SCons) They will create Environment()'s with setting to configure how they use and configure compilers,etc. Likely you'll have to set MSSDK_DIR and/or MSSDK_VERSION to get the appropriate SDK. Also (I believe) not all SDK versions are compatible with all MSVC versions.. So make sure you have the versions which should work together installed. I think MSVC 2015 has some options to install MSSDK versions? – bdbaddog Sep 05 '18 at 19:42
  • @bdbaddog This [article](https://ntcore.com/?p=458) provides a really good explanation about the whole backwards compatibility on xp. In any case, that's why i've added all those different tags to the questions. If somebody was able to provide an explanation how to use platform toolset on the command line we could extrapolate that to be used by SCons. My guts tells me that maybe that flag is specific to `msbuild` and not `cl & link` but I don't know... Thing is, platform toolset a) modifies PE header b) change startup code c) pick up appropiate SDK. – BPL Sep 05 '18 at 20:30

1 Answers1

3

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

BPL
  • 9,632
  • 9
  • 59
  • 117