Present day compilers with the XDK

Discussion in 'Xbox (Original console)' started by weinerschnitzel, Nov 26, 2014.

  1. weinerschnitzel

    weinerschnitzel Spirited Member

    Joined:
    Sep 23, 2012
    Messages:
    153
    Likes Received:
    13
    hcf at emuxtras.net has spent some time investigating how to build parts of an xbox app with the Intel Compiler or GCC. Both of which have significantly better optimizations than MSVC, and this method also gives C++11 a chance of day on the xbox.

    Check out his tutorial here:
    http://www.emuxtras.net/forum/viewtopic.php?f=193&t=4463#p56335

    This all pretty recent, so please feel free to join in the discussion! :)
     
  2. rso

    rso Gone. See y'all elsewhere, maybe.

    Joined:
    Mar 26, 2010
    Messages:
    2,190
    Likes Received:
    447
    So it boils down to "compile your objects with icc/gcc whenever possible (mind the problems with C++ linkage though), otherwise use VS as usual". I had hoped for a more complete solution (like e.g. an updated OpenXDK-style toolchain). Oh well.

    Note that I haven't really used VS in a while, but shouldn't you be able to override the compiler and flags values for specific objects right inside of the VS solution, instead of messing around with Makefiles? Would make the whole build process a lot tidier imho.

    Also, regarding the advertized C++11/C11 features - looks like all recent library functionality (like threads, bounds checking, atomics, ...) will still be missing, unless someone finds a way to retrofit that somewhere...? (And MS's components - which all that crap needs to get linked again in the end, after all - don't even implement C99 properly, so that might be another source of problems.)
     
  3. weinerschnitzel

    weinerschnitzel Spirited Member

    Joined:
    Sep 23, 2012
    Messages:
    153
    Likes Received:
    13
    A complete OpenXDK approach would be nice, but I don't see much reason to be hopeful for it. So this method will have to do for now.

    Could you explain a little more? Intel Compiler can be used very closely with VS. Do you have a better idea for GCC?

    You're probably right about the advanced C++11 library functionality. I'm not sure of any C99 linker level discrepancies yet, but an[y ]other compiler should be able to build that code where VS2003 won't.

    Thanks for your valuable input!
     
  4. rso

    rso Gone. See y'all elsewhere, maybe.

    Joined:
    Mar 26, 2010
    Messages:
    2,190
    Likes Received:
    447
    In the properties of any compilation unit (right-click on any c/cpp file in VS) you get to set options specifically for that unit. Usually you only care about things like extra compiler flags (which would probably also be a good idea for this application since gcc takes different options than msvc), but I think there should also be a way in there to change the compiler used. That would also eliminate the need to build a library (or extend the linker command) btw, since this way the IDE retains the knowledge of what files to link in. Not to mention easier rebuilds, dependencies etc.

    Yeah, it's lucky that large parts of the C++ stdlib are usually implemented as templates, and as such aren't bound to underlying libs. And regarding C11 - you're unlikely to run into problems with any currently existing Xbox projects, because - since there's not even full C99 support in MSVC anyways - there aren't too many advanced features in use, anyways.

    Oh, and speaking of advanced features: You do have to keep in mind to pay close attention to things like struct alignment etc when mixing compilers, especially if you do that via pragmas - since compilers are allowed to just silently ignore those. Crap like that has been a constant source of "fun" for me for quite some time.

    edit: Brwosing around a bit, it seems like VS is unable to use any other compilers than "cl.exe" (icc "integrates" itself by providing a replacement for that) directly. (2005+ can, but it's still a lot of effort.) General consensus seems to be to add a "Makefile project" to the project/solution - that way you at least keep the IDE integration. You still lose debugging though, unless you also integrate gdb in some way - so I'd recommend sticking to MSVC for debug builds.
     
    Last edited: Nov 27, 2014
  5. Myria

    Myria Peppy Member

    Joined:
    Aug 21, 2012
    Messages:
    341
    Likes Received:
    14
    It probably wouldn't be that hard to get Visual Studio 2015 working with the XDK.
     
  6. weinerschnitzel

    weinerschnitzel Spirited Member

    Joined:
    Sep 23, 2012
    Messages:
    153
    Likes Received:
    13
    Could you elaborate on what would need to be done?

    I remember some people talking about trying VS 2005 with the XDK, but that talk never got anywhere.

    VS2015 would be great to let us link in highly optimized .libs that use more (all) of the C++11 features. Ya know, aside from breaking the need of an old pc or virtual ware to run VS 2003.
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page