Skip to content

build: Allow installation of python bindings.

Pierre Wendling requested to merge FtZPetruska/ns-3-dev:install-bindings into master

Description

Since version 3.36, the python bindings are no longer installed by the build tool. This MR would allow their installation to a configurable location.

This is achieved in CMake as followed:

  • If bindings are available, in macros-and-definitions.cmake, add a cache entry called NS3_BINDINGS_INSTALL_DIR that contains the relative path from the prefix to the desired install location of the bindings. This is set after Python is found as the default value relies on the version found.
  • If bindings are available, in the ns3_cmake_package function, the binding's __init__.py file is configured instead of relying on the lock file at runtime. This is done late in the configure process so all the data is available (most notably the ns3-libs variable).
  • Bindings (and Visualizer) are installed to NS3_BINDINGS_INSTALL_DIR.
  • The custom uninstall target is made last so NS3_BINDINGS_INSTALL_DIR is already set.

A notable difference is that in the build directory, python bindings are placed in build/NS3_BINDINGS_INSTALL_DIR, this allows interoperability between working from the source and working from an install.

Issue

Follow-up to !978 (closed).

Merge request reports