elastic / ml-cpp

Machine learning C++ code
Other
149 stars 62 forks source link

[ML] Add `codesign` CMake target #2683

Closed edsavage closed 1 month ago

edsavage commented 2 months ago

This PR adds the codesign_autodetect and codesign_pytorch_inference targets to CMake. These targets add the get-task-allow entitlement to the respective executables, which is necessary to allow debugging with e.g. Instruments on macOS

The codesign targets are only applicable on macOS. Attempting to run them on any other platform will fail with an explanatory message.

Labelling as a >non-issue as this is purely a development aid.

davidkyle commented 1 month ago

Thanks Ed this change will be helpful. One question, are the new cmake targets invoked automatically or do they have to be called explicitly when building debug on macOS?

edsavage commented 1 month ago

One question, are the new cmake targets invoked automatically or do they have to be called explicitly when building debug on macOS?

The new targets need to be called manually @davidkyle - something like this (for pytorch_inference)

cmake -B cmake-build-relwithdebinfo
cmake --build cmake-build-relwithdebinfo -j 8 -t install codesign_pytorch_inference