Skip to content

[python3] Expose paths of included assets such as the standard library #46618

@ImOnALampshade

Description

@ImOnALampshade

Is your feature request related to a problem? Please describe.

Python3_STDLIB is exposed after find_package(Python3 COMPONENTS Interpreter Development REQUIRED) in cmake, but isn't neccisarily the python standard library you should configure embedded python to use. On my Linux build, I have to use ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR} on debug builds, but Python3_STDLIB always points toward ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}.

On Windows, it's even worse - Python3_STDLIB points to ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/python${Python3_VERSION_MAJOR}/Lib, but there is nothing to point at ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/python${Python3_VERSION_MAJOR}/DLLs, so I have to manually create point toward that.

All this leads to a bunch of CMake code I have in my own build system to set up Python3_STDLIB, Python3_DYNAMIC_LIBARIES for each triplet. Which I was under the impression is VCPKG's job.

Proposed solution

Expose Python3_STDLIB correctly (Either by pointing to the debug or non-debug version of the python libs depending on the cmake configuration, or creating a Python3_STDLIB_DEBUG variable if that isn't possible for whatever reason).

Expose Python3_DYNAMIC_LIBARIES as its own variable on systems where these are not part of the Python3_STDLIB directory (namely; windows).

If these variables are already exposed and I just missed them, it would be great to see them mentioned in the usage file for Python3, which they currently are not.

Describe alternatives you've considered

Currently I am doing the above proposed solution manually in my own build system, but it's fragile - it depends on VCPKG placing files in particular locations,

Additional context

Apps including embedded Python will require the python built-in libraries to be included with the application's distribution. Having to wrangle these all manually is a hassle for getting automated CI builds to work properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:port-featureThe issue is with a library, which is requesting new capabilities that didn’t exist

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions