openage icon indicating copy to clipboard operation
openage copied to clipboard

Document optional possibility to hardcode a Python directory

Open simonsan opened this issue 5 years ago • 2 comments

With the update to Python3.cmake -DPYTHON_DIR is used as a HINT to search for a suitable Python3 version.

Sometimes just hinting towards a location is not enough and you would like to hardcode that and let the process fail miserably if nothing is found.

To keep the hinting behaviour of -DPYTHON_DIR=<path> we should add -DFORCE_PYTHON_DIR=TRUE that will switch from hinting => enforcing the search in PYTHON_DIR and nowhere else.

The whole processing in packaged CMake runs in an extra file from Python3.cmake kept in FindPython/Support.cmake that we would need to adopt to buildsystem/modules/FindPython/Support.cmake to let it be used by CMake and overwrite default behaviour.

Be aware, that we are limited to the 3.12.x version and functionality of CMake as this is our minimum version requirement, there are newer version of the files and It would make sense to test how far we can update that with the usage of our CMake 3.12.x minimum requirement. In the newer version there is a find virtual environment handling included that could be interesting for example.

Python3_FIND_VIRTUALENV This variable defines the handling of virtual environments. It is meaningfull only when a virtual environment is active (i.e. the activate script has been evaluated). In this case, it takes precedence over Python3_FIND_REGISTRY and CMAKE_FIND_FRAMEWORK variables.

simonsan avatar Apr 30 '20 17:04 simonsan

Will be fixed with #1263 version bump of CMake to 3.16.3.

Artifacts Specification
^^^^^^^^^^^^^^^^^^^^^^^

To solve special cases, it is possible to specify directly the artifacts by
setting the following variables:

``Python3_EXECUTABLE``
  The path to the interpreter.

``Python3_COMPILER``
  The path to the compiler.

``Python3_LIBRARY``
  The path to the library. It will be used to compute the
  variables ``Python3_LIBRARIES``, ``Python3_LIBRAY_DIRS`` and
  ``Python3_RUNTIME_LIBRARY_DIRS``.

.. note::

  When an artifact is specified, all ``HINTS`` will be ignored and no search
  will be performed for this artifact.

  If more than one artifact is specified, it is the user's responsability to
  ensure the consistency of the various artifacts.

simonsan avatar May 07 '20 11:05 simonsan

@TheJJ Python3_EXECUTABLE flag needs documentation though, I feel.

simonsan avatar May 20 '20 19:05 simonsan