[gdal-dev] building just the python bindings (cmake)

Greg Troxel gdt at lexort.com
Wed May 22 07:59:31 PDT 2024


I got 3.5 to work, so I'm focusing on the 3.9 upgrade.   It seems that
3.9, vs 3.5, has withdrawn the swig generated files from the distfile.

  With 3.9, you could also do a more manual approach (not sure the
  python_generated_files target is available in 3.5)
  cmake ..
  make GDAL  # build the library
  cd swig/python
  make python_generated_files  # generate SWIG generated files
  python setup.py build

That looks like it works.  Except that I omitted the 'make GDAL'  -- in
my case, gdal is already installed.   I don't see why one would need to
build, as long as the headers and libs are available in the system.
Does that seem reasonable, or am I missing something?

It would be great if README in swig/python explained this.  The
"installation" instructions are more pointers to packaging systems, and
not so much guidance for people trying to build from source.  I realize
that almost all people who use gdal use it from packaging and do not
have the slightest idea how to build perhaps anything, but on the other
hand I would expect that a README in the sources is only read by people
who are trying to build it.

Also in README, it talks about numpy being a depdendency but not
formally required.   I think two clarificaions would be useful:

  What is lost specifically, vs "many examples and utilities"?  If you
  use it with qgis, without numpy, are things missing there too?  I'm
  willing to believe it's a big deal, but it's hard to understand.

  I am guessing that the things that need numpy work fine if you install
  this built in an environment without numpy and then later also install
  numpy, but it is unclear if numpy is a run-time-only dependency or if
  it is needed at build time.


More information about the gdal-dev mailing list