Fix brew path on Apple Silicon (#1633)

* Fix brew path on Apple Silicon

* code review: `brew --prefix openssl`

* code review: correct mbedtls path

* code review: cmake does support autodetection of OPENSSL_ROOT_DIR
This commit is contained in:
Cœur 2024-05-04 17:42:26 +08:00 committed by GitHub
parent 3c744ceed0
commit f516e399b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 8 deletions

View File

@ -556,9 +556,6 @@ jobs:
- name: Build - name: Build
shell: bash shell: bash
run: | run: |
# NOTE: cmake does not support autodetection of OPENSSL_ROOT_DIR via brew
export OPENSSL_ROOT_DIR=/usr/local/opt/openssl
if [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_OPENSSL" ]; then if [ "${{ matrix.EVENT_MATRIX }}" == "DISABLE_OPENSSL" ]; then
EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_OPENSSL=ON" EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_OPENSSL=ON"
@ -583,7 +580,7 @@ jobs:
else else
EVENT_CMAKE_OPTIONS="" EVENT_CMAKE_OPTIONS=""
fi fi
EVENT_CMAKE_OPTIONS="$EVENT_CMAKE_OPTIONS -DMBEDTLS_ROOT_DIR=/usr/local/opt/mbedtls@2" EVENT_CMAKE_OPTIONS="$EVENT_CMAKE_OPTIONS -DMBEDTLS_ROOT_DIR=`brew --prefix mbedtls@2`"
mkdir -p build mkdir -p build
cd build cd build
@ -641,8 +638,8 @@ jobs:
- name: Build - name: Build
shell: bash shell: bash
run: | run: |
export CPPFLAGS="-I/usr/local/opt/mbedtls@2/include" export CPPFLAGS="-I`brew --prefix mbedtls@2`/include"
export LDFLAGS="-L/usr/local/opt/mbedtls@2/lib" export LDFLAGS="-L`brew --prefix mbedtls@2`/lib"
./autogen.sh ./autogen.sh
mkdir -p build mkdir -p build

View File

@ -55,8 +55,8 @@ def link_and_run(link, code):
if vcpkg_root is not None: if vcpkg_root is not None:
vcpkg = f"-DCMAKE_TOOLCHAIN_FILE={vcpkg_root}/scripts/buildsystems/vcpkg.cmake" vcpkg = f"-DCMAKE_TOOLCHAIN_FILE={vcpkg_root}/scripts/buildsystems/vcpkg.cmake"
elif platform.system() == "Darwin": elif platform.system() == "Darwin":
openssldir = '-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl' openssldir = '-DOPENSSL_ROOT_DIR=/opt/homebrew/opt/openssl'
mbedtlsdir = '-DMBEDTLS_ROOT_DIR=/usr/local/opt/mbedtls@2' mbedtlsdir = '-DMBEDTLS_ROOT_DIR=/opt/homebrew/opt/mbedtls@2'
cmd = f"cmake .." \ cmd = f"cmake .." \
f" {arch}" \ f" {arch}" \
f" {vcpkg}" \ f" {vcpkg}" \