From 9fbce393d9632f4e8a631bfebd18476010d3e500 Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Tue, 26 Sep 2023 16:22:46 +0100 Subject: [PATCH] Windows: Fix workflows OpenSSL install --- .github/workflows/main.yml | 7 ++----- scripts/msbuild.sln.cmd | 9 +++++++++ scripts/msinstallopenssl.cmd | 5 +++++ 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 scripts/msinstallopenssl.cmd diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 62fd0a0a45..4b9b0e1a71 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,6 @@ on: env: PLATFORM: posix TESTS: yes - OPENSSL_INSTALL_PATH: C:\Program Files\OpenSSL-Win64\ jobs: build-linux: @@ -156,8 +155,7 @@ jobs: uses: microsoft/setup-msbuild@v1 - name: Install OpenSSL on Windows (choco) - run: | - choco install openssl + run: call .\scripts\msinstallopenssl.cmd shell: cmd - name: Build sln @@ -169,8 +167,7 @@ jobs: - uses: actions/checkout@v3 - name: Install OpenSSL on Windows (choco) - run: | - choco install openssl + run: call .\scripts\msinstallopenssl.cmd shell: cmd - name: MS CMake setup diff --git a/scripts/msbuild.sln.cmd b/scripts/msbuild.sln.cmd index 7c22c98a7a..7b639ffa65 100644 --- a/scripts/msbuild.sln.cmd +++ b/scripts/msbuild.sln.cmd @@ -8,6 +8,15 @@ if exist NoTLS rd /s /q NoTLS cd .. +REM Need to set OPENSSL_INSTALL_PATH so we can build with OpenSSL +IF EXIST "C:\Program Files\OpenSSL\include\openssl\ssl.h" ( + SET "OPENSSL_INSTALL_PATH=C:\Program Files\OpenSSL\" +) ELSE ( + SET "OPENSSL_INSTALL_PATH=C:\Program Files\OpenSSL-Win64\") +) + +echo OPENSSL_INSTALL_PATH = %OPENSSL_INSTALL_PATH% + rem MSBuild.exe ./win32/libcoap.sln /p:Configuration=NoTLS /p:Platform=x64 /warnaserror MSBuild.exe ./win32/libcoap.sln /p:Platform=x64 /warnaserror diff --git a/scripts/msinstallopenssl.cmd b/scripts/msinstallopenssl.cmd new file mode 100644 index 0000000000..5f14e3de70 --- /dev/null +++ b/scripts/msinstallopenssl.cmd @@ -0,0 +1,5 @@ +IF NOT EXIST "C:\Program Files\OpenSSL\include\openssl\ssl.h" ( + choco install openssl --no-progress +) ELSE ( + echo OpenSSL already installed. +)