Opened 14 years ago
Closed 14 years ago
#2370 closed patch (fixed)
Native and faster compilation of Python bindings
Reported by: | wonder | Owned by: | wonder |
---|---|---|---|
Priority: | major: does not work as expected | Milestone: | Version 1.5.0 |
Component: | Build/Install | Version: | Trunk |
Keywords: | Cc: | ||
Must Fix for Release: | No | Platform: | All |
Platform Version: | Awaiting user input: | no |
Description
The attached patch cleans the way how python wrappers are compiled. Until now, the compilation was driven with custom generated makefiles that didn't integrate well with CMake.
The patch uses macros from PyKDE project that make compilation native in CMake. The configuration is cleaner and it's possible to use multiple jobs (e.g. make -j3). Additionally the compilation runs several times faster: SIP is configured to generate only few (big) files instead of 100+ files (one for each class) - the compiler has to parse the headers fewer times.
Tested on linux (ubuntu). Before applying to trunk it should be confirmed that it works with other platforms.
Attachments (2)
Change History (9)
by , 14 years ago
Attachment: | pyqgis_cleanup.diff added |
---|
by , 14 years ago
Attachment: | pyqgis_cleanup_addendum.diff added |
---|
follow-up: 2 comment:1 by , 14 years ago
comment:2 by , 14 years ago
Works with minor changes for the MSVC build:
cmake/SIPMacros.cmake:
< FILE(APPEND filename "") > FILE(APPEND ${filename} "")
python/CMakeLists.txt:
> IF(MSVC) > ADD_DEFINITIONS(-DNOMINMAX) > ENDIF(MSVC)
otherwise I get errors in qgsrasterbands.h
.
Also linking the ${QT_LIBS
} is not necessary (qgis_core
and qgis_gui
already are linked with them).
comment:3 by , 14 years ago
Works on OSX (10.6, system python 2.6, SIP 4.9, PyQt 4.6). It does seem to compile faster.
I need to take a closer look to see how well it will work in the Xcode project. Right now I just run the configure.py and make, instead of using Xcode compilation (too hard for this case). Looks like configure.py is dropped. It would be nice if I can now make the Xcode project generate the sip sources and compile, then compilation can benefit from progress feedback and multicores.
comment:4 by , 14 years ago
P.S. I wonder if the new findSIP could use the same Cmake variable names as the old one? This would make current build instructions still usable (OSX uses SIP_BINARY_PATH, now SIP_EXECUTABLE, to specify SIP).
follow-up: 6 comment:5 by , 14 years ago
Juergen, thanks for testing and providing the tweaks. I'll apply them when committing the patch to trunk. I'm just wondering why it needs the -DNOMINMAX definition... maybe it should be fixed elsewhere?
William, thanks for the feedback. Original variable names can be preserved, there's no problem with it.
comment:6 by , 14 years ago
Replying to wonder:
Juergen, thanks for testing and providing the tweaks. I'll apply them when committing the patch to trunk. I'm just wondering why it needs the -DNOMINMAX definition... maybe it should be fixed elsewhere?
In Windef.h
there are min()
and max()
macros that interfere with the usage of std::numeric_limits<T>::min()
and :max()
in qgsrasterbands.h
.
MSVC doesn't tell the hierachy of includes (at least by default), so I don't really know where the Windef.h
include is from. Not sure why that wasn't an issue before.
comment:7 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Added a small change I've missed... apply also pyqgis_cleanup_addendum.diff