Put all dependency libraries and shaders in bin directory

This commit is contained in:
Martin Fouilleul 2023-04-12 16:12:26 +02:00
parent f35e91a38c
commit c347e10577
2 changed files with 7 additions and 2 deletions

View File

@ -52,11 +52,16 @@ if [ ! \( -e bin \) ] ; then
mkdir ./bin
fi
if [ ! \( -e resources \) ] ; then
mkdir ./resources
fi
if [ $target = 'lib' ] ; then
# compile metal shader
xcrun -sdk macosx metal $shaderFlagParam -fno-fast-math -c -o $BINDIR/mtl_renderer.air $SRCDIR/mtl_renderer.metal
xcrun -sdk macosx metallib -o $RESDIR/mtl_renderer.metallib $BINDIR/mtl_renderer.air
xcrun -sdk macosx metallib -o $BINDIR/mtl_renderer.metallib $BINDIR/mtl_renderer.air
# compile milepost. We use one compilation unit for all C code, and one compilation
# unit for all ObjectiveC code

View File

@ -1155,7 +1155,7 @@ mg_canvas_backend* mg_mtl_canvas_create(mg_surface surface)
@autoreleasepool{
//NOTE: load metal library
str8 shaderPath = mp_app_get_resource_path(mem_scratch(), "../resources/mtl_renderer.metallib");
str8 shaderPath = mp_app_get_resource_path(mem_scratch(), "mtl_renderer.metallib");
NSString* metalFileName = [[NSString alloc] initWithBytes: shaderPath.ptr length:shaderPath.len encoding: NSUTF8StringEncoding];
NSError* err = 0;
id<MTLLibrary> library = [metalSurface->device newLibraryWithFile: metalFileName error:&err];