From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 05BFE422CC for ; Fri, 17 Dec 2021 08:54:47 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ACDAB68A61A; Fri, 17 Dec 2021 10:54:44 +0200 (EET) Received: from mail8.parnet.fi (mail8.parnet.fi [77.234.108.134]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9E5E2680500 for ; Fri, 17 Dec 2021 10:54:38 +0200 (EET) Received: from mail9.parnet.fi (mail9.parnet.fi [77.234.108.21]) by mail8.parnet.fi with ESMTP id 1BH8sbY0030264-1BH8sbY1030264; Fri, 17 Dec 2021 10:54:37 +0200 Received: from foo.martin.st (host-97-187.parnet.fi [77.234.97.187]) by mail9.parnet.fi (Postfix) with ESMTPS id 0BB85A143F; Fri, 17 Dec 2021 10:54:36 +0200 (EET) Date: Fri, 17 Dec 2021 10:54:36 +0200 (EET) From: =?ISO-8859-15?Q?Martin_Storsj=F6?= To: FFmpeg development discussions and patches In-Reply-To: <20211216202858.77643-2-ffmpeg@tmm1.net> Message-ID: <353c304f-bbcb-3eee-4023-e8c0cdb55896@martin.st> References: <20211216202858.77643-1-ffmpeg@tmm1.net> <20211216202858.77643-2-ffmpeg@tmm1.net> MIME-Version: 1.0 X-FE-Policy-ID: 3:14:2:SYSTEM Subject: Re: [FFmpeg-devel] [PATCH v3 2/5] build: detect Metal.framework and build .metal files X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: kernrj@gmail.com, Aman Karmani , philipl@overt.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Thu, 16 Dec 2021, Aman Karmani wrote: > From: Aman Karmani > > Signed-off-by: Aman Karmani > --- > .gitignore | 3 +++ > configure | 8 +++++++- > ffbuild/common.mak | 9 +++++++++ > 3 files changed, 19 insertions(+), 1 deletion(-) > > diff --git a/.gitignore b/.gitignore > index 9ed24b542e..1a5bb29ad5 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -19,6 +19,9 @@ > *.swp > *.ver > *.version > +*.metal.air > +*.metallib > +*.metallib.c > *.ptx > *.ptx.c > *.ptx.gz > diff --git a/configure b/configure > index 5fffcb8afe..ab00b2d7cb 100755 > --- a/configure > +++ b/configure > @@ -309,6 +309,7 @@ External library support: > if openssl, gnutls or libtls is not used [no] > --enable-mediacodec enable Android MediaCodec support [no] > --enable-mediafoundation enable encoding via MediaFoundation [auto] > + --disable-metal disable Apple Metal framework [autodetect] > --enable-libmysofa enable libmysofa, needed for sofalizer filter [no] > --enable-openal enable OpenAL 1.1 capture support [no] > --enable-opencl enable OpenCL processing [no] > @@ -382,6 +383,7 @@ Toolchain options: > --dep-cc=DEPCC use dependency generator DEPCC [$cc_default] > --nvcc=NVCC use Nvidia CUDA compiler NVCC or clang [$nvcc_default] > --ld=LD use linker LD [$ld_default] > + --metalcc=METALCC use metal compiler METALCC [$metalcc_default] > --pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default] > --pkg-config-flags=FLAGS pass additional flags to pkgconf [] > --ranlib=RANLIB use ranlib RANLIB [$ranlib_default] > @@ -2564,6 +2566,7 @@ CMDLINE_SET=" > ln_s > logfile > malloc_prefix > + metalcc > nm > optflags > nvcc > @@ -3835,6 +3838,7 @@ host_cc_default="gcc" > doxygen_default="doxygen" > install="install" > ln_s_default="ln -s -f" > +metalcc_default="xcrun metal" > nm_default="nm -g" > pkg_config_default=pkg-config > ranlib_default="ranlib" > @@ -4435,7 +4439,7 @@ if enabled cuda_nvcc; then > fi > > set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \ > - target_exec x86asmexe > + target_exec x86asmexe metalcc > enabled cross_compile || host_cc_default=$cc > set_default host_cc > > @@ -6326,6 +6330,7 @@ check_apple_framework CoreFoundation > check_apple_framework CoreMedia > check_apple_framework CoreVideo > check_apple_framework CoreAudio > +check_apple_framework Metal > > enabled avfoundation && { > disable coregraphics applicationservices > @@ -7620,6 +7625,7 @@ ARFLAGS=$arflags > AR_O=$ar_o > AR_CMD=$ar > NM_CMD=$nm > +METALCC=$metalcc > RANLIB=$ranlib > STRIP=$strip > STRIPTYPE=$striptype > diff --git a/ffbuild/common.mak b/ffbuild/common.mak > index 0eb831d434..05440911f4 100644 > --- a/ffbuild/common.mak > +++ b/ffbuild/common.mak > @@ -112,6 +112,15 @@ COMPILE_LASX = $(call COMPILE,CC,LASXFLAGS) > $(BIN2CEXE): ffbuild/bin2c_host.o > $(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $^ $(HOSTEXTRALIBS) > > +%.metal.air: %.metal > + $(METALCC) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) -o $@ > + > +%.metallib: %.metal.air > + $(METALCC)lib --split-module-without-linking $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) -o $@ Hmm, so does this try to run "xcrun metallib" instead of "xcrun metal"? I think that can be kinda brittle, e.g. if someone wants to configure a custom build env, where METALCC expands to e.g. "my-wrapped-metal-compiler.sh". I guess it feels a bit boring to need to define two separate variables, but if it really is two separate tools, then I think that'd be the best for clarity. // Martin _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".