Skip to content

Commit

Permalink
moltenvk: refactor to build without Xcode
Browse files Browse the repository at this point in the history
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

- Use the 11.0 SDK instead of the 10.12 one on x86_64-darwin;
- Use `NIX_CFLAGS_COMPILE` and `NIX_LDFLAGS` to pass flags to the
  compiler instead of patching the Xcode project files; and
- Use xcbuild to build the project.
  • Loading branch information
reckenrode committed Jul 21, 2022
1 parent 9bde935 commit 9d2b95e
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 263 deletions.
58 changes: 0 additions & 58 deletions pkgs/os-specific/darwin/moltenvk/MoltenVK.xcodeproj.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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;
13 changes: 0 additions & 13 deletions pkgs/os-specific/darwin/moltenvk/createDylib.patch

This file was deleted.

Loading

0 comments on commit 9d2b95e

Please sign in to comment.