Compiling GlobalAIs with scons

Compiling GlobalAIs with scons

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Compiling GlobalAIs with scons

Post by hoijui »

well.. i found out that the

Code: Select all

-DSTREFLOP_X87
flag is not used when compiling the GlobalAIs. don't know if thats an error or wanted, but my Java-AI-interface GlobalAI would need this flag. sure.. i can compile it myself, with my own makefile, as anyway.. its still far from usable...
just asking:
should/can it be used there aswell?
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: Compiling GlobalAIs with scons

Post by imbaczek »

It's not needed, since AIs are technically unsynced. Adding one flag somewhere might be possible, but I have no idea what to tamper with.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Compiling GlobalAIs with scons

Post by hoijui »

...hmm..
the thing is.. that java wants the FPU to be in one state whihc is different then the state spring uses. so when calling java from spring, java resets the FPU to the state it wants it to be, and when the call returns, spring is running with the FPU state that Java uses, and spring gets sync errors. so i need to call streflop to reset the FPU to the spring state every time i did a call to Java (from the C/C++ code). so.. i need it.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Compiling GlobalAIs with scons

Post by hoijui »

hmm... so!?!?
can someone do it pls? (add the streflop flag for GlocalAIs)
who would i have to ask?
first, i dont know how to do it(looked into it once, did not get it). second, i have no submit rights.
it would also be nice, if GlobalAIs could have header files in all subfolders, but maybe someone would have problems with that.. if you dont think so.. make it possible too pls.

and ..
it would also be nice if the cheefs here could help me change the 3 things in the svn that i need, for SWIG to be able to generate successfully.
  • Command.h (a very small cosmetic change, to be found in patch 0000655)
  • CommandQueue.h (also a very small change, moving a struct from private to public, also in patch 0000655)
  • UnitDef.h add no-arg consttructor to UnitDef::UnitDefWeapon (reason can be foudn here: http://spring.clan-sy.com/phpbb/viewtop ... 8&start=60)
dann haett ich auch noch gern 'n bier und eine kippenschachtel!
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Compiling GlobalAIs with scons

Post by Tobi »

hoijui wrote:hmm... so!?!?
can someone do it pls? (add the streflop flag for GlocalAIs)
who would i have to ask?
first, i dont know how to do it(looked into it once, did not get it). second, i have no submit rights.
Maybe it's easiest for now to copy the relevant code from streflop for now:

Code: Select all

#ifdef _MSC_VER
#define STREFLOP_FSTCW(cw) do { short tmp; __asm { fstcw tmp }; (cw) = tmp; } while (0)
#define STREFLOP_FLDCW(cw) do { short tmp = (cw); __asm { fclex }; __asm { fldcw tmp }; } while (0)
#else
#define STREFLOP_FSTCW(cw) do { asm volatile ("fstcw %0" : "=m" (cw) : ); } while (0)
#define STREFLOP_FLDCW(cw) do { asm volatile ("fclex \n fldcw %0" : : "m" (cw)); } while (0)
#endif

/// Initialize the FPU for the different types
/// this may also be called to switch between code sections using
/// different precisions
inline void streflop_init() {
    unsigned short fpu_mode;
    STREFLOP_FSTCW(fpu_mode);
    fpu_mode &= 0xFCFF; // 32 bits internal operations
    STREFLOP_FLDCW(fpu_mode);
}
(Modified so it should compile without modification)
it would also be nice, if GlobalAIs could have header files in all subfolders, but maybe someone would have problems with that.. if you dont think so.. make it possible too pls.
What do you mean? Adding -I<insert every possible directory here> to compiler commandline? If so, I think that's a bad idea.
and ..
it would also be nice if the cheefs here could help me change the 3 things in the svn that i need, for SWIG to be able to generate successfully.
  • Command.h (a very small cosmetic change, to be found in patch 0000655)
  • CommandQueue.h (also a very small change, moving a struct from private to public, also in patch 0000655)
  • UnitDef.h add no-arg consttructor to UnitDef::UnitDefWeapon (reason can be foudn here: http://spring.clan-sy.com/phpbb/viewtop ... 8&start=60)
Done
dann haett ich auch noch gern 'n bier und eine kippenschachtel!
Image
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Compiling GlobalAIs with scons

Post by hoijui »

Thanks Tobi!! :-)
Tobi wrote: Adding -I<insert every possible directory here> to compiler commandline? I think that's a bad idea.
..right :D

the beer.. ;-)

aaehm... i tryed to add the code for streflop you modified for me.. and i did not get how i had to call it and it also had a compiling error. i tryed again adding the streflop flag in the scons config.. and.. well .. its now there.. i think its used whenever it compiles anything, not jsut for AIs now :D but.. so far its just for me locally, its ok.

further problems appear here again:
viewtopic.php?f=15&t=12308&start=60
Post Reply

Return to “Engine”