Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rfc/expose object #2609

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions docs/rfcs/0001-expose-object.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Summary

Provide the build facility to expose objects of nebula for outside project.

# Motivation

Some outside projects will use some components of nebula directly, such as CPP client will reference the `common` and `interface` code. And also useful to `UDF` and `extension` systems etc. developing in future.

# Usage explanation

For the module user, just try these steps:

1. Include the nebula project, build the objects you need, such as `cmake --build --target base_obj` which will build the object containing all code in `base` source folder.
2. Find the nebula as package.
3. Include the reference headers, link with used objects. A prefix `nebula_` will be added to the object's name when exposed to outside, so user should link to `nebula_base_obj` instead of `base_obj`.

# Design explanation

There is a cmake macro to simplify exposing object:

```cmake
macro(nebula_add_export_library name type)
nebula_add_library(${name} ${type} ${ARGN})
export(
TARGETS ${name}
NAMESPACE "nebula_"
APPEND
FILE ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}-config.cmake
)
endmacro()
```

# Rationale and alternatives

# Drawbacks

# Prior art

# Unresolved questions

# Future possibilities

Maybe we should provide shared library too. And the shared library could reduce the size of test binaries.