Skip to content

Commit 362fd9c

Browse files
authored
fix: simulate mac + windows releases, fix openssl root path (#329)
Removes some obsolete openSSL CI config, as well as enables release simulation for Mac + Windows (previously only on Ubunutu.) This fixes Windows releases by setting `LD_DYNAMIC_LINK_BOOST=OFF` when building shared libraries. This was already intended to be enabled, but it was only being set on the debug releases (`build-windows.sh`). Now it is present in both the debug and non-debug releases.
1 parent 152f139 commit 362fd9c

File tree

8 files changed

+103
-51
lines changed

8 files changed

+103
-51
lines changed

.github/actions/ci/action.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ inputs:
2525
description: 'Whether to run ./build-release.sh for the CMake target'
2626
required: false
2727
default: 'false'
28+
simulate_windows_release:
29+
description: 'Whether to run ./build-release-windows.sh for the CMake target'
30+
required: false
31+
default: 'false'
2832

2933
runs:
3034
using: composite
@@ -60,9 +64,19 @@ runs:
6064
# This uses the binary, versus "make tests" because the binary
6165
# has better performance and output.
6266
run: ./build/gtest_${{ inputs.cmake_target }}
63-
- name: Simulate Release
67+
68+
- name: Simulate Release (Linux/MacOS)
6469
if: inputs.simulate_release == 'true'
6570
shell: bash
6671
run: ./scripts/build-release.sh ${{ inputs.cmake_target }}
6772
env:
6873
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
74+
OPENSSL_ROOT_DIR: ${{ steps.install-openssl.outputs.OPENSSL_ROOT_DIR }}
75+
76+
- name: Simulate Release (Windows)
77+
if: inputs.simulate_windows_release == 'true'
78+
shell: bash
79+
run: ./scripts/build-release-windows.sh ${{ inputs.cmake_target }}
80+
env:
81+
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
82+
OPENSSL_ROOT_DIR: ${{ steps.install-openssl.outputs.OPENSSL_ROOT_DIR }}

.github/actions/sdk-release/action.yml

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ runs:
3737
- name: Install boost
3838
uses: ./.github/actions/install-boost
3939
id: install-boost
40-
40+
- name: Install OpenSSL
41+
uses: ./.github/actions/install-openssl
42+
id: install-openssl
4143
- name: Build Linux Artifacts
4244
if: runner.os == 'Linux'
4345
shell: bash
@@ -49,6 +51,7 @@ runs:
4951
env:
5052
WORKSPACE: ${{ inputs.sdk_path }}
5153
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
54+
OPENSSL_ROOT_DIR: ${{ steps.install-openssl.outputs.OPENSSL_ROOT_DIR }}
5255

5356
- name: Archive Release Linux - GCC/x64/Static
5457
if: runner.os == 'Linux'
@@ -92,29 +95,13 @@ runs:
9295
if: runner.os == 'Windows'
9396
uses: ilammy/msvc-dev-cmd@v1
9497

95-
- name: Upgrade OpenSSL
96-
if: runner.os == 'Windows'
97-
shell: bash
98-
run: |
99-
choco upgrade openssl --no-progress
100-
- name: Determine OpenSSL Installation Directory
101-
if: runner.os == 'Windows'
102-
shell: bash
103-
run: |
104-
if [ -d "C:\Program Files\OpenSSL-Win64" ]; then
105-
echo "OPENSSL_ROOT_DIR=C:\Program Files\OpenSSL-Win64" >> "$GITHUB_ENV"
106-
else
107-
echo "OPENSSL_ROOT_DIR=C:\Program Files\OpenSSL" >> "$GITHUB_ENV"
108-
fi
10998
- name: Build Windows Artifacts
11099
if: runner.os == 'Windows'
111100
shell: bash
112101
env:
113-
OPENSSL_ROOT_DIR: ${{ env.OPENSSL_ROOT_DIR }}
114-
BOOST_LIBRARY_DIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3'
115-
BOOST_LIBRARYDIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3'
116102
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
117-
run: ./scripts/build-windows.sh ${{ inputs.sdk_cmake_target }}
103+
OPENSSL_ROOT_DIR: ${{ steps.install-openssl.outputs.OPENSSL_ROOT_DIR }}
104+
run: ./scripts/build-release-windows.sh ${{ inputs.sdk_cmake_target }}
118105

119106
- name: Archive Release Windows - MSVC/x64/Static
120107
if: runner.os == 'Windows'
@@ -168,14 +155,11 @@ runs:
168155
id: brew-action
169156
if: runner.os == 'macOS'
170157
shell: bash
171-
run: |
172-
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" >> "$GITHUB_ENV"
173-
export OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)
174-
175-
./scripts/build-release.sh ${{ inputs.sdk_cmake_target }}
158+
run: ./scripts/build-release.sh ${{ inputs.sdk_cmake_target }}
176159
env:
177160
WORKSPACE: ${{ inputs.sdk_path }}
178161
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
162+
OPENSSL_ROOT_DIR: ${{ steps.install-openssl.outputs.OPENSSL_ROOT_DIR }}
179163

180164
- name: Archive Release Mac - AppleClang/x64/Static
181165
if: runner.os == 'macOS'

.github/workflows/client.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
with:
4646
cmake_target: launchdarkly-cpp-client
4747
platform_version: 12
48+
simulate_release: true
4849
build-test-client-windows:
4950
runs-on: windows-2022
5051
steps:
@@ -58,3 +59,4 @@ jobs:
5859
cmake_target: launchdarkly-cpp-client
5960
platform_version: 2022
6061
toolset: msvc
62+
simulate_windows_release: true

.github/workflows/server-redis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
cmake_target: launchdarkly-cpp-server-redis-source
3434
platform_version: 12
3535
run_tests: false # TODO: figure out how to run Redis service on Mac
36+
simulate_release: true
3637
build-test-redis-windows:
3738
runs-on: windows-2022
3839
steps:
@@ -47,3 +48,4 @@ jobs:
4748
platform_version: 2022
4849
toolset: msvc
4950
run_tests: false # TODO: figure out how to run Redis service on Windows
51+
simulate_windows_release: true

.github/workflows/server.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
with:
4747
cmake_target: launchdarkly-cpp-server
4848
platform_version: 12
49+
simulate_release: true
4950
build-test-server-windows:
5051
runs-on: windows-2022
5152
steps:
@@ -56,3 +57,4 @@ jobs:
5657
cmake_target: launchdarkly-cpp-server
5758
platform_version: 2022
5859
toolset: msvc
60+
simulate_windows_release: true

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ project(
1212
LANGUAGES CXX C
1313
)
1414

15+
# Allow BOOST_ROOT to be set by CI without warnings.
16+
if (POLICY CMP0074)
17+
cmake_policy(SET CMP0074 NEW)
18+
endif ()
19+
20+
if (POLICY CMP0144)
21+
cmake_policy(SET CMP0144 NEW)
22+
endif ()
23+
1524
include(GNUInstallDirs)
1625

1726
option(BUILD_TESTING "Top-level switch for testing. Turn off to disable unit and contract tests." ON)

scripts/build-release-windows.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash -e
2+
3+
# Call this script with a CMakeTarget
4+
# ./scripts/build-release launchdarkly-cpp-client
5+
6+
set -e
7+
8+
# Special case: unlike the other targets, enabling redis support will pull in redis++ and hiredis dependencies at
9+
# configuration time. To ensure this only happens when asked, disable the support by default.
10+
build_redis="OFF"
11+
if [ "$1" == "launchdarkly-cpp-server-redis-source" ]; then
12+
build_redis="ON"
13+
fi
14+
15+
# Build a static release.
16+
mkdir -p build-static && cd build-static
17+
mkdir -p release
18+
cmake -G Ninja -D CMAKE_BUILD_TYPE=Release \
19+
-D LD_BUILD_REDIS_SUPPORT="$build_redis" \
20+
-D BUILD_TESTING=OFF \
21+
-D CMAKE_INSTALL_PREFIX=./release ..
22+
23+
cmake --build . --target "$1"
24+
cmake --install .
25+
cd ..
26+
27+
# Build a dynamic release.
28+
mkdir -p build-dynamic && cd build-dynamic
29+
mkdir -p release
30+
cmake -G Ninja -D CMAKE_BUILD_TYPE=Release \
31+
-D LD_BUILD_REDIS_SUPPORT="$build_redis" \
32+
-D BUILD_TESTING=OFF \
33+
-D LD_BUILD_SHARED_LIBS=ON \
34+
-D LD_DYNAMIC_LINK_BOOST=OFF \
35+
-D CMAKE_INSTALL_PREFIX=./release ..
36+
37+
cmake --build . --target "$1"
38+
cmake --install .
39+
cd ..
40+
41+
# Build a static debug release.
42+
mkdir -p build-static-debug && cd build-static-debug
43+
mkdir -p release
44+
cmake -G Ninja -D CMAKE_BUILD_TYPE=Debug \
45+
-D BUILD_TESTING=OFF \
46+
-D LD_BUILD_REDIS_SUPPORT="$build_redis" \
47+
-D CMAKE_INSTALL_PREFIX=./release ..
48+
49+
cmake --build . --target "$1"
50+
cmake --install .
51+
52+
cd ..
53+
54+
# Build a dynamic debug release.
55+
mkdir -p build-dynamic-debug && cd build-dynamic-debug
56+
mkdir -p release
57+
cmake -G Ninja -D CMAKE_BUILD_TYPE=Debug \
58+
-D BUILD_TESTING=OFF \
59+
-D LD_BUILD_REDIS_SUPPORT="$build_redis" \
60+
-D LD_BUILD_SHARED_LIBS=ON \
61+
-D LD_DYNAMIC_LINK_BOOST=OFF \
62+
-D CMAKE_INSTALL_PREFIX=./release ..
63+
64+
cmake --build . --target "$1"
65+
cmake --install .

scripts/build-windows.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)