andreww / fox

A Fortran XML library
https://andreww.github.io/fox/
Other
58 stars 50 forks source link

Cmake portable definitions: #36

Closed victorsndvg closed 8 years ago

victorsndvg commented 8 years ago

fixed some forced definition flags problems while compiling with XLF (v14.1):

- Changed some :
              SET(FPPFLAGS -D...  
  for:
              ADD_DEFINITION(-D...

It compiles now with XLF.

victorsndvg commented 8 years ago

Hi @andreww ,

I'm not sure if I'm doing "clean" things in the last commit: -> ADD_DEFINITION(-DxlC)

Is xlC flag intended for this use?

andreww commented 8 years ago

I'm unsure about ADD_DEFINITION(-DxlC). Clearly this needs to be set for the pxfflush subroutine in fox_m_fsys_abort_flush.F90 where you need to call it flush_, but the autoconfig stuff (e.g. line 1053 in aclocal.m and line 103 in TW_FC_CHECK_FLUSH.m4) does not appear to set this. However, almost all the autoconfig stuff dates back to before my involvement with FoX and I think it mostly dates back before FoX itself. One possibility is that older versions of the IBM compiler used to set -DxlC automatically, but (and, for whatever reason, it no longer does this). Another is that FoX has never compiled properly with XLF.

A complication with this is that I don't have access to a machine with an XLF compiler. @victorsndvg - could you see if FoX compiles with:

./configure ; make 

under XLF and try to see if -DxlC is set during the compilation?

I'm tempted to apply this patch anyway once I'm back in the office tomorrow. It would be nice if we could use CTest to run the test suite - it would then be possible to automate the testing on remote machines.

victorsndvg commented 8 years ago

Hi @andreww ,

I don't know how autotools works. I can't help you at this point.

I tried to do ./configure; make and it don't crash, it seems that all are compiled properly.

At the configure step, it properly detects the flush_ method:

checking how to compile a call to FLUSH... with underscore

It also happend with CMake, but in this case we get a compile time crash,

I've added a small check inside xml_openfile subroutine:

`#ifdef xlC print*, 'xlC flag enabled'

else

print*, 'xlC flag disabled'

endif`

And it seems that xlC is not set, it returns:

xlC flag disabled

I don't know how we can fix this in CMake as clean as possible, if you have any suggestion I will be glad to help.

I think that is a good idea to integrate CTest. I will send you a merge request with this feature as soon as possible. Note that I'm not an expert using CMake tools, but I will try to give the better :)

andreww commented 8 years ago

Ok - I guess that I've not fully traced what the configure script is doing. Anyway, merged. I've added another issue to remind me that it is a good idea to check to see that ./configure and CMake are doing the same thing in this case (i.e. setting -DxlC).