Skip to content

chore: Add basic build docs. #114

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

Merged
merged 3 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
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
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ This repository contains beta software and should not be considered ready for pr

## Packages

| SDK packages | issues | tests | docs |
|-------------------------------------------------------|---------------------------------------------|----------------------------------------------------------|--------------------------|
| Readme | issues | tests | docs |
|----------------------------------------------|---------------------------------------------|----------------------------------------------------------|--------------------------|
| [libs/client-sdk](libs/client-sdk/README.md) | [C++ Client SDK][package-cpp-client-issues] | [![Actions Status][cpp-client-ci-badge]][cpp-client-ci] |[![Documentation](https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8)](https://launchdarkly.github.io/cpp-sdks/libs/client-sdk/docs/html/)

| Shared packages | issues | tests |
Expand All @@ -18,7 +18,30 @@ This repository contains beta software and should not be considered ready for pr

## Organization

[TODO]
| Directory | Description |
|----------|--------------|
| .github | Contains CI and release process workflows and actions.
| apps | Contains example and test applications.
| cmake | Contains cmake files for importing and configuring external libraries.
| libs | Contains library implementations. This includes libraries shared within the project as well as SDK libraries like the client-sdk.
| scripts | Contains scripts used in the release process.
| vendor | Contains third party source which is directly integrated into the project. Generally third party source is included through CMake using FetchContent, but some libraries require modification specific to this repository.

## Build Requirements

### Dependencies

1. C++17 and above
1. CMake 3.19 or higher
1. Ninja (if using the included build scripts)
1. Boost version 1.80 or higher.
1. OpenSSL

Additional dependencies are fetched via CMake. For details see the `cmake` folder.

GoogleTest is used for testing.

For information on integrating an SDK package please refer to the SDK specific README.

## LaunchDarkly overview

Expand Down
34 changes: 33 additions & 1 deletion libs/client-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,39 @@ This version of the LaunchDarkly SDK is compatible with POSIX environments (Linu
Getting started
---------------

Download a release archive from the [TODO](TODO) for use in your project. Refer to the [SDK documentation](TODO) for complete instructions on installing and using the SDK.
Download a release archive from the [Github releases]https://github.com/launchdarkly/cpp-sdks/releases?q=cpp-client&expanded=true) for use in your project.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This URL should be good enough for now, and we can improve it after we have made some releases.


Refer to the [SDK documentation](https://docs.launchdarkly.com/sdk/client-side/c-c--) for complete instructions on installing and using the SDK.

### Incorporating the SDK

The SDK can be used via a C++ or C interface and can be incorporated via a static library or shared object. The static library and shared object each have their on use cases and limitations.

The static library supports both the C++ and C interface. When using the static library, you should ensure that it is compiled using a compatible configuration and toolchain. For instance, when using MSVC, it needs to be using the same runtime library.

Using the static library also requires that you have OpenSSL and Boost available at the time of compilation for your project.

The C++ API does not have a stable ABI, so if this is important to you, consider using the shared object with the C API.

Example of basic compilation using the C++ API with a static library using gcc:
```shell
g++ -I path_to_the_sdk_install/include -O3 -std=c++17 -Llib -fPIE -g main.cpp path_to_the_sdk_install/lib/liblaunchdarkly-cpp-client.a -lpthread -lstdc++ -lcrypto -lssl -lboost_json -lboost_url
```
Example of basic compilation using the C API with a static library using msvc:

```shell
cl /I include /Fe: hello.exe main.cpp /link lib/launchdarkly-cpp-client.lib
```

The shared library (so, DLL, dylib), only supports the C interface. The shared object does not require you to have Boost or OpenSSL available when linking the shared object to your project.

Example of basic compilation using the C API with a shared library using gcc:
```shell
gcc -I $(pwd)/include -Llib -fPIE -g main.c liblaunchdarkly-cpp-client.so
```

The examples here are to help with getting started, but generally speaking the SDK should be incorporated using your
build system (CMake for instance).

Learn more
-----------
Expand Down