[Scons-dev] MSVS builder in combination with cross compilation

Bill Deegan bill at baddogconsulting.com
Wed Jul 16 15:33:02 EDT 2014


Tomer,

Please address such message to the users mailing list.
The dev mailing list is intended for the internal development of SCons.

Thanks,
Bill
p.s. I'm ccing the users mailinglist


On Mon, Jul 14, 2014 at 8:19 PM, Tomer Shalev <shalev.tomer at gmail.com>
wrote:

> Hello there,
>
> I work in Windows development environment. I am using the MSVS builder
> (env.MSVSProject, env.MSVSSolution) to build a VS solution in which I edit
> cross-platform code, and when I build the project is cross-compiles an .elf
> file for Linux environment.
>
> I define the following:
>
> env.AppendUnique(CCFLAGS = [
>     '-Wall',
>     '-Werror',
>     '-g',
>     '-mcpu=arm7tdmi',
>     '-DARM7',
>     '-DXXTEST',
>     '-DUSE_UART',
>     '-DMENU_TESTS',
>     '-DMY_TESTS',
>     '-DUSE_FOO',
>     ])
>
> This setup works well, and I am able to build the VS solution and project
> files, and cross-compile an .elf file from the source files I define.
>
> However, there is a bug in the Scons builder which is rather annoying. The
> VS IDE grays-out code sections that are surrounded by definitions defined
> in the Sconscript, e.g. #ifdef USE_FOO.
> It is merely a usability bug, since the code compiles as expected. The
> only issue is with the IDE (Visual Studio 2008) showing the code grayed-out
> and that there is code browsing is unavailable inside that code section.
>
> In the VS project file, the following line should be defined in order to
> remedy this issue:
> PreprocessorDefinitions="ARM7;XXTEST;USE_UART;MENU_TESTS;MY_TESTS;USE_FOO"
>
> However, the builder currently generates this definition empty. I read the
> its code and noticed that the PreprocessorDefinitions line is only
> populated according to CPPDEFINES value.
>
> I tried moving the definitions accordingly:
>
> env.AppendUnique(CCFLAGS = [
>     '-Wall',
>     '-Werror',
>     '-g',
>     '-mcpu=arm7tdmi',
>     ])
>
> env.AppendUnique(CPPDEFINES = [
>     'ARM7',
>     'XXTEST',
>     'USE_UART',
>     'MENU_TESTS',
>     'MY_TESTS',
>     'USE_FOO',
>     ])
>
>
> However, since I run the Sconscript in Windows environment, the
> compilation flags set by it are not set according to POSIX (it uses /D),
> and result in a compilation error when I cross-compile my code from Visual
> Studio (using GNU compilers).
>
> If I set env.Platform(’posix’) in the Sconscript then the MSVS builder
> fails to create the project and solution files.
>
> I created a patch to make the builder sensitive to CCFLAGS values which
> starts with '-D' and it works for me. Please see the attach patch file.
>
> However, I am not sure this is the right solution, and I would be happy to
> hear your opinion on the subject. Any help is appreciated.
>
> Thanks,
> Tomer
>
> _______________________________________________
> Scons-dev mailing list
> Scons-dev at scons.org
> http://two.pairlist.net/mailman/listinfo/scons-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/scons-dev/attachments/20140716/23525bc8/attachment.html>


More information about the Scons-dev mailing list