Skip to content

Commit

Permalink
update READMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
cwaldren-ld committed Oct 7, 2024
1 parent 55c8b17 commit bf3522c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 30 deletions.
43 changes: 36 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ GoogleTest is used for testing.

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

## CMake Usage
## CMake Options

Various CMake options are available to customize the client/server SDK builds.

Expand All @@ -73,23 +73,52 @@ symbols aren't exposed. To run unit tests, build a static library._
> When building shared libraries C++ symbols are not exported, only the C API will be exported. This is because C++ does
> not have a stable ABI.
Basic usage example:
## Building the SDK from Source

To configure the SDK's CMake project:

```bash
mkdir -p build && cd build
cmake -G"Unix Makefiles" ..
# Use 'make' as the build system.
cmake -B build -S . -G"Unix Makefiles"
```

Slightly more advanced example - build shared libraries, and don't build any of the testing components:
To pass in config options defined in the table above, add them using `-D`:

```bash
mkdir -p build && cd build
cmake -G"Unix Makefiles" -DLD_BUILD_SHARED_LIBS=On -DBUILD_TESTING=Off ..
# Use 'make' as the build system, build shared libs, and disable testing.
cmake -B build -S . -G"Unix Makefiles" \
-DLD_BUILD_SHARED_LIBS=On \
-DBUILD_TESTING=Off ..
```

The example uses `make`, but you might instead use [Ninja](https://ninja-build.org/),
MSVC, [etc.](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html)

## Incorporating the SDK via `add_subdirectory`

The SDK can be incorporated into an existing application using CMake via `add_subdirectory.`.

```cmake
# Set SDK build options, for example:
set(LD_BUILD_SHARED_LIBS On)
add_subdirectory(path-to-cpp-sdks-repo)
target_link_libraries(your-app PRIVATE launchdarkly::client)
# ... or launchdarkly::server
````
## Incorporating the SDK via `find_package`
> [!WARNING]
> Preliminary support for `find_package` is available. The package configuration is subject to change, do not expect it
> to be stable as long as this notice is present.
```cmake
find_package(launchdarkly REQUIRED)
target_link_libraries(your-app PRIVATE launchdarkly::launchdarkly-cpp-client)
# ... or launchdarkly::launchdarkly-cpp-server
```

## LaunchDarkly overview

[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves trillions of feature flags
Expand Down
23 changes: 0 additions & 23 deletions cmake-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,3 @@ Checks that a project can include the SDK via `find_package(ldserverapi)`.
This would be a likely use-case if the SDK was installed on the system by the user.

**NOTE:** Requires SDK to be installed.

### cmake_projects/test_find_package_cpp

Checks that a C++ project can include the SDK via `find_package(ldserverapi)`.
Also checks that C++ bindings can be included without compilation issues.

**NOTE:** Requires SDK to be installed.

### cmake_projects/test_find_package_compatible_version

Checks that a project can include the SDK via `find_package(ldserverapi [version])`.
This would be a likely use-case if the user depends on a particular version of the SDK,
rather than accepting any version.

**NOTE:** Requires SDK to be installed.

### cmake_projects/test_find_package_incompatible_version

Checks that a project will *fail* to configure if `find_package(ldserverapi [version])`
is invoked with a version that isn't present on the system. The test uses a fictional
version `10.0.0`.

**NOTE:** Requires SDK to be installed.

0 comments on commit bf3522c

Please sign in to comment.