p4lang / tdi

Table-Driven Interface (TDI) for a P4-programmable backend device.
Apache License 2.0
40 stars 23 forks source link

Build artifacts and include files are copied during cmake and make #129

Open shibir007 opened 1 year ago

shibir007 commented 1 year ago

We have found that during the cmake stage itself all the header files of tdi and its third-party are copied to ${CMAKE_INSTALL_PREFIX}/include/ Few instances here: https://github.com/p4lang/tdi/blob/22cb07ac887491450d2efdb65cca727f99ecd317/CMakeLists.txt#L15C1-L17C26 https://github.com/p4lang/target-utils/blob/455fc4787a199978e0ae53bd2a6eb0cd2af1b790/CMakeLists.txt#L54

Also during make, libraries are copied to ${CMAKE_INSTALL_PREFIX}/lib. Such as below: ├── libcjson.a ├── libclish.so ├── libtarget_sys.so ├── libtarget_utils.so ├── libtdi_json_parser.so ├── libtdi_pna.so ├── libtdi_psa.so ├── libtdi.so └── libtdi_tna.so

Is this a standard practice?

From a usability point, these are the following customer requirements we are not able to meet (because of it):

  1. until make install is called the customer wants ${CMAKE_INSTALL_PREFIX} to be untouched.
  2. make uninstall should clean any file copied or created in ${CMAKE_INSTALL_PREFIX}

Probable alternative: Copy all the libs/artifacts to ${CMAKE_BINARY_DIR} so that we can internally include/link and proceed with the build. Only "make install" should ideally copy the artifacts.

In this way we can reverse everything done by make install by using make uninstall.

saynb commented 1 year ago

Feel free to take it up as long as the same artifacts are installed during make install