Fix issue where incremental dynamic builds do not link to static dependencies.

After the recent change to building dynamic frameworks and dylibs as targets
built by linking to a static library dependency, incremental builds do not
correctly link the dynamic frameworks and dylibs to the rebuilt static library.

- Delete dynamic target outputs during static target builds.
- Run platform schemes sequentially in manual order.
- Build the dynamic framework before the dylib.
- Clean up Xcode Scheme organization.

It is not entirely obvious what the dependency problem is, and why
these particular changes work. A lot of trial-and-error was required.
It's possible that Xcode dependency analysis does not correctly analyze
the flow used in MoltenVK builds.
This commit is contained in:
Bill Hollings 2024-03-30 17:47:36 -04:00
parent e97ec49663
commit 7533974fda
12 changed files with 109 additions and 315 deletions

View File

@ -1519,6 +1519,7 @@
2FEA0A4024902F9F00EEF3AD /* Headers */,
2FEA0A8224902F9F00EEF3AD /* Sources */,
A9CBBFF124F89F79006D41EF /* Copy to Staging */,
A905CE712BB898E000BBCB10 /* Clean Dynamic */,
);
buildRules = (
);
@ -1556,6 +1557,7 @@
A9B8EE071A98D796009C5A02 /* Headers */,
A9B8EE051A98D796009C5A02 /* Sources */,
A9CBBFEF24F89F5F006D41EF /* Copy to Staging */,
A905CE702BB8988A00BBCB10 /* Clean Dynamic */,
);
buildRules = (
);
@ -1575,6 +1577,7 @@
A9CBED871B6299D800E45FDC /* Headers */,
A9CBEDCE1B6299D800E45FDC /* Sources */,
A9CBBFF224F89F87006D41EF /* Copy to Staging */,
A942D3052BAC3AD200A25A0A /* Clean Dynamic */,
);
buildRules = (
);
@ -1674,6 +1677,7 @@
DCFD7EE32A45BC6E007BBBF7 /* Headers */,
DCFD7F272A45BC6E007BBBF7 /* Sources */,
DCFD7F5D2A45BC6E007BBBF7 /* Copy to Staging */,
A905CE722BB8993F00BBCB10 /* Clean Dynamic */,
);
buildRules = (
);
@ -1811,6 +1815,86 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
A905CE702BB8988A00BBCB10 /* Clean Dynamic */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"$(BUILT_PRODUCTS_DIR)/libMoltenVK.a",
);
name = "Clean Dynamic";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/$(TARGET_NAME)/CleanDynamicDummyOutputFile",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = ". \"${SRCROOT}/../Scripts/clean_dynamic.sh\"\n";
};
A905CE712BB898E000BBCB10 /* Clean Dynamic */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"$(BUILT_PRODUCTS_DIR)/libMoltenVK.a",
);
name = "Clean Dynamic";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/$(TARGET_NAME)/CleanDynamicDummyOutputFile",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = ". \"${SRCROOT}/../Scripts/clean_dynamic.sh\"\n";
};
A905CE722BB8993F00BBCB10 /* Clean Dynamic */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"$(BUILT_PRODUCTS_DIR)/libMoltenVK.a",
);
name = "Clean Dynamic";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/$(TARGET_NAME)/CleanDynamicDummyOutputFile",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = ". \"${SRCROOT}/../Scripts/clean_dynamic.sh\"\n";
};
A942D3052BAC3AD200A25A0A /* Clean Dynamic */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${BUILT_PRODUCTS_DIR}/libMoltenVK.a",
);
name = "Clean Dynamic";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/$(TARGET_NAME)/CleanDynamicDummyOutputFile",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = ". \"${SRCROOT}/../Scripts/clean_dynamic.sh\"\n";
};
A980A25B24C6283D007A8F6F /* Generate Version Header */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;

View File

@ -50,8 +50,8 @@
A975D59A2140586700D4834F /* Package MoltenVK */,
);
dependencies = (
A979A95A2B9A232800F69E67 /* PBXTargetDependency */,
A9F4D9F12B8EC210004AD576 /* PBXTargetDependency */,
A979A95A2B9A232800F69E67 /* PBXTargetDependency */,
);
name = "MoltenVK-macOS";
productName = Package;
@ -75,8 +75,8 @@
A9B1008824F84BE400EADC6E /* Package MoltenVK */,
);
dependencies = (
A979A9662B9A233C00F69E67 /* PBXTargetDependency */,
A9F4D9F82B8EC22E004AD576 /* PBXTargetDependency */,
A979A9662B9A233C00F69E67 /* PBXTargetDependency */,
A9F4D9F62B8EC22E004AD576 /* PBXTargetDependency */,
A9F4D9FA2B8EC22E004AD576 /* PBXTargetDependency */,
);
@ -276,6 +276,7 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
A905CE6F2BB897F700BBCB10 /* clean_dynamic.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = clean_dynamic.sh; sourceTree = "<group>"; };
A92DB3E41CE0F37D00FBC835 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
A92DB3E51CE0F37D00FBC835 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
A92DB3E61CE0F37D00FBC835 /* Whats_New.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = Whats_New.md; path = Docs/Whats_New.md; sourceTree = "<group>"; };
@ -346,6 +347,7 @@
A975D55B213F25AD00D4834F /* Scripts */ = {
isa = PBXGroup;
children = (
A905CE6F2BB897F700BBCB10 /* clean_dynamic.sh */,
A9F4D8942B8D4F81004AD576 /* copy_to_staging.sh */,
A93ED4DE24F59CDB00FEB018 /* copy_lib_to_staging.sh */,
A9B1007A24F837AF00EADC6E /* create_xcframework_func.sh */,
@ -430,9 +432,9 @@
projectRoot = "";
targets = (
A9FEADBC1F3517480010240E /* MoltenVK */,
A975D58B2140586700D4834F /* MoltenVK-macOS */,
A975D5782140585200D4834F /* MoltenVK-iOS */,
2FEA0A2F24902F5E00EEF3AD /* MoltenVK-tvOS */,
A975D58B2140586700D4834F /* MoltenVK-macOS */,
DCFD7ED52A45BC56007BBBF7 /* MoltenVK-xrOS */,
A91170FD2B9110050057AD37 /* MoltenVK-MacCat */,
A9AD700D2440ED3B00B9E254 /* MVKShaderConverterTool */,

View File

@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "9999"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A9AD700D2440ED3B00B9E254"
BuildableName = "MVKShaderConverterTool"
BlueprintName = "MVKShaderConverterTool"
ReferencedContainer = "container:MoltenVKPackaging.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A9AD700D2440ED3B00B9E254"
BuildableName = "MVKShaderConverterTool"
BlueprintName = "MVKShaderConverterTool"
ReferencedContainer = "container:MoltenVKPackaging.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -1,81 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "9999"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A9FEADBC1F3517480010240E"
BuildableName = "MoltenVK"
BlueprintName = "MoltenVK"
ReferencedContainer = "container:MoltenVKPackaging.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
disableMainThreadChecker = "YES"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "NO"
debugXPCServices = "NO"
debugServiceExtension = "internal"
enableGPUFrameCaptureMode = "3"
enableGPUValidationMode = "1"
allowLocationSimulation = "NO"
queueDebuggingEnabled = "No">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A9FEADBC1F3517480010240E"
BuildableName = "MoltenVK"
BlueprintName = "MoltenVK"
ReferencedContainer = "container:MoltenVKPackaging.xcodeproj">
</BuildableReference>
</MacroExpansion>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A9FEADBC1F3517480010240E"
BuildableName = "MoltenVK"
BlueprintName = "MoltenVK"
ReferencedContainer = "container:MoltenVKPackaging.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -3,8 +3,8 @@
LastUpgradeVersion = "9999"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
parallelizeBuildables = "NO"
buildImplicitDependencies = "NO">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"

View File

@ -3,8 +3,8 @@
LastUpgradeVersion = "9999"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
parallelizeBuildables = "NO"
buildImplicitDependencies = "NO">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"

View File

@ -3,8 +3,8 @@
LastUpgradeVersion = "9999"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
parallelizeBuildables = "NO"
buildImplicitDependencies = "NO">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"

View File

@ -3,8 +3,8 @@
LastUpgradeVersion = "9999"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
parallelizeBuildables = "NO"
buildImplicitDependencies = "NO">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"

View File

@ -3,8 +3,8 @@
LastUpgradeVersion = "9999"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
parallelizeBuildables = "NO"
buildImplicitDependencies = "NO">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"

View File

@ -4,7 +4,7 @@
version = "2.0">
<BuildAction
parallelizeBuildables = "NO"
buildImplicitDependencies = "YES">
buildImplicitDependencies = "NO">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"

View File

@ -1,153 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "9999"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A9092A8C1A81717B00051823"
BuildableName = "MoltenVKShaderConverter"
BlueprintName = "MoltenVKShaderConverter"
ReferencedContainer = "container:MoltenVKShaderConverter.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
disableMainThreadChecker = "YES"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "NO"
debugXPCServices = "NO"
debugServiceExtension = "internal"
enableGPUFrameCaptureMode = "3"
enableGPUValidationMode = "1"
allowLocationSimulation = "NO"
queueDebuggingEnabled = "No">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A9092A8C1A81717B00051823"
BuildableName = "MoltenVKShaderConverter"
BlueprintName = "MoltenVKShaderConverter"
ReferencedContainer = "container:MoltenVKShaderConverter.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "-d"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "path-to-shader-directory"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "-r"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "-gi"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "path-to-glsl-shader-file"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "-si"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "path-to-SPIR-V-shader-file"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "-so"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "-mo"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "-mv"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "3.1"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "-mp"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "ios"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "-mab"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "-l"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "-XS"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "-p"
isEnabled = "NO">
</CommandLineArgument>
</CommandLineArguments>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A9092A8C1A81717B00051823"
BuildableName = "MoltenVKShaderConverter"
BlueprintName = "MoltenVKShaderConverter"
ReferencedContainer = "container:MoltenVKShaderConverter.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

9
Scripts/clean_dynamic.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
# Delete the dynamic components, to force them to be rebuilt.
# This, combined with forcing the Scheme to run sequentially, and building
# the dynamic framework before the dylib, avoids a problem where the dynamic
# components contain no static content after an incremental build.
rm -rf "${BUILT_PRODUCTS_DIR}/MoltenVK.framework"
rm -rf "${BUILT_PRODUCTS_DIR}/libMoltenVK.dylib"