realm / realm-core

Core database component for the Realm Mobile Database SDKs
https://realm.io
Apache License 2.0
1.01k stars 152 forks source link

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

Open kraenhansen opened 2 months ago

kraenhansen commented 2 months ago

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
sync-by-unito[bot] commented 2 months ago

➤ PM Bot commented:

Jira ticket: RCORE-2107