diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2019-12-04 13:04:35 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2020-01-09 17:39:32 +0300 |
commit | f17b30515167d3e679f30118e52c41385787faba (patch) | |
tree | cecdefa3882854c102ebf648a133528bd227c365 | |
parent | 3d0325b72f6043e57e3414ec46e898061d1a299a (diff) |
[CMAKE] Do not create a deployable mac bundle during build
This simplifies the cmake scripts and reduces build times
-rw-r--r-- | CMakeLists.txt | 38 | ||||
-rw-r--r-- | OwnCloudCPack.cmake | 24 | ||||
-rwxr-xr-x | admin/osx/macdeployqt.py | 425 | ||||
-rw-r--r-- | cmake/modules/AddAppIconMacro.cmake | 133 | ||||
-rw-r--r-- | shell_integration/MacOSX/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/cmd/CMakeLists.txt | 12 | ||||
-rw-r--r-- | src/csync/CMakeLists.txt | 24 | ||||
-rw-r--r-- | src/gui/CMakeLists.txt | 62 | ||||
-rw-r--r-- | src/gui/MacOSXBundleInfo.plist (renamed from cmake/modules/MacOSXBundleInfo.plist.in) | 22 | ||||
-rw-r--r-- | src/gui/updater/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/libsync/CMakeLists.txt | 11 | ||||
-rw-r--r-- | src/libsync/vfs/suffix/CMakeLists.txt | 28 |
12 files changed, 52 insertions, 739 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c7159888a..d07dce0a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,25 +97,6 @@ else() set(PLUGINDIR "../PlugIns" CACHE STRING "Extra path to look for Qt plugins like for VFS. May be relative to binary.") endif() -##### -## handle BUILD_OWNCLOUD_OSX_BUNDLE -# BUILD_OWNCLOUD_OSX_BUNDLE was not initialized OR set to true on OSX -if(APPLE AND (NOT DEFINED BUILD_OWNCLOUD_OSX_BUNDLE OR BUILD_OWNCLOUD_OSX_BUNDLE)) - set(BUILD_OWNCLOUD_OSX_BUNDLE ON) - set(OWNCLOUD_OSX_BUNDLE "${APPLICATION_EXECUTABLE}.app") - set(LIB_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS") - set(BIN_INSTALL_DIR "${APPLICATION_EXECUTABLE}.app/Contents/MacOS") - -# BUILD_OWNCLOUD_OSX_BUNDLE was disabled on OSX -elseif(APPLE AND NOT BUILD_OWNCLOUD_OSX_BUNDLE) - message(FATAL_ERROR "Building in non-bundle mode on OSX is currently not supported. Comment this error out if you want to work on/test it.") - -# any other platform -else() - set(BUILD_OWNCLOUD_OSX_BUNDLE OFF) -endif() -##### - # this option removes Http authentication, keychain, shibboleth etc and is intended for # external authentication mechanisms option(TOKEN_AUTH_ONLY "TOKEN_AUTH_ONLY" OFF) @@ -172,7 +153,7 @@ if(BUILD_CLIENT) find_package(Sparkle) endif(APPLE) - if(UNIX) + if(UNIX AND NOT APPLE) find_package(INotify REQUIRED) else() find_package(INotify) @@ -202,6 +183,14 @@ endif( WIN32 ) file( GLOB TRANS_FILES ${CMAKE_SOURCE_DIR}/translations/client_*.ts) set(TRANSLATIONS ${TRANS_FILES}) + +if(APPLE) + list(APPEND OWNCLOUD_BUNDLED_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/sync-exclude.lst) +elseif(BUILD_CLIENT) + configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY) + install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} ) +endif() + if(BUILD_CLIENT) add_subdirectory(src) if(NOT BUILD_LIBRARIES_ONLY) @@ -228,11 +217,4 @@ endif() configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h) -if(BUILD_OWNCLOUD_OSX_BUNDLE) - install(FILES sync-exclude.lst DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/) - configure_file(sync-exclude.lst bin/${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY) -elseif(BUILD_CLIENT) - install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} ) - configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY) -endif() -feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
\ No newline at end of file +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/OwnCloudCPack.cmake b/OwnCloudCPack.cmake index 39eee0080..1eb5fbe42 100644 --- a/OwnCloudCPack.cmake +++ b/OwnCloudCPack.cmake @@ -15,30 +15,6 @@ set( CPACK_PACKAGE_VERSION_PATCH ${MIRALL_VERSION_PATCH} ) set( CPACK_PACKAGE_VERSION_BUILD ${MIRALL_VERSION_BUILD} ) set( CPACK_PACKAGE_VERSION ${MIRALL_VERSION_FULL}${MIRALL_VERSION_SUFFIX} ) -if(APPLE) - set( CPACK_GENERATOR "DragNDrop" ) - set( CPACK_SOURCE_GENERATOR "") - set( CPACK_PACKAGE_FILE_NAME ${APPLICATION_SHORTNAME}-${CPACK_PACKAGE_VERSION} ) - set( CPACK_PACKAGE_ICON ${CMAKE_BINARY_DIR}/src/gui/ownCloud.icns) - - set( CPACK_DMG_DS_STORE "${CMAKE_SOURCE_DIR}/admin/osx/DS_Store.in") -# set( CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/admin/osx/DMGBackground.png" ) - - set( CPACK_DMG_FORMAT "UDBZ" ) - set( CPACK_DMG_VOLUME_NAME "${APPLICATION_SHORTNAME}") - - # did not work with cmake 2.8.7, so we override MacOSXBundleInfo.plist.in - #set( CPACK_BUNDLE_PLIST ${CMAKE_SOURCE_DIR}/admin/osx/Info.plist ) - - # do we need these? - #set( CPACK_SYSTEM_NAME "OSX" ) - #set( CPACK_PACKAGE_NAME "FOO" ) - #set( CPACK_BUNDLE_NAME "BAR" ) -endif() - - - - if(WIN32) set( CPACK_PACKAGE_FILE_NAME ${APPLICATION_SHORTNAME}-${CPACK_PACKAGE_VERSION}-setup ) # Package file name without extension. Also a directory of installer cmake-2.5.0-Linux-i686 diff --git a/admin/osx/macdeployqt.py b/admin/osx/macdeployqt.py deleted file mode 100755 index 8d51b01d2..000000000 --- a/admin/osx/macdeployqt.py +++ /dev/null @@ -1,425 +0,0 @@ -#!/usr/bin/python -# This file is part of ownCloud. -# It was inspired in large part by the macdeploy script in Clementine -# and Tomahawk -# -# ownCloud is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# ownCLoud is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with ownCloud. If not, see <http://www.gnu.org/licenses/>. - -import os -import re -import subprocess -import commands -import sys -from glob import glob -from distutils.version import LooseVersion - -print("Deploying (Qt) dependencies and fixing library paths...") - -bundle_dir = sys.argv[1] -dsyms_dir = os.path.realpath(os.path.join(bundle_dir, '..', os.path.basename(bundle_dir)+'_symbols')) -qmake_path = sys.argv[2] - -def QueryQMake(attrib): - return subprocess.check_output([qmake_path, '-query', attrib]).rstrip('\n') - -FRAMEWORK_SEARCH_PATH=[ - '/Library/Frameworks', - os.path.join(os.environ['HOME'], 'Library/Frameworks') -] - -LIBRARY_SEARCH_PATH=[ - '.' -] - -QT_PLUGINS = [ - 'platforms/libqcocoa.dylib', - 'imageformats/libqgif.dylib', - 'imageformats/libqico.dylib', - 'imageformats/libqjpeg.dylib', - 'imageformats/libqsvg.dylib', -] - -QT_PLUGINS_SEARCH_PATH=[ -] - -# Package libraries from these paths even if they are also a system library -SYSTEM_LIBRARY_BLACKLIST = [ - QueryQMake('QT_INSTALL_LIBS') -] - -class Error(Exception): - pass - - -class CouldNotFindQtPluginErrorFindFrameworkError(Error): - pass - - -class InstallNameToolError(Error): - pass - - -class CouldNotFindQtPluginError(Error): - pass - - -class CouldNotFindScriptPluginError(Error): - pass - -class CouldNotFindFrameworkError(Error): - pass - -if len(sys.argv) < 3: - print 'Usage: %s <bundle.app> <path-to-qmake>' % sys.argv[0] - exit() - -def is_exe(fpath): - return os.path.isfile(fpath) and os.access(fpath, os.X_OK) - - -bundle_name = os.path.basename(bundle_dir).split('.')[0] - -commands = [] - -binary_dir = os.path.join(bundle_dir, 'Contents', 'MacOS') -frameworks_dir = os.path.join(bundle_dir, 'Contents', 'Frameworks') -commands.append(['mkdir', '-p', frameworks_dir]) -resources_dir = os.path.join(bundle_dir, 'Contents', 'Resources') -commands.append(['mkdir', '-p', resources_dir]) -plugins_dir = os.path.join(bundle_dir, 'Contents', 'PlugIns') -binaries = [i for i in glob(os.path.join(bundle_dir, 'Contents', 'MacOS', "*")) if is_exe(i)]; - -qt_version = QueryQMake('QT_VERSION') -print "Using Qt", qt_version - -fixed_libraries = [] -fixed_frameworks = [] - -def WriteQtConf(): - print "Writing qt.conf..." - with open(os.path.join(resources_dir, 'qt.conf'), 'w') as f: - f.write("[Paths]\nPlugins = PlugIns\n"); - f.close() - -def GetBrokenLibraries(binary): - #print "Checking libs for binary: %s" % binary - output = subprocess.Popen(['otool', '-L', binary], stdout=subprocess.PIPE).communicate()[0] - broken_libs = { - 'frameworks': [], - 'libs': []} - for line in [x.split(' ')[0].lstrip() for x in output.split('\n')[1:]]: - #print "Checking line: %s" % line - if not line: # skip empty lines - continue - if os.path.basename(binary) == os.path.basename(line): - #print "mnope %s-%s" % (os.path.basename(binary), os.path.basename(line)) - continue - if re.match(r'^\s*/System/', line): - continue # System framework - elif re.match(r'^\s*/usr/lib/', line): - #print "unix style system lib" - continue # unix style system library - elif re.match(r'Breakpad', line): - continue # Manually added by cmake. - elif re.match(r'^\s*@executable_path', line) or re.match(r'^\s*@loader_path', line): - # Potentially already fixed library - if '.framework' in line: - relative_path = os.path.join(*line.split('/')[3:]) - if not os.path.exists(os.path.join(frameworks_dir, relative_path)): - broken_libs['frameworks'].append(relative_path) - else: - relative_path = os.path.join(*line.split('/')[1:]) - #print "RELPATH %s %s" % (relative_path, os.path.join(binary_dir, relative_path)) - if not os.path.exists(os.path.join(binary_dir, relative_path)): - broken_libs['libs'].append(relative_path) - elif re.search(r'\w+\.framework', line): - broken_libs['frameworks'].append(line) - else: - broken_libs['libs'].append(line) - - return broken_libs - -def FindFramework(path): - search_pathes = FRAMEWORK_SEARCH_PATH - search_pathes.insert(0, QueryQMake('QT_INSTALL_LIBS')) - for search_path in search_pathes: - # The following two lines are needed for a custom built Qt from version 5.5 on, possibly not for the one from the Qt SDK. - # Looks like the upstream macdeployqt also had an issue there https://bugreports.qt.io/browse/QTBUG-47868 - if path.find( "\@rpath/"): - path = path.replace("@rpath/", "") - abs_path = os.path.join(search_path, path) - if os.path.exists(abs_path): - return abs_path - - raise CouldNotFindFrameworkError(path) - -def FindLibrary(path): - if os.path.exists(path): - return path - search_pathes = LIBRARY_SEARCH_PATH - search_pathes.insert(0, QueryQMake('QT_INSTALL_LIBS')) - for search_path in search_pathes: - abs_path = os.path.join(search_path, path) - if os.path.exists(abs_path): - return abs_path - else: # try harder---look for lib name in library folders - newpath = os.path.join(search_path,os.path.basename(path)) - if os.path.exists(newpath): - return newpath - - return "" - #raise CouldNotFindFrameworkError(path) - -def FixAllLibraries(broken_libs): - for framework in broken_libs['frameworks']: - FixFramework(framework) - for lib in broken_libs['libs']: - FixLibrary(lib) - -def FixFramework(path): - if path in fixed_libraries: - return - else: - fixed_libraries.append(path) - abs_path = FindFramework(path) - broken_libs = GetBrokenLibraries(abs_path) - FixAllLibraries(broken_libs) - - new_path = CopyFramework(abs_path) - id = os.sep.join(new_path.split(os.sep)[3:]) - FixFrameworkId(new_path, id) - for framework in broken_libs['frameworks']: - FixFrameworkInstallPath(framework, new_path) - for library in broken_libs['libs']: - FixLibraryInstallPath(library, new_path) - -def FixLibrary(path): - if path in fixed_libraries or FindSystemLibrary(path) is not None: - return - else: - fixed_libraries.append(path) - abs_path = FindLibrary(path) - if abs_path == "": - print "Could not resolve %s, not fixing!" % path - return - broken_libs = GetBrokenLibraries(abs_path) - FixAllLibraries(broken_libs) - - new_path = CopyLibrary(abs_path) - FixLibraryId(new_path) - for framework in broken_libs['frameworks']: - FixFrameworkInstallPath(framework, new_path) - for library in broken_libs['libs']: - FixLibraryInstallPath(library, new_path) - -def FixPlugin(abs_path, subdir): - broken_libs = GetBrokenLibraries(abs_path) - FixAllLibraries(broken_libs) - - new_path = CopyPlugin(abs_path, subdir) - for framework in broken_libs['frameworks']: - FixFrameworkInstallPath(framework, new_path) - for library in broken_libs['libs']: - FixLibraryInstallPath(library, new_path) - -def FixBinary(path): - broken_libs = GetBrokenLibraries(path) - FixAllLibraries(broken_libs) - for framework in broken_libs['frameworks']: - FixFrameworkInstallPath(framework, path) - for library in broken_libs['libs']: - FixLibraryInstallPath(library, path) - - -def CopyDSYM(dep): - frameworkString = '.framework' - pos = dep.rfind(frameworkString) - dsym_path = dep + ".dSYM" - if pos > -1: - frameworkPath = dep[:pos+len(frameworkString)] - dsym_path = frameworkPath + ".dSYM" - - if os.path.exists(dsym_path): - new_dsym_path = os.path.join(dsyms_dir, os.path.basename(dsym_path)) - print("CopyDSYM: [%s]" % dsym_path) - args = ['rm', '-rf', os.path.join(dsyms_dir, os.path.basename(dsym_path))] - commands.append(args) - args = ['cp', '-R', dsym_path, dsyms_dir] - commands.append(args) - else: - print("CopyDSYM: no .dSYM found.") - - - -def CopyLibrary(path): - print "CopyLibrary:", path - CopyDSYM(path) - new_path = os.path.join(binary_dir, os.path.basename(path)) - args = ['ditto', '--arch=x86_64', path, new_path] - commands.append(args) - args = ['chmod', 'u+w', new_path] - commands.append(args) - return new_path - -def CopyPlugin(path, subdir): - print "CopyPlugin:", path, subdir - CopyDSYM(path) - new_path = os.path.join(plugins_dir, subdir, os.path.basename(path)) - args = ['mkdir', '-p', os.path.dirname(new_path)] - commands.append(args) - args = ['ditto', '--arch=x86_64', path, new_path] - commands.append(args) - args = ['chmod', 'u+w', new_path] - commands.append(args) - return new_path - -def CopyFramework(source_dylib): - print "CopyFramework:", source_dylib - CopyDSYM(source_dylib) - parts = source_dylib.split(os.sep) - for i, part in enumerate(parts): - matchObj = re.match(r'(\w+\.framework)', part) - if matchObj: - framework = matchObj.group(1) - dylib_name = parts[-1] - source_path = os.path.join('/', *parts[:i+1]) - dest_path = os.path.join(frameworks_dir, framework) - dest_dylib_path = os.path.join(frameworks_dir, *parts[i:-1]) - break - if os.path.exists(dest_path): - print dest_path, "already exists, skipping copy..." - return os.path.join(dest_dylib_path, dylib_name) - - args = ['mkdir', '-p', dest_dylib_path] - commands.append(args) - args = ['ditto', '--arch=x86_64', source_dylib, dest_dylib_path] - commands.append(args) - args = ['chmod', 'u+w', os.path.join(dest_dylib_path, parts[-1])] - commands.append(args) - args = ['ln', '-s', '5', os.path.join(dest_path, 'Versions', 'Current')] - commands.append(args) - args = ['ln', '-s', os.path.join('Versions', 'Current', dylib_name), os.path.join(dest_path, dylib_name)] - commands.append(args) - args = ['ln', '-s', os.path.join('Versions', 'Current', 'Resources'), os.path.join(dest_path, 'Resources')] - commands.append(args) - args = ['cp', '-r', os.path.join(source_path, 'Versions', '5', 'Resources'), os.path.join(dest_path, 'Versions', '5')] - commands.append(args) - - return os.path.join(dest_dylib_path, dylib_name) - -def FixId(path, library_name): - id = '@executable_path/../Frameworks/%s' % library_name - args = ['install_name_tool', '-id', id, path] - commands.append(args) - -def FixLibraryId(path): - library_name = os.path.basename(path) - FixId(path, library_name) - -def FixFrameworkId(path, id): - FixId(path, id) - -def FixInstallPath(library_path, library, new_path): - args = ['install_name_tool', '-change', library_path, new_path, library] - commands.append(args) - -def FindSystemLibrary(library_path): - for item in SYSTEM_LIBRARY_BLACKLIST: - if os.path.realpath(library_path).startswith(os.path.realpath(item)): - return None - - library_name = os.path.basename(library_path) - for path in ['/lib', '/usr/lib']: - full_path = os.path.join(path, library_name) - if os.path.exists(full_path): - return full_path - return None - -def FixLibraryInstallPath(library_path, library): - system_library = FindSystemLibrary(library_path) - if system_library is None: - new_path = '@executable_path/../MacOS/%s' % os.path.basename(library_path) - FixInstallPath(library_path, library, new_path) - else: - print "Fix as system library: [%s]" % library_path - print "We currently don't need this and it's most likely an error if this code path is hit. Exiting." - sys.exit(53) - FixInstallPath(library_path, library, system_library) - -def FixFrameworkInstallPath(library_path, library): - parts = library_path.split(os.sep) - for i, part in enumerate(parts): - if re.match(r'\w+\.framework', part): - full_path = os.path.join(*parts[i:]) - break - new_path = '@executable_path/../Frameworks/%s' % full_path - FixInstallPath(library_path, library, new_path) - -def FindQtPlugin(name): - search_path = QT_PLUGINS_SEARCH_PATH - search_path.insert(0, QueryQMake('QT_INSTALL_PLUGINS')) - for path in search_path: - if os.path.exists(path): - if os.path.exists(os.path.join(path, name)): - return os.path.join(path, name) - raise CouldNotFindQtPluginError(name) - - -def runCommand(command): - p = subprocess.Popen(command) - os.waitpid(p.pid, 0) - -def runCommandDebug(command): - print "Run command: %s" % command - runCommand(command) - -if 'ENABLE_CRASHREPORTS' in os.environ and os.environ['ENABLE_CRASHREPORTS'] == 'true': - print "Crashreports enabled. Dump symbols of our own binaries." - for binary in binaries: - print("Create .dSYM for [binary]") - dsym_path = binary+'.dSYM' - runCommandDebug(['dsymutil', binary]) - runCommandDebug(['rm', '-rf', os.path.join(dsyms_dir, os.path.basename(dsym_path))]) - runCommandDebug(['mv', dsym_path, dsyms_dir]) -else: - print "Crashreports disabled." - - -for binary in binaries: - FixBinary(binary) - -if LooseVersion(qt_version) >= LooseVersion("5.10.0"): - QT_PLUGINS.append('styles/libqmacstyle.dylib') -for plugin in QT_PLUGINS: - FixPlugin(FindQtPlugin(plugin), os.path.dirname(plugin)) - -# The FixPlugin function is actually for Qt plugins, but for now we abuse it for our own plugin -FixPlugin(bundle_dir+'/Contents/PlugIns/{bundle_name}sync_vfs_suffix.dylib'.format(bundle_name=bundle_name), '') - -if LooseVersion(qt_version) >= LooseVersion("5.10.0"): - args = ['plutil', '-insert', 'LSMinimumSystemVersion', '-string', '10.10.0', os.path.join(bundle_dir, 'Contents', 'Info.plist')] - commands.append(args) -else: - args = ['plutil', '-insert', 'LSMinimumSystemVersion', '-string', '10.7.0', os.path.join(bundle_dir, 'Contents', 'Info.plist')] - commands.append(args) - -if len(sys.argv) <= 2: - print 'Will run %d commands:' % len(commands) - for command in commands: - print ' '.join(command) - -for command in commands: - runCommand(command) - -WriteQtConf() diff --git a/cmake/modules/AddAppIconMacro.cmake b/cmake/modules/AddAppIconMacro.cmake deleted file mode 100644 index dc833bd9d..000000000 --- a/cmake/modules/AddAppIconMacro.cmake +++ /dev/null @@ -1,133 +0,0 @@ -SET(WINDRES_EXECUTABLE_BASE ${CMAKE_RC_COMPILER}) - -# This macro is taken from kdelibs/cmake/modules/KDE4Macros.cmake. -# -# Copyright (c) 2006-2009 Alexander Neundorf, <neundorf@kde.org> -# Copyright (c) 2006, 2007, Laurent Montel, <montel@kde.org> -# Copyright (c) 2007 Matthias Kretz <kretz@kde.org> -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file [in KDE repositories]. - - -# adds application icon to target source list -# for detailed documentation see the top of FindKDE4Internal.cmake -macro (KDE4_ADD_APP_ICON appsources pattern) - set (_outfilename ${CMAKE_CURRENT_BINARY_DIR}/${appsources}) - - if (WIN32) - if(NOT WINCE) - find_program(PNG2ICO_EXECUTABLE NAMES png2ico) - else(NOT WINCE) - find_program(PNG2ICO_EXECUTABLE NAMES png2ico PATHS ${HOST_BINDIR} NO_DEFAULT_PATH ) - endif(NOT WINCE) - find_program(WINDRES_EXECUTABLE NAMES ${WINDRES_EXECUTABLE_BASE}) - if(MSVC) - set(WINDRES_EXECUTABLE TRUE) - endif(MSVC) - if (PNG2ICO_EXECUTABLE AND WINDRES_EXECUTABLE) - string(REPLACE "*" "([0123456789]*)" pattern_rx "${pattern}") - file(GLOB files "${pattern}") - foreach (it ${files}) - string(REGEX REPLACE "${pattern_rx}" "\\1" fn "${it}") - if (fn MATCHES ".*16.*" ) - list (APPEND _icons ${it}) - endif (fn MATCHES ".*16.*") - if (fn MATCHES ".*32.*" ) - list (APPEND _icons ${it}) - endif (fn MATCHES ".*32.*") - if (fn MATCHES ".*48.*" ) - list (APPEND _icons ${it}) - endif (fn MATCHES ".*48.*") - if (fn MATCHES ".*64.*" ) - list (APPEND _icons ${it}) - endif (fn MATCHES ".*64.*") - if (fn MATCHES ".*128.*" ) - list (APPEND _icons ${it}) - endif (fn MATCHES ".*128.*") - endforeach (it) - if (_icons) - add_custom_command(OUTPUT ${_outfilename}.ico ${_outfilename}.rc - COMMAND ${PNG2ICO_EXECUTABLE} ARGS --rcfile ${_outfilename}.rc ${_outfilename}.ico ${_icons} - DEPENDS ${PNG2ICO_EXECUTABLE} ${_icons} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - if (MINGW) - add_custom_command(OUTPUT ${_outfilename}_res.o - COMMAND ${WINDRES_EXECUTABLE} ARGS -i ${_outfilename}.rc -o ${_outfilename}_res.o --include-dir=${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${WINDRES_EXECUTABLE} ${_outfilename}.rc - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - list(APPEND ${appsources} ${_outfilename}_res.o) - else(MINGW) - list(APPEND ${appsources} ${_outfilename}.rc) - endif(MINGW) - else(_icons) - message(STATUS "Unable to find a related icon that matches pattern ${pattern} for variable ${appsources} - application will not have an application icon!") - endif(_icons) - else(PNG2ICO_EXECUTABLE AND WINDRES_EXECUTABLE) - message(WARNING "Unable to find the png2ico or windres utilities - application will not have an application icon!") - endif(PNG2ICO_EXECUTABLE AND WINDRES_EXECUTABLE) - endif(WIN32) - if (APPLE) - file(GLOB_RECURSE files "${pattern}") - file(MAKE_DIRECTORY ${appsources}.iconset) - - # List from: - # https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Optimizing/Optimizing.html#//apple_ref/doc/uid/TP40012302-CH7-SW4 - foreach (it ${files}) - if (it MATCHES ".*icon-16.*") - configure_file(${it} ${appsources}.iconset/icon_16x16.png COPYONLY) - elseif (it MATCHES ".*icon-32.*") - configure_file(${it} ${appsources}.iconset/icon_16x16@2x.png COPYONLY) - configure_file(${it} ${appsources}.iconset/icon_32x32.png COPYONLY) - elseif (it MATCHES ".*icon-64.*") - configure_file(${it} ${appsources}.iconset/icon_32x32@2x.png COPYONLY) - elseif (it MATCHES ".*icon-128.*") - configure_file(${it} ${appsources}.iconset/icon_128x128.png COPYONLY) - elseif (it MATCHES ".*icon-256.*") - configure_file(${it} ${appsources}.iconset/icon_128x128@2x.png COPYONLY) - configure_file(${it} ${appsources}.iconset/icon_256x256.png COPYONLY) - elseif (it MATCHES ".*icon-512.*") - configure_file(${it} ${appsources}.iconset/icon_256x256@2x.png COPYONLY) - configure_file(${it} ${appsources}.iconset/icon_512x512.png COPYONLY) - elseif (it MATCHES ".*icon-1024.*") - configure_file(${it} ${appsources}.iconset/icon_512x512@2x.png COPYONLY) - endif() - endforeach (it) - - # Copy the sidebar icons in the main app bundle for the FinderSync extension to pick. - # https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Finder.html#//apple_ref/doc/uid/TP40014214-CH15-SW15 - foreach (it ${files}) - if (it MATCHES ".*sidebar-16.*") - configure_file(${it} ${appsources}.iconset/sidebar_16x16.png COPYONLY) - elseif (it MATCHES ".*sidebar-18.*") - configure_file(${it} ${appsources}.iconset/sidebar_18x18.png COPYONLY) - elseif (it MATCHES ".*sidebar-32.*") - configure_file(${it} ${appsources}.iconset/sidebar_16x16@2x.png COPYONLY) - configure_file(${it} ${appsources}.iconset/sidebar_32x32.png COPYONLY) - elseif (it MATCHES ".*sidebar-36.*") - configure_file(${it} ${appsources}.iconset/sidebar_18x18@2x.png COPYONLY) - elseif (it MATCHES ".*sidebar-64.*") - configure_file(${it} ${appsources}.iconset/sidebar_32x32@2x.png COPYONLY) - endif() - endforeach (it) - - add_custom_command(OUTPUT ${_outfilename}.icns - COMMAND echo === Building bundle icns with iconset: - COMMAND ls -1 ${appsources}.iconset - COMMAND iconutil -c icns -o ${_outfilename}.icns ${appsources}.iconset - DEPENDS ${files} - ) - - # This will register the icon into the bundle - set(MACOSX_BUNDLE_ICON_FILE ${appsources}.icns) - - # Append the icns file to the sources list so it will be a dependency to the - # main target - list(APPEND ${appsources} ${_outfilename}.icns) - - # Install the icon into the Resources dir in the bundle - set_source_files_properties(${_outfilename}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - endif(APPLE) -endmacro (KDE4_ADD_APP_ICON) diff --git a/shell_integration/MacOSX/CMakeLists.txt b/shell_integration/MacOSX/CMakeLists.txt index 4173f6e94..99216ef94 100644 --- a/shell_integration/MacOSX/CMakeLists.txt +++ b/shell_integration/MacOSX/CMakeLists.txt @@ -17,7 +17,7 @@ add_custom_target( mac_overlayplugin ALL add_dependencies(mac_overlayplugin ${APPLICATION_EXECUTABLE}) # for the ownCloud.icns to be generated INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Release/FinderSyncExt.appex - DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/PlugIns + DESTINATION ${PLUGIN_INSTALL_DIR} USE_SOURCE_PERMISSIONS) endif(APPLE) diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index 7e76ae86f..fab58e8cb 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -16,11 +16,7 @@ if(NOT BUILD_LIBRARIES_ONLY) target_include_directories(${cmd_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src/3rdparty/qtokenizer) endif() -if(BUILD_OWNCLOUD_OSX_BUNDLE) - install(TARGETS ${cmd_NAME} DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/MacOS) -elseif(NOT BUILD_LIBRARIES_ONLY) - install(TARGETS ${cmd_NAME} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -endif() +install(TARGETS ${cmd_NAME} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/src/csync/CMakeLists.txt b/src/csync/CMakeLists.txt index 2b5c084f2..1928e39f1 100644 --- a/src/csync/CMakeLists.txt +++ b/src/csync/CMakeLists.txt @@ -98,28 +98,6 @@ set_target_properties( SOVERSION ${LIBRARY_SOVERSION} ) -if(BUILD_OWNCLOUD_OSX_BUNDLE) - INSTALL( - TARGETS - "${csync_NAME}" - LIBRARY DESTINATION - ${LIB_INSTALL_DIR} - ARCHIVE DESTINATION - ${LIB_INSTALL_DIR} - RUNTIME DESTINATION - ${BIN_INSTALL_DIR} - ) -else() - INSTALL( - TARGETS - "${csync_NAME}" - LIBRARY DESTINATION - ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION - ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION - ${CMAKE_INSTALL_BINDIR} - ) -endif() +INSTALL(TARGETS "${csync_NAME}" ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) configure_file(config_csync.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config_csync.h) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 70963da23..72b56fa71 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -128,12 +128,6 @@ IF( APPLE ) add_definitions(-DHAVE_SPARKLE) list(APPEND updater_SRCS updater/sparkleupdater_mac.mm updater/sparkleupdater.h) list(APPEND updater_DEPS ${SPARKLE_LIBRARY}) - - # Sparkle.framework is installed from here because macdeployqt's CopyFramework breaks on this bundle - # as its logic is tightly tailored around Qt5 frameworks - install(DIRECTORY "${SPARKLE_LIBRARY}" - DESTINATION "${OWNCLOUD_OSX_BUNDLE}/Contents/Frameworks" USE_SOURCE_PERMISSIONS) - endif() ENDIF() @@ -206,8 +200,7 @@ ecm_add_app_icon(final_src ICONS "${OWNCLOUD_ICONS}" SIDEBAR_ICONS "${OWNCLOUD_S add_executable( ${APPLICATION_EXECUTABLE} main.cpp ${final_src}) - -if(NOT BUILD_OWNCLOUD_OSX_BUNDLE) +if(NOT APPLE) if(NOT WIN32) file(GLOB _icons "${theme_dir}/colored/*-${APPLICATION_ICON_NAME}-icon.png") foreach(_file ${_icons}) @@ -220,29 +213,22 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE) install(FILES ${client_I18N} DESTINATION ${SHAREDIR}/${APPLICATION_EXECUTABLE}/i18n) # we may not add MACOSX_BUNDLE here, if not building one - - # add_executable( ${APPLICATION_EXECUTABLE} main.cpp ${final_src}) - add_executable( ${APPLICATION_EXECUTABLE} main.cpp ${final_src}) else() - # set(CMAKE_INSTALL_PREFIX ".") # Examples use /Applications. hurmpf. - set(MACOSX_BUNDLE_ICON_FILE "ownCloud.icns") - - # we must add MACOSX_BUNDLE only if building a bundle - add_executable( ${APPLICATION_EXECUTABLE} main.cpp ${final_src}) - - set (QM_DIR ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/Translations) - install(FILES ${client_I18N} DESTINATION ${QM_DIR}) - get_target_property(_qmake Qt5::qmake LOCATION) - execute_process(COMMAND ${_qmake} -query QT_INSTALL_TRANSLATIONS - OUTPUT_VARIABLE QT_TRANSLATIONS_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - file(GLOB qt_I18N ${QT_TRANSLATIONS_DIR}/qt_??.qm ${QT_TRANSLATIONS_DIR}/qt_??_??.qm) - install(FILES ${qt_I18N} DESTINATION ${QM_DIR}) - file(GLOB qtbase_I18N ${QT_TRANSLATIONS_DIR}/qtbase_??.qm ${QT_TRANSLATIONS_DIR}/qt_??_??.qm) - install(FILES ${qtbase_I18N} DESTINATION ${QM_DIR}) - file(GLOB qtkeychain_I18N ${QT_TRANSLATIONS_DIR}/qtkeychain*.qm) - install(FILES ${qtkeychain_I18N} DESTINATION ${QM_DIR}) + target_sources(${APPLICATION_EXECUTABLE} PRIVATE ${OWNCLOUD_BUNDLED_RESOURCES}) + + set_source_files_properties( + ${client_I18N} + PROPERTIES + MACOSX_PACKAGE_LOCATION Resources/Translations + ) + + set_source_files_properties( + ${OWNCLOUD_BUNDLED_RESOURCES} + PROPERTIES + MACOSX_PACKAGE_LOCATION Resources + ) + + set_target_properties(${APPLICATION_EXECUTABLE} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/MacOSXBundleInfo.plist) endif() add_library(updater STATIC ${updater_SRCS}) @@ -287,14 +273,9 @@ target_compile_definitions(${APPLICATION_EXECUTABLE} PRIVATE "QT_DISABLE_DEPRECA include(libcloudproviders/libcloudproviders.cmake) -install(TARGETS ${APPLICATION_EXECUTABLE} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - BUNDLE DESTINATION "." - ) +install(TARGETS ${APPLICATION_EXECUTABLE} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) -if(NOT BUILD_OWNCLOUD_OSX_BUNDLE AND NOT WIN32) +if(UNIX AND NOT APPLE) configure_file(${CMAKE_SOURCE_DIR}/mirall.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_EXECUTABLE}.desktop) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_EXECUTABLE}.desktop DESTINATION ${DATADIR}/applications ) @@ -302,15 +283,8 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE AND NOT WIN32) configure_file(owncloud.xml.in ${APPLICATION_EXECUTABLE}.xml) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_EXECUTABLE}.xml DESTINATION ${DATADIR}/mime/packages ) - find_package(ECM 1.2.0 CONFIG) - set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") find_package(SharedMimeInfo) if(SharedMimeInfo_FOUND) update_xdg_mimetypes( ${DATADIR}/mime/packages ) endif(SharedMimeInfo_FOUND) endif() - -if(BUILD_OWNCLOUD_OSX_BUNDLE) - get_target_property (QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION) - add_custom_target(macdeployqt "${CMAKE_SOURCE_DIR}/admin/osx/macdeployqt.py" "${CMAKE_INSTALL_PREFIX}/${OWNCLOUD_OSX_BUNDLE}" "${QT_QMAKE_EXECUTABLE}") -endif() diff --git a/cmake/modules/MacOSXBundleInfo.plist.in b/src/gui/MacOSXBundleInfo.plist index a73902a97..d77481d0e 100644 --- a/cmake/modules/MacOSXBundleInfo.plist.in +++ b/src/gui/MacOSXBundleInfo.plist @@ -9,25 +9,25 @@ <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleExecutable</key> - <string>@APPLICATION_EXECUTABLE@</string> + <string>${APPLICATION_EXECUTABLE}</string> <key>CFBundleIconFile</key> - <string>@APPLICATION_ICON_NAME@.icns</string> + <string>${MACOSX_BUNDLE_ICON_FILE}</string> <key>CFBundleIdentifier</key> - <string>@APPLICATION_REV_DOMAIN@</string> + <string>${APPLICATION_REV_DOMAIN}</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleLongVersionString</key> - <string>@APPLICATION_NAME_XML_ESCAPED@ @MIRALL_VERSION_STRING@</string> + <string>${APPLICATION_NAME_XML_ESCAPED} ${MIRALL_VERSION_STRING}</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> - <string>@MIRALL_VERSION_FULL@</string> + <string>${MIRALL_VERSION_FULL}</string> <key>CFBundleShortVersionString</key> - <string>@MIRALL_VERSION_STRING@</string> + <string>${MIRALL_VERSION_STRING}</string> <key>NSHumanReadableCopyright</key> - <string>(C) 2014-2019 @APPLICATION_VENDOR@</string> + <string>(C) 2014-2019 ${APPLICATION_VENDOR}</string> <key>SUShowReleaseNotes</key> <false/> <key>SUPublicDSAKeyFile</key> @@ -37,11 +37,11 @@ <array> <dict> <key>UTTypeIdentifier</key> - <string>@APPLICATION_REV_DOMAIN@.VIRTUALFILE</string> + <string>${APPLICATION_REV_DOMAIN}.VIRTUALFILE</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> - <string>@APPLICATION_VIRTUALFILE_SUFFIX@</string> + <string>${APPLICATION_VIRTUALFILE_SUFFIX}</string> <key>public.mime-type</key> <string>application/octet-stream</string> </dict> @@ -56,14 +56,14 @@ <array> <dict> <key>CFBundleTypeName</key> - <string>@APPLICATION_EXECUTABLE@ Download Virtual File</string> + <string>${APPLICATION_EXECUTABLE} Download Virtual File</string> <key>CFBundleTypeRole</key> <string>Editor</string> <key>LSHandlerRank</key> <string>Owner</string> <key>LSItemContentTypes</key> <array> - <string>@APPLICATION_REV_DOMAIN@.VIRTUALFILE</string> + <string>${APPLICATION_REV_DOMAIN}.VIRTUALFILE</string> </array> </dict> </array> diff --git a/src/gui/updater/CMakeLists.txt b/src/gui/updater/CMakeLists.txt index ecfba6318..589a3a3a1 100644 --- a/src/gui/updater/CMakeLists.txt +++ b/src/gui/updater/CMakeLists.txt @@ -1,9 +1,7 @@ -if(BUILD_OWNCLOUD_OSX_BUNDLE AND NOT BUILD_LIBRARIES_ONLY) +if(APPLE AND NOT BUILD_LIBRARIES_ONLY) if (SPARKLE_FOUND) - install(FILES ${CMAKE_SOURCE_DIR}/admin/osx/deny_autoupdate_com.owncloud.desktopclient.plist - DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources) - install(FILES ${CMAKE_SOURCE_DIR}/admin/osx/sparkle/dsa_pub.pem - DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources) + list(APPEND OWNCLOUD_BUNDLED_RESOURCES ${PROJECT_SOURCE_DIR}/admin/osx/deny_autoupdate_com.owncloud.desktopclient.plist + ${PROJECT_SOURCE_DIR}/admin/osx/sparkle/dsa_pub.pem) + set(OWNCLOUD_BUNDLED_RESOURCES ${OWNCLOUD_BUNDLED_RESOURCES} PARENT_SCOPE) endif() endif() - diff --git a/src/libsync/CMakeLists.txt b/src/libsync/CMakeLists.txt index 5a8635b37..cd30fd267 100644 --- a/src/libsync/CMakeLists.txt +++ b/src/libsync/CMakeLists.txt @@ -150,16 +150,7 @@ set_target_properties( ${synclib_NAME} PROPERTIES VERSION ${MIRALL_VERSION} SOVERSION ${MIRALL_SOVERSION} ) - -if(NOT BUILD_OWNCLOUD_OSX_BUNDLE) - install(TARGETS ${synclib_NAME} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) -else() - install(TARGETS ${synclib_NAME} DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/MacOS) -endif() +install(TARGETS ${synclib_NAME} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) add_subdirectory(vfs) diff --git a/src/libsync/vfs/suffix/CMakeLists.txt b/src/libsync/vfs/suffix/CMakeLists.txt index 9d51a1200..2ca1c399e 100644 --- a/src/libsync/vfs/suffix/CMakeLists.txt +++ b/src/libsync/vfs/suffix/CMakeLists.txt @@ -1,33 +1,9 @@ -add_library("${synclib_NAME}_vfs_suffix" SHARED +add_library("${synclib_NAME}_vfs_suffix" MODULE vfs_suffix.cpp ) target_link_libraries("${synclib_NAME}_vfs_suffix" "${synclib_NAME}" ) - -set_target_properties("${synclib_NAME}_vfs_suffix" PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY} - RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY} - PREFIX "" -) - -if(APPLE) - # for being loadable when client run from build dir - set(vfs_buildoutputdir "${BIN_OUTPUT_DIRECTORY}/${OWNCLOUD_OSX_BUNDLE}/Contents/PlugIns/") - set_target_properties("${synclib_NAME}_vfs_suffix" - PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${vfs_buildoutputdir} - RUNTIME_OUTPUT_DIRECTORY ${vfs_buildoutputdir} - ) - # For being lodable when client run from install dir (after make macdeployqt) - set(vfs_installdir "${LIB_INSTALL_DIR}/../PlugIns") -else() - set(vfs_installdir "${PLUGINDIR}") -endif() - -INSTALL(TARGETS "${synclib_NAME}_vfs_suffix" - LIBRARY DESTINATION "${vfs_installdir}" - RUNTIME DESTINATION "${vfs_installdir}" -) +INSTALL(TARGETS "${synclib_NAME}_vfs_suffix" DESTINATION ${QT_PLUGIN_INSTALL_DIR}) |