Platform-specific macros in WEC2013 SDKs

Erwin - October 11, 2016 - 11:34

As you can see in the WEC2013 release notes, the "Platform-specific Macro" in the SDK properties is no longer supported.
This is a change from WEC7 where you could simply add platform specific macros in the SDK's options dialog:

This way you can add custom preprocessor definitions that will be set by default for all your applications developed against your SDK. So, in the picture above, the preprocessor definition BSP_REV=9999 and __RPC_ARM32__ are set (on top of some definitions set by default). The impact of adding the above to the platform-specific macro option is that when you create a (new) smart device project against the SDK built with those platform specific macros set, the compiler options will look like this:

Adding these platform-specific macros can be very useful but unfortunately WEC2013 lost the ability to easily set these "platform specific macros". In WEC7 the platform-specific macros are stored in the SDK configuration file, but even adding the

tag to the SDK's configuration file (*.sdkcfg) doesn't work in WEC2013. Luckily, there is a possibility to achieve the same in WEC2013, but it is really unnecessarily complicated. We have no idea why Microsoft killed this SDK feature in WEC2013 and made it so difficult...

The build procedure for building an SDK is different for WEC2013 and WEC7. In WEC2013 the SDK preprocessor definitions are stored in a file named microsoft.cpp.sdk_name.ce800.props, located in:

As you know, you should never modify any file in the PUBLIC (and PRIVATE) trees, but luckily this file is being copied during the sysgen phase and thus we can intercept and modify it before building the SDK.

To add custom pre-processor definitions to the WEC2013 SDK you need to modify the sysgenned and copied file microsoft.cpp.sdk_name.ce800.props in:

As you can see in the above xml, we've added BSP_REV=9999 and __RPC_ARM32__ to the PreprocessorDefinitions tag.

After this modification you can build your SDK so it will contain the custom preprocessor definitions.

To automate this process you could, for example, create a batch script that will run after the make image phase (post-makeimage). This batch script could replace or modify the microsoft.cpp.sdk_name.ce800.props file. Getting a batch file to run after the make-image phase is easily done through the project properties:

Check out this blog post for ideas on how to create a useful batch file to add, replace or remove strings from arbitrary (text) files.