From 9e1e7dc7db2f150588711fd17a0aa96baf7a554a Mon Sep 17 00:00:00 2001 From: Gusts Kaksis Date: Tue, 2 Nov 2021 16:24:28 +0200 Subject: Xcode: Add embedded plugins option --- Help/prop_tgt/XCODE_EMBED_type.rst | 6 ++++++ Help/prop_tgt/XCODE_EMBED_type_CODE_SIGN_ON_COPY.rst | 3 +++ Help/prop_tgt/XCODE_EMBED_type_PATH.rst | 3 +++ .../XCODE_EMBED_type_REMOVE_HEADERS_ON_COPY.rst | 3 +++ Help/release/dev/xcode-embed-plugins.rst | 6 ++++++ Source/cmGlobalXCodeGenerator.cxx | 9 +++++++++ Source/cmGlobalXCodeGenerator.h | 1 + .../EmbedPlugIns-macOS-check.cmake | 4 ++++ .../XcodeProject-Embed/EmbedPlugIns-macOS.cmake | 1 + Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake | 20 ++++++++++++++++++++ 10 files changed, 56 insertions(+) create mode 100644 Help/release/dev/xcode-embed-plugins.rst create mode 100644 Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake create mode 100644 Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS.cmake create mode 100644 Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake diff --git a/Help/prop_tgt/XCODE_EMBED_type.rst b/Help/prop_tgt/XCODE_EMBED_type.rst index a1af56f..e8383c2 100644 --- a/Help/prop_tgt/XCODE_EMBED_type.rst +++ b/Help/prop_tgt/XCODE_EMBED_type.rst @@ -19,6 +19,12 @@ The supported values for ```` are: The specified items will be added to the ``Embed App Extensions`` build phase. They must be CMake target names. +``PLUGINS`` + .. versionadded:: 3.23 + + The specified items will be added to the ``Embed PlugIns`` build phase. + They must be CMake target names. + See also :prop_tgt:`XCODE_EMBED__PATH`, :prop_tgt:`XCODE_EMBED__REMOVE_HEADERS_ON_COPY` and :prop_tgt:`XCODE_EMBED__CODE_SIGN_ON_COPY`. diff --git a/Help/prop_tgt/XCODE_EMBED_type_CODE_SIGN_ON_COPY.rst b/Help/prop_tgt/XCODE_EMBED_type_CODE_SIGN_ON_COPY.rst index 7ec0385..cb449ac 100644 --- a/Help/prop_tgt/XCODE_EMBED_type_CODE_SIGN_ON_COPY.rst +++ b/Help/prop_tgt/XCODE_EMBED_type_CODE_SIGN_ON_COPY.rst @@ -14,5 +14,8 @@ The supported values for ```` are: ``APP_EXTENSIONS`` .. versionadded:: 3.21 +``PLUGINS`` + .. versionadded:: 3.23 + If a ``XCODE_EMBED__CODE_SIGN_ON_COPY`` property is not defined on the target, no code signing on copy will be performed for that ````. diff --git a/Help/prop_tgt/XCODE_EMBED_type_PATH.rst b/Help/prop_tgt/XCODE_EMBED_type_PATH.rst index a6f980d..160f765 100644 --- a/Help/prop_tgt/XCODE_EMBED_type_PATH.rst +++ b/Help/prop_tgt/XCODE_EMBED_type_PATH.rst @@ -16,3 +16,6 @@ The supported values for ```` are: ``APP_EXTENSIONS`` .. versionadded:: 3.21 + +``PLUGINS`` + .. versionadded:: 3.23 diff --git a/Help/prop_tgt/XCODE_EMBED_type_REMOVE_HEADERS_ON_COPY.rst b/Help/prop_tgt/XCODE_EMBED_type_REMOVE_HEADERS_ON_COPY.rst index 75c8eae..e3a7ced 100644 --- a/Help/prop_tgt/XCODE_EMBED_type_REMOVE_HEADERS_ON_COPY.rst +++ b/Help/prop_tgt/XCODE_EMBED_type_REMOVE_HEADERS_ON_COPY.rst @@ -18,3 +18,6 @@ The supported values for ```` are: If the ``XCODE_EMBED_APP_EXTENSIONS_REMOVE_HEADERS_ON_COPY`` property is not defined, headers WILL be removed on copy by default. + +``PLUGINS`` + .. versionadded:: 3.23 diff --git a/Help/release/dev/xcode-embed-plugins.rst b/Help/release/dev/xcode-embed-plugins.rst new file mode 100644 index 0000000..10f91f6 --- /dev/null +++ b/Help/release/dev/xcode-embed-plugins.rst @@ -0,0 +1,6 @@ +xcode-embed-plugins +------------------- + +* The :prop_tgt:`XCODE_EMBED_PLUGINS >` target property + was added to tell the :generator:`Xcode` generator what targets to put in + the ``Embed PlugIns`` build phase. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index c8df0a7..6fa15e6 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3910,6 +3910,14 @@ void cmGlobalXCodeGenerator::AddEmbeddedFrameworks(cmXCodeObject* target) NoActionOnCopyByDefault); } +void cmGlobalXCodeGenerator::AddEmbeddedPlugIns(cmXCodeObject* target) +{ + static const auto dstSubfolderSpec = "13"; + + this->AddEmbeddedObjects(target, "Embed PlugIns", "XCODE_EMBED_PLUGINS", + dstSubfolderSpec, NoActionOnCopyByDefault); +} + void cmGlobalXCodeGenerator::AddEmbeddedAppExtensions(cmXCodeObject* target) { static const auto dstSubfolderSpec = "13"; @@ -4298,6 +4306,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( for (auto t : targets) { this->AddDependAndLinkInformation(t); this->AddEmbeddedFrameworks(t); + this->AddEmbeddedPlugIns(t); this->AddEmbeddedAppExtensions(t); // Inherit project-wide values for any target-specific search paths. this->InheritBuildSettingAttribute(t, "HEADER_SEARCH_PATHS"); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 4d7ee90..910c946 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -216,6 +216,7 @@ private: const std::string& dstSubfolderSpec, int actionsOnByDefault); void AddEmbeddedFrameworks(cmXCodeObject* target); + void AddEmbeddedPlugIns(cmXCodeObject* target); void AddEmbeddedAppExtensions(cmXCodeObject* target); void AddPositionIndependentLinkAttribute(cmGeneratorTarget* target, cmXCodeObject* buildSettings, diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake new file mode 100644 index 0000000..576be11 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) + +findAttribute(${test} "RemoveHeadersOnCopy" TRUE) +findAttribute(${test} "CodeSignOnCopy" FALSE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS.cmake new file mode 100644 index 0000000..57f8fbe --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/EmbedPlugIns.cmake) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake new file mode 100644 index 0000000..1bd1bd0 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake @@ -0,0 +1,20 @@ +add_executable(plug_in MACOS_BUNDLE Empty.txt) +set_target_properties(plug_in PROPERTIES + LINKER_LANGUAGE CXX + XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO" + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" + XCODE_ATTRIBUTE_ENABLE_BITCODE "NO" + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in" + MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app.plug_in" + XCODE_EXPLICIT_FILE_TYPE "wrapper.cfbundle" + XCODE_ATTRIBUTE_MACH_O_TYPE "mh_bundle" +) + +add_executable(app MACOSX_BUNDLE main.m) +add_dependencies(app plug_in) +set_target_properties(app PROPERTIES + XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO" + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" + XCODE_EMBED_PLUGINS plug_in + MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app" +) -- cgit v0.12