Optional Integration

Option 1: build with SCAPIX_BRIDGE=cpp

Even with Scapix integrated into your project, the default build of your project has Scapix effectively disabled: when you don’t specify SCAPIX_BRIDGE=<Lang> parameter, it defaults to SCAPIX_BRIDGE=cpp (i.e. bridge C++ to C++), scapix::bridge::object<> becomes an empty class and your C++ code builds normally without any overhead.

Option 2: support building your project without Scapix

If previous option is not enough, you can make Scapix integration optional, by deriving your C++ classes not directly from scapix::bridge::object<>, but from some base_object<> class defined as follows:


#include <scapix/bridge/object.h>

template <typename T>
using base_object = scapix::bridge::object<T>;


template <typename T>
class base_object {};


This way your project will be using Scapix when building from CMake with Scapix integration, but will also build normally (without Scapix) in all other cases.