kfr icon indicating copy to clipboard operation
kfr copied to clipboard

Portable Architecture Flags for Prebuilt Binary Support

Open Jman420 opened this issue 5 years ago • 2 comments

I moved all of the CPU & Architecture Detection CMake code into a dedicated cmake file and added the cmake folder as an install directory so that consuming Projects can use all that detection logic in their CMake in order to set the appropriate preprocessor definitions.

I've included snippets from my Project's CMakeList to provide some guidance. I've also implemented this method of using KFR in my Project as an example here : https://github.com/Jman420/menrva/blob/feature/test-harness/engine/src/CMakeLists.txt#L71

Jman420 avatar Mar 31 '20 19:03 Jman420

I was thinking about this more and I'm beginning to think that the CPU Detection is really best used at compilation time for KFR, but in the Consuming Project having a pre-populated cmake file with a definition for the CPU_ARCH which that KFR Library was compiled with will be even better.

The pre-populated cmake file would contain a set() for CPU_ARCH and the definition for target_set_arch(). The consuming project would then only need to use the target_set_arch() function to set the compiler flags on the appropriate builds.

Jman420 avatar Apr 01 '20 12:04 Jman420

I definitely like this 'kfr_include.cmake' approach much better.

Jman420 avatar Apr 01 '20 16:04 Jman420

In KFR6 build system and CMake configuration have been fully refactored. The recommended method now is to build kfr in a separate step and use find_packege(KFR CONFIG)

dancasarin avatar Feb 05 '24 20:02 dancasarin