OpenSSL find package (#6952)

* Change cmake to use find_package for openssl

* Change cmake prefix paths

* Fix Qt prefix path

* Limit static to apple

* Re-add qt bin path

* Fix use of apple cmake variable

* Update ChangeLog

* Update CMake prefix path for mac and windows tests

* Fix windows test

* Seems to fix mac test

* Brew defined prefix paths

* Explicitly ensure all homebrew dependencies
This commit is contained in:
Kyle Bloom 2021-03-03 11:04:39 +00:00 committed by GitHub
parent b7a5da9404
commit 54cb817de8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 52 additions and 54 deletions

View file

@ -16,14 +16,19 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: install qt - name: Install brew dependencies
run: brew install qt run: |
brew list qt5 &>/dev/null || brew install qt5
brew list openssl &>/dev/null || brew install openssl
- name: Build - name: Build
run: | run: |
mkdir build mkdir build
cd build cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/local/opt/qt .. cmake \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$(brew --prefix qt5);$(brew --prefix openssl)" ..
. ./version . ./version
make -j make -j

View file

@ -12,12 +12,12 @@ jobs:
env: env:
GIT_COMMIT: ${{ github.sha }} GIT_COMMIT: ${{ github.sha }}
QT_BASE_DIR: ${{ github.workspace }}\deps\Qt
BONJOUR_BASE_DIR: ${{ github.workspace }}\deps\bonjour BONJOUR_BASE_DIR: ${{ github.workspace }}\deps\bonjour
QT_BASE_DIR: ${{ github.workspace }}\deps\Qt
QT_VERSION: 5.12.6 QT_VERSION: 5.12.6
QT_BASE_URL: http://qt.mirror.constant.com/ QT_BASE_URL: http://qt.mirror.constant.com/
BONJOUR_SDK_HOME: ${{ github.workspace }}\deps\bonjour\BonjourSDK QT_LIB_DIR: ${{ github.workspace }}\deps\Qt\5.12.6
CMAKE_PREFIX_PATH: ${{ github.workspace }}\deps\Qt\5.12.6\msvc2017_64\ OPENSSL_LIB_DIR: ${{ github.workspace }}\ext\openssl\windows
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -34,7 +34,7 @@ jobs:
run: | run: |
pip install aqtinstall pip install aqtinstall
python -m aqt install --outputdir $env:QT_BASE_DIR --base $env:QT_BASE_URL $env:QT_VERSION windows desktop win64_msvc2017_64 python -m aqt install --outputdir $env:QT_BASE_DIR --base $env:QT_BASE_URL $env:QT_VERSION windows desktop win64_msvc2017_64
cd $env:QT_BASE_DIR\$env:QT_VERSION\msvc2017_64 cd $QT_LIB_DIR\msvc2017_64
dir dir
- name: Cache Bonjour - name: Cache Bonjour
@ -47,7 +47,7 @@ jobs:
- name: Install Bonjour SDK - name: Install Bonjour SDK
if: steps.cache-bonjour.outputs.cache-hit != 'true' if: steps.cache-bonjour.outputs.cache-hit != 'true'
run: | run: |
New-Item -Force -ItemType Directory -Path ".\deps\bonjour" New-Item -Force -ItemType Directory -Path $env:BONJOUR_BASE_DIR"
$client = new-object System.Net.WebClient $client = new-object System.Net.WebClient
$client.DownloadFile("https://binaries.symless.com/bonjour/BonjourSDK.zip",".\bonjoursdk.zip") $client.DownloadFile("https://binaries.symless.com/bonjour/BonjourSDK.zip",".\bonjoursdk.zip")
[System.IO.Compression.ZipFile]::ExtractToDirectory(".\bonjoursdk.zip", $env:BONJOUR_BASE_DIR) [System.IO.Compression.ZipFile]::ExtractToDirectory(".\bonjoursdk.zip", $env:BONJOUR_BASE_DIR)
@ -56,6 +56,8 @@ jobs:
uses: microsoft/setup-msbuild@v1.0.2 uses: microsoft/setup-msbuild@v1.0.2
- name: Build - name: Build
env:
CMAKE_PREFIX_PATH: "${{ env.QT_LIB_DIR }}\\msvc2017_64\\;${{ env.OPENSSL_LIB_DIR }}\\x64"
run: | run: |
mkdir build mkdir build
cd build cd build

View file

@ -34,13 +34,12 @@ steps:
-DCMAKE_OSX_DEPLOYMENT_TARGET=$(version) \ -DCMAKE_OSX_DEPLOYMENT_TARGET=$(version) \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \ -DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CONFIGURATION_TYPES=Release \ -DCMAKE_CONFIGURATION_TYPES=Release ..
-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \
-DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib ..
displayName: 'Cmake standard' displayName: 'Cmake standard'
condition: eq(variables['buildType'], 'standard') condition: eq(variables['buildType'], 'standard')
env: env:
GIT_COMMIT: $(Build.SourceVersion) GIT_COMMIT: $(Build.SourceVersion)
CMAKE_PREFIX_PATH: "$(Qt5_DIR);/usr/local/opt/openssl"
- task: CmdLine@2 - task: CmdLine@2
inputs: inputs:
@ -54,13 +53,12 @@ steps:
-DCMAKE_OSX_ARCHITECTURES=x86_64 \ -DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CONFIGURATION_TYPES=Release \ -DCMAKE_CONFIGURATION_TYPES=Release \
-DSYNERGY_ENTERPRISE=ON \ -DSYNERGY_ENTERPRISE=ON ..
-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \
-DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib ..
displayName: 'Cmake enterprise' displayName: 'Cmake enterprise'
condition: eq(variables['buildType'], 'enterprise') condition: eq(variables['buildType'], 'enterprise')
env: env:
GIT_COMMIT: $(Build.SourceVersion) GIT_COMMIT: $(Build.SourceVersion)
CMAKE_PREFIX_PATH: "$(Qt5_DIR);/usr/local/opt/openssl"
- task: CmdLine@2 - task: CmdLine@2
inputs: inputs:
@ -77,7 +75,7 @@ steps:
- task: CmdLine@2 - task: CmdLine@2
inputs: inputs:
script: | script: |
export PATH="$(QT_PATH):$(Qt5_DIR)/bin:$PATH" export PATH="$(Qt5_DIR)/bin:$PATH"
macdeployqt $(Build.Repository.LocalPath)/build/bundle/Synergy.app -codesign="$CODESIGN_ID" macdeployqt $(Build.Repository.LocalPath)/build/bundle/Synergy.app -codesign="$CODESIGN_ID"
codesign -f --options runtime --deep -s "$CODESIGN_ID" $(Build.Repository.LocalPath)/build/bundle/Synergy.app codesign -f --options runtime --deep -s "$CODESIGN_ID" $(Build.Repository.LocalPath)/build/bundle/Synergy.app
ln -s /Applications $(Build.Repository.LocalPath)/build/bundle/Applications ln -s /Applications $(Build.Repository.LocalPath)/build/bundle/Applications

View file

@ -51,17 +51,17 @@ steps:
mkdir build64 mkdir build64
cd build64 cd build64
IF "$(buildType)"=="enterprise" ( IF "$(buildType)"=="enterprise" (
cmake -G "Visual Studio 16 2019" -A %MSARCH% -V -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=%QT_PATH% -DSYNERGY_ENTERPRISE=ON .. cmake -G "Visual Studio 16 2019" -A %MSARCH% -V -DCMAKE_BUILD_TYPE=Release -DSYNERGY_ENTERPRISE=ON ..
) else ( ) else (
cmake -G "Visual Studio 16 2019" -A %MSARCH% -V -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=%QT_PATH% .. cmake -G "Visual Studio 16 2019" -A %MSARCH% -V -DCMAKE_BUILD_TYPE=Release ..
) )
displayName: 'Cmake x64 Standard' displayName: 'Cmake x64 Standard'
env: env:
ENV_BAT: $(ENV_BAT) ENV_BAT: $(ENV_BAT)
BONJOUR_SDK_DIR: $(BONJOUR_SDK_DIR) BONJOUR_SDK_DIR: $(BONJOUR_SDK_DIR)
QT_PATH: $(QT_BIN_PATH)
MSARCH: 'x64' MSARCH: 'x64'
GIT_COMMIT: $(Build.SourceVersion) GIT_COMMIT: $(Build.SourceVersion)
CMAKE_PREFIX_PATH: "$(QT_BIN_PATH);$(Build.Repository.LocalPath)\\ext\\openssl\\windows\\x64"
- script: | - script: |
call "%ENV_BAT%" -arch=x64 call "%ENV_BAT%" -arch=x64
@ -79,17 +79,17 @@ steps:
mkdir build32 mkdir build32
cd build32 cd build32
IF "$(buildType)"=="enterprise" ( IF "$(buildType)"=="enterprise" (
cmake -G "Visual Studio 16 2019" -A %MSARCH% -V -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=%QT_PATH% -DSYNERGY_ENTERPRISE=ON .. cmake -G "Visual Studio 16 2019" -A %MSARCH% -V -DCMAKE_BUILD_TYPE=Release -DSYNERGY_ENTERPRISE=ON ..
) else ( ) else (
cmake -G "Visual Studio 16 2019" -A %MSARCH% -V -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=%QT_PATH% .. cmake -G "Visual Studio 16 2019" -A %MSARCH% -V -DCMAKE_BUILD_TYPE=Release ..
) )
displayName: 'Cmake x32 Standard' displayName: 'Cmake x32 Standard'
env: env:
ENV_BAT: $(ENV_BAT) ENV_BAT: $(ENV_BAT)
BONJOUR_SDK_DIR: $(BONJOUR_SDK_DIR) BONJOUR_SDK_DIR: $(BONJOUR_SDK_DIR)
QT_PATH: $(QT_BIN_PATH_32)
MSARCH: 'Win32' MSARCH: 'Win32'
GIT_COMMIT: $(Build.SourceVersion) GIT_COMMIT: $(Build.SourceVersion)
CMAKE_PREFIX_PATH: "$(QT_BIN_PATH_32);$(Build.Repository.LocalPath)\\ext\\openssl\\windows\\x86"
- script: | - script: |
call "%ENV_BAT%" -arch=x86 call "%ENV_BAT%" -arch=x86

View file

@ -315,31 +315,13 @@ endif()
# #
# OpenSSL # OpenSSL
# #
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") # Apple has to use static libraries because
set (OPENSSL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/ext/openssl/windows) # "Use of the Apple-provided OpenSSL libraries by apps is strongly discouraged."
if (CMAKE_SIZEOF_VOID_P EQUAL 8) # https://developer.apple.com/library/archive/documentation/Security/Conceptual/cryptoservices/SecureNetworkCommunicationAPIs/SecureNetworkCommunicationAPIs.html
set (OPENSSL_ROOT "${OPENSSL_ROOT}/x64") if(APPLE)
else() set(OPENSSL_USE_STATIC_LIBS TRUE)
set (OPENSSL_ROOT "${OPENSSL_ROOT}/x86")
endif()
include_directories (BEFORE SYSTEM ${OPENSSL_ROOT}/include)
set (OPENSSL_LIBS
${OPENSSL_ROOT}/lib/libssl.lib
${OPENSSL_ROOT}/lib/libcrypto.lib
)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set (OPENSSL_ROOT /usr/local/opt/openssl)
include_directories (BEFORE SYSTEM ${OPENSSL_ROOT}/include)
set (OPENSSL_LIBS
${OPENSSL_ROOT}/lib/libssl.a
${OPENSSL_ROOT}/lib/libcrypto.a
)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux|.*BSD|DragonFly")
set (OPENSSL_LIBS ssl crypto)
else()
message (FATAL_ERROR "Couldn't find OpenSSL")
endif() endif()
find_package(OpenSSL REQUIRED)
# #
# Check submodules # Check submodules

View file

@ -40,6 +40,7 @@ Enhancements:
- #6938 Remove auto config message from the main window - #6938 Remove auto config message from the main window
- #6941 Add Raspberry Pi Builds - #6941 Add Raspberry Pi Builds
- #6949 Add a new option SYNERGY_AUTOCONFIG to exclude autoconfig from the standard version - #6949 Add a new option SYNERGY_AUTOCONFIG to exclude autoconfig from the standard version
- #6952 Change OpenSSL logic to use find_package
v1.13.0-stable v1.13.0-stable
=========== ===========

View file

@ -48,7 +48,7 @@ endif()
add_executable(synergyc ${sources}) add_executable(synergyc ${sources})
target_link_libraries(synergyc target_link_libraries(synergyc
arch base client common io mt net ipc platform server synlib ${libs} ${OPENSSL_LIBS}) arch base client common io mt net ipc platform server synlib ${libs})
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
install (TARGETS synergyc DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR}) install (TARGETS synergyc DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR})

View file

@ -24,4 +24,4 @@ else()
endif() endif()
target_link_libraries (synergyd target_link_libraries (synergyd
arch base common io ipc mt net platform synlib shared ${libs} ${OPENSSL_LIBS}) arch base common io ipc mt net platform synlib shared ${libs})

View file

@ -48,7 +48,7 @@ endif()
add_executable(synergys ${sources}) add_executable(synergys ${sources})
target_link_libraries(synergys target_link_libraries(synergys
arch base client common io mt net ipc platform server synlib ${libs} ${OPENSSL_LIBS}) arch base client common io mt net ipc platform server synlib ${libs})
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
install (TARGETS synergys DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR}) install (TARGETS synergys DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR})

View file

@ -18,7 +18,7 @@ file(GLOB sources "*.cpp")
add_executable(syntool ${sources}) add_executable(syntool ${sources})
target_link_libraries(syntool target_link_libraries(syntool
synlib arch base client common io ipc mt net platform server ${libs} ${OPENSSL_LIBS}) synlib arch base client common io ipc mt net platform server ${libs})
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
install (TARGETS syntool DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR}) install (TARGETS syntool DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR})

View file

@ -22,7 +22,17 @@ if (SYNERGY_ADD_HEADERS)
endif() endif()
add_library(net STATIC ${sources}) add_library(net STATIC ${sources})
target_link_libraries(net
if (UNIX) PUBLIC
target_link_libraries(net mt io ${OPENSSL_LIBS}) OpenSSL::SSL
PRIVATE
mt
io
)
if(WIN32)
target_link_libraries(net
PRIVATE
Crypt32
ws2_32
)
endif() endif()

View file

@ -68,4 +68,4 @@ endif()
add_executable(integtests ${sources}) add_executable(integtests ${sources})
target_link_libraries(integtests target_link_libraries(integtests
arch base client common io ipc mt net platform server synlib gtest gmock ${libs} ${OPENSSL_LIBS}) arch base client common io ipc mt net platform server synlib gtest gmock ${libs})

View file

@ -68,4 +68,4 @@ endif()
add_executable(unittests ${sources}) add_executable(unittests ${sources})
target_link_libraries(unittests target_link_libraries(unittests
arch base client server common io net platform server synlib mt ipc gtest gmock shared ${libs} ${OPENSSL_LIBS}) arch base client server common io net platform server synlib mt ipc gtest gmock shared ${libs})