diff --git a/.github/workflows/job-test-mac.yml b/.github/workflows/job-test-mac.yml index ee37bde76..ce7b6eb10 100644 --- a/.github/workflows/job-test-mac.yml +++ b/.github/workflows/job-test-mac.yml @@ -16,14 +16,19 @@ jobs: steps: - uses: actions/checkout@v2 - - name: install qt - run: brew install qt + - name: Install brew dependencies + run: | + brew list qt5 &>/dev/null || brew install qt5 + brew list openssl &>/dev/null || brew install openssl - name: Build run: | mkdir 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 make -j diff --git a/.github/workflows/job-test-windows.yml b/.github/workflows/job-test-windows.yml index f9c5b2cc2..775045741 100644 --- a/.github/workflows/job-test-windows.yml +++ b/.github/workflows/job-test-windows.yml @@ -12,12 +12,12 @@ jobs: env: GIT_COMMIT: ${{ github.sha }} - QT_BASE_DIR: ${{ github.workspace }}\deps\Qt BONJOUR_BASE_DIR: ${{ github.workspace }}\deps\bonjour + QT_BASE_DIR: ${{ github.workspace }}\deps\Qt QT_VERSION: 5.12.6 QT_BASE_URL: http://qt.mirror.constant.com/ - BONJOUR_SDK_HOME: ${{ github.workspace }}\deps\bonjour\BonjourSDK - CMAKE_PREFIX_PATH: ${{ github.workspace }}\deps\Qt\5.12.6\msvc2017_64\ + QT_LIB_DIR: ${{ github.workspace }}\deps\Qt\5.12.6 + OPENSSL_LIB_DIR: ${{ github.workspace }}\ext\openssl\windows steps: - uses: actions/checkout@v2 @@ -34,7 +34,7 @@ jobs: run: | 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 - cd $env:QT_BASE_DIR\$env:QT_VERSION\msvc2017_64 + cd $QT_LIB_DIR\msvc2017_64 dir - name: Cache Bonjour @@ -47,7 +47,7 @@ jobs: - name: Install Bonjour SDK if: steps.cache-bonjour.outputs.cache-hit != 'true' 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.DownloadFile("https://binaries.symless.com/bonjour/BonjourSDK.zip",".\bonjoursdk.zip") [System.IO.Compression.ZipFile]::ExtractToDirectory(".\bonjoursdk.zip", $env:BONJOUR_BASE_DIR) @@ -56,6 +56,8 @@ jobs: uses: microsoft/setup-msbuild@v1.0.2 - name: Build + env: + CMAKE_PREFIX_PATH: "${{ env.QT_LIB_DIR }}\\msvc2017_64\\;${{ env.OPENSSL_LIB_DIR }}\\x64" run: | mkdir build cd build diff --git a/CI/MacOS/mac-build.yml b/CI/MacOS/mac-build.yml index a11f11654..3db29b91c 100644 --- a/CI/MacOS/mac-build.yml +++ b/CI/MacOS/mac-build.yml @@ -34,13 +34,12 @@ steps: -DCMAKE_OSX_DEPLOYMENT_TARGET=$(version) \ -DCMAKE_OSX_ARCHITECTURES=x86_64 \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_CONFIGURATION_TYPES=Release \ - -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \ - -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib .. + -DCMAKE_CONFIGURATION_TYPES=Release .. displayName: 'Cmake standard' condition: eq(variables['buildType'], 'standard') env: GIT_COMMIT: $(Build.SourceVersion) + CMAKE_PREFIX_PATH: "$(Qt5_DIR);/usr/local/opt/openssl" - task: CmdLine@2 inputs: @@ -54,13 +53,12 @@ steps: -DCMAKE_OSX_ARCHITECTURES=x86_64 \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CONFIGURATION_TYPES=Release \ - -DSYNERGY_ENTERPRISE=ON \ - -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \ - -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib .. + -DSYNERGY_ENTERPRISE=ON .. displayName: 'Cmake enterprise' condition: eq(variables['buildType'], 'enterprise') env: GIT_COMMIT: $(Build.SourceVersion) + CMAKE_PREFIX_PATH: "$(Qt5_DIR);/usr/local/opt/openssl" - task: CmdLine@2 inputs: @@ -77,7 +75,7 @@ steps: - task: CmdLine@2 inputs: 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" codesign -f --options runtime --deep -s "$CODESIGN_ID" $(Build.Repository.LocalPath)/build/bundle/Synergy.app ln -s /Applications $(Build.Repository.LocalPath)/build/bundle/Applications diff --git a/CI/Windows/windows-build.yml b/CI/Windows/windows-build.yml index 4ef18a7ef..edbb04f0e 100644 --- a/CI/Windows/windows-build.yml +++ b/CI/Windows/windows-build.yml @@ -51,17 +51,17 @@ steps: mkdir build64 cd build64 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 ( - 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' env: ENV_BAT: $(ENV_BAT) BONJOUR_SDK_DIR: $(BONJOUR_SDK_DIR) - QT_PATH: $(QT_BIN_PATH) MSARCH: 'x64' GIT_COMMIT: $(Build.SourceVersion) + CMAKE_PREFIX_PATH: "$(QT_BIN_PATH);$(Build.Repository.LocalPath)\\ext\\openssl\\windows\\x64" - script: | call "%ENV_BAT%" -arch=x64 @@ -79,17 +79,17 @@ steps: mkdir build32 cd build32 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 ( - 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' env: ENV_BAT: $(ENV_BAT) BONJOUR_SDK_DIR: $(BONJOUR_SDK_DIR) - QT_PATH: $(QT_BIN_PATH_32) MSARCH: 'Win32' GIT_COMMIT: $(Build.SourceVersion) + CMAKE_PREFIX_PATH: "$(QT_BIN_PATH_32);$(Build.Repository.LocalPath)\\ext\\openssl\\windows\\x86" - script: | call "%ENV_BAT%" -arch=x86 diff --git a/CMakeLists.txt b/CMakeLists.txt index c1e78d1d2..e287d3a09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -315,31 +315,13 @@ endif() # # OpenSSL # -if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") - set (OPENSSL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/ext/openssl/windows) - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - set (OPENSSL_ROOT "${OPENSSL_ROOT}/x64") - else() - 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") +# Apple has to use static libraries because +# "Use of the Apple-provided OpenSSL libraries by apps is strongly discouraged." +# https://developer.apple.com/library/archive/documentation/Security/Conceptual/cryptoservices/SecureNetworkCommunicationAPIs/SecureNetworkCommunicationAPIs.html +if(APPLE) + set(OPENSSL_USE_STATIC_LIBS TRUE) endif() +find_package(OpenSSL REQUIRED) # # Check submodules diff --git a/ChangeLog b/ChangeLog index 83457e2a9..9a196ca12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,6 +40,7 @@ Enhancements: - #6938 Remove auto config message from the main window - #6941 Add Raspberry Pi Builds - #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 =========== diff --git a/src/cmd/synergyc/CMakeLists.txt b/src/cmd/synergyc/CMakeLists.txt index e47c9ebe1..c01609c9d 100644 --- a/src/cmd/synergyc/CMakeLists.txt +++ b/src/cmd/synergyc/CMakeLists.txt @@ -48,7 +48,7 @@ endif() add_executable(synergyc ${sources}) 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") install (TARGETS synergyc DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR}) diff --git a/src/cmd/synergyd/CMakeLists.txt b/src/cmd/synergyd/CMakeLists.txt index 0d9e0af3e..240cdfd07 100644 --- a/src/cmd/synergyd/CMakeLists.txt +++ b/src/cmd/synergyd/CMakeLists.txt @@ -24,4 +24,4 @@ else() endif() 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}) diff --git a/src/cmd/synergys/CMakeLists.txt b/src/cmd/synergys/CMakeLists.txt index 72b3992d4..47b237407 100644 --- a/src/cmd/synergys/CMakeLists.txt +++ b/src/cmd/synergys/CMakeLists.txt @@ -48,7 +48,7 @@ endif() add_executable(synergys ${sources}) 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") install (TARGETS synergys DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR}) diff --git a/src/cmd/syntool/CMakeLists.txt b/src/cmd/syntool/CMakeLists.txt index 62374962f..5f841b7e9 100644 --- a/src/cmd/syntool/CMakeLists.txt +++ b/src/cmd/syntool/CMakeLists.txt @@ -18,7 +18,7 @@ file(GLOB sources "*.cpp") add_executable(syntool ${sources}) 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") install (TARGETS syntool DESTINATION ${SYNERGY_BUNDLE_BINARY_DIR}) diff --git a/src/lib/net/CMakeLists.txt b/src/lib/net/CMakeLists.txt index 62e0231a7..7ebb8ed02 100644 --- a/src/lib/net/CMakeLists.txt +++ b/src/lib/net/CMakeLists.txt @@ -22,7 +22,17 @@ if (SYNERGY_ADD_HEADERS) endif() add_library(net STATIC ${sources}) - -if (UNIX) - target_link_libraries(net mt io ${OPENSSL_LIBS}) +target_link_libraries(net + PUBLIC + OpenSSL::SSL + PRIVATE + mt + io +) +if(WIN32) + target_link_libraries(net + PRIVATE + Crypt32 + ws2_32 + ) endif() diff --git a/src/test/integtests/CMakeLists.txt b/src/test/integtests/CMakeLists.txt index 86ce8365a..7497ec3f4 100644 --- a/src/test/integtests/CMakeLists.txt +++ b/src/test/integtests/CMakeLists.txt @@ -68,4 +68,4 @@ endif() add_executable(integtests ${sources}) 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}) diff --git a/src/test/unittests/CMakeLists.txt b/src/test/unittests/CMakeLists.txt index 46307e90e..dd898140c 100644 --- a/src/test/unittests/CMakeLists.txt +++ b/src/test/unittests/CMakeLists.txt @@ -68,4 +68,4 @@ endif() add_executable(unittests ${sources}) 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})