Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve CMake FindPython#922

Merged
gijzelaerr merged 4 commits into
masterfrom
improve-cmake-findpython
Jun 5, 2019
Merged

Improve CMake FindPython#922
gijzelaerr merged 4 commits into
masterfrom
improve-cmake-findpython

Conversation

@ludwigschwardt
Copy link
Copy Markdown
Contributor

@ludwigschwardt ludwigschwardt commented May 24, 2019

CMake 3.12 introduced the FindPython2 and FindPython3 modules which supercede the old and buggy FindPythonLibs and FindPythonInterp modules. It finds consistent versions of the interpreter, development artifacts and NumPy include directories in one go, and does it separately for
Python 2 and 3.

I've kept the original CMake variable names since I'm not sure where they are used, but some of them may probably be removed or refactored. This has been tested on a Homebrew setup (but not on Linux), where it fixes detection errors using the previous commit.

By copying the appropriate modules from CMake, this functionality could also be made to work on the older CMake 3.7 (although this might not be old enough for all installations of casacore).

I've also kept the original versions of the CMakeLists.txt files and switch to them if CMake is older than 3.12, so this should be backwards compatible (although having four copies of everything is suboptimal...).

These versions will be used by CMake 3.11 and older.
CMake 3.12 introduced the FindPython2 and FindPython3 modules which
supercede the old and buggy FindPythonLibs and FindPythonInterp modules.
It finds consistent versions of the interpreter, development artifacts
and NumPy include directories in one go, and does it separately for
Python 2 and 3.

I've kept the original CMake variable names since I'm not sure where
they are used, but some of them may probably be removed or refactored.
This has been tested on a Homebrew setup (but not on Linux), where it
fixes detection errors using the previous commit.

By copying the appropriate modules from CMake, this functionality could
also be made to work on the older CMake 3.7 (although this might not be
old enough for all installations of casacore).
Use the newer CMakeLists if CMake version >= 3.12. It would have been
nice to use the CMAKE_VERSION variable instead, but that only appeared
in CMake 2.6.3 (and we have a minimum version of 2.6.0).

An alternative solution is to check for the presence of the FindPython2
and FindPython3 modules, using a CheckHasModule function like the one
in https://stackoverflow.com/questions/15706318.
Prefer EQUAL/GREATER to STREQUAL/STRGREATER, otherwise Boost 1.100
(Heaven forbid!) would be less than 1.67. Fix whitespace and reduce
the line count.
@ludwigschwardt
Copy link
Copy Markdown
Contributor Author

BTW, the tests passed - the first one timed out after 50 minutes though, hence the red cross...

@ludwigschwardt
Copy link
Copy Markdown
Contributor Author

ludwigschwardt commented May 28, 2019

I've rerun the tests on Travis and now they pass (maybe we should increase the timeout to 60 minutes per test?).

ludwigschwardt added a commit to ska-sa/homebrew-tap that referenced this pull request May 28, 2019
The HEAD no longer needs a patch (although it is currently running off
a feature branch to be merged as casacore/casacore#922). Now use a
single patch that turns v3.1.0 into HEAD (at least as far as the
Python build scripts are concerned).
@ludwigschwardt
Copy link
Copy Markdown
Contributor Author

Can we try this out for 3.1.1 too? It will really help my Homebrew formula along (and maybe even your Travis build).

ludwigschwardt referenced this pull request Jun 5, 2019
@gijzelaerr
Copy link
Copy Markdown
Member

@tammojan @gervandiepen what do you guys think? Include in 3.1.1? Looks good to me.

@gijzelaerr gijzelaerr requested a review from gervandiepen June 5, 2019 13:01
@gijzelaerr gijzelaerr added this to the 3.1.1 milestone Jun 5, 2019
@gervandiepen
Copy link
Copy Markdown
Contributor

gervandiepen commented Jun 5, 2019 via email

@gijzelaerr gijzelaerr merged commit e9d763b into master Jun 5, 2019
gijzelaerr added a commit that referenced this pull request Jun 5, 2019
gijzelaerr added a commit that referenced this pull request Jun 5, 2019
* prepare for 3.1.1

* feedback

* Improve CMake FindPython #922
@gijzelaerr gijzelaerr deleted the improve-cmake-findpython branch June 5, 2019 13:23
@ludwigschwardt
Copy link
Copy Markdown
Contributor Author

I tried to maintain the original script for older CMakes and at least Travis is happy, so this should hopefully be fine 🤞

@gervandiepen
Copy link
Copy Markdown
Contributor

gervandiepen commented Jun 5, 2019 via email

ludwigschwardt added a commit to ska-sa/homebrew-tap that referenced this pull request Jun 5, 2019
Thanks to casacore/casacore#922 we can also drop all the patches.
ludwigschwardt added a commit to ludwigschwardt/casacore-test-tap that referenced this pull request Jun 11, 2024
The HEAD no longer needs a patch (although it is currently running off
a feature branch to be merged as casacore/casacore#922). Now use a
single patch that turns v3.1.0 into HEAD (at least as far as the
Python build scripts are concerned).
ludwigschwardt added a commit to ludwigschwardt/casacore-test-tap that referenced this pull request Jun 11, 2024
Thanks to casacore/casacore#922 we can also drop all the patches.
ludwigschwardt added a commit to casacore/homebrew-tap that referenced this pull request Jun 11, 2024
The HEAD no longer needs a patch (although it is currently running off
a feature branch to be merged as casacore/casacore#922). Now use a
single patch that turns v3.1.0 into HEAD (at least as far as the
Python build scripts are concerned).
ludwigschwardt added a commit to casacore/homebrew-tap that referenced this pull request Jun 11, 2024
Thanks to casacore/casacore#922 we can also drop all the patches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants