Xcode: Add embedded plugins option

This commit is contained in:
Gusts Kaksis
2021-11-02 16:24:28 +02:00
committed by Brad King
parent 4e84a4763d
commit 9e1e7dc7db
10 changed files with 56 additions and 0 deletions

View File

@@ -19,6 +19,12 @@ The supported values for ``<type>`` 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_<type>_PATH`,
:prop_tgt:`XCODE_EMBED_<type>_REMOVE_HEADERS_ON_COPY` and
:prop_tgt:`XCODE_EMBED_<type>_CODE_SIGN_ON_COPY`.

View File

@@ -14,5 +14,8 @@ The supported values for ``<type>`` are:
``APP_EXTENSIONS``
.. versionadded:: 3.21
``PLUGINS``
.. versionadded:: 3.23
If a ``XCODE_EMBED_<type>_CODE_SIGN_ON_COPY`` property is not defined on the
target, no code signing on copy will be performed for that ``<type>``.

View File

@@ -16,3 +16,6 @@ The supported values for ``<type>`` are:
``APP_EXTENSIONS``
.. versionadded:: 3.21
``PLUGINS``
.. versionadded:: 3.23

View File

@@ -18,3 +18,6 @@ The supported values for ``<type>`` 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

View File

@@ -0,0 +1,6 @@
xcode-embed-plugins
-------------------
* The :prop_tgt:`XCODE_EMBED_PLUGINS <XCODE_EMBED_<type>>` target property
was added to tell the :generator:`Xcode` generator what targets to put in
the ``Embed PlugIns`` build phase.

View File

@@ -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");

View File

@@ -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,

View File

@@ -0,0 +1,4 @@
include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake)
findAttribute(${test} "RemoveHeadersOnCopy" TRUE)
findAttribute(${test} "CodeSignOnCopy" FALSE)

View File

@@ -0,0 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/EmbedPlugIns.cmake)

View File

@@ -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"
)