mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-20 00:53:12 +03:00
Merge pull request #180988 from reckenrode/moltenvk-no-sdk-v3
This commit is contained in:
commit
ed05a2b827
@ -3,6 +3,13 @@
|
||||
, rustPlatform
|
||||
, fetchFromGitHub
|
||||
, makeWrapper
|
||||
, AppKit
|
||||
, CoreFoundation
|
||||
, CoreGraphics
|
||||
, CoreVideo
|
||||
, Foundation
|
||||
, Metal
|
||||
, QuartzCore
|
||||
, xorg
|
||||
, vulkan-loader
|
||||
}:
|
||||
@ -24,7 +31,11 @@ rustPlatform.buildRustPackage rec {
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
buildInputs = lib.optionals stdenv.isDarwin [
|
||||
AppKit CoreFoundation CoreGraphics CoreVideo Foundation Metal QuartzCore
|
||||
];
|
||||
|
||||
postInstall = lib.optionalString (!stdenv.isDarwin) ''
|
||||
wrapProgram $out/bin/binocle \
|
||||
--suffix LD_LIBRARY_PATH : ${lib.makeLibraryPath (with xorg; [ libX11 libXcursor libXi libXrandr ] ++ [ vulkan-loader ])}
|
||||
'';
|
||||
@ -34,6 +45,5 @@ rustPlatform.buildRustPackage rec {
|
||||
homepage = "https://github.com/sharkdp/binocle";
|
||||
license = with licenses; [ asl20 /* or */ mit ];
|
||||
maintainers = with maintainers; [ SuperSandro2000 ];
|
||||
broken = stdenv.isDarwin;
|
||||
};
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ stdenv.mkDerivation rec {
|
||||
"-Dvulkan-registry=${vulkan-headers}/share/vulkan/registry/vk.xml"
|
||||
"-Ddemos=false" # Don't build and install the demo programs
|
||||
"-Dd3d11=disabled" # Disable the Direct3D 11 based renderer
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
"-Dunwind=disabled" # libplacebo doesn’t build with `darwin.libunwind`
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
|
@ -86,61 +86,3 @@ index c23afce4..12ac12f4 100644
|
||||
/* Begin XCBuildConfiguration section */
|
||||
2FEA0AB824902F9F00EEF3AD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
@@ -1586,11 +1544,12 @@
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
GENERATE_MASTER_OBJECT_FILE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
- "\"$(SRCROOT)/include\"",
|
||||
- "\"$(SRCROOT)/../MoltenVKShaderConverter\"",
|
||||
- "\"$(SRCROOT)/../MoltenVKShaderConverter/SPIRV-Cross\"",
|
||||
- "\"$(SRCROOT)/../External/cereal/include\"",
|
||||
- "\"${BUILT_PRODUCTS_DIR}\"",
|
||||
+ "@@sourceRoot@@/outputs/include",
|
||||
+ "@@sourceRoot@@/outputs/include/simd_workaround",
|
||||
+ "@@sourceRoot@@/MoltenVKShaderConverter",
|
||||
+ "@@cereal@@/include",
|
||||
+ "@@spirv-cross@@/include/spirv_cross",
|
||||
+ "@@vulkan-headers@@/include",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MACH_O_TYPE = staticlib;
|
||||
@@ -1600,6 +1559,10 @@
|
||||
MVK_SKIP_DYLIB = "";
|
||||
"MVK_SKIP_DYLIB[sdk=appletvsimulator*]" = YES;
|
||||
"MVK_SKIP_DYLIB[sdk=iphonesimulator*]" = YES;
|
||||
+ OTHER_CFLAGS = (
|
||||
+ "-isystem",
|
||||
+ "@@libcxx@@/include/c++/v1",
|
||||
+ );
|
||||
PRELINK_LIBS = "${CONFIGURATION_BUILD_DIR}/libMoltenVKShaderConverter.a";
|
||||
PRODUCT_NAME = MoltenVK;
|
||||
SKIP_INSTALL = YES;
|
||||
@@ -1658,11 +1621,12 @@
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
GENERATE_MASTER_OBJECT_FILE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
- "\"$(SRCROOT)/include\"",
|
||||
- "\"$(SRCROOT)/../MoltenVKShaderConverter\"",
|
||||
- "\"$(SRCROOT)/../MoltenVKShaderConverter/SPIRV-Cross\"",
|
||||
- "\"$(SRCROOT)/../External/cereal/include\"",
|
||||
- "\"${BUILT_PRODUCTS_DIR}\"",
|
||||
+ "@@sourceRoot@@/outputs/include",
|
||||
+ "@@sourceRoot@@/outputs/include/simd_workaround",
|
||||
+ "@@sourceRoot@@/MoltenVKShaderConverter",
|
||||
+ "@@cereal@@/include",
|
||||
+ "@@spirv-cross@@/include/spirv_cross",
|
||||
+ "@@vulkan-headers@@/include",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MACH_O_TYPE = staticlib;
|
||||
@@ -1672,6 +1636,10 @@
|
||||
MVK_SKIP_DYLIB = "";
|
||||
"MVK_SKIP_DYLIB[sdk=appletvsimulator*]" = YES;
|
||||
"MVK_SKIP_DYLIB[sdk=iphonesimulator*]" = YES;
|
||||
+ OTHER_CFLAGS = (
|
||||
+ "-isystem",
|
||||
+ "@@libcxx@@/include/c++/v1",
|
||||
+ );
|
||||
PRELINK_LIBS = "${CONFIGURATION_BUILD_DIR}/libMoltenVKShaderConverter.a";
|
||||
PRODUCT_NAME = MoltenVK;
|
||||
SKIP_INSTALL = YES;
|
||||
|
@ -82,99 +82,3 @@ index c7842b63..d55f73ed 100644
|
||||
productReference = A93903C71C57E9ED00FE90DC /* libMoltenVKShaderConverter.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
@@ -536,6 +518,17 @@
|
||||
OTHER_LDFLAGS = (
|
||||
"-ObjC",
|
||||
"-w",
|
||||
+ "-lMachineIndependent",
|
||||
+ "-lGenericCodeGen",
|
||||
+ "-lOGLCompiler",
|
||||
+ "-lglslang",
|
||||
+ "-lOSDependent",
|
||||
+ "-lSPIRV",
|
||||
+ "-lSPIRV-Tools",
|
||||
+ "-lSPIRV-Tools-opt",
|
||||
+ "-lspirv-cross-msl",
|
||||
+ "-lspirv-cross-core",
|
||||
+ "-lspirv-cross-glsl",
|
||||
);
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
@@ -548,6 +541,17 @@
|
||||
OTHER_LDFLAGS = (
|
||||
"-ObjC",
|
||||
"-w",
|
||||
+ "-lMachineIndependent",
|
||||
+ "-lGenericCodeGen",
|
||||
+ "-lOGLCompiler",
|
||||
+ "-lglslang",
|
||||
+ "-lOSDependent",
|
||||
+ "-lSPIRV",
|
||||
+ "-lSPIRV-Tools",
|
||||
+ "-lSPIRV-Tools-opt",
|
||||
+ "-lspirv-cross-msl",
|
||||
+ "-lspirv-cross-core",
|
||||
+ "-lspirv-cross-glsl",
|
||||
);
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
@@ -624,15 +628,24 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
- "$(inherited)",
|
||||
- "\"$(SRCROOT)\"",
|
||||
- "\"$(SRCROOT)/SPIRV-Cross\"",
|
||||
- "\"$(SRCROOT)/glslang\"",
|
||||
- "\"$(SRCROOT)/glslang/External/spirv-tools/include\"",
|
||||
+ "@@sourceRoot@@/Common",
|
||||
+ "@@glslang@@/include",
|
||||
+ "@@spirv-cross@@/include/spirv_cross",
|
||||
+ "@@spirv-tools@@/include",
|
||||
+ "@@spirv-headers@@/include/spirv/unified1/",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
+ LIBRARY_SEARCH_PATHS = (
|
||||
+ "@@glslang@@/lib",
|
||||
+ "@@spirv-cross@@/lib",
|
||||
+ "@@spirv-tools@@/lib",
|
||||
+ );
|
||||
MACH_O_TYPE = staticlib;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
+ OTHER_CFLAGS = (
|
||||
+ "-isystem",
|
||||
+ "@@libcxx@@/include/c++/v1",
|
||||
+ );
|
||||
PRODUCT_NAME = MoltenVKShaderConverter;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
@@ -683,15 +696,24 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
- "$(inherited)",
|
||||
- "\"$(SRCROOT)\"",
|
||||
- "\"$(SRCROOT)/SPIRV-Cross\"",
|
||||
- "\"$(SRCROOT)/glslang\"",
|
||||
- "\"$(SRCROOT)/glslang/External/spirv-tools/include\"",
|
||||
+ "@@sourceRoot@@/Common",
|
||||
+ "@@glslang@@/include",
|
||||
+ "@@spirv-cross@@/include/spirv_cross",
|
||||
+ "@@spirv-tools@@/include",
|
||||
+ "@@spirv-headers@@/include/spirv/unified1/",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
+ LIBRARY_SEARCH_PATHS = (
|
||||
+ "@@glslang@@/lib",
|
||||
+ "@@spirv-cross@@/lib",
|
||||
+ "@@spirv-tools@@/lib",
|
||||
+ );
|
||||
MACH_O_TYPE = staticlib;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
+ OTHER_CFLAGS = (
|
||||
+ "-isystem",
|
||||
+ "@@libcxx@@/include/c++/v1",
|
||||
+ );
|
||||
PRODUCT_NAME = MoltenVKShaderConverter;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
|
@ -1,13 +0,0 @@
|
||||
diff --git a/Scripts/create_dylib.sh b/Scripts/create_dylib.sh
|
||||
index 5ba75f67..a0405067 100755
|
||||
--- a/Scripts/create_dylib.sh
|
||||
+++ b/Scripts/create_dylib.sh
|
||||
@@ -57,6 +57,8 @@ ${MVK_SAN} \
|
||||
-framework Metal ${MVK_IOSURFACE_FWK} -framework ${MVK_UX_FWK} -framework QuartzCore -framework CoreGraphics ${MVK_IOKIT_FWK} -framework Foundation \
|
||||
--library-directory ${MVK_USR_LIB_DIR} \
|
||||
-o "${MVK_BUILT_PROD_DIR}/dynamic/${MVK_DYLIB_NAME}" \
|
||||
+-L@@sourceRoot@@/outputs/lib -L@@glslang@@/lib -L@@spirv-tools@@/lib -L@@spirv-cross@@/lib \
|
||||
+-lobjc -lMoltenVKShaderConverter -lGenericCodeGen -lMachineIndependent -lOGLCompiler -lOSDependent -lSPIRV -lSPIRV-Tools -lSPIRV-Tools-opt -lspirv-cross-core -lspirv-cross-glsl -lspirv-cross-msl -lspirv-cross-reflect \
|
||||
-force_load "${MVK_BUILT_PROD_DIR}/lib${PRODUCT_NAME}.a"
|
||||
|
||||
if test "$CONFIGURATION" = Debug; then
|
@ -1,42 +1,34 @@
|
||||
{ lib
|
||||
, overrideCC
|
||||
, stdenv
|
||||
, stdenvNoCC
|
||||
, fetchurl
|
||||
, fetchFromGitHub
|
||||
, cctools
|
||||
, sigtool
|
||||
, cereal
|
||||
, libcxx
|
||||
, glslang
|
||||
, spirv-cross
|
||||
, spirv-headers
|
||||
, spirv-tools
|
||||
, vulkan-headers
|
||||
, xcbuild
|
||||
, AppKit
|
||||
, Foundation
|
||||
, Libsystem
|
||||
, MacOSX-SDK
|
||||
, Metal
|
||||
, QuartzCore
|
||||
}:
|
||||
|
||||
# Even though the derivation is currently impure, it is written to build successfully using
|
||||
# `xcbuild`. Once the SDK on x86_64-darwin is updated, it should be possible to switch from being
|
||||
# an impure derivation.
|
||||
#
|
||||
# The `sandboxProfile` was copied from the iTerm2 derivation. In order to build you at least need
|
||||
# the `sandbox` option set to `relaxed` or `false`. Xcode should be available in the default
|
||||
# location.
|
||||
let
|
||||
libcxx.dev = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr";
|
||||
in
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "MoltenVK";
|
||||
version = "1.1.9";
|
||||
version = "1.1.10";
|
||||
|
||||
buildInputs = [
|
||||
AppKit
|
||||
Foundation
|
||||
Metal
|
||||
QuartzCore
|
||||
];
|
||||
buildInputs = [ AppKit Foundation Metal QuartzCore cereal ]
|
||||
++ lib.attrValues finalAttrs.passthru;
|
||||
|
||||
nativeBuildInputs = [ cctools sigtool xcbuild ];
|
||||
|
||||
outputs = [ "out" "bin" "dev" ];
|
||||
|
||||
@ -47,47 +39,42 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
src = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "glslang";
|
||||
rev = "9bb8cfffb0eed010e07132282c41d73064a7a609";
|
||||
hash = "sha256-YLn/Mxuk6mXPGtBBgfwky5Nl1TCAW6i2g+AZLzqVz+A=";
|
||||
rev = "adbf0d3106b26daa237b10b9bf72b1af7c31092d";
|
||||
hash = "sha256-sjidkiPtRADhyOEKDb2cHCBXnFjLwk2F5Lppv5/fwNQ=";
|
||||
};
|
||||
})).override {
|
||||
inherit (finalAttrs.passthru) spirv-headers spirv-tools;
|
||||
};
|
||||
})).override { inherit (finalAttrs.passthru) spirv-headers spirv-tools; };
|
||||
spirv-cross = spirv-cross.overrideAttrs (old: {
|
||||
cmakeFlags = (old.cmakeFlags or [ ]) ++ [
|
||||
"-DSPIRV_CROSS_NAMESPACE_OVERRIDE=MVK_spirv_cross"
|
||||
];
|
||||
cmakeFlags = (old.cmakeFlags or [ ])
|
||||
++ [ "-DSPIRV_CROSS_NAMESPACE_OVERRIDE=MVK_spirv_cross" ];
|
||||
src = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "SPIRV-Cross";
|
||||
rev = "0d4ce028bf8b8a94d325dc1e1c20446153ba19c4";
|
||||
hash = "sha256-OluTxOEfDIGMdrXhvIifjpMgZBvyh9ofLKxKt0dX5ZU=";
|
||||
rev = "50b4d5389b6a06f86fb63a2848e1a7da6d9755ca";
|
||||
hash = "sha256-SsupPHJ3VHxJhEAUl3EeQwN4texYhdDjxTnGD+bkNAw=";
|
||||
};
|
||||
});
|
||||
spirv-headers = spirv-headers.overrideAttrs (_: {
|
||||
src = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "spirv-headers";
|
||||
rev = "4995a2f2723c401eb0ea3e10c81298906bf1422b";
|
||||
hash = "sha256-LkIrTFWYvZffLVJJW3152um5LTEsMJEDEsIhBAdhBlk=";
|
||||
rev = "5a121866927a16ab9d49bed4788b532c7fcea766";
|
||||
hash = "sha256-X4GuFesX015mrzutguhZLrIGlllCgAZ+DUBGSADt8xU=";
|
||||
};
|
||||
});
|
||||
spirv-tools = (spirv-tools.overrideAttrs (old: {
|
||||
src = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "spirv-tools";
|
||||
rev = "eed5c76a57bb965f2e1b56d1dc40b50910b5ec1d";
|
||||
hash = "sha256-2Mr3HbhRslLpRfwHascl7e/UoPijhrij9Bjg3aCiqBM=";
|
||||
rev = "b930e734ea198b7aabbbf04ee1562cf6f57962f0";
|
||||
hash = "sha256-NWpFSRoxtYWi+hLUt9gpw0YScM3shcUwv9yUmbivRb0=";
|
||||
};
|
||||
})).override {
|
||||
inherit (finalAttrs.passthru) spirv-headers;
|
||||
};
|
||||
})).override { inherit (finalAttrs.passthru) spirv-headers; };
|
||||
vulkan-headers = vulkan-headers.overrideAttrs (old: {
|
||||
src = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "Vulkan-Headers";
|
||||
rev = "76f00ef6cbb1886eb1162d1fa39bee8b51e22ee8";
|
||||
hash = "sha256-FqrcFHsUS8e4ZgZpxVc8nNZWdNltniFmMjyyWVoNc7w=";
|
||||
rev = "3ef4c97fd6ea001d75a8e9da408ee473c180e456";
|
||||
hash = "sha256-jHzW3m9smuzEGbZrSyBI74K9rFozxiG3M5Xql/WOw7U=";
|
||||
};
|
||||
});
|
||||
};
|
||||
@ -96,92 +83,99 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
owner = "KhronosGroup";
|
||||
repo = "MoltenVK";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-5ie1IGzZqaYbciFnrBJ1/9V0LEuz7JsEOFXXkG3hJzg=";
|
||||
hash = "sha256-LZvCCP2yelTaWcNt+WvG+RZnVLHRgMDTlNWwRIey7ZM=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Specify the libraries to link directly since XCFrameworks are not being used.
|
||||
./createDylib.patch
|
||||
# Move `mvkGitRevDerived.h` to a stable location
|
||||
./gitRevHeaderStability.patch
|
||||
# Fix the Xcode projects to play nicely with `xcbuild`.
|
||||
./MoltenVKShaderConverter.xcodeproj.patch
|
||||
./MoltenVK.xcodeproj.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace MoltenVKShaderConverter/MoltenVKShaderConverter.xcodeproj/project.pbxproj \
|
||||
--replace @@sourceRoot@@ $(pwd) \
|
||||
--replace @@libcxx@@ "${libcxx.dev}" \
|
||||
--replace @@glslang@@ "${finalAttrs.passthru.glslang}" \
|
||||
--replace @@spirv-cross@@ "${finalAttrs.passthru.spirv-cross}" \
|
||||
--replace @@spirv-tools@@ "${finalAttrs.passthru.glslang.spirv-tools}" \
|
||||
--replace @@spirv-headers@@ "${finalAttrs.passthru.glslang.spirv-headers}"
|
||||
substituteInPlace MoltenVK/MoltenVK.xcodeproj/project.pbxproj \
|
||||
--replace @@sourceRoot@@ $(pwd) \
|
||||
--replace @@libcxx@@ "${libcxx.dev}" \
|
||||
--replace @@cereal@@ "${cereal}" \
|
||||
--replace @@spirv-cross@@ "${finalAttrs.passthru.spirv-cross}" \
|
||||
--replace @@vulkan-headers@@ "${finalAttrs.passthru.vulkan-headers}"
|
||||
substituteInPlace Scripts/create_dylib.sh \
|
||||
--replace @@sourceRoot@@ $(pwd) \
|
||||
--replace @@glslang@@ "${finalAttrs.passthru.glslang}" \
|
||||
--replace @@spirv-tools@@ "${finalAttrs.passthru.glslang.spirv-tools}" \
|
||||
--replace @@spirv-cross@@ "${finalAttrs.passthru.spirv-cross}"
|
||||
# Move `mvkGitRevDerived.h` to a stable location
|
||||
substituteInPlace Scripts/gen_moltenvk_rev_hdr.sh \
|
||||
--replace @@sourceRoot@@ $(pwd) \
|
||||
--replace '$'''{BUILT_PRODUCTS_DIR}' "$NIX_BUILD_TOP/$sourceRoot/build/include" \
|
||||
--replace '$(git rev-parse HEAD)' ${finalAttrs.src.rev}
|
||||
# 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.
|
||||
mkdir -p build/include
|
||||
ln -s "${MacOSX-SDK}/usr/include/simd" "build/include"
|
||||
'';
|
||||
|
||||
dontConfigure = true;
|
||||
|
||||
NIX_CFLAGS_COMPILE = [
|
||||
"-isystem ${lib.getDev libcxx}/include/c++/v1"
|
||||
"-I${finalAttrs.passthru.spirv-cross}/include/spirv_cross"
|
||||
"-I${finalAttrs.passthru.spirv-headers}/include/spirv/unified1/"
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
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`.
|
||||
derived_data_path=$(pwd)/DerivedData
|
||||
build=$NIX_BUILD_TOP/$sourceRoot/build
|
||||
mkdir -p "$build/bin" "$build/lib"
|
||||
|
||||
NIX_LDFLAGS+=" \
|
||||
-lMachineIndependent \
|
||||
-lGenericCodeGen \
|
||||
-lOGLCompiler \
|
||||
-lglslang \
|
||||
-lOSDependent \
|
||||
-lSPIRV \
|
||||
-lSPIRV-Tools \
|
||||
-lSPIRV-Tools-opt \
|
||||
-lspirv-cross-msl \
|
||||
-lspirv-cross-core \
|
||||
-lspirv-cross-glsl"
|
||||
|
||||
pushd MoltenVKShaderConverter
|
||||
/usr/bin/xcodebuild build \
|
||||
-jobs $NIX_BUILD_CORES \
|
||||
-derivedDataPath "$derived_data_path" \
|
||||
-configuration Release \
|
||||
-project MoltenVKShaderConverter.xcodeproj \
|
||||
-scheme MoltenVKShaderConverter \
|
||||
-arch ${stdenv.targetPlatform.darwinArch}
|
||||
popd
|
||||
mkdir -p outputs/bin outputs/lib
|
||||
declare -A outputs=( [MoltenVKShaderConverter]=bin [libMoltenVKShaderConverter.a]=lib )
|
||||
for output in "''${!outputs[@]}"; do
|
||||
cp DerivedData/Build/Products/Release/$output "outputs/''${outputs[$output]}/$output"
|
||||
xcodebuild build \
|
||||
-jobs $NIX_BUILD_CORES \
|
||||
-configuration Release \
|
||||
-project MoltenVKShaderConverter.xcodeproj \
|
||||
-scheme MoltenVKShaderConverter \
|
||||
-arch ${stdenv.targetPlatform.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
|
||||
/usr/bin/xcodebuild build \
|
||||
-jobs $NIX_BUILD_CORES \
|
||||
-derivedDataPath "$derived_data_path" \
|
||||
-configuration Release \
|
||||
-project MoltenVK.xcodeproj \
|
||||
-scheme MoltenVK-macOS \
|
||||
-arch ${stdenv.targetPlatform.darwinArch}
|
||||
xcodebuild build \
|
||||
-jobs $NIX_BUILD_CORES \
|
||||
-configuration Release \
|
||||
-project MoltenVK.xcodeproj \
|
||||
-scheme MoltenVK-macOS \
|
||||
-arch ${stdenv.targetPlatform.darwinArch}
|
||||
cp MoltenVK-*/Build/Products/Release/dynamic/libMoltenVK.dylib "$build/lib/libMoltenVK.dylib"
|
||||
popd
|
||||
cp DerivedData/Build/Products/Release/dynamic/libMoltenVK.dylib outputs/lib/libMoltenVK.dylib
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/lib" "$out/share/vulkan/icd.d" "$bin/bin" "$dev/include/MoltenVK"
|
||||
cp outputs/bin/MoltenVKShaderConverter "$bin/bin/"
|
||||
cp outputs/lib/libMoltenVK.dylib "$out/lib/"
|
||||
cp build/bin/MoltenVKShaderConverter "$bin/bin/"
|
||||
cp build/lib/libMoltenVK.dylib "$out/lib/"
|
||||
cp MoltenVK/MoltenVK/API/* "$dev/include/MoltenVK"
|
||||
${cctools}/bin/install_name_tool -id "$out/lib/libMoltenVK.dylib" "$out/lib/libMoltenVK.dylib"
|
||||
# FIXME: https://github.com/NixOS/nixpkgs/issues/148189
|
||||
/usr/bin/codesign -s - -f "$out/lib/libMoltenVK.dylib"
|
||||
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 ./libMoltenVK.dylib "$out/lib/libMoltenVK.dylib"
|
||||
'';
|
||||
|
||||
sandboxProfile = ''
|
||||
(allow file-read* file-write* process-exec mach-lookup)
|
||||
; block homebrew dependencies
|
||||
(deny file-read* file-write* process-exec mach-lookup (subpath "/usr/local") (with no-log))
|
||||
postFixup = ''
|
||||
install_name_tool -id "$out/lib/libMoltenVK.dylib" "$out/lib/libMoltenVK.dylib"
|
||||
codesign -s - -f "$out/lib/libMoltenVK.dylib"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
@ -189,7 +183,6 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
homepage = "https://github.com/KhronosGroup/MoltenVK";
|
||||
changelog = "https://github.com/KhronosGroup/MoltenVK/releases";
|
||||
maintainers = [ lib.maintainers.reckenrode ];
|
||||
hydraPlatforms = [ ]; # Prevent building on Hydra until MoltenVK no longer requires Xcode.
|
||||
license = lib.licenses.asl20;
|
||||
platforms = lib.platforms.darwin;
|
||||
};
|
||||
|
@ -1,14 +0,0 @@
|
||||
diff --git a/Scripts/gen_moltenvk_rev_hdr.sh b/Scripts/gen_moltenvk_rev_hdr.sh
|
||||
index c49ea4e6..9b7d13d1 100755
|
||||
--- a/Scripts/gen_moltenvk_rev_hdr.sh
|
||||
+++ b/Scripts/gen_moltenvk_rev_hdr.sh
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Record the MoltenVK GIT revision as a derived header file suitable for including in a build
|
||||
MVK_GIT_REV=$(git rev-parse HEAD)
|
||||
-MVK_HDR_FILE="${BUILT_PRODUCTS_DIR}/mvkGitRevDerived.h"
|
||||
+MVK_HDR_FILE="@@sourceRoot@@/outputs/include/mvkGitRevDerived.h"
|
||||
+mkdir -p $(dirname ${MVK_HDR_FILE})
|
||||
echo "// Auto-generated by MoltenVK" > "${MVK_HDR_FILE}"
|
||||
echo "static const char* mvkRevString = \"${MVK_GIT_REV}\";" >> "${MVK_HDR_FILE}"
|
||||
-
|
@ -2,6 +2,7 @@
|
||||
, fetchFromGitHub
|
||||
, cmake
|
||||
, pkg-config
|
||||
, cctools
|
||||
, python3
|
||||
, vulkan-headers
|
||||
, vulkan-loader
|
||||
@ -63,6 +64,8 @@ stdenv.mkDerivation rec {
|
||||
cmake
|
||||
pkg-config
|
||||
python3
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
cctools
|
||||
];
|
||||
|
||||
# Tests are disabled so we do not have to pull in googletest and more dependencies
|
||||
|
@ -44,7 +44,8 @@ stdenv.mkDerivation rec {
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = [ vulkan-headers vulkan-loader glslang libgcc libwebp ncnn ];
|
||||
buildInputs = [ vulkan-headers vulkan-loader glslang libwebp ncnn ]
|
||||
++ lib.optional (!stdenv.isDarwin) libgcc;
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace main.cpp --replace REPLACE_MODELS $out/share/models
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ lib, rustPlatform, fetchFromGitHub, pkg-config, makeWrapper, vulkan-loader }:
|
||||
{ lib, stdenv, rustPlatform, fetchFromGitHub, pkg-config, makeWrapper, vulkan-loader, QuartzCore }:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "wgpu-utils";
|
||||
@ -18,6 +18,8 @@ rustPlatform.buildRustPackage rec {
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = lib.optional stdenv.isDarwin QuartzCore;
|
||||
|
||||
# Tests fail, as the Nix sandbox doesn't provide an appropriate adapter (e.g. Vulkan).
|
||||
doCheck = false;
|
||||
|
||||
|
@ -2050,7 +2050,9 @@ with pkgs;
|
||||
|
||||
betterdiscord-installer = callPackage ../tools/misc/betterdiscord-installer { };
|
||||
|
||||
binocle = callPackage ../applications/misc/binocle { };
|
||||
binocle = callPackage ../applications/misc/binocle {
|
||||
inherit (darwin.apple_sdk.frameworks) AppKit CoreFoundation CoreGraphics CoreVideo Foundation Metal QuartzCore;
|
||||
};
|
||||
|
||||
bitwise = callPackage ../tools/misc/bitwise { };
|
||||
|
||||
@ -2490,7 +2492,9 @@ with pkgs;
|
||||
|
||||
gtklp = callPackage ../tools/misc/gtklp { };
|
||||
|
||||
google-amber = callPackage ../tools/graphics/amber { };
|
||||
google-amber = callPackage ../tools/graphics/amber {
|
||||
inherit (darwin) cctools;
|
||||
};
|
||||
|
||||
hakrawler = callPackage ../tools/security/hakrawler { };
|
||||
|
||||
@ -12006,7 +12010,9 @@ with pkgs;
|
||||
});
|
||||
};
|
||||
|
||||
wgpu-utils = callPackage ../tools/graphics/wgpu-utils { };
|
||||
wgpu-utils = callPackage ../tools/graphics/wgpu-utils {
|
||||
inherit (darwin.apple_sdk.frameworks) QuartzCore;
|
||||
};
|
||||
|
||||
wg-bond = callPackage ../applications/networking/wg-bond { };
|
||||
|
||||
|
@ -148,7 +148,11 @@ impure-cmds // appleSourcePackages // chooseLibs // {
|
||||
|
||||
lsusb = callPackage ../os-specific/darwin/lsusb { };
|
||||
|
||||
moltenvk = callPackage ../os-specific/darwin/moltenvk { };
|
||||
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;
|
||||
};
|
||||
|
||||
opencflite = callPackage ../os-specific/darwin/opencflite { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user