build: detect Metal.framework and build .metal files

Reviewed-by: Ridley Combs <rcombs@rcombs.me>
Signed-off-by: Aman Karmani <aman@tmm1.net>
pull/379/head
Aman Karmani 3 years ago
parent ad3c19dc9e
commit c975946577
  1. 3
      .gitignore
  2. 12
      configure
  3. 9
      ffbuild/common.mak

3
.gitignore vendored

@ -19,6 +19,9 @@
*.swp *.swp
*.ver *.ver
*.version *.version
*.metal.air
*.metallib
*.metallib.c
*.ptx *.ptx
*.ptx.c *.ptx.c
*.ptx.gz *.ptx.gz

12
configure vendored

@ -309,6 +309,7 @@ External library support:
if openssl, gnutls or libtls is not used [no] if openssl, gnutls or libtls is not used [no]
--enable-mediacodec enable Android MediaCodec support [no] --enable-mediacodec enable Android MediaCodec support [no]
--enable-mediafoundation enable encoding via MediaFoundation [auto] --enable-mediafoundation enable encoding via MediaFoundation [auto]
--disable-metal disable Apple Metal framework [autodetect]
--enable-libmysofa enable libmysofa, needed for sofalizer filter [no] --enable-libmysofa enable libmysofa, needed for sofalizer filter [no]
--enable-openal enable OpenAL 1.1 capture support [no] --enable-openal enable OpenAL 1.1 capture support [no]
--enable-opencl enable OpenCL processing [no] --enable-opencl enable OpenCL processing [no]
@ -382,6 +383,8 @@ Toolchain options:
--dep-cc=DEPCC use dependency generator DEPCC [$cc_default] --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
--nvcc=NVCC use Nvidia CUDA compiler NVCC or clang [$nvcc_default] --nvcc=NVCC use Nvidia CUDA compiler NVCC or clang [$nvcc_default]
--ld=LD use linker LD [$ld_default] --ld=LD use linker LD [$ld_default]
--metalcc=METALCC use metal compiler METALCC [$metalcc_default]
--metallib=METALLIB use metal linker METALLIB [$metallib_default]
--pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default] --pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default]
--pkg-config-flags=FLAGS pass additional flags to pkgconf [] --pkg-config-flags=FLAGS pass additional flags to pkgconf []
--ranlib=RANLIB use ranlib RANLIB [$ranlib_default] --ranlib=RANLIB use ranlib RANLIB [$ranlib_default]
@ -2564,6 +2567,8 @@ CMDLINE_SET="
ln_s ln_s
logfile logfile
malloc_prefix malloc_prefix
metalcc
metallib
nm nm
optflags optflags
nvcc nvcc
@ -3835,6 +3840,8 @@ host_cc_default="gcc"
doxygen_default="doxygen" doxygen_default="doxygen"
install="install" install="install"
ln_s_default="ln -s -f" ln_s_default="ln -s -f"
metalcc_default="xcrun metal"
metallib_default="xcrun metallib"
nm_default="nm -g" nm_default="nm -g"
pkg_config_default=pkg-config pkg_config_default=pkg-config
ranlib_default="ranlib" ranlib_default="ranlib"
@ -4435,7 +4442,7 @@ if enabled cuda_nvcc; then
fi fi
set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \ set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
target_exec x86asmexe target_exec x86asmexe metalcc metallib
enabled cross_compile || host_cc_default=$cc enabled cross_compile || host_cc_default=$cc
set_default host_cc set_default host_cc
@ -6326,6 +6333,7 @@ check_apple_framework CoreFoundation
check_apple_framework CoreMedia check_apple_framework CoreMedia
check_apple_framework CoreVideo check_apple_framework CoreVideo
check_apple_framework CoreAudio check_apple_framework CoreAudio
check_apple_framework Metal
enabled avfoundation && { enabled avfoundation && {
disable coregraphics applicationservices disable coregraphics applicationservices
@ -7620,6 +7628,8 @@ ARFLAGS=$arflags
AR_O=$ar_o AR_O=$ar_o
AR_CMD=$ar AR_CMD=$ar
NM_CMD=$nm NM_CMD=$nm
METALCC=$metalcc
METALLIB=$metallib
RANLIB=$ranlib RANLIB=$ranlib
STRIP=$strip STRIP=$strip
STRIPTYPE=$striptype STRIPTYPE=$striptype

@ -112,6 +112,15 @@ COMPILE_LASX = $(call COMPILE,CC,LASXFLAGS)
$(BIN2CEXE): ffbuild/bin2c_host.o $(BIN2CEXE): ffbuild/bin2c_host.o
$(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $^ $(HOSTEXTRALIBS) $(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $^ $(HOSTEXTRALIBS)
%.metal.air: %.metal
$(METALCC) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) -o $@
%.metallib: %.metal.air
$(METALLIB) --split-module-without-linking $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) -o $@
%.metallib.c: %.metallib $(BIN2CEXE)
$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
%.ptx: %.cu $(SRC_PATH)/compat/cuda/cuda_runtime.h %.ptx: %.cu $(SRC_PATH)/compat/cuda/cuda_runtime.h
$(COMPILE_NVCC) $(COMPILE_NVCC)

Loading…
Cancel
Save