Abel,

cf https://github.com/OSGeo/gdal/commit/bcd4ed241503a545c1dee2819849d54117ac4e78 for a commit that adds a new vector driver.

See the additions in ogr/ogrsf_frmts/CMakeLists.txt , ogr/ogrsf_frmts/generic/ogrregisterall.cpp, ogr/ogrsf_frmts/ogrsf_frmts.h and frmts/drivers.ini

And similarly for a raster driver: https://github.com/OSGeo/gdal/commit/27203405bc33723163b3c9a66a7f8dbb82be3e9f

Even

Le 09/06/2023 à 12:11, Abel Pau a écrit :
Hi again.

Finally I managed to use CMake to create a Visual Studio sln. And it's 
beautiful see all drivers there.
But it's not crear for me what I have to modify (Cmakelist.txt,.. or something 
else) to include the new driver. I need it to be there to be able to debug.
I created a copy of, let's say, Shape and modified the Cmakelists.txt in an 
apropriate way... but I miss something because recompiling and rebuilding 
doesn't change anything and my driver is not in the project.

Anyone can make me a simple list of which files I have to modify?
THANKS in advance!!!

Abel.

-----Mensaje original-----
De: Even Rouault <even.roua...@spatialys.com>
Enviado el: divendres, 2 de juny de 2023 20:34
Para: Abel Pau <a....@creaf.uab.cat>
CC: gdal-dev@lists.osgeo.org; Howard Butler <how...@hobu.co>
Asunto: Re: [gdal-dev] Creation of a new driver from scratch


It is indeed desired that the code style of the contribution matches GDAL's 
style to some degree. GDAL provides a .clang-format file that might be helpful 
when you are editing to provide some automated conformance.
Cf https://gdal.org/development/dev_practices.html#commit-hooks also to install 
pre-commit hooks to ensure the formatting is OK & fix it if not.

https://gdal.org/development/rfc/rfc8_devguide.html also gives some hints on 
the general development practices. Generally try to stick with the conventions 
you observe in source code of drivers you take inspiration from.

You might be able to build a sln file using GDAL's CMake configuration, but 
there is no standard documentation about how to do this. Do know that most any 
configuration you provide must build and work with the standard GDAL CMake 
configuration which is typically invoked through the command line.
The source of "truth" will be the CMakeLists.txt file.

sln files are just a possible by-product of CMake that isn't stored in git.

You may just google "Cmake visual studio" as there's nothing GDAL specific 
regarding this topic. ==>
https://learn.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=msvc-170
among other links that you'll get

·         Once I have a Visual Studio solution (sln) to inspire myself, how 
should I proceed to create the driver? Is there any pre-existing pattern or 
template to follow?
Find an existing raster or vector driver in the project that matches MiraMon's 
vector or raster format and use it as a skeleton.

I would like to be able to debug it.
Familiarize yourself with GDAL's tests (a good place to learn is to look at 
GDAL's CI configuration), get tests running locally on your machine, and then 
write tests that provide test coverage for your raster or vector driver.
For vector drivers, the test_ogrsf utility that is built with GDAL is used by 
most unit tests of vector drivers to check their compliance w.r.t expectations 
of what a driver should do/not do. Not that of course this is only generic 
testing. You also need to add tests that check that the content you read from a 
test file is the one you expect.

--
http://www.spatialys.com
My software is free, but my time generally not.

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to