1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ if(kst_3rdparty)
find_package(Matio)
find_package(CFITSIO)
find_package(LibTiff)
find_package(HDF5)
message(STATUS "----------------------------------------------")
else()
message(STATUS "Building plugins depending on 3rd party libraries suppressed")
Expand Down
32 changes: 0 additions & 32 deletions build-kst

This file was deleted.

71 changes: 71 additions & 0 deletions cmake/modules/FindHDF5.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# ***************************************************************************
# * *
# * Copyright : (C) 2010 The University of Toronto *
# * email : netterfield@astro.utoronto.ca *
# * *
# * Copyright : (C) 2010 Peter Kümmel *
# * email : syntheticpp@gmx.net *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU General Public License as published by *
# * the Free Software Foundation; either version 2 of the License, or *
# * (at your option) any later version. *
# * *
# ***************************************************************************

# copied from FindGsl.cmake

if(NOT HDF5_INCLUDEDIR OR HDF5_INCLUDEDIR STREQUAL "HDF5_INCLUDEDIR-NOTFOUND")

if(NOT kst_cross)
include(FindPkgConfig)
pkg_check_modules(PKGHDF5 QUIET hdf5 hdf5-serial hdf5-cpp)
endif()

if(NOT PKGHDF5_LIBRARIES)
message("NO PKGHDF5_LIBRARIES found")
set(PKGHDF5_LIBRARIES hdf5_cpp)
#if (UNIX)
# list(APPEND PKGHDF5_LIBRARIES ${PKGHDF5_LIBRARIES})
#endif()
endif()

set(HDF5_DIR /usr/include/hdf5)

set(HDF5_INCLUDEDIR HDF5_INCLUDEDIR-NOTFOUND CACHE STRING "" FORCE)
find_path(HDF5_INCLUDEDIR H5Cpp.h
HINTS
ENV HDF5_DIR
PATH_SUFFIXES serial
PATHS ${kst_3rdparty_dir} ${PKGHDF5_INCLUDEDIR} ${HDF5_DIR})

set(HDF5_LIBRARY_LIST)
if(kst_3rdparty_dir)
list(APPEND PKGHDF5_LIBRARIES)
endif()
foreach(it ${PKGHDF5_LIBRARIES})
set(lib lib-NOTFOUND CACHE STRING "" FORCE)
FIND_LIBRARY(lib ${it}
HINTS
ENV HDF5_DIR
PATH_SUFFIXES lib
PATHS ${kst_3rdparty_dir} ${PKGHDF5_LIBRARY_DIRS})
list(APPEND HDF5_LIBRARY_LIST ${lib})
endforeach()
set(HDF5_LIBRARIES ${HDF5_LIBRARY_LIST} CACHE STRING "" FORCE)

endif()

if(HDF5_INCLUDEDIR AND HDF5_LIBRARIES)
set(HDF5_INCLUDE_DIR ${HDF5_INCLUDEDIR} ${HDF5_INCLUDEDIR}/..)
set(hdf5 1)
message(STATUS "Found HDF5 (for hdf5 data files):")
message(STATUS " includes : ${HDF5_INCLUDE_DIR}")
message(STATUS " libraries: ${HDF5_LIBRARIES}")
message(STATUS "THIS IS A TEST")
else()
message(STATUS "Not found: HDF5, set HDF5_DIR")
endif()

message(STATUS "")

15 changes: 15 additions & 0 deletions devel-docs/BugsAndFeatures
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
kst seems to crash with zero sized data files.

------------

Save a kst session. File dialog recent files doesn't include ".kst" if it was
automatically added on save.

------------------
When you open up kst file, opening another one tends to crash kst.

------------------
No way to check matrix slave vector names in data manager.
And slave scalar names are similarly not there.

-----------------
329684

When saving a kst session the fileRelative paths for the data files are always
Expand Down
Binary file added sample_data/hdf5AllType.hdf5
Binary file not shown.
5 changes: 5 additions & 0 deletions src/datasources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,8 @@ if(tiff)
kst_link(${TIFF_LIBRARIES})
endif()

if(hdf5)
include_directories(${HDF5_INCLUDEDIR})
kst_add_plugin(. hdf5)
kst_link(${HDF5_LIBRARIES})
endif()
19 changes: 19 additions & 0 deletions src/datasources/HOWTO_add_a_datasource.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ required librqries to make it conditional (check [root]/cmake/modules)
- Once the output of cmake is as wished, the data source will be compiled: start
filling out the contents of the actual code files

**** UPDATE 2019 ****
Some further pointers on the build system from someone who has actually done this since this howto was written (I wrote the Hdf module):

- The current build system uses cmake, so ignore the qmake options
- If your datasource has no library dependancies, (unlikely) this will be an easy process, otherwise I really hope you know cmake
- You will need to update both the root CMakeLists.txt to include a find_package line for your package (this is easy, just look at the existing code)
- You will then need to write a FindLibname.txt file in [root]/cmake/modules
- You will also need to include that module in [root]/src/datasources/CMakeLists.txt
- As far as I know, what happens is the FindLibname module is called first, and then the CMakeLists in datasources is run to actually include and link the library, which means that it can fail if your FindLibname module doesn't work. Libraries at the bottom of the CMakeLists file use a conditional to avoid this problem and still build kst in the absence of the require plugin
- The FindLibname.txt module is the hardest part of this process. Look at the others for a model. This file locates the required headers as well as the required libraries to link against, so if either of those cannot be found your datasource will not work
- The header files (and libraries) are found with find_path (or find_library), which is a cmake command. You need to specify a guess (HINTS or PATHS) as to where it should look, so most of the examples use environment variables to specify the library install path
- if the libraries or header files are not found, they are set to LIBNAME-NOTFOUND. The build system will complain if it tries to compile any NOTFOUND libraries, so make sure you check for this if that could happen
- cmake uses a local variable cache that persists between runs (CMakeCache.txt in your build directory). This means that if you re-run the build a second time, most variables will already be defined (so for instance if(NOT VARNAME) will likely not be executed). This means that if a variable gets badly defined because you didn't get the cmake files exactly right, you probably want to remove the CMakeCache before re-running to get output that makes any sense

** Step 2: Implement the important classes **
To get your datasource to work, you have to:
1a) Implement the MatlabSourcePlugin::provides() (trivial)
Expand Down Expand Up @@ -99,6 +113,11 @@ Hints: you can use qDebug() as a stream to produce debug output, and the
Help->Debug Dialog also provides some interesting information, in particular
plugin loading errors.

**** UPDATE 2019 ****
As far as I can tell, the Plugin class contains a bunch of list functions that you do not need to implement. IDK what they are there for but I left them blank and everything seems to work fine. No one was adequately able to tell me what they were for, so it seems like this whole process could be made clearer by getting rid of them (or at least documenting them properly)

Kst also cannot determine where on disk a piece of data came from once it has been loaded into memory. This means that if you want to be able to plot your data against INDEX in some way (ie. the array index of the original data), you need to provide this index, either by making sure it is always stored in your data format, or by generating it when KST tries to read from it.

** Step 3: Polish **
This step is important, don't neglect it! It is important to check:
- That your code is well documented/commented and easy to understand
Expand Down
2 changes: 1 addition & 1 deletion src/datasources/bis/kstdata_bissource.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Name[it]=Lettore di flusso di immagine a bit
Name[nl]=Streamleesprogramma van BIT-image
Name[pl]=Czytnik strumienia obrazów bitowych
Name[pt]=Leitor de Fontes de Imagens Bit
Name[pt_BR]=Leitor de Fontes de Imagens Bit
Name[pt_BR]=Leitor de fontes de imagens Bit
Name[sv]=Strömläsare av bitavbildning
Name[uk]=Засіб читання Bit Image Stream
Name[x-test]=xxBit Image Stream Readerxx
Loading