mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 19:08:07 +08:00
FileAPI: Add integration for runtime dependency installers
This commit is contained in:
@@ -752,6 +752,12 @@ with members:
|
|||||||
The ``destination`` member is populated. The ``isOptional`` member may
|
The ``destination`` member is populated. The ``isOptional`` member may
|
||||||
exist. This type has no additional members.
|
exist. This type has no additional members.
|
||||||
|
|
||||||
|
``runtimeDependencySet``
|
||||||
|
An :command:`install(RUNTIME_DEPENDENCY_SET)` call or an
|
||||||
|
:command:`install(TARGETS)` call with ``RUNTIME_DEPENDENCIES``. The
|
||||||
|
``destination`` member is populated. This type has additional members
|
||||||
|
``runtimeDependencySetName`` and ``runtimeDependencySetType``.
|
||||||
|
|
||||||
``isExcludeFromAll``
|
``isExcludeFromAll``
|
||||||
Optional member that is present with boolean value ``true`` when
|
Optional member that is present with boolean value ``true`` when
|
||||||
:command:`install` is called with the ``EXCLUDE_FROM_ALL`` option.
|
:command:`install` is called with the ``EXCLUDE_FROM_ALL`` option.
|
||||||
@@ -811,6 +817,24 @@ with members:
|
|||||||
An unsigned integer 0-based index into the main "codemodel"
|
An unsigned integer 0-based index into the main "codemodel"
|
||||||
object's ``targets`` array for the target.
|
object's ``targets`` array for the target.
|
||||||
|
|
||||||
|
``runtimeDependencySetName``
|
||||||
|
Optional member that is present when ``type`` is ``runtimeDependencySet``
|
||||||
|
and the installer was created by an
|
||||||
|
:command:`install(RUNTIME_DEPENDENCY_SET)` call. The value is a string
|
||||||
|
specifying the name of the runtime dependency set that was installed.
|
||||||
|
|
||||||
|
``runtimeDependencySetType``
|
||||||
|
Optional member that is present when ``type`` is ``runtimeDependencySet``.
|
||||||
|
The value is a string with one of the following values:
|
||||||
|
|
||||||
|
``library``
|
||||||
|
Indicates that this installer installs dependencies that are not macOS
|
||||||
|
frameworks.
|
||||||
|
|
||||||
|
``framework``
|
||||||
|
Indicates that this installer installs dependencies that are macOS
|
||||||
|
frameworks.
|
||||||
|
|
||||||
``scriptFile``
|
``scriptFile``
|
||||||
Optional member that is present when ``type`` is ``script``.
|
Optional member that is present when ``type`` is ``script``.
|
||||||
The value is a string specifying the path to the script file on disk,
|
The value is a string specifying the path to the script file on disk,
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <cm/string_view>
|
||||||
#include <cmext/algorithm>
|
#include <cmext/algorithm>
|
||||||
|
|
||||||
#include <cm3p/json/value.h>
|
#include <cm3p/json/value.h>
|
||||||
@@ -29,7 +30,10 @@
|
|||||||
#include "cmInstallExportGenerator.h"
|
#include "cmInstallExportGenerator.h"
|
||||||
#include "cmInstallFilesGenerator.h"
|
#include "cmInstallFilesGenerator.h"
|
||||||
#include "cmInstallGenerator.h"
|
#include "cmInstallGenerator.h"
|
||||||
|
#include "cmInstallGetRuntimeDependenciesGenerator.h"
|
||||||
#include "cmInstallImportedRuntimeArtifactsGenerator.h"
|
#include "cmInstallImportedRuntimeArtifactsGenerator.h"
|
||||||
|
#include "cmInstallRuntimeDependencySet.h"
|
||||||
|
#include "cmInstallRuntimeDependencySetGenerator.h"
|
||||||
#include "cmInstallScriptGenerator.h"
|
#include "cmInstallScriptGenerator.h"
|
||||||
#include "cmInstallSubdirectoryGenerator.h"
|
#include "cmInstallSubdirectoryGenerator.h"
|
||||||
#include "cmInstallTargetGenerator.h"
|
#include "cmInstallTargetGenerator.h"
|
||||||
@@ -876,8 +880,10 @@ Json::Value DirectoryObject::DumpInstaller(cmInstallGenerator* gen)
|
|||||||
{
|
{
|
||||||
Json::Value installer = Json::objectValue;
|
Json::Value installer = Json::objectValue;
|
||||||
|
|
||||||
// Exclude subdirectory installers. They are implementation details.
|
// Exclude subdirectory installers and file(GET_RUNTIME_DEPENDENCIES)
|
||||||
if (dynamic_cast<cmInstallSubdirectoryGenerator*>(gen)) {
|
// installers. They are implementation details.
|
||||||
|
if (dynamic_cast<cmInstallSubdirectoryGenerator*>(gen) ||
|
||||||
|
dynamic_cast<cmInstallGetRuntimeDependenciesGenerator*>(gen)) {
|
||||||
return installer;
|
return installer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1019,6 +1025,24 @@ Json::Value DirectoryObject::DumpInstaller(cmInstallGenerator* gen)
|
|||||||
if (installImportedRuntimeArtifacts->GetOptional()) {
|
if (installImportedRuntimeArtifacts->GetOptional()) {
|
||||||
installer["isOptional"] = true;
|
installer["isOptional"] = true;
|
||||||
}
|
}
|
||||||
|
} else if (auto* installRuntimeDependencySet =
|
||||||
|
dynamic_cast<cmInstallRuntimeDependencySetGenerator*>(gen)) {
|
||||||
|
installer["type"] = "runtimeDependencySet";
|
||||||
|
installer["destination"] =
|
||||||
|
installRuntimeDependencySet->GetDestination(this->Config);
|
||||||
|
std::string name(
|
||||||
|
installRuntimeDependencySet->GetRuntimeDependencySet()->GetName());
|
||||||
|
if (!name.empty()) {
|
||||||
|
installer["runtimeDependencySetName"] = name;
|
||||||
|
}
|
||||||
|
switch (installRuntimeDependencySet->GetDependencyType()) {
|
||||||
|
case cmInstallRuntimeDependencySetGenerator::DependencyType::Framework:
|
||||||
|
installer["runtimeDependencySetType"] = "framework";
|
||||||
|
break;
|
||||||
|
case cmInstallRuntimeDependencySetGenerator::DependencyType::Library:
|
||||||
|
installer["runtimeDependencySetType"] = "library";
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add fields common to all install generators.
|
// Add fields common to all install generators.
|
||||||
|
@@ -180,6 +180,14 @@ def check_directory(c):
|
|||||||
expected_keys.append("scriptFile")
|
expected_keys.append("scriptFile")
|
||||||
assert is_string(a["scriptFile"], e["scriptFile"])
|
assert is_string(a["scriptFile"], e["scriptFile"])
|
||||||
|
|
||||||
|
if e.get("runtimeDependencySetName", None) is not None:
|
||||||
|
expected_keys.append("runtimeDependencySetName")
|
||||||
|
assert is_string(a["runtimeDependencySetName"], e["runtimeDependencySetName"])
|
||||||
|
|
||||||
|
if e.get("runtimeDependencySetType", None) is not None:
|
||||||
|
expected_keys.append("runtimeDependencySetType")
|
||||||
|
assert is_string(a["runtimeDependencySetType"], e["runtimeDependencySetType"])
|
||||||
|
|
||||||
if e["backtrace"] is not None:
|
if e["backtrace"] is not None:
|
||||||
expected_keys.append("backtrace")
|
expected_keys.append("backtrace")
|
||||||
check_backtrace(d, a["backtrace"], e["backtrace"])
|
check_backtrace(d, a["backtrace"], e["backtrace"])
|
||||||
@@ -650,6 +658,14 @@ def gen_check_directories(c, g):
|
|||||||
if "pathsNamelink" in i:
|
if "pathsNamelink" in i:
|
||||||
i["paths"] = i["pathsNamelink"]
|
i["paths"] = i["pathsNamelink"]
|
||||||
|
|
||||||
|
if sys.platform not in ("win32", "darwin") and "linux" not in sys.platform:
|
||||||
|
for e in expected:
|
||||||
|
e["installers"] = list(filter(lambda i: i["type"] != "runtimeDependencySet", e["installers"]))
|
||||||
|
|
||||||
|
if sys.platform != "darwin":
|
||||||
|
for e in expected:
|
||||||
|
e["installers"] = list(filter(lambda i: i.get("runtimeDependencySetType", None) != "framework", e["installers"]))
|
||||||
|
|
||||||
return expected
|
return expected
|
||||||
|
|
||||||
def check_directories(c, g):
|
def check_directories(c, g):
|
||||||
|
@@ -17,6 +17,165 @@
|
|||||||
],
|
],
|
||||||
"projectName": "Cxx",
|
"projectName": "Cxx",
|
||||||
"minimumCMakeVersion": "3.12",
|
"minimumCMakeVersion": "3.12",
|
||||||
"hasInstallRule": null,
|
"hasInstallRule": true,
|
||||||
"installers": []
|
"installers": [
|
||||||
|
{
|
||||||
|
"component": "Unspecified",
|
||||||
|
"type": "target",
|
||||||
|
"destination": "lib",
|
||||||
|
"paths": [
|
||||||
|
"^cxx/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?cxx_exe(\\.exe)?$"
|
||||||
|
],
|
||||||
|
"isExcludeFromAll": null,
|
||||||
|
"isForAllComponents": null,
|
||||||
|
"isOptional": null,
|
||||||
|
"targetId": "^cxx_exe::@a56b12a3f5c0529fb296$",
|
||||||
|
"targetIndex": "cxx_exe",
|
||||||
|
"targetIsImportLibrary": null,
|
||||||
|
"targetInstallNamelink": null,
|
||||||
|
"exportName": null,
|
||||||
|
"exportTargets": null,
|
||||||
|
"scriptFile": null,
|
||||||
|
"backtrace": [
|
||||||
|
{
|
||||||
|
"file": "^cxx/CMakeLists\\.txt$",
|
||||||
|
"line": 38,
|
||||||
|
"command": "install",
|
||||||
|
"hasParent": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "^cxx/CMakeLists\\.txt$",
|
||||||
|
"line": null,
|
||||||
|
"command": null,
|
||||||
|
"hasParent": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"component": "Unspecified",
|
||||||
|
"type": "runtimeDependencySet",
|
||||||
|
"destination": "lib",
|
||||||
|
"paths": null,
|
||||||
|
"isExcludeFromAll": null,
|
||||||
|
"isForAllComponents": null,
|
||||||
|
"isOptional": null,
|
||||||
|
"targetId": null,
|
||||||
|
"targetIndex": null,
|
||||||
|
"targetIsImportLibrary": null,
|
||||||
|
"targetInstallNamelink": null,
|
||||||
|
"exportName": null,
|
||||||
|
"exportTargets": null,
|
||||||
|
"scriptFile": null,
|
||||||
|
"runtimeDependencySetType": "library",
|
||||||
|
"backtrace": [
|
||||||
|
{
|
||||||
|
"file": "^cxx/CMakeLists\\.txt$",
|
||||||
|
"line": 38,
|
||||||
|
"command": "install",
|
||||||
|
"hasParent": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "^cxx/CMakeLists\\.txt$",
|
||||||
|
"line": null,
|
||||||
|
"command": null,
|
||||||
|
"hasParent": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"component": "Unspecified",
|
||||||
|
"type": "runtimeDependencySet",
|
||||||
|
"destination": "fw",
|
||||||
|
"paths": null,
|
||||||
|
"isExcludeFromAll": null,
|
||||||
|
"isForAllComponents": null,
|
||||||
|
"isOptional": null,
|
||||||
|
"targetId": null,
|
||||||
|
"targetIndex": null,
|
||||||
|
"targetIsImportLibrary": null,
|
||||||
|
"targetInstallNamelink": null,
|
||||||
|
"exportName": null,
|
||||||
|
"exportTargets": null,
|
||||||
|
"scriptFile": null,
|
||||||
|
"runtimeDependencySetType": "framework",
|
||||||
|
"backtrace": [
|
||||||
|
{
|
||||||
|
"file": "^cxx/CMakeLists\\.txt$",
|
||||||
|
"line": 38,
|
||||||
|
"command": "install",
|
||||||
|
"hasParent": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "^cxx/CMakeLists\\.txt$",
|
||||||
|
"line": null,
|
||||||
|
"command": null,
|
||||||
|
"hasParent": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"component": "Unspecified",
|
||||||
|
"type": "runtimeDependencySet",
|
||||||
|
"destination": "lib",
|
||||||
|
"paths": null,
|
||||||
|
"isExcludeFromAll": null,
|
||||||
|
"isForAllComponents": null,
|
||||||
|
"isOptional": null,
|
||||||
|
"targetId": null,
|
||||||
|
"targetIndex": null,
|
||||||
|
"targetIsImportLibrary": null,
|
||||||
|
"targetInstallNamelink": null,
|
||||||
|
"exportName": null,
|
||||||
|
"exportTargets": null,
|
||||||
|
"scriptFile": null,
|
||||||
|
"runtimeDependencySetType": "library",
|
||||||
|
"runtimeDependencySetName": "deps",
|
||||||
|
"backtrace": [
|
||||||
|
{
|
||||||
|
"file": "^cxx/CMakeLists\\.txt$",
|
||||||
|
"line": 43,
|
||||||
|
"command": "install",
|
||||||
|
"hasParent": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "^cxx/CMakeLists\\.txt$",
|
||||||
|
"line": null,
|
||||||
|
"command": null,
|
||||||
|
"hasParent": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"component": "Unspecified",
|
||||||
|
"type": "runtimeDependencySet",
|
||||||
|
"destination": "fw",
|
||||||
|
"paths": null,
|
||||||
|
"isExcludeFromAll": null,
|
||||||
|
"isForAllComponents": null,
|
||||||
|
"isOptional": null,
|
||||||
|
"targetId": null,
|
||||||
|
"targetIndex": null,
|
||||||
|
"targetIsImportLibrary": null,
|
||||||
|
"targetInstallNamelink": null,
|
||||||
|
"exportName": null,
|
||||||
|
"exportTargets": null,
|
||||||
|
"scriptFile": null,
|
||||||
|
"runtimeDependencySetType": "framework",
|
||||||
|
"runtimeDependencySetName": "deps",
|
||||||
|
"backtrace": [
|
||||||
|
{
|
||||||
|
"file": "^cxx/CMakeLists\\.txt$",
|
||||||
|
"line": 43,
|
||||||
|
"command": "install",
|
||||||
|
"hasParent": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "^cxx/CMakeLists\\.txt$",
|
||||||
|
"line": null,
|
||||||
|
"command": null,
|
||||||
|
"hasParent": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@@ -114,6 +114,23 @@
|
|||||||
"install": {
|
"install": {
|
||||||
"prefix": "^(/usr/local|[A-Za-z]:.*/codemodel-v2)$",
|
"prefix": "^(/usr/local|[A-Za-z]:.*/codemodel-v2)$",
|
||||||
"destinations": [
|
"destinations": [
|
||||||
|
{
|
||||||
|
"path": "lib",
|
||||||
|
"backtrace": [
|
||||||
|
{
|
||||||
|
"file": "^cxx/CMakeLists\\.txt$",
|
||||||
|
"line": 38,
|
||||||
|
"command": "install",
|
||||||
|
"hasParent": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "^cxx/CMakeLists\\.txt$",
|
||||||
|
"line": null,
|
||||||
|
"command": null,
|
||||||
|
"hasParent": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "bin",
|
"path": "bin",
|
||||||
"backtrace": [
|
"backtrace": [
|
||||||
|
@@ -30,3 +30,18 @@ if(CMAKE_CXX_STANDARD_DEFAULT AND DEFINED CMAKE_CXX11_STANDARD_COMPILE_OPTION)
|
|||||||
target_compile_features(cxx_standard_compile_feature_exe PRIVATE cxx_decltype)
|
target_compile_features(cxx_standard_compile_feature_exe PRIVATE cxx_decltype)
|
||||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx_std_11.txt" "")
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx_std_11.txt" "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(_rdeps)
|
||||||
|
if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|Windows|Darwin)$")
|
||||||
|
set(_rdeps RUNTIME_DEPENDENCIES)
|
||||||
|
endif()
|
||||||
|
install(TARGETS cxx_exe ${_rdeps}
|
||||||
|
DESTINATION lib
|
||||||
|
FRAMEWORK DESTINATION fw
|
||||||
|
)
|
||||||
|
if(_rdeps)
|
||||||
|
install(RUNTIME_DEPENDENCY_SET deps
|
||||||
|
DESTINATION lib
|
||||||
|
FRAMEWORK DESTINATION fw
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
Reference in New Issue
Block a user