Skip to content

Commit

Permalink
macOS: Fix build dependencies
Browse files Browse the repository at this point in the history
Fixes #2450
  • Loading branch information
hluk committed Sep 3, 2023
1 parent 976aaa1 commit 08d6ab9
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 195 deletions.
95 changes: 0 additions & 95 deletions .github/workflows/build-linux.yml

This file was deleted.

24 changes: 12 additions & 12 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ jobs:
submodules: false
fetch-depth: 1

- name: Enable ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ github.job }}-${{ matrix.os }}

- name: Set up ccache
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
- name: Install dependencies
run: '${{github.workspace}}/utils/github/install-macos.sh'

- name: Build with CMake
uses: lukka/run-cmake@v3
uses: lukka/run-cmake@v10
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{github.workspace}}/CMakeLists.txt'
cmakeBuildType: Release
cmakeGenerator: Ninja
buildDirectory: '${{runner.workspace}}/build'
cmakeAppendedArgs: >-
-DWITH_TESTS=TRUE
-DCMAKE_BUILD_TYPE='${{matrix.build_type}}'
-DCMAKE_PREFIX_PATH="/usr/local/opt/qt@5/lib/cmake"
-DCMAKE_OSX_DEPLOYMENT_TARGET='10.15'
-DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations"
configurePreset: macOS
buildPreset: macOS

- name: Create gnupg directory for tests
run: mkdir -p ~/.gnupg
Expand Down
25 changes: 25 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"version": 3,
"configurePresets": [
{
"name": "macOS",
"generator": "Ninja",
"binaryDir": "${sourceParentDir}/build",
"installDir": "${sourceParentDir}/build",
"cacheVariables": {
"WITH_TESTS": "TRUE",
"CMAKE_PREFIX_PATH": "/usr/local/opt/qt@5/lib/cmake",
"CMAKE_OSX_DEPLOYMENT_TARGET": "10.15",
"CMAKE_CXX_FLAGS": "-Wno-deprecated-declarations"
}
}
],
"buildPresets": [
{
"name": "macOS",
"configurePreset": "macOS",
"configuration": "Release",
"targets": "install"
}
]
}
60 changes: 0 additions & 60 deletions appveyor.yml

This file was deleted.

46 changes: 24 additions & 22 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,26 +193,28 @@ else()
COMPONENT Runtime
)

set(FIXUP_BUNDLE_APPS "\${CMAKE_INSTALL_PREFIX}/${COPYQ_EXECUTABLE_NAME}.app")

get_property(_copyq_installed_plugins GLOBAL PROPERTY COPYQ_INSTALLED_PLUGINS)

# Directories to look for dependencies
set(FIXUP_BUNDLE_DEP_DIRS "${CMAKE_BINARY_DIR};${QT_LIBRARY_DIRS};${${copyq_qt}Widgets_DIR}/../..")

message(STATUS "Fixup app: ${FIXUP_BUNDLE_APPS}")
message(STATUS "Fixup app plugins: ${_copyq_installed_plugins}")
message(STATUS "Fixup qt plugins: ${FIXUP_BUNDLE_QT_PLUGINS}")
message(STATUS "Fixup dirs: ${FIXUP_BUNDLE_DEP_DIRS}")
install(CODE "
include(BundleUtilities)
set(BU_CHMOD_BUNDLE_ITEMS ON)
fixup_bundle(\"${FIXUP_BUNDLE_APPS}\" \"${FIXUP_BUNDLE_QT_PLUGINS};${_copyq_installed_plugins}\" \"${FIXUP_BUNDLE_DEP_DIRS}\")
verify_app(\"${FIXUP_BUNDLE_APPS}\")
"
COMPONENT Runtime
)

set(CPACK_GENERATOR "DragNDrop")
include(CPack)
# FIXME: Disable cpack for now due to unresolvable libraries:
# https://github.com/Homebrew/homebrew-core/issues/140930
# set(FIXUP_BUNDLE_APPS "\${CMAKE_INSTALL_PREFIX}/${COPYQ_EXECUTABLE_NAME}.app")
#
# get_property(_copyq_installed_plugins GLOBAL PROPERTY COPYQ_INSTALLED_PLUGINS)
#
# # Directories to look for dependencies
# set(FIXUP_BUNDLE_DEP_DIRS "${CMAKE_BINARY_DIR};${QT_LIBRARY_DIRS};${QT_PLUGINS_DIR}/iconengines;${QT_PLUGINS_DIR}/imageformats;${QT_PLUGINS_DIR}/platforms;${QT_PLUGINS_DIR}/tls;${${copyq_qt}Widgets_DIR}/../..")
#
# message(STATUS "Fixup app: ${FIXUP_BUNDLE_APPS}")
# message(STATUS "Fixup app plugins: ${_copyq_installed_plugins}")
# message(STATUS "Fixup qt plugins: ${FIXUP_BUNDLE_QT_PLUGINS}")
# message(STATUS "Fixup dirs: ${FIXUP_BUNDLE_DEP_DIRS}")
# install(CODE "
# include(BundleUtilities)
# set(BU_CHMOD_BUNDLE_ITEMS ON)
# fixup_bundle(\"${FIXUP_BUNDLE_APPS}\" \"${FIXUP_BUNDLE_QT_PLUGINS};${_copyq_installed_plugins}\" \"${FIXUP_BUNDLE_DEP_DIRS}\")
# verify_app(\"${FIXUP_BUNDLE_APPS}\")
# "
# COMPONENT Runtime
# )
#
# set(CPACK_GENERATOR "DragNDrop")
# include(CPack)
endif()
17 changes: 12 additions & 5 deletions utils/github/bundle-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@
# Creates macOS bundle.
set -xeuo pipefail

cpack

app_bundle_path="$(echo _CPack_Packages/Darwin/DragNDrop/copyq-*/CopyQ.app)"
qt_bin="$(brew --prefix qt@5)/bin"
app_bundle_path="CopyQ.app"
plugins="$app_bundle_path/Contents/PlugIns/copyq/"
"$qt_bin/macdeployqt" "$app_bundle_path" -dmg -verbose=2 -always-overwrite \
-executable="$plugins/itemencrypted.so" \
-executable="$plugins/itemfakevim.so" \
-executable="$plugins/itemimage.so" \
-executable="$plugins/itemnotes.so" \
-executable="$plugins/itempinned.so" \
-executable="$plugins/itemsync.so" \
-executable="$plugins/itemtags.so" \
-executable="$plugins/itemtext.so"
executable="${PWD}/${app_bundle_path}/Contents/MacOS/CopyQ"

# Test the app before deployment.
Expand Down Expand Up @@ -37,5 +46,3 @@ brew remove --force --ignore-dependencies $remove
otool -L "$executable"
otool -L "$app_bundle_path/Contents/PlugIns/copyq/"*
otool -L "$app_bundle_path/Contents/Frameworks/"Qt*.framework/Versions/5/Qt*

mv copyq-*.dmg CopyQ.dmg
2 changes: 1 addition & 1 deletion utils/github/install-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ rm -rf \

brew tap copyq/kde utils/github/homebrew/

brew install qt5 copyq/kde/kf5-knotifications
brew install qt@5 copyq/kde/kf5-knotifications

0 comments on commit 08d6ab9

Please sign in to comment.