mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-18 02:05:51 +03:00
Merge pull request #295856 from reckenrode/moltenvk-cleanup
darwin.moltenvk: clean up derivation
This commit is contained in:
commit
2dab101ca5
@ -1,100 +0,0 @@
|
||||
diff --git a/MoltenVK/MoltenVK.xcodeproj/project.pbxproj b/MoltenVK/MoltenVK.xcodeproj/project.pbxproj
|
||||
index c23afce4..12ac12f4 100644
|
||||
--- a/MoltenVK/MoltenVK.xcodeproj/project.pbxproj
|
||||
+++ b/MoltenVK/MoltenVK.xcodeproj/project.pbxproj
|
||||
@@ -365,13 +365,6 @@
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
- 2F21D82E24983488009BEA5F /* PBXContainerItemProxy */ = {
|
||||
- isa = PBXContainerItemProxy;
|
||||
- containerPortal = A9C86CB61C55B8350096CAF2 /* MoltenVKShaderConverter.xcodeproj */;
|
||||
- proxyType = 1;
|
||||
- remoteGlobalIDString = 2FEA0CFF2490381A00EEF3AD;
|
||||
- remoteInfo = "MoltenVKSPIRVToMSLConverter-tvOS";
|
||||
- };
|
||||
2FEA0D1B249040CA00EEF3AD /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = A9C86CB61C55B8350096CAF2 /* MoltenVKShaderConverter.xcodeproj */;
|
||||
@@ -400,27 +393,6 @@
|
||||
remoteGlobalIDString = A93903C71C57E9ED00FE90DC;
|
||||
remoteInfo = "MVKSPIRVToMSLConverter-macOS";
|
||||
};
|
||||
- A981499A1FB6B9CF005F00B4 /* PBXContainerItemProxy */ = {
|
||||
- isa = PBXContainerItemProxy;
|
||||
- containerPortal = A9C86CB61C55B8350096CAF2 /* MoltenVKShaderConverter.xcodeproj */;
|
||||
- proxyType = 1;
|
||||
- remoteGlobalIDString = A93903B81C57E9D700FE90DC;
|
||||
- remoteInfo = "MVKSPIRVToMSLConverter-iOS";
|
||||
- };
|
||||
- A9B1C7F4251AA5AF001D12CC /* PBXContainerItemProxy */ = {
|
||||
- isa = PBXContainerItemProxy;
|
||||
- containerPortal = A9C86CB61C55B8350096CAF2 /* MoltenVKShaderConverter.xcodeproj */;
|
||||
- proxyType = 1;
|
||||
- remoteGlobalIDString = A9092A8C1A81717B00051823;
|
||||
- remoteInfo = MoltenVKShaderConverter;
|
||||
- };
|
||||
- DCA2CEAE2A45DFD400FB75B6 /* PBXContainerItemProxy */ = {
|
||||
- isa = PBXContainerItemProxy;
|
||||
- containerPortal = A9C86CB61C55B8350096CAF2 /* MoltenVKShaderConverter.xcodeproj */;
|
||||
- proxyType = 1;
|
||||
- remoteGlobalIDString = DCFD7F6F2A45BDA0007BBBF7;
|
||||
- remoteInfo = "MoltenVKShaderConverter-xrOS";
|
||||
- };
|
||||
DCBC41212A45DB1000F49BD1 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = A9C86CB61C55B8350096CAF2 /* MoltenVKShaderConverter.xcodeproj */;
|
||||
@@ -1019,7 +998,6 @@
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
- 2F21D82F24983488009BEA5F /* PBXTargetDependency */,
|
||||
);
|
||||
name = "MoltenVK-tvOS";
|
||||
productName = MoltenVK;
|
||||
@@ -1039,7 +1017,6 @@
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
- A981499B1FB6B9CF005F00B4 /* PBXTargetDependency */,
|
||||
);
|
||||
name = "MoltenVK-iOS";
|
||||
productName = MoltenVK;
|
||||
@@ -1059,7 +1036,6 @@
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
- A9B1C7F5251AA5AF001D12CC /* PBXTargetDependency */,
|
||||
);
|
||||
name = "MoltenVK-macOS";
|
||||
productName = MoltenVK;
|
||||
@@ -1476,29 +1452,6 @@
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
-/* Begin PBXTargetDependency section */
|
||||
- 2F21D82F24983488009BEA5F /* PBXTargetDependency */ = {
|
||||
- isa = PBXTargetDependency;
|
||||
- name = "MoltenVKSPIRVToMSLConverter-tvOS";
|
||||
- targetProxy = 2F21D82E24983488009BEA5F /* PBXContainerItemProxy */;
|
||||
- };
|
||||
- A981499B1FB6B9CF005F00B4 /* PBXTargetDependency */ = {
|
||||
- isa = PBXTargetDependency;
|
||||
- name = "MVKSPIRVToMSLConverter-iOS";
|
||||
- targetProxy = A981499A1FB6B9CF005F00B4 /* PBXContainerItemProxy */;
|
||||
- };
|
||||
- A9B1C7F5251AA5AF001D12CC /* PBXTargetDependency */ = {
|
||||
- isa = PBXTargetDependency;
|
||||
- name = MoltenVKShaderConverter;
|
||||
- targetProxy = A9B1C7F4251AA5AF001D12CC /* PBXContainerItemProxy */;
|
||||
- };
|
||||
- DCA2CEAF2A45DFD400FB75B6 /* PBXTargetDependency */ = {
|
||||
- isa = PBXTargetDependency;
|
||||
- name = "MoltenVKShaderConverter-xrOS";
|
||||
- targetProxy = DCA2CEAE2A45DFD400FB75B6 /* PBXContainerItemProxy */;
|
||||
- };
|
||||
-/* End PBXTargetDependency section */
|
||||
-
|
||||
/* Begin XCBuildConfiguration section */
|
||||
2FEA0AB824902F9F00EEF3AD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
@ -1,84 +0,0 @@
|
||||
diff --git a/MoltenVKShaderConverter/MoltenVKShaderConverter.xcodeproj/project.pbxproj b/MoltenVKShaderConverter/MoltenVKShaderConverter.xcodeproj/project.pbxproj
|
||||
index c7842b63..d55f73ed 100644
|
||||
--- a/MoltenVKShaderConverter/MoltenVKShaderConverter.xcodeproj/project.pbxproj
|
||||
+++ b/MoltenVKShaderConverter/MoltenVKShaderConverter.xcodeproj/project.pbxproj
|
||||
@@ -3,7 +3,7 @@
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
- objectVersion = 54;
|
||||
+ objectVersion = 48;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
@@ -33,9 +33,6 @@
|
||||
A920A8AC251B75B70076851C /* GLSLToSPIRVConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = A920A8A2251B75B70076851C /* GLSLToSPIRVConverter.h */; };
|
||||
A920A8AD251B75B80076851C /* GLSLToSPIRVConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = A920A8A2251B75B70076851C /* GLSLToSPIRVConverter.h */; };
|
||||
A920A8AE251B75B80076851C /* GLSLToSPIRVConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = A920A8A2251B75B70076851C /* GLSLToSPIRVConverter.h */; };
|
||||
- A920A8AF251B77900076851C /* glslang.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A98386FD24EEE93700199A05 /* glslang.xcframework */; };
|
||||
- A920A8B0251B77910076851C /* glslang.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A98386FD24EEE93700199A05 /* glslang.xcframework */; };
|
||||
- A920A8B1251B77920076851C /* glslang.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A98386FD24EEE93700199A05 /* glslang.xcframework */; };
|
||||
A925B71B1C78DEB2006E7ECD /* libMoltenVKShaderConverter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A93903C71C57E9ED00FE90DC /* libMoltenVKShaderConverter.a */; };
|
||||
A928C9191D0488DC00071B88 /* SPIRVConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = A928C9171D0488DC00071B88 /* SPIRVConversion.h */; };
|
||||
A928C91A1D0488DC00071B88 /* SPIRVConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = A928C9171D0488DC00071B88 /* SPIRVConversion.h */; };
|
||||
@@ -55,12 +52,6 @@
|
||||
A97CC7411C7527F3004A5C7E /* MoltenVKShaderConverterTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A97CC73E1C7527F3004A5C7E /* MoltenVKShaderConverterTool.cpp */; };
|
||||
A98149681FB6A98A005F00B4 /* MVKStrings.h in Headers */ = {isa = PBXBuildFile; fileRef = A98149651FB6A98A005F00B4 /* MVKStrings.h */; };
|
||||
A98149691FB6A98A005F00B4 /* MVKStrings.h in Headers */ = {isa = PBXBuildFile; fileRef = A98149651FB6A98A005F00B4 /* MVKStrings.h */; };
|
||||
- A98386FA24EEE91A00199A05 /* SPIRVCross.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A98386F824EEE91A00199A05 /* SPIRVCross.xcframework */; };
|
||||
- A98386FB24EEE91A00199A05 /* SPIRVCross.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A98386F824EEE91A00199A05 /* SPIRVCross.xcframework */; };
|
||||
- A98386FC24EEE91A00199A05 /* SPIRVCross.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A98386F824EEE91A00199A05 /* SPIRVCross.xcframework */; };
|
||||
- A983870724EEE94800199A05 /* SPIRVTools.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A983870224EEE94800199A05 /* SPIRVTools.xcframework */; };
|
||||
- A983870824EEE94800199A05 /* SPIRVTools.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A983870224EEE94800199A05 /* SPIRVTools.xcframework */; };
|
||||
- A983870924EEE94800199A05 /* SPIRVTools.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A983870224EEE94800199A05 /* SPIRVTools.xcframework */; };
|
||||
A9A14E332244388700C080F3 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9A14E322244388700C080F3 /* Metal.framework */; };
|
||||
A9B51BDD225E98BB00AC74D2 /* MVKOSExtensions.mm in Sources */ = {isa = PBXBuildFile; fileRef = A9B51BDB225E98BB00AC74D2 /* MVKOSExtensions.mm */; };
|
||||
A9F042B21FB4D060009FCCB8 /* MVKCommonEnvironment.h in Headers */ = {isa = PBXBuildFile; fileRef = A9F042AA1FB4D060009FCCB8 /* MVKCommonEnvironment.h */; };
|
||||
@@ -115,9 +106,6 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
- A983870824EEE94800199A05 /* SPIRVTools.xcframework in Frameworks */,
|
||||
- A98386FB24EEE91A00199A05 /* SPIRVCross.xcframework in Frameworks */,
|
||||
- A920A8B0251B77910076851C /* glslang.xcframework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -134,9 +122,6 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
- A983870724EEE94800199A05 /* SPIRVTools.xcframework in Frameworks */,
|
||||
- A98386FA24EEE91A00199A05 /* SPIRVCross.xcframework in Frameworks */,
|
||||
- A920A8AF251B77900076851C /* glslang.xcframework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -144,9 +129,6 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
- A983870924EEE94800199A05 /* SPIRVTools.xcframework in Frameworks */,
|
||||
- A98386FC24EEE91A00199A05 /* SPIRVCross.xcframework in Frameworks */,
|
||||
- A920A8B1251B77920076851C /* glslang.xcframework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -313,7 +295,7 @@
|
||||
A925B71D1C78DEBF006E7ECD /* PBXTargetDependency */,
|
||||
);
|
||||
name = MoltenVKShaderConverter;
|
||||
- productName = MetalGLShaderConverterTool;
|
||||
+ productName = MoltenVKShaderConverter;
|
||||
productReference = A964BD5F1C57EFBD00D930D8 /* MoltenVKShaderConverter */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
@@ -349,7 +331,7 @@
|
||||
dependencies = (
|
||||
);
|
||||
name = "MoltenVKShaderConverter-macOS";
|
||||
- productName = "MetalGLShaderConverter-macOS";
|
||||
+ productName = MoltenVKShaderConverter;
|
||||
productReference = A93903C71C57E9ED00FE90DC /* libMoltenVKShaderConverter.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
@ -1,26 +1,31 @@
|
||||
{ lib
|
||||
, overrideCC
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, gitUpdater
|
||||
, cctools
|
||||
, sigtool
|
||||
, cereal
|
||||
, libcxx
|
||||
, glslang
|
||||
, spirv-cross
|
||||
, spirv-headers
|
||||
, spirv-tools
|
||||
, vulkan-headers
|
||||
, xcbuild
|
||||
, AppKit
|
||||
, Foundation
|
||||
, Libsystem
|
||||
, MacOSX-SDK
|
||||
, Metal
|
||||
, QuartzCore
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
gitUpdater,
|
||||
cereal,
|
||||
libcxx,
|
||||
glslang,
|
||||
simd,
|
||||
spirv-cross,
|
||||
spirv-headers,
|
||||
spirv-tools,
|
||||
vulkan-headers,
|
||||
xcbuild,
|
||||
AppKit,
|
||||
Foundation,
|
||||
Metal,
|
||||
QuartzCore,
|
||||
# MoltenVK supports using private APIs to implement some Vulkan functionality.
|
||||
# Applications that use private APIs can’t be distributed on the App Store,
|
||||
# but that’s not really a concern for nixpkgs, so use them by default.
|
||||
# See: https://github.com/KhronosGroup/MoltenVK/blob/main/README.md#metal_private_api
|
||||
enablePrivateAPIUsage ? true,
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (stdenv.hostPlatform) isStatic;
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "MoltenVK";
|
||||
version = "1.2.7";
|
||||
@ -32,15 +37,20 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
QuartzCore
|
||||
cereal
|
||||
glslang
|
||||
simd
|
||||
spirv-cross
|
||||
spirv-headers
|
||||
spirv-tools
|
||||
vulkan-headers
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cctools sigtool xcbuild ];
|
||||
nativeBuildInputs = [ xcbuild ];
|
||||
|
||||
outputs = [ "out" "bin" "dev" ];
|
||||
outputs = [
|
||||
"out"
|
||||
"bin"
|
||||
"dev"
|
||||
];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
@ -49,106 +59,142 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
hash = "sha256-0+S/kueV+AEVt+oFnh4cgcDRVtEbUH1QiHFPhGhimCA=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Fix the Xcode projects to play nicely with `xcbuild`.
|
||||
./MoltenVKShaderConverter.xcodeproj.patch
|
||||
./MoltenVK.xcodeproj.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# Move `mvkGitRevDerived.h` to a stable location
|
||||
substituteInPlace Scripts/gen_moltenvk_rev_hdr.sh \
|
||||
--replace-fail '$'''{BUILT_PRODUCTS_DIR}' "$NIX_BUILD_TOP/$sourceRoot/build/include" \
|
||||
--replace-fail '$(git rev-parse HEAD)' ${finalAttrs.src.rev}
|
||||
# Use the SPIRV-Cross packaged in nixpkgs instead of one built specifically for MoltenVK.
|
||||
substituteInPlace MoltenVK/MoltenVK.xcodeproj/project.pbxproj \
|
||||
--replace-fail SPIRV_CROSS_NAMESPACE_OVERRIDE=MVK_spirv_cross SPIRV_CROSS_NAMESPACE_OVERRIDE=spirv_cross
|
||||
|
||||
# Modify MoltenVK Xcode projects to build with xcbuild and dependencies from nixpkgs.
|
||||
for proj in MoltenVK MoltenVKShaderConverter; do
|
||||
# Remove xcframework dependencies from the Xcode projects. The basic format is:
|
||||
# (children|files) = (
|
||||
# DCFD7F822A45BDA0007BBBF7 /* SPIRVCross.xcframework in Frameworks */,
|
||||
# etc
|
||||
# )
|
||||
# This regex will only remove lines matching `xcframework` that are in these blocks
|
||||
# to avoid accidentally corrupting the project.
|
||||
sed -E -e '/(children|files) = /,/;/{/xcframework/d}' \
|
||||
-i "$proj/$proj.xcodeproj/project.pbxproj"
|
||||
# Ensure the namespace used is consistent with the spirv-cross package in nixpkgs.
|
||||
substituteInPlace "$proj/$proj.xcodeproj/project.pbxproj" \
|
||||
--replace-fail SPIRV_CROSS_NAMESPACE_OVERRIDE=MVK_spirv_cross SPIRV_CROSS_NAMESPACE_OVERRIDE=spirv_cross
|
||||
done
|
||||
substituteInPlace MoltenVKShaderConverter/MoltenVKShaderConverter.xcodeproj/project.pbxproj \
|
||||
--replace-fail SPIRV_CROSS_NAMESPACE_OVERRIDE=MVK_spirv_cross SPIRV_CROSS_NAMESPACE_OVERRIDE=spirv_cross
|
||||
# Adding all of `usr/include` from the SDK results in header conflicts with `libcxx.dev`.
|
||||
# Work around it by symlinking just the SIMD stuff needed by MoltenVK.
|
||||
--replace-fail MetalGLShaderConverterTool MoltenVKShaderConverter \
|
||||
--replace-fail MetalGLShaderConverter-macOS MoltenVKShaderConverter
|
||||
|
||||
# Don’t try to build `xcframework`s because `xcbuild` can’t build them.
|
||||
sed -e '/xcframework/d' -i Scripts/package_all.sh
|
||||
|
||||
# Remove vendored dependency links.
|
||||
find . -lname '*/External/*' -delete
|
||||
|
||||
# The library will be linked in the install phase regardless of version,
|
||||
# so truncate it if it exists to avoid link failures.
|
||||
test -f Scripts/create_dylib.sh && truncate --size 0 Scripts/create_dylib.sh
|
||||
|
||||
# Link glslang source because MoltenVK needs non-public headers to build.
|
||||
mkdir -p build/include
|
||||
ln -s "${MacOSX-SDK}/usr/include/simd" "build/include"
|
||||
ln -s "${glslang.src}" "build/include/glslang"
|
||||
'';
|
||||
|
||||
dontConfigure = true;
|
||||
env.NIX_CFLAGS_COMPILE = toString (
|
||||
[
|
||||
"-isystem ${lib.getDev libcxx}/include/c++/v1"
|
||||
"-I${lib.getDev spirv-cross}/include/spirv_cross"
|
||||
"-I${lib.getDev spirv-headers}/include/spirv/unified1"
|
||||
]
|
||||
++ lib.optional enablePrivateAPIUsage "-DMVK_USE_METAL_PRIVATE_API=1"
|
||||
);
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = toString [
|
||||
"-isystem ${lib.getDev libcxx}/include/c++/v1"
|
||||
"-I${lib.getDev spirv-cross}/include/spirv_cross"
|
||||
"-I${lib.getDev spirv-headers}/include/spirv/unified1/"
|
||||
env.NIX_LDFLAGS = toString [
|
||||
"-lMachineIndependent"
|
||||
"-lGenericCodeGen"
|
||||
"-lglslang"
|
||||
"-lOSDependent"
|
||||
"-lSPIRV"
|
||||
"-lSPIRV-Tools"
|
||||
"-lSPIRV-Tools-opt"
|
||||
"-lspirv-cross-msl"
|
||||
"-lspirv-cross-core"
|
||||
"-lspirv-cross-glsl"
|
||||
"-lspirv-cross-reflect"
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
NIX_CFLAGS_COMPILE+=" \
|
||||
-I$NIX_BUILD_TOP/$sourceRoot/build/include \
|
||||
-I$NIX_BUILD_TOP/$sourceRoot/Common"
|
||||
NIX_LDFLAGS+=" -L$NIX_BUILD_TOP/$sourceRoot/build/lib"
|
||||
|
||||
# Build each project on its own because `xcbuild` fails to build `MoltenVKPackaging.xcodeproj`.
|
||||
build=$NIX_BUILD_TOP/$sourceRoot/build
|
||||
mkdir -p "$build/bin" "$build/lib"
|
||||
|
||||
NIX_LDFLAGS+=" \
|
||||
-lMachineIndependent \
|
||||
-lGenericCodeGen \
|
||||
-lglslang \
|
||||
-lOSDependent \
|
||||
-lSPIRV \
|
||||
-lSPIRV-Tools \
|
||||
-lSPIRV-Tools-opt \
|
||||
-lspirv-cross-msl \
|
||||
-lspirv-cross-core \
|
||||
-lspirv-cross-glsl"
|
||||
|
||||
pushd MoltenVKShaderConverter
|
||||
xcodebuild build \
|
||||
SYMROOT=$PWD/Products OBJROOT=$PWD/Intermedates \
|
||||
-jobs $NIX_BUILD_CORES \
|
||||
-configuration Release \
|
||||
-project MoltenVKShaderConverter.xcodeproj \
|
||||
-scheme MoltenVKShaderConverter \
|
||||
-project MoltenVKPackaging.xcodeproj \
|
||||
-scheme 'MoltenVK Package (macOS only)' \
|
||||
-destination generic/platform=macOS \
|
||||
-arch ${stdenv.hostPlatform.darwinArch}
|
||||
declare -A products=( [MoltenVKShaderConverter]=bin [libMoltenVKShaderConverter.a]=lib )
|
||||
for product in "''${!products[@]}"; do
|
||||
cp MoltenVKShaderConverter-*/Build/Products/Release/$product "$build/''${products[$product]}/$product"
|
||||
done
|
||||
popd
|
||||
|
||||
NIX_LDFLAGS+=" \
|
||||
-lobjc \
|
||||
-lMoltenVKShaderConverter \
|
||||
-lspirv-cross-reflect"
|
||||
|
||||
pushd MoltenVK
|
||||
xcodebuild build \
|
||||
-jobs $NIX_BUILD_CORES \
|
||||
-configuration Release \
|
||||
-project MoltenVK.xcodeproj \
|
||||
-scheme MoltenVK-macOS \
|
||||
-arch ${stdenv.hostPlatform.darwinArch}
|
||||
cp MoltenVK-*/Build/Products/Release/dynamic/libMoltenVK.dylib "$build/lib/libMoltenVK.dylib"
|
||||
popd
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
postBuild =
|
||||
if isStatic then
|
||||
''
|
||||
mkdir -p Package/Release/MoltenVK/static
|
||||
cp Products/Release/libMoltenVK.a Package/Release/MoltenVK/static
|
||||
''
|
||||
else
|
||||
''
|
||||
# MoltenVK’s Xcode project builds the dylib, but it doesn’t seem to work with
|
||||
# xcbuild. This is based on the script versions prior to 1.2.8 used.
|
||||
mkdir -p Package/Release/MoltenVK/dynamic/dylib
|
||||
clang++ -Wl,-all_load -Wl,-w \
|
||||
-dynamiclib \
|
||||
-compatibility_version 1.0.0 -current_version 1.0.0 \
|
||||
-LProducts/Release \
|
||||
-framework AppKit \
|
||||
-framework CoreGraphics \
|
||||
-framework Foundation \
|
||||
-framework IOKit \
|
||||
-framework IOSurface \
|
||||
-framework Metal \
|
||||
-framework QuartzCore \
|
||||
-lobjc \
|
||||
-lMoltenVKShaderConverter \
|
||||
-lspirv-cross-reflect \
|
||||
-install_name "$out/lib/libMoltenVK.dylib" \
|
||||
-o Package/Release/MoltenVK/dynamic/dylib/libMoltenVK.dylib \
|
||||
-force_load Products/Release/libMoltenVK.a
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/lib" "$out/share/vulkan/icd.d" "$bin/bin" "$dev/include/MoltenVK"
|
||||
cp build/bin/MoltenVKShaderConverter "$bin/bin/"
|
||||
cp build/lib/libMoltenVK.dylib "$out/lib/"
|
||||
cp MoltenVK/MoltenVK/API/* "$dev/include/MoltenVK"
|
||||
install -m644 MoltenVK/icd/MoltenVK_icd.json "$out/share/vulkan/icd.d/MoltenVK_icd.json"
|
||||
substituteInPlace $out/share/vulkan/icd.d/MoltenVK_icd.json \
|
||||
--replace-fail ./libMoltenVK.dylib "$out/lib/libMoltenVK.dylib"
|
||||
'';
|
||||
runHook preInstall
|
||||
|
||||
postFixup = ''
|
||||
install_name_tool -id "$out/lib/libMoltenVK.dylib" "$out/lib/libMoltenVK.dylib"
|
||||
codesign -s - -f "$out/lib/libMoltenVK.dylib"
|
||||
codesign -s - -f "$bin/bin/MoltenVKShaderConverter"
|
||||
libraryExtension=${if isStatic then ".a" else ".dylib"}
|
||||
packagePath=${if isStatic then "static" else "dynamic/dylib"}
|
||||
|
||||
mkdir -p "$out/lib" "$out/share/vulkan/icd.d" "$bin/bin" "$dev"
|
||||
|
||||
cp Package/Release/MoltenVKShaderConverter/Tools/MoltenVKShaderConverter "$bin/bin"
|
||||
cp -r Package/Release/MoltenVK/include "$dev"
|
||||
cp Package/Release/MoltenVK/$packagePath/libMoltenVK$libraryExtension "$out/lib"
|
||||
|
||||
# Install ICD definition for use with vulkan-loader.
|
||||
install -m644 MoltenVK/icd/MoltenVK_icd.json \
|
||||
"$out/share/vulkan/icd.d/MoltenVK_icd.json"
|
||||
substituteInPlace "$out/share/vulkan/icd.d/MoltenVK_icd.json" \
|
||||
--replace-fail ./libMoltenVK.dylib "$out/lib/libMoltenVK.dylib"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.updateScript = gitUpdater {
|
||||
rev-prefix = "v";
|
||||
ignoredVersions = ".*-(beta|rc).*";
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
@ -172,8 +172,7 @@ impure-cmds // appleSourcePackages // chooseLibs // {
|
||||
|
||||
moltenvk = pkgs.darwin.apple_sdk_11_0.callPackage ../os-specific/darwin/moltenvk {
|
||||
inherit (apple_sdk_11_0.frameworks) AppKit Foundation Metal QuartzCore;
|
||||
inherit (apple_sdk_11_0) MacOSX-SDK Libsystem;
|
||||
inherit (pkgs.darwin) cctools sigtool;
|
||||
inherit (apple_sdk_11_0.libs) simd;
|
||||
};
|
||||
|
||||
opencflite = callPackage ../os-specific/darwin/opencflite { };
|
||||
|
Loading…
Reference in New Issue
Block a user