mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-05 16:55:25 +08:00
qt 6.5.1 original
This commit is contained in:
124
mkspecs/features/mac/asset_catalogs.prf
Normal file
124
mkspecs/features/mac/asset_catalogs.prf
Normal file
@ -0,0 +1,124 @@
|
||||
# QMAKE_ASSET_CATALOGS
|
||||
# Paths to xcassets directories to be compiled
|
||||
#
|
||||
# QMAKE_ASSET_CATALOGS_BUILD_PATH
|
||||
# Location which asset catalogs will be compiled to.
|
||||
# If the current target is an app bundle, defaults to its Resources directory.
|
||||
# Otherwise, this value must be set manually.
|
||||
#
|
||||
# QMAKE_ASSET_CATALOGS_APP_ICON
|
||||
# Name of the icon resource in the asset catalogs that will be used as the app icon.
|
||||
# Defaults to AppIcon.
|
||||
#
|
||||
# QMAKE_ASSET_CATALOGS_LAUNCH_IMAGE
|
||||
# Name of the launch image resource in the asset catalogs that will be used as the launch image.
|
||||
#
|
||||
# QMAKE_ASSET_CATALOGS_INSTALL_PATH
|
||||
# Base path to install files to. Falls back to a path relative to the target install path,
|
||||
# based on QMAKE_ASSET_CATALOGS_BUILD_PATH.
|
||||
|
||||
!have_target|if(!build_pass:!isEmpty(BUILDS)): \
|
||||
return()
|
||||
|
||||
!isEmpty(QMAKE_ASSET_CATALOGS) {
|
||||
load(resolve_target)
|
||||
|
||||
isEmpty(QMAKE_ASSET_CATALOGS_BUILD_PATH) {
|
||||
!isEmpty(QMAKE_RESOLVED_BUNDLE):equals(TEMPLATE, app):app_bundle {
|
||||
macos: \
|
||||
QMAKE_ASSET_CATALOGS_BUILD_PATH = $$QMAKE_RESOLVED_BUNDLE/Contents/Resources
|
||||
else: \
|
||||
QMAKE_ASSET_CATALOGS_BUILD_PATH = $$QMAKE_RESOLVED_BUNDLE
|
||||
} else {
|
||||
error("QMAKE_ASSET_CATALOGS_BUILD_PATH must be set when using QMAKE_ASSET_CATALOGS.")
|
||||
}
|
||||
}
|
||||
|
||||
QMAKE_ASSET_CATALOGS_BUILD_PATH = $$clean_path($$QMAKE_ASSET_CATALOGS_BUILD_PATH)
|
||||
|
||||
macx-xcode {
|
||||
!isEmpty(QMAKE_ASSET_CATALOGS_APP_ICON) {
|
||||
asset_catalog_appicon.name = "ASSETCATALOG_COMPILER_APPICON_NAME"
|
||||
asset_catalog_appicon.value = $$QMAKE_ASSET_CATALOGS_APP_ICON
|
||||
QMAKE_MAC_XCODE_SETTINGS += asset_catalog_appicon
|
||||
}
|
||||
|
||||
!isEmpty(QMAKE_ASSET_CATALOGS_LAUNCH_IMAGE) {
|
||||
asset_catalog_launchimage.name = "ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME"
|
||||
asset_catalog_launchimage.value = $$QMAKE_ASSET_CATALOGS_LAUNCH_IMAGE
|
||||
QMAKE_MAC_XCODE_SETTINGS += asset_catalog_launchimage
|
||||
}
|
||||
|
||||
asset_catalog_compiler.files = $$QMAKE_ASSET_CATALOGS
|
||||
macos: asset_catalog_compiler.path = Contents/Resources
|
||||
QMAKE_BUNDLE_DATA += asset_catalog_compiler
|
||||
} else {
|
||||
!isEmpty(QMAKE_ASSET_CATALOGS_APP_ICON) {
|
||||
asset_catalog_app_icon_arg = \
|
||||
--app-icon $$shell_quote($$QMAKE_ASSET_CATALOGS_APP_ICON)
|
||||
}
|
||||
|
||||
!isEmpty(QMAKE_ASSET_CATALOGS_LAUNCH_IMAGE) {
|
||||
asset_catalog_launch_image_arg = \
|
||||
--launch-image $$shell_quote($$QMAKE_ASSET_CATALOGS_LAUNCH_IMAGE)
|
||||
}
|
||||
|
||||
asset_catalog_compiler.target = $$OUT_PWD/asset_catalog_compiler.Info.plist
|
||||
asset_catalog_compiler.commands = $$shell_quote($$QMAKE_ACTOOL) \
|
||||
$$asset_catalog_app_icon_arg \
|
||||
$$asset_catalog_launch_image_arg \
|
||||
--output-partial-info-plist $$shell_quote($$asset_catalog_compiler.target) \
|
||||
--platform $${platform_identifier} \
|
||||
--minimum-deployment-target $${deployment_target} \
|
||||
--compile $$shell_quote($$QMAKE_ASSET_CATALOGS_BUILD_PATH)
|
||||
|
||||
for (catalog, QMAKE_ASSET_CATALOGS) {
|
||||
asset_catalog_compiler.commands += $${catalog}
|
||||
asset_catalog_compiler.depends += $$files($$catalog/*, true)
|
||||
}
|
||||
|
||||
actool_output_files = $$system(\
|
||||
mkdir -p $$system_quote($$QMAKE_ASSET_CATALOGS_BUILD_PATH) && \
|
||||
/usr/libexec/PlistBuddy -c \'Print :com.apple.actool.compilation-results:output-files\' \
|
||||
/dev/stdin <<< $($${asset_catalog_compiler.commands} 2>/dev/null) | sed -Ene \'s/^ +//p\', lines)
|
||||
|
||||
for (output_file, actool_output_files) {
|
||||
!equals(output_file, $$asset_catalog_compiler.target): \
|
||||
actool_output_files_rel += $$relative_path($$output_file, $$QMAKE_ASSET_CATALOGS_BUILD_PATH)
|
||||
}
|
||||
|
||||
QMAKE_EXTRA_TARGETS += asset_catalog_compiler
|
||||
PRE_TARGETDEPS += $$asset_catalog_compiler.target
|
||||
|
||||
isEmpty(QMAKE_ASSET_CATALOGS_INSTALL_PATH) {
|
||||
!isEmpty(target.path): \
|
||||
QMAKE_ASSET_CATALOGS_INSTALL_PATH = $${target.path}/
|
||||
QMAKE_ASSET_CATALOGS_INSTALL_PATH = $${QMAKE_ASSET_CATALOGS_INSTALL_PATH}$$relative_path(\
|
||||
$$QMAKE_ASSET_CATALOGS_BUILD_PATH, $$absolute_path($$DESTDIR, $$OUT_PWD))
|
||||
}
|
||||
|
||||
for (ac_install_file, actool_output_files_rel) {
|
||||
asset_catalogs_files.files += \
|
||||
$$QMAKE_ASSET_CATALOGS_BUILD_PATH/$$ac_install_file
|
||||
}
|
||||
contains(INSTALLS, target): asset_catalogs_files.depends += install_target
|
||||
asset_catalogs_files.path = $$QMAKE_ASSET_CATALOGS_INSTALL_PATH
|
||||
asset_catalogs_files.CONFIG += no_check_exist
|
||||
INSTALLS += asset_catalogs_files
|
||||
}
|
||||
} else: macx-xcode {
|
||||
# Backwards compatibility
|
||||
for (bundle_data, QMAKE_BUNDLE_DATA) {
|
||||
for (bundle_file, $${bundle_data}.files) {
|
||||
!contains(bundle_file, .*\\.xcassets$): next()
|
||||
warning("*.xcassets in QMAKE_BUNDLE_DATA is deprecated. Use QMAKE_ASSET_CATALOGS instead.")
|
||||
!exists($$absolute_path($$bundle_file/AppIcon.appiconset, $$_PRO_FILE_PWD_)): next()
|
||||
|
||||
asset_catalog_appicon.name = "ASSETCATALOG_COMPILER_APPICON_NAME"
|
||||
asset_catalog_appicon.value = "AppIcon"
|
||||
QMAKE_MAC_XCODE_SETTINGS += asset_catalog_appicon
|
||||
break()
|
||||
}
|
||||
!isEmpty(asset_catalog_appicon.name): break()
|
||||
}
|
||||
}
|
309
mkspecs/features/mac/default_post.prf
Normal file
309
mkspecs/features/mac/default_post.prf
Normal file
@ -0,0 +1,309 @@
|
||||
load(default_post)
|
||||
|
||||
# Recompute SDK version in case the user set it explicitly
|
||||
sdk_version = $$QMAKE_MAC_SDK_VERSION
|
||||
QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
|
||||
|
||||
contains(TEMPLATE, .*app) {
|
||||
!macx-xcode:if(isEmpty(BUILDS)|build_pass) {
|
||||
# Detect changes to the platform SDK
|
||||
QMAKE_EXTRA_VARIABLES += \
|
||||
QMAKE_MAC_SDK \
|
||||
QMAKE_MAC_SDK_VERSION \
|
||||
QMAKE_XCODE_DEVELOPER_PATH \
|
||||
_QMAKE_STASH_ \
|
||||
|
||||
QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/sdk.mk)
|
||||
}
|
||||
|
||||
# Detect incompatible SDK versions
|
||||
|
||||
isEmpty(QT_MAC_SDK_VERSION_MIN): \
|
||||
QT_MAC_SDK_VERSION_MIN = $$QT_MAC_SDK_VERSION
|
||||
|
||||
!versionAtLeast(QMAKE_MAC_SDK_VERSION, $$QT_MAC_SDK_VERSION_MIN): \
|
||||
warning("Qt requires at least version $$QT_MAC_SDK_VERSION_MIN of the platform SDK," \
|
||||
"you're building against version $${QMAKE_MAC_SDK_VERSION}. Please upgrade.")
|
||||
|
||||
!isEmpty(QT_MAC_SDK_VERSION_MAX) {
|
||||
# For Qt developers only
|
||||
!isEmpty($$list($$(QT_MAC_SDK_NO_VERSION_CHECK))): \
|
||||
CONFIG += sdk_no_version_check
|
||||
|
||||
QMAKE_MAC_SDK_MAJOR_VERSION = $$replace(QMAKE_MAC_SDK_VERSION, "(\\d+)(\\.\\d+)(\\.\\d+)?", \\1)
|
||||
|
||||
!sdk_no_version_check:!versionAtMost(QMAKE_MAC_SDK_MAJOR_VERSION, $$QT_MAC_SDK_VERSION_MAX) {
|
||||
warning("Qt has only been tested with version $$QT_MAC_SDK_VERSION_MAX"\
|
||||
"of the platform SDK, you're using $${QMAKE_MAC_SDK_MAJOR_VERSION}.")
|
||||
warning("This is an unsupported configuration. You may experience build issues," \
|
||||
"and by using")
|
||||
warning("the $$QMAKE_MAC_SDK_VERSION SDK you are opting in to new features" \
|
||||
"that Qt has not been prepared for.")
|
||||
|
||||
warning("Please downgrade the SDK you use to build your app to version" \
|
||||
"$$QT_MAC_SDK_VERSION_MAX, or configure")
|
||||
warning("with CONFIG+=sdk_no_version_check when running qmake" \
|
||||
"to silence this warning.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
!no_objective_c:CONFIG += objective_c
|
||||
|
||||
qt {
|
||||
qtConfig(static) {
|
||||
# C++11 support means using libc++ instead of libstd++. As the
|
||||
# two libraries are incompatible we need to ensure the end user
|
||||
# project is built using the same C++11 support/no support as Qt.
|
||||
qtConfig(c++11) {
|
||||
CONFIG += c++11
|
||||
} else: c++11 {
|
||||
warning("Qt was not built with C++11 enabled, disabling feature")
|
||||
CONFIG -= c++11
|
||||
}
|
||||
|
||||
!c++11 {
|
||||
# Explicitly use libstdc++ if C++11 support is not enabled,
|
||||
# as otherwise the compiler will choose the standard library
|
||||
# based on the deployment target, which for iOS 7 and OS X 10.9
|
||||
# is libc++, and we can't mix and match the two.
|
||||
QMAKE_CXXFLAGS += -stdlib=libstdc++
|
||||
QMAKE_LFLAGS += -stdlib=libstdc++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Add the same default rpaths as Xcode does for new projects.
|
||||
# This is especially important for iOS/tvOS/watchOS where no other option is possible.
|
||||
!no_default_rpath {
|
||||
uikit: QMAKE_RPATHDIR += @executable_path/Frameworks
|
||||
else: QMAKE_RPATHDIR += @executable_path/../Frameworks
|
||||
equals(TEMPLATE, lib):!plugin:lib_bundle: QMAKE_RPATHDIR += @loader_path/Frameworks
|
||||
}
|
||||
|
||||
# Don't pass -headerpad_max_install_names when using Bitcode.
|
||||
# In that case the linker emits a warning stating that the flag is ignored when
|
||||
# used with bitcode, for reasons that cannot be determined (rdar://problem/20748962).
|
||||
# Using this flag is also unnecessary in practice on UIKit platforms since they
|
||||
# are sandboxed, and only UIKit platforms support bitcode to begin with.
|
||||
!bitcode: QMAKE_LFLAGS += $$QMAKE_LFLAGS_HEADERPAD
|
||||
|
||||
app_extension_api_only {
|
||||
QMAKE_CFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
|
||||
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
|
||||
QMAKE_CXXFLAGS_PRECOMPILE += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
|
||||
QMAKE_LFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
|
||||
}
|
||||
|
||||
macos {
|
||||
!isEmpty(QMAKE_APPLE_DEVICE_ARCHS) {
|
||||
# If the user has requested a specific set of architectures,
|
||||
# build all of those by default, but limited to only those.
|
||||
CONFIG -= only_active_arch
|
||||
} else {
|
||||
# Otherwise allow building all of the architectures available
|
||||
# in Qt, but only build the active arch (unless the user has
|
||||
# manually overridden this via CONFIG -= only_active_arch).
|
||||
QMAKE_APPLE_DEVICE_ARCHS = $$QT_ARCHS
|
||||
}
|
||||
}
|
||||
|
||||
macx-xcode {
|
||||
qmake_pkginfo_typeinfo.name = QMAKE_PKGINFO_TYPEINFO
|
||||
!isEmpty(QMAKE_PKGINFO_TYPEINFO): \
|
||||
qmake_pkginfo_typeinfo.value = $$QMAKE_PKGINFO_TYPEINFO
|
||||
else: \
|
||||
qmake_pkginfo_typeinfo.value = "????"
|
||||
QMAKE_MAC_XCODE_SETTINGS += qmake_pkginfo_typeinfo
|
||||
|
||||
bundle_version = $$VERSION
|
||||
isEmpty(bundle_version): bundle_version = 1.0.0
|
||||
|
||||
l = $$split(bundle_version, '.') 0 0 # make sure there are at least three
|
||||
VER_MAJ = $$member(l, 0, 0)
|
||||
VER_MIN = $$member(l, 1, 1)
|
||||
VER_PAT = $$member(l, 2, 2)
|
||||
unset(l)
|
||||
|
||||
qmake_full_version.name = QMAKE_FULL_VERSION
|
||||
qmake_full_version.value = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
|
||||
QMAKE_MAC_XCODE_SETTINGS += qmake_full_version
|
||||
|
||||
qmake_short_version.name = QMAKE_SHORT_VERSION
|
||||
qmake_short_version.value = $${VER_MAJ}.$${VER_MIN}
|
||||
QMAKE_MAC_XCODE_SETTINGS += qmake_short_version
|
||||
|
||||
!isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) {
|
||||
debug_information_format.name = DEBUG_INFORMATION_FORMAT
|
||||
debug_information_format.value = $$QMAKE_XCODE_DEBUG_INFORMATION_FORMAT
|
||||
debug_information_format.build = debug
|
||||
QMAKE_MAC_XCODE_SETTINGS += debug_information_format
|
||||
}
|
||||
|
||||
QMAKE_XCODE_ARCHS =
|
||||
|
||||
arch_device.name = "ARCHS[sdk=$${device.sdk}*]"
|
||||
arch_device.value = $$QMAKE_APPLE_DEVICE_ARCHS
|
||||
QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_DEVICE_ARCHS
|
||||
QMAKE_MAC_XCODE_SETTINGS += arch_device
|
||||
|
||||
ios:simulator {
|
||||
arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]"
|
||||
arch_simulator.value = $$QMAKE_APPLE_SIMULATOR_ARCHS
|
||||
QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_SIMULATOR_ARCHS
|
||||
QMAKE_MAC_XCODE_SETTINGS += arch_simulator
|
||||
}
|
||||
|
||||
only_active_arch.name = ONLY_ACTIVE_ARCH
|
||||
only_active_arch.value = YES
|
||||
only_active_arch.build = debug
|
||||
QMAKE_MAC_XCODE_SETTINGS += only_active_arch
|
||||
} else {
|
||||
device|!simulator: VALID_DEVICE_ARCHS = $$QMAKE_APPLE_DEVICE_ARCHS
|
||||
ios:simulator: VALID_SIMULATOR_ARCHS = $$QMAKE_APPLE_SIMULATOR_ARCHS
|
||||
VALID_ARCHS = $$VALID_DEVICE_ARCHS $$VALID_SIMULATOR_ARCHS
|
||||
|
||||
single_arch: VALID_ARCHS = $$first(VALID_ARCHS)
|
||||
|
||||
macos {
|
||||
only_active_arch: DEFAULT_ARCHS = $$system("uname -m")
|
||||
else: DEFAULT_ARCHS = $$VALID_ARCHS
|
||||
}
|
||||
|
||||
ARCHS = $(filter $(EXPORT_VALID_ARCHS), \
|
||||
$(if $(ARCHS), $(ARCHS), \
|
||||
$(if $(EXPORT_DEFAULT_ARCHS), $(EXPORT_DEFAULT_ARCHS), \
|
||||
$(EXPORT_VALID_ARCHS))))
|
||||
ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ARCHS), $(EXPORT_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch))
|
||||
|
||||
QMAKE_EXTRA_VARIABLES += VALID_ARCHS DEFAULT_ARCHS ARCHS ARCH_ARGS
|
||||
|
||||
arch_flags = $(EXPORT_ARCH_ARGS)
|
||||
|
||||
QMAKE_CFLAGS += $$arch_flags
|
||||
QMAKE_CXXFLAGS += $$arch_flags
|
||||
QMAKE_LFLAGS += $$arch_flags
|
||||
|
||||
QMAKE_PCH_ARCHS = $$VALID_ARCHS
|
||||
|
||||
macos: deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET
|
||||
ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
|
||||
tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET
|
||||
watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET
|
||||
|
||||
# If we're doing a simulator and device build, device and simulator
|
||||
# architectures use different paths and flags for the sysroot and
|
||||
# deployment target switch, so we must multiplex them across multiple
|
||||
# architectures using -Xarch. Otherwise we fall back to the simple path.
|
||||
# This is not strictly necessary, but results in cleaner command lines
|
||||
# and makes it easier for people to override EXPORT_VALID_ARCHS to limit
|
||||
# individual rules to a different set of architecture(s) from the overall
|
||||
# build (such as machtest in QtCore).
|
||||
ios:simulator:device {
|
||||
QMAKE_XARCH_CFLAGS =
|
||||
QMAKE_XARCH_LFLAGS =
|
||||
QMAKE_EXTRA_VARIABLES += QMAKE_XARCH_CFLAGS QMAKE_XARCH_LFLAGS
|
||||
|
||||
for (arch, VALID_ARCHS) {
|
||||
contains(VALID_SIMULATOR_ARCHS, $$arch) {
|
||||
sdk = $$simulator.sdk
|
||||
version_identifier = $$simulator.deployment_identifier
|
||||
platform_identifier = $$simulator.sdk
|
||||
} else {
|
||||
sdk = $$device.sdk
|
||||
version_identifier = $$device.deployment_identifier
|
||||
platform_identifier = $$device.sdk
|
||||
}
|
||||
|
||||
version_min_flags = \
|
||||
-Xarch_$${arch} \
|
||||
-m$${version_identifier}-version-min=$$deployment_target
|
||||
QMAKE_XARCH_CFLAGS_$${arch} = $$version_min_flags \
|
||||
-Xarch_$${arch} \
|
||||
-isysroot$$xcodeSDKInfo(Path, $$sdk)
|
||||
QMAKE_XARCH_LFLAGS_$${arch} = $$version_min_flags \
|
||||
-Xarch_$${arch} \
|
||||
-isysroot$$xcodeSDKInfo(Path, $$sdk)
|
||||
|
||||
QMAKE_XARCH_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS_$${arch})
|
||||
QMAKE_XARCH_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS_$${arch})
|
||||
|
||||
QMAKE_EXTRA_VARIABLES += \
|
||||
QMAKE_XARCH_CFLAGS_$${arch} \
|
||||
QMAKE_XARCH_LFLAGS_$${arch}
|
||||
}
|
||||
|
||||
QMAKE_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
|
||||
QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
|
||||
QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS)
|
||||
} else {
|
||||
ios:simulator {
|
||||
version_identifier = $$simulator.deployment_identifier
|
||||
platform_identifier = $$simulator.sdk
|
||||
sysroot_path = $$xcodeSDKInfo(Path, $$simulator.sdk)
|
||||
} else {
|
||||
version_identifier = $$device.deployment_identifier
|
||||
platform_identifier = $$device.sdk
|
||||
sysroot_path = $$xcodeSDKInfo(Path, $$device.sdk)
|
||||
}
|
||||
version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
|
||||
QMAKE_CFLAGS += -isysroot $$sysroot_path $$version_min_flag
|
||||
QMAKE_CXXFLAGS += -isysroot $$sysroot_path $$version_min_flag
|
||||
QMAKE_LFLAGS += -isysroot $$sysroot_path $$version_min_flag
|
||||
}
|
||||
|
||||
# Enable precompiled headers for multiple architectures
|
||||
QMAKE_CFLAGS_USE_PRECOMPILE =
|
||||
for (arch, VALID_ARCHS) {
|
||||
icc_pch_style: \
|
||||
use_flag = "-pch-use "
|
||||
else: \
|
||||
use_flag = -include
|
||||
|
||||
# Only use Xarch with multi-arch, as the option confuses ccache
|
||||
count(VALID_ARCHS, 1, greaterThan): \
|
||||
QMAKE_CFLAGS_USE_PRECOMPILE += \
|
||||
-Xarch_$${arch}
|
||||
|
||||
QMAKE_CFLAGS_USE_PRECOMPILE += \
|
||||
$${use_flag}${QMAKE_PCH_OUTPUT_$${arch}}
|
||||
}
|
||||
icc_pch_style {
|
||||
QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE -include ${QMAKE_PCH_INPUT}
|
||||
QMAKE_CFLAGS_USE_PRECOMPILE =
|
||||
} else {
|
||||
QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
|
||||
QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
|
||||
QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
|
||||
}
|
||||
|
||||
QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT}
|
||||
}
|
||||
|
||||
!equals(sdk_version, $$QMAKE_MAC_SDK_VERSION) {
|
||||
# Explicit SDK version has been set, respect that
|
||||
QMAKE_LFLAGS += -Wl,-sdk_version -Wl,$$sdk_version
|
||||
}
|
||||
|
||||
cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
|
||||
!isEmpty(QMAKE_XCODE_VERSION): \
|
||||
cache(QMAKE_XCODE_VERSION, stash)
|
||||
|
||||
QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
|
||||
|
||||
xcode_product_bundle_identifier_setting.name = PRODUCT_BUNDLE_IDENTIFIER
|
||||
xcode_product_bundle_identifier_setting.value = $$QMAKE_TARGET_BUNDLE_PREFIX
|
||||
isEmpty(xcode_product_bundle_identifier_setting.value): \
|
||||
xcode_product_bundle_identifier_setting.value = "com.yourcompany"
|
||||
xcode_product_bundle_target = $$QMAKE_BUNDLE
|
||||
isEmpty(xcode_product_bundle_target): \
|
||||
xcode_product_bundle_target = ${PRODUCT_NAME:rfc1034identifier}
|
||||
xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identifier_setting.value}.$${xcode_product_bundle_target}"
|
||||
QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting
|
||||
|
||||
!macx-xcode {
|
||||
generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode \"$(EXPORT__PRO_FILE_)\" $$QMAKE_ARGS
|
||||
generate_xcode_project.target = xcodeproj
|
||||
QMAKE_EXTRA_VARIABLES += _PRO_FILE_
|
||||
QMAKE_EXTRA_TARGETS += generate_xcode_project
|
||||
}
|
60
mkspecs/features/mac/default_pre.prf
Normal file
60
mkspecs/features/mac/default_pre.prf
Normal file
@ -0,0 +1,60 @@
|
||||
CONFIG = asset_catalogs rez $$CONFIG
|
||||
load(default_pre)
|
||||
|
||||
isEmpty(QMAKE_XCODE_DEVELOPER_PATH) {
|
||||
# Get path of Xcode's Developer directory
|
||||
QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null")
|
||||
isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
|
||||
error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.")
|
||||
|
||||
# Make sure Xcode path is valid
|
||||
!exists($$QMAKE_XCODE_DEVELOPER_PATH): \
|
||||
error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.")
|
||||
}
|
||||
|
||||
isEmpty(QMAKE_XCODEBUILD_PATH): \
|
||||
QMAKE_XCODEBUILD_PATH = $$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")
|
||||
|
||||
!isEmpty(QMAKE_XCODEBUILD_PATH) {
|
||||
# Make sure Xcode is set up properly
|
||||
!system("/usr/bin/xcrun xcodebuild -license check 2>/dev/null"): \
|
||||
error("Xcode not set up properly. You need to confirm the license agreement by running 'sudo xcrun xcodebuild -license accept'.")
|
||||
|
||||
isEmpty(QMAKE_XCODE_VERSION) {
|
||||
# Extract Xcode version using xcodebuild
|
||||
xcode_version = $$system("/usr/bin/xcrun xcodebuild -version")
|
||||
QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
|
||||
isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.")
|
||||
unset(xcode_version)
|
||||
}
|
||||
}
|
||||
|
||||
isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) {
|
||||
QMAKE_XCODE_PREFERENCES_FILE = $$(HOME)/Library/Preferences/com.apple.dt.Xcode.plist
|
||||
exists($$QMAKE_XCODE_PREFERENCES_FILE): \
|
||||
QMAKE_TARGET_BUNDLE_PREFIX = $$system("/usr/libexec/PlistBuddy -c 'print IDETemplateOptions:bundleIdentifierPrefix' $$QMAKE_XCODE_PREFERENCES_FILE 2>/dev/null")
|
||||
|
||||
!isEmpty(_QMAKE_CACHE_):!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \
|
||||
cache(QMAKE_TARGET_BUNDLE_PREFIX)
|
||||
}
|
||||
|
||||
QMAKE_ASSET_CATALOGS_APP_ICON = AppIcon
|
||||
|
||||
# Make the default debug info format for static debug builds
|
||||
# DWARF instead of DWARF with dSYM. This cuts down build times
|
||||
# for application debug builds significantly, as Xcode doesn't
|
||||
# have to pull out all the DWARF info from the Qt static libs
|
||||
# and put it into a dSYM file. We don't need that dSYM file in
|
||||
# the first place, since the information is available in the
|
||||
# object files inside the archives (static libraries).
|
||||
macx-xcode:qtConfig(static): \
|
||||
QMAKE_XCODE_DEBUG_INFORMATION_FORMAT = dwarf
|
||||
|
||||
# This variable is used by the xcode_dynamic_library_suffix
|
||||
# feature, which allows Xcode to choose the Qt libraries to link to
|
||||
# at build time, depending on the current Xcode SDK and configuration.
|
||||
QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX
|
||||
|
||||
xcode_copy_phase_strip_setting.name = COPY_PHASE_STRIP
|
||||
xcode_copy_phase_strip_setting.value = NO
|
||||
QMAKE_MAC_XCODE_SETTINGS += xcode_copy_phase_strip_setting
|
18
mkspecs/features/mac/mac.prf
Normal file
18
mkspecs/features/mac/mac.prf
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
# Embed plist file via linker if we're not building a bundle
|
||||
!isEmpty(QMAKE_INFO_PLIST) {
|
||||
add_plist = false
|
||||
equals(TEMPLATE, lib) {
|
||||
plugin:!plugin_bundle: \
|
||||
add_plist = true
|
||||
else: !plugin:!lib_bundle: \
|
||||
add_plist = true
|
||||
} else: equals(TEMPLATE, app) {
|
||||
!app_bundle: \
|
||||
add_plist = true
|
||||
}
|
||||
|
||||
$$add_plist: \
|
||||
QMAKE_LFLAGS += -Wl,-sectcreate,__TEXT,__info_plist,$$shell_quote( \
|
||||
$$relative_path($$absolute_path($$QMAKE_INFO_PLIST, $$_PRO_FILE_PWD_), $$OUT_PWD))
|
||||
}
|
7
mkspecs/features/mac/no_warn_empty_obj_files.prf
Normal file
7
mkspecs/features/mac/no_warn_empty_obj_files.prf
Normal file
@ -0,0 +1,7 @@
|
||||
# Prevent warnings about object files without any symbols. This is a common
|
||||
# thing in Qt as we tend to build files unconditionally, and then use ifdefs
|
||||
# to compile out parts that are not relevant.
|
||||
QMAKE_RANLIB += -no_warning_for_no_symbols
|
||||
|
||||
# We have to tell 'ar' to not run ranlib by itself
|
||||
QMAKE_AR += -S
|
12
mkspecs/features/mac/objective_c.prf
Normal file
12
mkspecs/features/mac/objective_c.prf
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
# Objective-C/C++ sources go in SOURCES, like all other sources
|
||||
SOURCES += $$OBJECTIVE_SOURCES
|
||||
unset(OBJECTIVE_SOURCES)
|
||||
|
||||
# Strip C/C++ flags from QMAKE_OBJECTIVE_CFLAGS just in case
|
||||
QMAKE_OBJECTIVE_CFLAGS -= $$QMAKE_CFLAGS $$QMAKE_CXXFLAGS
|
||||
|
||||
# Add Objective-C/C++ flags to C/C++ flags, the compiler can handle it
|
||||
QMAKE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS
|
||||
QMAKE_CXXFLAGS += $$QMAKE_OBJECTIVE_CFLAGS
|
||||
unset(QMAKE_OBJECTIVE_CFLAGS)
|
16
mkspecs/features/mac/rez.prf
Normal file
16
mkspecs/features/mac/rez.prf
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
#global defaults
|
||||
isEmpty(QMAKE_REZ) {
|
||||
QMAKE_REZ = /Developer/Tools/Rez
|
||||
}
|
||||
isEmpty(REZ_DIR):REZ_DIR = .
|
||||
isEmpty(QMAKE_EXT_REZ):QMAKE_EXT_REZ = .rsrc
|
||||
|
||||
rez_source.CONFIG += no_link
|
||||
rez_source.dependency_type = TYPE_C
|
||||
rez_source.commands = $$QMAKE_REZ ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} -useDF
|
||||
rez_source.output = $$REZ_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_REZ)}
|
||||
rez_source.input = REZ_FILES
|
||||
rez_source.name = REZ ${QMAKE_FILE_IN}
|
||||
silent:rez_source.commands = @echo rez ${QMAKE_FILE_IN} && $$rez_source.commands
|
||||
QMAKE_EXTRA_COMPILERS += rez_source
|
27
mkspecs/features/mac/sdk.mk
Normal file
27
mkspecs/features/mac/sdk.mk
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
ifeq ($(QT_MAC_SDK_NO_VERSION_CHECK),)
|
||||
CHECK_SDK_COMMAND = /usr/bin/xcrun --sdk $(EXPORT_QMAKE_MAC_SDK) -show-sdk-version 2>/dev/null
|
||||
CURRENT_MAC_SDK_VERSION := $(shell DEVELOPER_DIR=$(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) $(CHECK_SDK_COMMAND))
|
||||
ifneq ($(CURRENT_MAC_SDK_VERSION),$(EXPORT_QMAKE_MAC_SDK_VERSION))
|
||||
# We don't want to complain about out of date SDK unless the target needs to be remade.
|
||||
# This covers use-cases such as running 'make check' after moving the build to a
|
||||
# computer without Xcode or with a different Xcode version.
|
||||
TARGET_UP_TO_DATE := $(shell QT_MAC_SDK_NO_VERSION_CHECK=1 $(MAKE) --question $(QMAKE_TARGET) && echo 1 || echo 0)
|
||||
ifeq ($(TARGET_UP_TO_DATE),0)
|
||||
ifneq ($(findstring missing DEVELOPER_DIR path,$(CURRENT_MAC_SDK_VERSION)),)
|
||||
$(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) is no longer valid.)
|
||||
else ifneq ($(findstring SDK "$(EXPORT_QMAKE_MAC_SDK)" cannot be located,$(CURRENT_MAC_SDK_VERSION)),)
|
||||
$(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) no longer contains the $(EXPORT_QMAKE_MAC_SDK_VERSION) platform SDK.)
|
||||
else ifneq ($(CURRENT_MAC_SDK_VERSION),)
|
||||
$(info The $(EXPORT_QMAKE_MAC_SDK) platform SDK has been changed from version $(EXPORT_QMAKE_MAC_SDK_VERSION) to version $(CURRENT_MAC_SDK_VERSION).)
|
||||
else
|
||||
$(info Unknown error resolving current platform SDK version.)
|
||||
endif
|
||||
$(info This requires a fresh build of your project. Please wipe the build directory)
|
||||
ifneq ($(EXPORT__QMAKE_STASH_),)
|
||||
$(info including the qmake cache in $(EXPORT__QMAKE_STASH_))
|
||||
endif
|
||||
$(error ^)
|
||||
endif
|
||||
endif
|
||||
endif
|
61
mkspecs/features/mac/sdk.prf
Normal file
61
mkspecs/features/mac/sdk.prf
Normal file
@ -0,0 +1,61 @@
|
||||
|
||||
isEmpty(QMAKE_MAC_SDK): \
|
||||
error("QMAKE_MAC_SDK must be set when using CONFIG += sdk.")
|
||||
|
||||
contains(QMAKE_MAC_SDK, .*/.*): \
|
||||
error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)")
|
||||
|
||||
defineReplace(xcodeSDKInfo) {
|
||||
info = $$1
|
||||
equals(info, "Path"): \
|
||||
infoarg = --show-sdk-path
|
||||
equals(info, "PlatformPath"): \
|
||||
infoarg = --show-sdk-platform-path
|
||||
equals(info, "SDKVersion"): \
|
||||
infoarg = --show-sdk-version
|
||||
sdk = $$2
|
||||
isEmpty(sdk): \
|
||||
sdk = $$QMAKE_MAC_SDK
|
||||
|
||||
isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) {
|
||||
QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$infoarg 2>/dev/null")
|
||||
# --show-sdk-platform-path won't work for Command Line Tools; this is fine
|
||||
# only used by the XCTest backend to testlib
|
||||
isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(infoarg, "--show-sdk-platform-path")): \
|
||||
error("Could not resolve SDK $$info for \'$$sdk\' using $$infoarg")
|
||||
cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info})
|
||||
}
|
||||
|
||||
return($$eval(QMAKE_MAC_SDK.$${sdk}.$${info}))
|
||||
}
|
||||
|
||||
QMAKE_MAC_SDK_PATH = $$xcodeSDKInfo(Path)
|
||||
QMAKE_MAC_SDK_PLATFORM_PATH = $$xcodeSDKInfo(PlatformPath)
|
||||
QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
|
||||
|
||||
isEmpty(QMAKE_EXPORT_INCDIR_OPENGL) {
|
||||
QMAKE_EXPORT_INCDIR_OPENGL = $$QMAKE_INCDIR_OPENGL
|
||||
sysrootified =
|
||||
for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
|
||||
QMAKE_INCDIR_OPENGL = $$sysrootified
|
||||
}
|
||||
|
||||
QMAKESPEC_NAME = $$basename(QMAKESPEC)
|
||||
|
||||
# Resolve SDK version of various tools
|
||||
for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_LINK QMAKE_LINK_SHLIB QMAKE_ACTOOL QMAKE_LINK_C QMAKE_LINK_C_SHLIB)) {
|
||||
tool_variable = QMAKE_MAC_SDK.$${QMAKESPEC_NAME}.$${QMAKE_MAC_SDK}.$${tool}
|
||||
!isEmpty($$tool_variable) {
|
||||
$$tool = $$eval($$tool_variable)
|
||||
next()
|
||||
}
|
||||
|
||||
value = $$eval($$tool)
|
||||
isEmpty(value): next()
|
||||
|
||||
sysrooted = $$system("/usr/bin/xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value) 2>/dev/null")
|
||||
isEmpty(sysrooted): next()
|
||||
|
||||
$$tool = $$sysrooted $$member(value, 1, -1)
|
||||
cache($$tool_variable, set stash, $$tool)
|
||||
}
|
5
mkspecs/features/mac/toolchain.prf
Normal file
5
mkspecs/features/mac/toolchain.prf
Normal file
@ -0,0 +1,5 @@
|
||||
# Ensure that we process sdk.prf first, as it will update QMAKE_CXX,
|
||||
# which the default path determination uses.
|
||||
sdk: load(sdk)
|
||||
|
||||
load(toolchain)
|
50
mkspecs/features/mac/unsupported/objc_namespace.prf
Normal file
50
mkspecs/features/mac/unsupported/objc_namespace.prf
Normal file
@ -0,0 +1,50 @@
|
||||
#
|
||||
# W A R N I N G
|
||||
# -------------
|
||||
#
|
||||
# This file is not part of the Qt API. It exists purely as an
|
||||
# implementation detail. It may change from version to version
|
||||
# without notice, or even be removed.
|
||||
#
|
||||
# We mean it.
|
||||
#
|
||||
|
||||
# The Objective-C runtime will complain when loading a binary that
|
||||
# introduces as class name that already exists in the global namespace.
|
||||
# This may happen when linking Qt statically into a plugin, and then
|
||||
# loading more than two plugins into the same host, both using Qt.
|
||||
#
|
||||
# We work around this by doing a bit of post-processing on the final
|
||||
# binary, adding new suffixed class name entries to the __objc_classname
|
||||
# section of the __TEXT segment, and then patching the class_ro_t
|
||||
# entries to point to the newly added class names.
|
||||
#
|
||||
# By linking the binary between these two steps we avoid having to
|
||||
# manually remap all the offsets in the Mach-O binary due to the
|
||||
# added class names, instead relying on the linker to do this
|
||||
# for us by linking in an assembly file with the added names.
|
||||
|
||||
objc_namespace_script = $$clean_path($$PWD/../../data/mac/objc_namespace.sh)
|
||||
|
||||
isEmpty(QMAKE_OBJC_NAMESPACE_SUFFIX) {
|
||||
QMAKE_OBJC_NAMESPACE_SUFFIX = $$TARGET
|
||||
!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \
|
||||
QMAKE_OBJC_NAMESPACE_SUFFIX = $${QMAKE_TARGET_BUNDLE_PREFIX}.$${QMAKE_OBJC_NAMESPACE_SUFFIX}
|
||||
}
|
||||
|
||||
QMAKE_LFLAGS += \
|
||||
-Wobjc_namespace,--target=$$shell_quote($$TARGET) \
|
||||
-Wobjc_namespace,--suffix=$$shell_quote($$QMAKE_OBJC_NAMESPACE_SUFFIX) \
|
||||
-Wobjc_namespace,--original_ld=$$shell_quote($$QMAKE_LINK)
|
||||
|
||||
!isEmpty(QMAKE_OBJC_NAMESPACE_EXCLUDE): \
|
||||
QMAKE_LFLAGS += -Wobjc_namespace,--exclude_list=$$shell_quote($$QMAKE_OBJC_NAMESPACE_EXCLUDE)
|
||||
!isEmpty(QMAKE_OBJC_NAMESPACE_EXCLUDE_REGEX) {
|
||||
equals(MAKEFILE_GENERATOR, UNIX): \
|
||||
QMAKE_OBJC_NAMESPACE_EXCLUDE_REGEX ~= s/\\$/\$\$/
|
||||
QMAKE_LFLAGS += -Wobjc_namespace,--exclude_regex=$$shell_quote($$QMAKE_OBJC_NAMESPACE_EXCLUDE_REGEX)
|
||||
}
|
||||
|
||||
slient: QMAKE_LFLAGS += -Wobjc_namespace,--silent=1
|
||||
|
||||
QMAKE_LINK = $$objc_namespace_script
|
Reference in New Issue
Block a user