[gdal-dev] Where to fins my own files

Abel Pau a.pau at creaf.uab.cat
Thu Jan 18 12:16:32 PST 2024


After all that process if I search for the file in all gdal it appears twice:
d:\GitHub-repository\gdal\ogr\ogrsf_frmts\miramon\data\MM_m_idofic.csv <-- OK; where it is...

And here, with all other data files. It is correct?
d:\GitHub-repository\gdal\build\data\MM_m_idofic.csv

De: gdal-dev <gdal-dev-bounces at lists.osgeo.org> En nombre de Abel Pau via gdal-dev
Enviado el: dijous, 18 de gener de 2024 21:13
Para: Even Rouault <even.rouault at spatialys.com>; gdal-dev at lists.osgeo.org
Asunto: Re: [gdal-dev] Where to fins my own files

Even,
thanks a lot.

I moved the file to {my GitHubDir}\GDAL\ogr\ogrsf_frmts\miramon\data\MM_m_idofic.csv
I changed my CMakeLists.txt  (see it below) as you indicated. And I deleted from gdal.cmake than now has only 5 files in there)
I rebased, deleted my gdal\build directory created the project again and built this.

An when I debug it seems that CPLFindFile("gdal", "MM_m_idofic.csv"); returns NULL. If I see inside it has only one locator and it seems that should be more, now...

I am missing something?

The CMakeLists
add_gdal_driver(
  TARGET ogr_MiraMon
  SOURCES ogrmiramondatasource.cpp ogrmiramondriver.cpp ogrmiramonlayer.cpp mm_wrlayr.c mm_gdal_functions.c mmrdlayr.c
  BUILTIN)
gdal_standard_includes(ogr_MiraMon)
target_include_directories(ogr_MiraMon PRIVATE $<TARGET_PROPERTY:ogrsf_generic,SOURCE_DIR>)

set(GDAL_DATA_FILES
    ${CMAKE_CURRENT_SOURCE_DIR}/data/MM_m_idofic.csv
)
set_property(
  TARGET ${GDAL_LIB_TARGET_NAME}
  APPEND
  PROPERTY RESOURCE "${GDAL_DATA_FILES}")

Thanks again


De: Even Rouault <even.rouault at spatialys.com<mailto:even.rouault at spatialys.com>>
Enviado el: dimecres, 17 de gener de 2024 17:13
Para: Abel Pau <a.pau at creaf.uab.cat<mailto:a.pau at creaf.uab.cat>>; gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
Asunto: Re: [gdal-dev] Where to fins my own files


Abel,
Le 17/01/2024 à 15:50, Abel Pau a écrit :
Hi,
ok Even,

so, as my driver is not already online I have to do some changes at this part of the code, don’t I?

At this moment I have the file in the folder GDAL\data (my GDAL_DATA environment variable).
I call it like that.
aMMIDDBFFile=CPLFindFile("gdal", "MM_m_idofic.csv");

Do I have to move the file to somewhere? where?

I've merged the PR, so you can rebase on top of latest master

No change required in your .cpp file

The only change is to move the resource file into a data/ subdirectory within your ogr/ogrsf_frmts/XXXX driver directory

and add in ogr/ogrsf_frmts/XXX/CMakeLists.txt

set(GDAL_DATA_FILES
    ${CMAKE_CURRENT_SOURCE_DIR}/data/MM_m_idofic.csv
)
set_property(
  TARGET ${GDAL_LIB_TARGET_NAME}
  APPEND
  PROPERTY RESOURCE "${GDAL_DATA_FILES}")

Even


--

http://www.spatialys.com

My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240118/ff4d792a/attachment-0001.htm>


More information about the gdal-dev mailing list