Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
780 commits
Select commit Hold shift + click to select a range
ecfd9fc
update streaming tests
hroederld Mar 22, 2019
047085a
fix memoryInit (currently unsafe handling of error state)
hroederld Mar 22, 2019
6d16aca
add uthash dep
hroederld Mar 22, 2019
d9c900b
convert rest of tests to new api
hroederld Mar 22, 2019
0358617
replace segment free with segment rc decrement
hroederld Mar 22, 2019
656c245
convert allFlags store api to use reference counting
hroederld Mar 22, 2019
c98ed20
ensure prequisiteKey gets freed in details cleanup, simplify evaluati…
hroederld Mar 22, 2019
bae2e2e
fix reference count decrement
hroederld Mar 22, 2019
82f80ec
ensure subevents always get freed
hroederld Mar 22, 2019
4553f10
cleanup leaks in error conditions and generally reduce allocations
hroederld Mar 22, 2019
e7c620f
remove allocation from parse path
hroederld Mar 22, 2019
ae83d78
use new detach function instead of duplicate
hroederld Mar 22, 2019
814378b
rename FeatureCollection to FeatureCollectionItem
hroederld Mar 25, 2019
10db64a
convert ldstore interface to use static strings instead of enum
hroederld Mar 25, 2019
c7b70de
update streaming to rename flags to features
hroederld Mar 25, 2019
600733b
replace two instance of free with LDFree
hroederld Mar 25, 2019
88c7ca9
replace two unrelated instances of malloc with LDAlloc
hroederld Mar 25, 2019
3b184f8
rename flags to features in polling update
hroederld Mar 25, 2019
1effcdb
DRY up with featureKindToString
hroederld Mar 25, 2019
f7973c6
more logically organize ldstore
hroederld Mar 25, 2019
b5c88d6
update doxygen header for RC related functions
hroederld Mar 25, 2019
3bee424
correctly return NULL when RC lock construction fails
hroederld Mar 25, 2019
115e145
add sanity check assertion that current reference count is > 0 when d…
hroederld Mar 25, 2019
c686b9a
make some routines static and some parameters const
hroederld Mar 25, 2019
ea51017
replace free with LDFree in store destroy
hroederld Mar 25, 2019
7e50771
add const to ptr for addHidden
hroederld Mar 26, 2019
f64845a
rename and make jsonrc destruction static
hroederld Mar 26, 2019
2ac8b08
makeFeatureCollection -> makeFeatureCollectionItem, replacementcollec…
hroederld Mar 26, 2019
39ca5e3
Merge pull request #7 from launchdarkly/hr/refcount
hroederld Mar 27, 2019
359d26d
1.0.0 beta.1 (#8)
hroederld Mar 27, 2019
a08df4f
Merge github.com:launchdarkly/c-client-server-side
hroederld Mar 28, 2019
aef0203
update readme to refer to better distinguish between server-side and …
bwoskow-ld Mar 28, 2019
0cdb5dd
Merge pull request #10 from launchdarkly/bw/readme-updates
bwoskow-ld Mar 28, 2019
1a7c009
Merge github.com:launchdarkly/c-client-server-side
hroederld Mar 28, 2019
97bac37
Add jitter to networking backoff (#9)
hroederld Mar 28, 2019
ad113ab
Remove GMP dep (#12)
hroederld Apr 1, 2019
9f60af9
Add support for debugEventsUntilDate (#11)
hroederld Apr 2, 2019
5c93f25
Windows C++ compatibility (#13)
hroederld Apr 3, 2019
9cfae31
Window specific time parsing (#14)
hroederld Apr 4, 2019
ac06b3a
Windows CI (#15)
hroederld Apr 5, 2019
9d46358
Dynamic library symbol hygiene (#16)
hroederld Apr 5, 2019
618bb3b
Prepare 1.0.0 beta.2 (#17)
hroederld Apr 5, 2019
584a375
Merge branch 'master' of github.com:launchdarkly/c-client-server-side
hroederld Apr 5, 2019
9924f89
add back ifdef cplusplus (#18)
hroederld Apr 5, 2019
c92c603
Merge branch 'master' of github.com:launchdarkly/c-client-server-side
hroederld Apr 5, 2019
202e531
Extra build documentation (#19)
hroederld Apr 8, 2019
8b47c0c
Merge branch 'master' of github.com:launchdarkly/c-client-server-side
hroederld Apr 8, 2019
8f4e101
reorganize headers (#21)
hroederld Apr 26, 2019
061e5aa
Fix doxygen and add docgen infra (#22)
hroederld Apr 30, 2019
34da394
cmake cleanup (#24)
hroederld May 3, 2019
a68ed94
Complete doxygen coverage (#23)
hroederld May 3, 2019
9d07f90
applying markdown templates (#25)
bwoskow-ld May 13, 2019
3759bc8
bump version and update changelog (#26)
hroederld May 17, 2019
61aed0c
free subevents as append does not transfer ownership (#27)
hroederld Jun 11, 2019
d6fd94e
bump version and add memory leak info to changelog (#28)
hroederld Jun 11, 2019
a6c21b4
merge in public
hroederld Jun 11, 2019
0e73f2a
Merge branch 'master' of github.com:launchdarkly/c-server-sdk
hroederld Jun 11, 2019
e063402
Update to handle index events (#29)
hroederld Jun 25, 2019
7ae5129
switch to using milliseconds everywhere internally (#30)
hroederld Jun 26, 2019
c56eac1
adding a circleci badge to the readme (#31)
bwoskow-ld Jun 27, 2019
8a5f961
switch from checking for header end within size (usually one) to tota…
hroederld Jul 5, 2019
5c793f2
bump version constant, document changes, remove beta warning (#33)
hroederld Jul 5, 2019
c479a06
Merge github.com:launchdarkly/c-server-sdk
hroederld Jul 5, 2019
2fbdbd0
add /usr/local/include for osx (#34)
hroederld Jul 11, 2019
1ec7b98
bump version, append changelog (#35)
hroederld Jul 11, 2019
d1bbf58
Merge github.com:launchdarkly/c-server-sdk
hroederld Jul 11, 2019
0a555ce
Merge branch 'master' of github.com:launchdarkly/c-server-sdk
bwoskow-ld Jul 18, 2019
1f7569a
memset time struct (#36)
hroederld Jul 26, 2019
2616be0
bump version, document changes (#37)
hroederld Jul 26, 2019
b9bbca4
Merge github.com:launchdarkly/c-server-sdk
hroederld Jul 26, 2019
58012df
update type comparison to work with object OR array detection (#38)
hroederld Sep 6, 2019
981412d
Experimention track metric (#40)
hroederld Sep 25, 2019
323fda8
prepare 1.1.0
hroederld Sep 26, 2019
e4ebf0a
bump changelog date before release
hroederld Sep 26, 2019
7abce0b
Fix rule match explanation encoding (#42)
hroederld Sep 26, 2019
bb8773c
Merge github.com:launchdarkly/c-server-sdk
hroederld Sep 26, 2019
2e7c85a
Merge branch 'master' of github.com:launchdarkly/c-server-sdk
bwoskow-ld Oct 11, 2019
6bfe2de
Double to int variation tests, and document behavior. (#43)
hroederld Oct 22, 2019
d1804af
Merge github.com:launchdarkly/c-server-sdk
hroederld Oct 23, 2019
93937e7
Merge branch 'master' of github.com:launchdarkly/c-server-sdk
bwoskow-ld Nov 7, 2019
7228635
[ch49806] redis store (#44)
hroederld Nov 15, 2019
a6db075
[ch58854] Update cJSON to 1.7.12
hroederld Dec 11, 2019
fe02635
[ch57214] Store API v2 (#46)
hroederld Dec 23, 2019
7939622
[ch55939] add Releaser scripts, CircleCI Windows build, use custom Do…
eli-darkly Dec 23, 2019
46c1778
[ch59994] add code coverage flag
hroederld Dec 23, 2019
51fcfbb
[ch43307] put user in last bucket for a bucketing fallthrough
hroederld Dec 26, 2019
7cad004
[ch60038] dont assert on polling put failure
hroederld Dec 26, 2019
74b2f13
[ch54986] old osx clock gettime (#51)
hroederld Dec 26, 2019
e1cf4ee
[ch60053] fix redis race detection
hroederld Dec 30, 2019
79eefbc
[ch61092] Event payload ID. (#54)
hroederld Jan 14, 2020
07bbf01
[ch60589] Cache external store values (#53)
hroederld Jan 16, 2020
1aa97e9
[ch61935] Releaser for redis (#55)
hroederld Jan 17, 2020
575ff0c
merge from public after release
LaunchDarklyCI Jan 22, 2020
81f10f3
Merge github.com:launchdarkly/c-server-sdk
hroederld Feb 26, 2020
5c65559
[ch69694] reconnect consistency (#57)
hroederld Mar 25, 2020
c10b08f
[ch69694] streaming status codes (#58)
hroederld Mar 27, 2020
cdf8fbc
merge from public after release
LaunchDarklyCI Mar 31, 2020
78b1184
[ch71379] create more ideal concurrency h (#59)
hroederld Apr 1, 2020
5fc1f5a
[ch72167] api level assert (#61)
hroederld Apr 3, 2020
1721d82
[ch72078] remove higher stack assertions for system ops (#60)
hroederld Apr 3, 2020
c5a8350
[ch72307] optional asserts compilation (#62)
hroederld Apr 5, 2020
f29d338
[ch72310] cmake cleanup (#63)
hroederld Apr 5, 2020
f29e0e8
[ch72310] cleanup redis cmake
hroederld Apr 5, 2020
75f20be
[ch72763] correct find package (#65)
hroederld Apr 8, 2020
3722ccb
[ch72838] detangle headers (#66)
hroederld Apr 8, 2020
5cf420b
[ch73235] enable mock concurrency (#68)
hroederld Apr 13, 2020
e871222
[ch72863] event processing cleanup and optimization (#67)
hroederld Apr 14, 2020
aad652e
[ch73704] dedup test utils (#69)
hroederld Apr 15, 2020
42d546a
[ch73828] null user key ban (#70)
hroederld Apr 15, 2020
83d00b9
[ch73828] null user key fix (#71)
hroederld Apr 15, 2020
8f706a5
[ch73236] detach sse (#72)
hroederld Apr 17, 2020
d88c3db
[ch73698] mock backend server and polling test (#73)
hroederld Apr 21, 2020
2a27aa5
[ch74213] release bundle (#75)
hroederld Apr 26, 2020
99f0605
[ch73853] start of defensive mode (#74)
hroederld Apr 26, 2020
15826b6
[ch75034] enable and fix more warnings (#76)
hroederld Apr 26, 2020
782d374
[ch73853] add logging to existing defensive checks (#77)
hroederld Apr 26, 2020
df9e6c3
[ch75137] double for large milliseconds (#85)
hroederld Apr 28, 2020
9fffd98
[ch75136] c89 fix for loop initialization
hroederld Apr 28, 2020
f4e0cdd
[ch75131] add time.h on posix
hroederld Apr 28, 2020
ae23499
[ch75126] Fix event generation for NULL fallback
hroederld Apr 28, 2020
16b0e91
[ch73853] remove extra error channels
hroederld Apr 28, 2020
70becd6
[ch73853] Defensive JSON (#78)
hroederld Apr 28, 2020
ac1422e
[ch73853] enable defensive api by default (#81)
hroederld Apr 28, 2020
f4918da
[ch75201] custom bool type for public api (#86)
hroederld Apr 28, 2020
4932e47
[ch74995] null fallback tests (#87)
hroederld Apr 29, 2020
e61e2cb
[ch74995] basic stream mock (#88)
hroederld Apr 29, 2020
4ff7688
undelete docs directory (#91)
hroederld Apr 30, 2020
8c2fd44
Merge github.com:launchdarkly/c-server-sdk
hroederld Apr 30, 2020
3067628
Merge branch 'master' of github.com:launchdarkly/c-server-sdk-private
hroederld Apr 30, 2020
6c0e202
merge from public after release
LaunchDarklyCI Apr 30, 2020
b6aae2a
[ch76282] wrapper metadata config (#92)
hroederld May 12, 2020
77dc800
merge from public after release
LaunchDarklyCI May 12, 2020
d3d0ff4
[ch78853] Add 32 bit linux CI (#93)
hroederld Jun 5, 2020
9d29115
[ch80280] usleep error (#94)
hroederld Jun 18, 2020
2979e35
merge from public after release
LaunchDarklyCI Jun 18, 2020
460b3ed
[ch80280] skip sleep on EINTR
hroederld Jun 19, 2020
236af00
merge from public after release
LaunchDarklyCI Jun 19, 2020
8c1fc5b
[ch80617] c sdk common (#96)
hroederld Jun 22, 2020
3b51258
[ch80617] add common headers to doxygen
hroederld Jun 22, 2020
78de393
[ch81023] accept header (#98)
hroederld Jun 25, 2020
9d43c96
merge from public after release
LaunchDarklyCI Jun 25, 2020
14accbb
[ch81049] add common/include to public header export
hroederld Jun 30, 2020
94dd087
[ch81355] fix experimentation events (#100)
hroederld Jul 1, 2020
038dec6
merge from public after release
LaunchDarklyCI Jul 2, 2020
006b5ce
[ch94759] bump xcode to next circleci supported version
hroederld Nov 17, 2020
28efd98
[ch94757] cleanup staticGetValue after use in test #101
hroederld Nov 17, 2020
b58a9fb
[ch94758] run valgrind memcheck in linux ci (#103)
hroederld Nov 17, 2020
c1a53ad
[ch94776] fix helgrind warning #104
hroederld Nov 18, 2020
c5272e4
[ch94759] releaser upgrade xcode version #105
hroederld Nov 18, 2020
4344aa4
[ch95201] Update to use LDBasicLoggerThreadSafe in tests (#106)
hroederld Nov 23, 2020
fa6e7b0
merge from public after release
LaunchDarklyCI Nov 24, 2020
6bbc2ee
[ch97247] more coverage and bug fixes (#107)
hroederld Jan 8, 2021
57837a6
[ch97472] use Findhiredis (#108)
hroederld Jan 13, 2021
65acae2
merge from public after release
LaunchDarklyCI Jan 14, 2021
6c204a5
[ch99403] Add Alias method (#110)
hroederld Jan 27, 2021
d37fa42
merge from public after release
LaunchDarklyCI Jan 28, 2021
9d13969
[ch99260] Add O3 build and cleanup warnings (#109)
hroederld Jan 29, 2021
77b20b3
Update c-sdk-common (#111)
hroederld Jan 31, 2021
d66fa39
Removed the guides link
bwoskow-ld Feb 3, 2021
1e391f1
[ch100420] Hook in c-sdk-common LDUser (#112)
hroederld Feb 7, 2021
a37819e
run clang format (#113)
hroederld Feb 7, 2021
c97e586
Forgotten clang-format and C standard audit. (#114)
hroederld Feb 8, 2021
f501486
minor merge conflict in public contribution
hroederld May 13, 2021
f17458c
merge from public after release
LaunchDarklyCI May 13, 2021
39cf780
[ch109467] fix bucketBy (#115)
hroederld May 26, 2021
10e6aea
merge from public after release
LaunchDarklyCI May 26, 2021
cc1652f
[ch111014] remove stdbool.h references (#117)
hroederld Jun 9, 2021
a90bd1d
merge from public after release
LaunchDarklyCI Jun 9, 2021
8ac7180
[ch111014] Ensure modern clang passes (#118)
hroederld Jun 11, 2021
eeb6a55
[ch111482] fix OSX CI (#119)
hroederld Jun 14, 2021
4012e9d
[ch111482] fix osx releaser (#120)
hroederld Jun 14, 2021
89d5c4e
merge from public after release
LaunchDarklyCI Jun 14, 2021
c46de88
merge experimentation allocation changes
hroederld Jun 20, 2021
7405cc1
merge from public after release
LaunchDarklyCI Jun 21, 2021
e7dbe0c
[ch114396] improve flag / segment validation (#121)
hroederld Jul 20, 2021
1802b1e
merge from public after release
Jul 21, 2021
5b2497e
ch121458 Ensure that LDAllFlags returns all valid flags in the case w…
kinyoklion Sep 9, 2021
8203b89
ch121458 Handle the case where there are not any flags in the store.
kinyoklion Sep 9, 2021
22616d5
ch121458 Remove unused eval status.
kinyoklion Sep 9, 2021
6f34436
ch121458 Run test before shutting down logger.
kinyoklion Sep 10, 2021
32da843
ch121458 Address style feedback. Space after if.
kinyoklion Sep 10, 2021
20d7666
ch121458 Check that result is empty in malformed fallthrough case.
kinyoklion Sep 10, 2021
dc85aa4
ch121458 Allow for the rollout kind to be empty.
kinyoklion Sep 10, 2021
f7de8f4
ch121458 Summarize events with EVAL_SCHEMA errors.
kinyoklion Sep 13, 2021
0c357be
ch121458 Re-enable tests. Fix formatting.
kinyoklion Sep 13, 2021
4e04b92
ch121458 Remove comment about updating test.
kinyoklion Sep 13, 2021
9b61a57
Remove duplicate line.
kinyoklion Sep 14, 2021
01cb21b
Merge pull request #122 from launchdarkly/rlamb/ch121458/LDAllFlags-s…
kinyoklion Sep 14, 2021
716805f
ch123139 Allow the c-server-sdk to build from any directory on windows.
kinyoklion Sep 17, 2021
f13cc90
Merge pull request #124 from launchdarkly/rlamb/ch123139/Allow-sdk-to…
kinyoklion Sep 17, 2021
bb260be
merge from public after release
Sep 17, 2021
fe3a302
Rlamb/ch122102/add unit testing framework (#123)
kinyoklion Sep 20, 2021
0caf25e
ch123169 Add unit test reporting for circleci. (#125)
kinyoklion Sep 21, 2021
bf8b54a
Updates docs URLs
ember-stevens Sep 26, 2021
d0c2669
Merge pull request #126 from launchdarkly/emberstevens/sc-118589/url-…
ember-stevens Sep 27, 2021
e2924be
ch124211 Make google test makefile not relative. (#127)
kinyoklion Sep 28, 2021
4e9ab6b
update Releaser config and scripts to v2 model (#128)
eli-darkly Oct 12, 2021
0429973
sc-126967 Build for windows in release. (#129)
kinyoklion Oct 18, 2021
4c73636
merge from public after release
Oct 19, 2021
93476bc
SC-130264: Update PCRE download URL [Windows] (#131)
cwaldren-ld Nov 8, 2021
620f658
Remove unused headers from various source files (#130)
cwaldren-ld Nov 9, 2021
2b99d74
Fix batch of spelling issues (#133)
cwaldren-ld Dec 13, 2021
f4da52f
merge from public after release
Dec 14, 2021
625b65c
Add dedicated valgrind & helgrind analysis jobs (#136)
cwaldren-ld Jan 5, 2022
32ee854
Minor updates to language (#140)
cwaldren-ld Jan 8, 2022
2339e93
Fix language 'API Interface' -> 'API' (#141)
cwaldren-ld Jan 8, 2022
6a5fb4d
SC-121933: Add additional JSON helpers (#142)
cwaldren-ld Jan 14, 2022
68ad987
merge from public after release
Jan 20, 2022
d596053
SC-131685: Add LDVersion API (#145)
cwaldren-ld Jan 25, 2022
8353562
SC-121933: Add LDAllFlagsState API (#143)
cwaldren-ld Feb 1, 2022
f1e034a
Use CircleCI macOS Gen2 resource class. (#148)
gwhelanLD Feb 4, 2022
f22abba
SC-138968: SDK Test Harness contract implementation (#146)
cwaldren-ld Feb 14, 2022
862f242
Adds singleton info (#153)
ember-stevens Feb 15, 2022
b44e3f3
Allow LDJSONVariation to accept any type (#149)
cwaldren-ld Feb 17, 2022
0a363b1
Do not return variation index when user requests wrong flag type (#152)
cwaldren-ld Feb 17, 2022
670640e
Don't emit warnings when optional flag data is missing (#150)
cwaldren-ld Feb 17, 2022
02a743f
Remove trailing slash from streaming URI (#151)
cwaldren-ld Feb 17, 2022
b6e8e3b
SC-134551: Fix LDStoreInitialized double-free & add concurrency test …
cwaldren-ld Feb 23, 2022
c5d6e9e
Remove embedded nlohmann/json and replace with FetchContent (#157)
cwaldren-ld Feb 23, 2022
6c8d438
merge from public after release
Feb 23, 2022
048444c
Add new suppressions to handle v1.3 of SDK test harness (#158)
cwaldren-ld Mar 10, 2022
dcdb400
FileData source (#155)
belevy Mar 16, 2022
16f9e35
Fix AllFlagsState behavior when flag evaluation fails (#159)
cwaldren-ld Apr 12, 2022
6e84dad
Update testharness-suppressions to handle latest additions to upstrea…
cwaldren-ld Apr 13, 2022
14891fb
Merge TestData source (#160)
cwaldren-ld Apr 15, 2022
77b8afa
Implement service-endpoints capability for contract tests (#161)
cwaldren-ld Apr 18, 2022
8657396
Increase EventProcessor's encapsulation and add some documentation (#…
cwaldren-ld Apr 18, 2022
0dd2306
Implement config option to disable analytic events (#165)
cwaldren-ld Apr 19, 2022
fe13815
Call floor() on computed milliseconds values (#167)
cwaldren-ld Apr 20, 2022
abda1ca
merge from public after release
Apr 20, 2022
b250914
Do not generate identify events for users with empty keys (#168)
cwaldren-ld Apr 21, 2022
e333b2d
Adds link (#166)
ember-stevens Apr 22, 2022
ec988b3
Update SDK contract test suppressions (#170)
cwaldren-ld Apr 27, 2022
727dcaf
Rename master to main in PR template & update c-sdk-common subtree (#…
cwaldren-ld May 3, 2022
469a247
Set private user attributes in contract-test service (#171)
cwaldren-ld May 4, 2022
3c1fc3b
Redundant index event should not be generated after identify event (#…
cwaldren-ld May 5, 2022
d53f3e0
merge from public after release
May 6, 2022
3752ed5
Rules: null user attributes should never match (#174)
cwaldren-ld May 11, 2022
fb27671
Change debugEventsUntilDate in flag model to double (#180)
cwaldren-ld May 19, 2022
1566b9c
Add file manifest to Releaser configuration (#179)
cwaldren-ld May 19, 2022
1ff1909
merge from public after release
May 26, 2022
6675008
Fetch third-party libraries using FetchContent (#178)
cwaldren-ld Jun 1, 2022
b45ceaf
merge from public after release
Jun 2, 2022
191557c
releaser: add hashes for release artifacts (#182)
cwaldren-ld Jun 15, 2022
3e8d81a
cmake: build 3rd party dependencies as OBJECT libraries (#181)
cwaldren-ld Jun 24, 2022
2185917
merge from public after release
Jun 24, 2022
7132eb3
cmake: set PROJECT_VERSION based on version found in launchdarkly/api…
cwaldren-ld Jun 28, 2022
3c421ab
Allow for unrecognized patch paths in streaming events (#198)
cwaldren-ld Jun 30, 2022
8796927
merge from public after release
Jul 7, 2022
92fc675
Add find_package support & integration tests (#199)
cwaldren-ld Jul 11, 2022
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
17 changes: 9 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,14 @@ jobs:
name: Build
command: |
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=Release -D REDIS_STORE=ON ..
cmake --build .
cmake -D CMAKE_BUILD_TYPE=Release -D REDIS_STORE=ON -D ENABLE_CMAKE_PROJECT_TESTS=ON -D CMAKE_INSTALL_PREFIX=./INSTALL ..
cmake --build . --target install
- run:
name: Unit test
command: |
cd build
GTEST_OUTPUT="xml:$(pwd)/../reports/" make test

- store_test_results:
path: reports

Expand Down Expand Up @@ -116,8 +117,8 @@ jobs:
export CC=/usr/bin/clang-11
export CXX=/usr/bin/clang++-11
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=Release -D REDIS_STORE=ON ..
cmake --build .
cmake -D CMAKE_BUILD_TYPE=Release -D REDIS_STORE=ON -D ENABLE_CMAKE_PROJECT_TESTS=ON -D CMAKE_INSTALL_PREFIX=./INSTALL ..
cmake --build . --target install
- run:
name: Unit test
command: |
Expand Down Expand Up @@ -170,8 +171,8 @@ jobs:
name: Build
command: |
mkdir build && cd build
cmake -D REDIS_STORE=ON ..
cmake --build .
cmake -D REDIS_STORE=ON -D ENABLE_CMAKE_PROJECT_TESTS=ON CMAKE_INSTALL_PREFIX=./INSTALL ..
cmake --build . --target install
- run:
name: Test
command: |
Expand Down Expand Up @@ -202,8 +203,8 @@ jobs:
name: Build
command: |
mkdir build && cd build
cmake -D REDIS_STORE=ON ..
cmake --build .
cmake -D REDIS_STORE=ON -D ENABLE_CMAKE_PROJECT_TESTS=ON -D CMAKE_INSTALL_PREFIX=./INSTALL ..
cmake --build . --target install
- run:
name: Test
command: |
Expand Down
1 change: 1 addition & 0 deletions .ldrelease/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function Build-Sdk {
Write-Host
ExecuteOrFail {
cmake -G "Visual Studio 16 2019" -A x64 `
-D ENABLE_CMAKE_PROJECT_TESTS=ON `
-D BUILD_TESTING=${BUILD_TESTING} `
-D BUILD_SHARED_LIBS=${BUILD_SHARED} `
-D SKIP_DATABASE_TESTS=ON `
Expand Down
2 changes: 1 addition & 1 deletion .ldrelease/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ cd ..

mkdir -p build-redis-static && cd build-redis-static
mkdir -p release
cmake -D SKIP_BASE_INSTALL=ON -D REDIS_STORE=ON -D BUILD_TESTING=OFF -D CMAKE_INSTALL_PREFIX=./release ..
cmake -D SKIP_BASE_INSTALL=ON -D REDIS_STORE=ON -D BUILD_TESTING=OFF -D CMAKE_INSTALL_PREFIX=./release ..
cmake --build .
cmake --build . --target install
cd ..
Expand Down
2 changes: 1 addition & 1 deletion .ldrelease/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ SetupVSToolsEnv -architecture amd64

cd build-static
$env:GTEST_OUTPUT="xml:${PSScriptRoot}/../reports/"
ExecuteOrFail { cmake --build . --target RUN_TESTS }
ExecuteOrFail { cmake -E env CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --target RUN_TESTS }
cd ..
212 changes: 160 additions & 52 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# 3.11 is required for basic FetchContent support.
cmake_minimum_required(VERSION 3.11)

# The launchdarkly/api.h header contains the SDK's version.
Expand All @@ -11,25 +12,63 @@ if(NOT DEFINED CMAKE_MATCH_1)
endif()

project(ldserverapi
VERSION ${CMAKE_MATCH_1}
DESCRIPTION "LaunchDarkly C Server SDK"
VERSION ${CMAKE_MATCH_1}
DESCRIPTION "LaunchDarkly C Server SDK"
)

message(STATUS "LaunchDarkly C Server SDK ${PROJECT_VERSION}")

include(FetchContent)

include(CMakeFiles/uthash.cmake)
include(CMakeFiles/hexify.cmake)
include(CMakeFiles/semver.cmake)
include(CMakeFiles/sha1.cmake)
include(CMakeFiles/timestamp.cmake)
# Contains various Find files, code coverage, 3rd party library FetchContent scripts,
# and the project's Package Configuration script.
set(CMAKE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

# Download 3rd party libraries.
include(FetchContent)
include(${CMAKE_FILES}/uthash.cmake)
include(${CMAKE_FILES}/hexify.cmake)
include(${CMAKE_FILES}/semver.cmake)
include(${CMAKE_FILES}/sha1.cmake)
include(${CMAKE_FILES}/timestamp.cmake)

# Provide user configurable options.
include(CMakeDependentOption)
option(BUILD_TESTING "Enable C++ unit tests." ON)
option(BUILD_TEST_SERVICE "Build the contract test service. Requires C++" OFF)
option(REDIS_STORE "Build optional redis store support" OFF)
option(COVERAGE "Add support for generating coverage reports" OFF)
option(SKIP_DATABASE_TESTS "Do not test external store integrations" OFF)
option(SKIP_BASE_INSTALL "Do not install the base library on install" OFF)

include(CTest)
# Add an option for enabling the "CMake Project Tests" (see tests/cmake_projects README).
# These tests require testing to be enabled (BUILD_TESTING), but aren't unit tests, so are disabled by default.
cmake_dependent_option(ENABLE_CMAKE_PROJECT_TESTS
"Test integration of SDK into other CMake projects" OFF
"BUILD_TESTING" OFF
)

# Emit variables for informational/debugging purposes.
message(STATUS "LaunchDarkly - BUILD_TESTING: ${BUILD_TESTING}")
message(STATUS "LaunchDarkly - BUILD_TEST_SERVICE: ${BUILD_TEST_SERVICE}")
message(STATUS "LaunchDarkly - BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}")
message(STATUS "LaunchDarkly - REDIS_STORE: ${REDIS_STORE}")
message(STATUS "LaunchDarkly - COVERAGE: ${COVERAGE}")
message(STATUS "LaunchDarkly - SKIP_DATABASE_TESTS: ${SKIP_DATABASE_TESTS}")
message(STATUS "LaunchDarkly - SKIP_BASE_INSTALL: ${SKIP_BASE_INSTALL}")
message(STATUS "LaunchDarkly - ENABLE_CMAKE_PROJECT_TESTS: ${ENABLE_CMAKE_PROJECT_TESTS}")

# The SDK uses two system packages, CURL and PCRE.
# Use the CMAKE_FILES directory to find these packages first - necessary because FindPCRE is provided
# with the SDK (while FindCURL is provided by CMake itself.)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_FILES}")
find_package(CURL REQUIRED)
find_package(PCRE REQUIRED)

set(CMAKE_THREAD_PREFER_PTHREAD ON)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

# Build the unit test binary, and add all of the unit tests.
include(CTest)
if(BUILD_TESTING)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
configure_file(external/googletest/CMakeLists.txt.in
Expand All @@ -44,29 +83,16 @@ if(BUILD_TESTING)
${CMAKE_BINARY_DIR}/googletest-build EXCLUDE_FROM_ALL)

enable_testing()

# Adds unit tests, and if enabled, cmake project tests.
add_subdirectory(tests)
endif()


option(REDIS_STORE "Build optional redis store support" OFF)
option(COVERAGE "Add support for generating coverage reports" OFF)
option(SKIP_DATABASE_TESTS "Do not test external store integrations" OFF)
option(SKIP_BASE_INSTALL "Do not install the base library on install" OFF)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeFiles")

# Enable code coverage.
if (COVERAGE)
include(CMakeFiles/CodeCoverage.cmake)
include(${CMAKE_FILES}/CodeCoverage.cmake)
append_coverage_compiler_flags()
setup_target_for_coverage_gcovr_html(NAME coverage)
endif (COVERAGE)


find_package(CURL REQUIRED)
find_package(PCRE REQUIRED)

if(NOT DEFINED MSVC)
set(LD_LIBRARIES pthread m)
endif()

set(LD_INCLUDE_PATHS
Expand All @@ -77,14 +103,6 @@ set(LD_INCLUDE_PATHS
${PCRE_INCLUDE_DIR}
)

if(APPLE)
set(LD_INCLUDE_PATHS ${LD_INCLUDE_PATHS} "/usr/local/include")
endif(APPLE)

if (REDIS_STORE)
add_subdirectory(stores/redis)
endif (REDIS_STORE)

file(GLOB SOURCES "src/*" "src/integrations/*" "third-party/src/*" "c-sdk-common/src/*")

if(NOT DEFINED MSVC)
Expand All @@ -93,10 +111,9 @@ if(NOT DEFINED MSVC)
)
endif()

set(LD_LIBRARIES ${LD_LIBRARIES} ${CURL_LIBRARIES} ${PCRE_LIBRARIES})

# ldserverapi target -----------------------------------------------------------

# Define the main ldserverapi target.
# The 3rd party libs are included as object archives, so that static library users can include one
# artifact, rather than the ldserverapi + these dependencies individually.
add_library(ldserverapi
$<TARGET_OBJECTS:hexify>
$<TARGET_OBJECTS:semver>
Expand All @@ -105,22 +122,45 @@ add_library(ldserverapi
${SOURCES}
)

if(REDIS_STORE)
add_subdirectory(stores/redis)
endif()

# Allow linking against the target ldserverapi::ldserverapi when using find_package, or when
# using add_subdirectory.
add_library(ldserverapi::ldserverapi ALIAS ldserverapi)

target_link_libraries(ldserverapi
PRIVATE
uthash
hexify
semver
sha1
timestamp
${LD_LIBRARIES}
Threads::Threads
${CURL_LIBRARIES}
${PCRE_LIBRARIES}
)

if(NOT WIN32 AND NOT APPLE)
# Required for fmod function definition, which is implemented in libm (the c math library.)
# This is part of the c standard library on macOS, and apparently not required on Windows.
target_link_libraries(ldserverapi PRIVATE m)
endif()

target_include_directories(ldserverapi
PUBLIC "include"
"c-sdk-common/include"
PRIVATE ${LD_INCLUDE_PATHS}
PUBLIC
# During the build phase, the SDK requires headers from the shared c-sdk-common subtree and the
# normal include directory.
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/c-sdk-common/include>
# Installed headers should all be lumped into a single include directory.
$<INSTALL_INTERFACE:include>
PRIVATE
${LD_INCLUDE_PATHS}
)

# Setup compiler definitions.
target_compile_definitions(ldserverapi
PRIVATE -D LAUNCHDARKLY_CONCURRENCY_ABORT
-D LAUNCHDARKLY_USE_ASSERT
Expand Down Expand Up @@ -157,22 +197,90 @@ if(BUILD_SHARED_LIBS)
endif(BUILD_SHARED_LIBS)

if(NOT SKIP_BASE_INSTALL)
INSTALL(
TARGETS ldserverapi
DESTINATION lib
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

# All of these variables are defined relative to the build tree.
# Generally, the scheme used here is that files created in the build tree will be copied over to the install tree.
# This makes it simpler to support the add_subdirectory/find_package workflows in a unified manner.
set(LDSERVERSDK_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}")

# Path of the (to be created) cmake version configuration.
set(LDSERVERSDK_CMAKE_VERSION_CONFIG_FILE "${LDSERVERSDK_CMAKE_CONFIG_DIR}/${PROJECT_NAME}ConfigVersion.cmake")

# Path of the (to be copied/renamed) cmake package configuration.
# This file already exists in the project's cmake directory, but is copied here so the install steps are uniform.
set(LDSERVERSDK_CMAKE_PROJECT_CONFIG_FILE "${LDSERVERSDK_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Config.cmake")

# Path of the (to be created) cmake targets configuration.
set(LDSERVERSDK_CMAKE_PROJECT_TARGETS_FILE "${LDSERVERSDK_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Targets.cmake")

# Arbitrary name of the targets file, which serves to contain the ldserverapi target.
# This file allows other projects to import the target for convenient usage.
set(LDSERVERSDK_EXPORT_NAME "${PROJECT_NAME}-targets")

# Generate a version config for the SDK.
write_basic_package_version_file(${LDSERVERSDK_CMAKE_VERSION_CONFIG_FILE}
VERSION ${PACKAGE_VERSION}
COMPATIBILITY SameMajorVersion
)

# Copy over the cmake project config to the build tree. If this scheme is later changed to generate the config
# using a template, rather than including the source directly in the repo as is currently the case,
# the installation won't need to change.
configure_file(${CMAKE_FILES}/${PROJECT_NAME}Config.cmake
${LDSERVERSDK_CMAKE_PROJECT_CONFIG_FILE}
COPYONLY
)

# Instead of directly installing the library to a destination, associate it to an "export".
# The name of the export is arbitrary; it just needs to be consistent.
install(
TARGETS ${PROJECT_NAME}
EXPORT ${LDSERVERSDK_EXPORT_NAME}
)

INSTALL(
DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION include
# Take the export and generate a new CMake file containing the targets contained within.
# This lives in the build tree, and MUST NOT BE INSTALLED, since paths are relative to the build tree,
# not the install tree.
export(EXPORT ${LDSERVERSDK_EXPORT_NAME}
FILE ${LDSERVERSDK_CMAKE_PROJECT_TARGETS_FILE} # <-- build tree
NAMESPACE ldserverapi::
)

# Do the same as the above, but for the install tree. This file will take the name
# <export-name>.cmake. This results in two different export files - one for the build tree (above)
# and one for the install tree (below.)
install(EXPORT ${LDSERVERSDK_EXPORT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ldserverapi
NAMESPACE ldserverapi::
FILE ${PROJECT_NAME}Targets.cmake
)

# Install SDK include directory.
install(
DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h*"
)

INSTALL(
DIRECTORY ${PROJECT_SOURCE_DIR}/c-sdk-common/include/
DESTINATION include
# Install c-sdk-common include directory.
install(
DIRECTORY c-sdk-common/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h*"
)

# Install the custom FindPCRE module, the project config, and the version config, all to the
# install tree's cmake/ldserverapi directory.
install(
FILES
${CMAKE_FILES}/FindPCRE.cmake
${LDSERVERSDK_CMAKE_PROJECT_CONFIG_FILE}
${LDSERVERSDK_CMAKE_VERSION_CONFIG_FILE}
DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake/ldserverapi
)
endif()

# test targets ----------------------------------------------------------------
Expand Down
Loading