[Kst] CFITSIO Problem

Peter Kümmel syntheticpp at gmx.net
Wed Aug 7 16:06:14 UTC 2013


On 07.08.2013 16:12, Nicholas Chapman wrote:
> Sorry if I am being dense, but this doesn't make sense to me.  In
> [root]/cmake/src/datasources/CMakeLists.txt, the fitsimage plugin has
> the test: if(fitsimage) .... endif()

Have you read the code? ;)

https://github.com/Kst-plot/kst/blob/master/cmake/src/datasources/CMakeLists.txt

if(cfitsio)
     include_directories(${CFITSIO_INCLUDE_DIR})
     kst_add_plugin(. fitsimage)
     #kst_add_plugin(. healpix)
     kst_link(${CFITSIO_LIBRARIES})
endif()


Or what code do you use?


>
> Yet "fitsimage" isn't defined anywhere.  I even checked in
> [root]/cmake/modules as suggested by
> src/datasources/HOWTO_add_a_datasource.txt, but "fitsimage" doesn't
> appear anywhere in those files, so I don't see how this evaluates to
> true.

"fitsimage" is the target name of the plugin and must not defined before.

>
> I guess my original naive theory was that kst would check for
> directories in [root]/src/datasources with the appropriate names such
> as fitsimage, healpix, etc, then if such a directory exists, the if()
> statement would be evaluated.  I can use the solution you suggest
> "if(kst_sharp)" for now, but I would like to know the correct way to
> do it.

No, cmake/src/datasources/CMakeLists.txt checks if the necessary non-kst
libraries are available and then builds the plugin:


if(getdata)

if(cfitsio)

if(netcdf)

if(matio)

...


In the master cmake file are tests for these libraries:

https://github.com/Kst-plot/kst/blob/master/cmake/CMakeLists.txt#L146


if(kst_3rdparty)
   message(STATUS "3rd party libs for plugins--------------------")
   find_package(Getdata)
   find_package(Gsl)
   find_package(Netcdf)
   find_package(Matio)
   find_package(CFITSIO)
   message(STATUS "----------------------------------------------")
else()


Plugins could only be disabled/enables as whole with -Dkst_3rdparty=1.


So the right way is to test for if(cfitsio) or simply to add your plugin
into the existing cfitsio if().

Peter

> Nicholas
>
> On 8/6/13, Peter Kümmel <syntheticpp at gmx.net> wrote:
>> On 06.08.2013 17:04, Nicholas Chapman wrote:
>>> Hi Peter.  Thanks for all your help.  I have solved my immediate
>>> problem with getting the code to compile.  As usual the solution is
>>> obvious in hindsight.  Below is my solution, though perhaps someone
>>> can enlighten me on the better solution.
>>>
>>> To activate my plugin, I edited
>>> [root]/cmake/src/datasources/CMakeLists.txt by adding the following:
>>> if(sharp) # NLC - Added to support raw sharp data
>>> 	include_directories(${SHARP_INCLUDE_DIR} ${CFITSIO_INCLUDE_DIR})
>>> 	kst_add_plugin(. sharp)
>>> 	kst_link(${SHARP_LIBRARIES} ${CFITSIO_LIBRARIES})
>>> endif()
>>>
>>> Eventually I realized that the if statement wasn't testing to true, so
>>> I added the following before the if:
>>> kst_add_plugin(. sharp)
>>>
>>> Which of course, caused all the linker error problems.  I initially
>>> thought that this was how one activated the if() statement.  I just
>>> now tried removing the if statement and leaving the three lines inside
>>> the if().  The code now compiles.  So, my question is, how can I set
>>> the if statement to evaluate to true?
>>>
>>> Thanks for all the help,
>>>
>>> Nicholas
>>
>>
>> You should test if the library cfitsio is available,
>> and only then build your sharp plugin like it is
>> done for the fitsimage plugin.
>>
>> Or you manually control the plugin by passing an additional
>> parameter when calling cmake:
>>
>> cmake -Dkst_sharp=1
>>
>> if(kst_sharp)
>> endif()
>>
>>
>> Peter
>>
>>
>> _______________________________________________
>> Kst mailing list
>> Kst at kde.org
>> https://mail.kde.org/mailman/listinfo/kst
>>
> _______________________________________________
> Kst mailing list
> Kst at kde.org
> https://mail.kde.org/mailman/listinfo/kst
>



More information about the Kst mailing list