realm-core icon indicating copy to clipboard operation
realm-core copied to clipboard

Add a CMake option to disable compilation of the FFI / C-API

Open kraenhansen opened this issue 9 months ago • 1 comments

For SDKs that don't use the FFI / C-API (such as the JS SDK), it would be great to cut down compilation time if we could configure the CMake project to avoid generating targets for the FFI / C-API. I imagine we'd add option(REALM_ENABLE_FFI "Enabled the ffi c-api" ON) around here: https://github.com/realm/realm-core/blob/e7285a374e3f497a0b2fd6fb1d5d535486c8bfbc/CMakeLists.txt#L256-L269

And use that option to either:

  1. Conditionally add the c_api subdirectory here: https://github.com/realm/realm-core/blob/master/src/realm/object-store/CMakeLists.txt#L1
  2. Alternatively, conditionally set EXCLUDE_FROM_ALL to ON for the RealmFFI (already has this on) and RealmFFIStatic targets, around here https://github.com/realm/realm-core/blob/e7285a374e3f497a0b2fd6fb1d5d535486c8bfbc/src/realm/object-store/c_api/CMakeLists.txt#L65-L80

kraenhansen avatar May 01 '24 08:05 kraenhansen