[vlc-devel] [PATCH v3] contrib: support CMAKE_GENERATOR other than makefile

Alexandre Janniaux ajanni at videolabs.io
Thu Nov 5 18:26:07 CET 2020


Hi,

Merged, thanks for your work!

Regards,
--
Alexandre Janniaux
Videolabs

On Wed, Nov 04, 2020 at 08:12:49PM +0800, Zhao Zhili wrote:
> First, fix the conflict setting/using of CMAKE_GENERATOR. Second,
> call build via cmake instead of run make directly.
> ---
> v3:
> Now $(CMAKEBUILD) is defined as "cmake --build" so we don't have to rename $(CMAKE).
>
> v2:
> remove $CMAKE_GENERATOR from soxr/rule.mak
> rename CMAKE_WRAPPER CONTRIB_CMAKE_CONFIG to avoid conflict with cmake standard variable.
>
>  contrib/bootstrap                  | 6 +++++-
>  contrib/src/aom/rules.mak          | 4 ++--
>  contrib/src/chromaprint/rules.mak  | 2 +-
>  contrib/src/ebml/rules.mak         | 2 +-
>  contrib/src/fluidlite/rules.mak    | 2 +-
>  contrib/src/glew/rules.mak         | 2 +-
>  contrib/src/glslang/rules.mak      | 2 +-
>  contrib/src/gme/rules.mak          | 2 +-
>  contrib/src/libebur128/rules.mak   | 2 +-
>  contrib/src/main.mak               | 3 ++-
>  contrib/src/matroska/rules.mak     | 2 +-
>  contrib/src/mpcdec/rules.mak       | 2 +-
>  contrib/src/mysofa/rules.mak       | 2 +-
>  contrib/src/openjpeg/rules.mak     | 2 +-
>  contrib/src/projectM/rules.mak     | 2 +-
>  contrib/src/soxr/rules.mak         | 4 ++--
>  contrib/src/spatialaudio/rules.mak | 2 +-
>  contrib/src/srt/rules.mak          | 2 +-
>  contrib/src/taglib/rules.mak       | 2 +-
>  contrib/src/x265/rules.mak         | 2 +-
>  20 files changed, 27 insertions(+), 22 deletions(-)
>
> diff --git a/contrib/bootstrap b/contrib/bootstrap
> index 5ed5f6f25d..8cd4c68f40 100755
> --- a/contrib/bootstrap
> +++ b/contrib/bootstrap
> @@ -256,7 +256,11 @@ test -z "$GNUV3" || add_make_enabled "GNUV3"
>  test -z "$AD_CLAUSES" || add_make_enabled "AD_CLAUSES"
>  test -z "$WITH_OPTIMIZATION" || add_make_enabled "WITH_OPTIMIZATION"
>  test -z "$ENABLE_PDB" || add_make_enabled "ENABLE_PDB"
> -test "`uname -o 2>/dev/null`" != "Msys" || add_make "CMAKE_GENERATOR := -G \"MSYS Makefiles\""
> +
> +if [ "`uname -o 2>/dev/null`" = "Msys" ]; then
> +    add_make "CMAKE_GENERATOR := MSYS Makefiles"
> +    add_make "export CMAKE_GENERATOR"
> +fi
>
>  #
>  # Checks
> diff --git a/contrib/src/aom/rules.mak b/contrib/src/aom/rules.mak
> index ccf6491582..d49c825d63 100644
> --- a/contrib/src/aom/rules.mak
> +++ b/contrib/src/aom/rules.mak
> @@ -89,7 +89,7 @@ endif
>  	rm -rf $(PREFIX)/include/aom
>  	cd $< && rm -rf aom_build && mkdir -p aom_build
>  	cd $</aom_build && LDFLAGS="$(AOM_LDFLAGS)" $(HOSTVARS) $(CMAKE) ../ $(AOM_CONF)
> -	cd $< && $(MAKE) -C aom_build
> +	cd $< && $(CMAKEBUILD) aom_build
>  	$(call pkg_static,"aom_build/aom.pc")
> -	cd $</aom_build && $(MAKE) install
> +	cd $</aom_build && $(CMAKEBUILD) . --target install
>  	touch $@
> diff --git a/contrib/src/chromaprint/rules.mak b/contrib/src/chromaprint/rules.mak
> index cac496d2c8..f01beaba79 100644
> --- a/contrib/src/chromaprint/rules.mak
> +++ b/contrib/src/chromaprint/rules.mak
> @@ -22,5 +22,5 @@ DEPS_chromaprint = ffmpeg $(DEPS_ffmpeg)
>
>  .chromaprint: chromaprint toolchain.cmake
>  	cd $< && $(HOSTVARS_PIC) $(CMAKE)
> -	cd $< && $(MAKE) install
> +	cd $< && $(CMAKEBUILD) . --target install
>  	touch $@
> diff --git a/contrib/src/ebml/rules.mak b/contrib/src/ebml/rules.mak
> index 3aecd88c38..5f3c9ab824 100644
> --- a/contrib/src/ebml/rules.mak
> +++ b/contrib/src/ebml/rules.mak
> @@ -18,5 +18,5 @@ ebml: libebml-$(EBML_VERSION).tar.xz .sum-ebml
>
>  .ebml: ebml toolchain.cmake
>  	cd $< && $(HOSTVARS_PIC) $(CMAKE) -DENABLE_WIN32_IO=OFF
> -	cd $< && $(MAKE) install
> +	cd $< && $(CMAKEBUILD) . --target install
>  	touch $@
> diff --git a/contrib/src/fluidlite/rules.mak b/contrib/src/fluidlite/rules.mak
> index e893a46c1c..e119a97ab0 100644
> --- a/contrib/src/fluidlite/rules.mak
> +++ b/contrib/src/fluidlite/rules.mak
> @@ -28,5 +28,5 @@ fluidlite: fluidlite-$(FLUID_HASH).tar.xz .sum-fluidlite
>  .fluidlite: fluidlite toolchain.cmake
>  	cd $< && rm -f CMakeCache.txt
>  	cd $< && $(HOSTVARS) $(CMAKE)
> -	cd $< && $(MAKE) install
> +	cd $< && $(CMAKEBUILD) . --target install
>  	touch $@
> diff --git a/contrib/src/glew/rules.mak b/contrib/src/glew/rules.mak
> index 7477d149f6..5793bf13e8 100644
> --- a/contrib/src/glew/rules.mak
> +++ b/contrib/src/glew/rules.mak
> @@ -18,5 +18,5 @@ glew: glew-$(GLEW_VERSION).tgz .sum-glew
>
>  .glew: glew toolchain.cmake
>  	cd $</build/cmake && $(HOSTVARS_PIC) $(CMAKE) -DBUILD_SHARED_LIBS:BOOL=OFF -DGLEW_USE_STATIC_LIBS:BOOL=ON
> -	cd $</build/cmake && $(MAKE) install
> +	cd $</build/cmake && $(CMAKEBUILD) . --target install
>  	touch $@
> diff --git a/contrib/src/glslang/rules.mak b/contrib/src/glslang/rules.mak
> index 32c680b9f0..ee389f4fa5 100644
> --- a/contrib/src/glslang/rules.mak
> +++ b/contrib/src/glslang/rules.mak
> @@ -25,5 +25,5 @@ glslang: glslang-$(GLSLANG_BASENAME).tar.xz .sum-glslang
>  .glslang: glslang toolchain.cmake
>  	cd $< && $(HOSTVARS_PIC) CXXFLAGS="-DYYDEBUG=0" $(CMAKE) -DBUILD_SHARED_LIBS=OFF \
>  	    -DENABLE_GLSLANG_BINARIES=OFF
> -	cd $< && $(MAKE) install
> +	cd $< && $(CMAKEBUILD) . --target install
>  	touch $@
> diff --git a/contrib/src/gme/rules.mak b/contrib/src/gme/rules.mak
> index 60af152940..51c0bf171d 100644
> --- a/contrib/src/gme/rules.mak
> +++ b/contrib/src/gme/rules.mak
> @@ -19,5 +19,5 @@ game-music-emu: game-music-emu-$(GME_VERSION).tar.bz2 .sum-gme
>
>  .gme: game-music-emu toolchain.cmake
>  	cd $< && $(HOSTVARS_PIC) $(CMAKE) .
> -	cd $< && $(MAKE) install
> +	cd $< && $(CMAKEBUILD) . --target install
>  	touch $@
> diff --git a/contrib/src/libebur128/rules.mak b/contrib/src/libebur128/rules.mak
> index 7f74aabb76..75d6cd7269 100644
> --- a/contrib/src/libebur128/rules.mak
> +++ b/contrib/src/libebur128/rules.mak
> @@ -20,6 +20,6 @@ libebur128: libebur128-$(LIBEBUR128_VERSION).tar.gz .sum-libebur128
>
>  .libebur128: libebur128 toolchain.cmake
>  	cd $< && $(HOSTVARS_PIC) $(CMAKE) -DENABLE_INTERNAL_QUEUE_H=TRUE
> -	cd $< && $(MAKE) install
> +	cd $< && $(CMAKEBUILD) . --target install
>  	rm -f $(PREFIX)/lib/libebur128.so*
>  	touch $@
> diff --git a/contrib/src/main.mak b/contrib/src/main.mak
> index aa273ef89c..fb71479d68 100644
> --- a/contrib/src/main.mak
> +++ b/contrib/src/main.mak
> @@ -392,8 +392,9 @@ AUTORECONF = autoreconf
>  endif
>  RECONF = mkdir -p -- $(PREFIX)/share/aclocal && \
>  	cd $< && $(AUTORECONF) -fiv $(ACLOCAL_AMFLAGS)
> +CMAKEBUILD := cmake --build
>  CMAKE = cmake . -DCMAKE_TOOLCHAIN_FILE=$(abspath toolchain.cmake) \
> -		-DCMAKE_INSTALL_PREFIX=$(PREFIX) $(CMAKE_GENERATOR) \
> +		-DCMAKE_INSTALL_PREFIX=$(PREFIX) \
>  		-DBUILD_SHARED_LIBS:BOOL=OFF
>  ifdef HAVE_WIN32
>  CMAKE += -DCMAKE_DEBUG_POSTFIX:STRING=
> diff --git a/contrib/src/matroska/rules.mak b/contrib/src/matroska/rules.mak
> index c455d2f912..786f338355 100644
> --- a/contrib/src/matroska/rules.mak
> +++ b/contrib/src/matroska/rules.mak
> @@ -23,5 +23,5 @@ matroska: libmatroska-$(MATROSKA_VERSION).tar.xz .sum-matroska
>
>  .matroska: matroska toolchain.cmake
>  	cd $< && $(HOSTVARS_PIC) $(CMAKE)
> -	cd $< && $(MAKE) install
> +	cd $< && $(CMAKEBUILD) . --target install
>  	touch $@
> diff --git a/contrib/src/mpcdec/rules.mak b/contrib/src/mpcdec/rules.mak
> index 9284ad4e99..32ee57d5af 100644
> --- a/contrib/src/mpcdec/rules.mak
> +++ b/contrib/src/mpcdec/rules.mak
> @@ -43,7 +43,7 @@ endif
>
>  .mpcdec: musepack toolchain.cmake
>  	cd $< && $(HOSTVARS_PIC) $(CMAKE) -DSHARED=OFF .
> -	cd $< && $(MAKE) install
> +	cd $< && $(CMAKEBUILD) . --target install
>  	mkdir -p -- "$(PREFIX)/lib"
>  	# Use globbing to work around cmake's change of destination file
>  	cd $< && cp libmpcdec/*mpcdec_static.* "$(PREFIX)/lib/libmpcdec.a"
> diff --git a/contrib/src/mysofa/rules.mak b/contrib/src/mysofa/rules.mak
> index fe443988c9..84c0bb6b36 100644
> --- a/contrib/src/mysofa/rules.mak
> +++ b/contrib/src/mysofa/rules.mak
> @@ -26,6 +26,6 @@ mysofa: libmysofa-$(MYSOFA_VERSION).tar.gz .sum-mysofa
>  .mysofa: mysofa toolchain.cmake
>  	cd $< && rm -f CMakeCache.txt
>  	cd $< && $(HOSTVARS) $(CMAKE) -DBUILD_TESTS=OFF
> -	cd $< && $(MAKE) install
> +	cd $< && $(CMAKEBUILD) . --target install
>  	touch $@
>
> diff --git a/contrib/src/openjpeg/rules.mak b/contrib/src/openjpeg/rules.mak
> index ad51638902..e485651354 100644
> --- a/contrib/src/openjpeg/rules.mak
> +++ b/contrib/src/openjpeg/rules.mak
> @@ -30,5 +30,5 @@ endif
>  		-DBUILD_PKGCONFIG_FILES=ON \
>  			-DBUILD_CODEC:bool=OFF \
>  		.
> -	cd $< && $(MAKE) install
> +	cd $< && $(CMAKEBUILD) . --target install
>  	touch $@
> diff --git a/contrib/src/projectM/rules.mak b/contrib/src/projectM/rules.mak
> index ee2652b6d2..ec5d2bc3a4 100644
> --- a/contrib/src/projectM/rules.mak
> +++ b/contrib/src/projectM/rules.mak
> @@ -43,6 +43,6 @@ DEPS_projectM = glew $(DEPS_glew)
>  		-DINCLUDE-PROJECTM-PULSEAUDIO:BOOL=OFF \
>  		-DINCLUDE-PROJECTM-QT:BOOL=OFF \
>  		-DBUILD_PROJECTM_STATIC:BOOL=ON .
> -	cd $< && $(MAKE) install
> +	cd $< && $(CMAKEBUILD) . --target install
>  	-cd $<; cp Renderer/libRenderer.a MilkdropPresetFactory/libMilkdropPresetFactory.a $(PREFIX)/lib
>  	touch $@
> diff --git a/contrib/src/soxr/rules.mak b/contrib/src/soxr/rules.mak
> index 3981271743..8d3a986568 100644
> --- a/contrib/src/soxr/rules.mak
> +++ b/contrib/src/soxr/rules.mak
> @@ -41,6 +41,6 @@ endif
>  		-DWITH_LSR_BINDINGS=OFF \
>  		-DWITH_OPENMP=OFF \
>  		-DWITH_AVFFT=ON \
> -		-Wno-dev $(CMAKE_GENERATOR)
> -	cd $< && $(MAKE) install
> +		-Wno-dev
> +	cd $< && $(CMAKEBUILD) . --target install
>  	touch $@
> diff --git a/contrib/src/spatialaudio/rules.mak b/contrib/src/spatialaudio/rules.mak
> index 60a6596fc2..ce65adbd87 100644
> --- a/contrib/src/spatialaudio/rules.mak
> +++ b/contrib/src/spatialaudio/rules.mak
> @@ -23,5 +23,5 @@ spatialaudio: spatialaudio-$(SPATIALAUDIO_VERSION).tar.bz2 .sum-spatialaudio
>  .spatialaudio: spatialaudio toolchain.cmake
>  	cd $< && rm -f CMakeCache.txt
>  	cd $< && $(HOSTVARS) $(CMAKE) -DMYSOFA_ROOT_DIR=$(PREFIX) -DHAVE_MIT_HRTF=OFF
> -	cd $< && $(MAKE) install
> +	cd $< && $(CMAKEBUILD) . --target install
>  	touch $@
> diff --git a/contrib/src/srt/rules.mak b/contrib/src/srt/rules.mak
> index c9dbb59db8..05942a7af5 100644
> --- a/contrib/src/srt/rules.mak
> +++ b/contrib/src/srt/rules.mak
> @@ -38,5 +38,5 @@ srt: srt-$(SRT_VERSION).tar.gz .sum-srt
>  .srt: srt toolchain.cmake
>  	cd $< && $(HOSTVARS_PIC) CFLAGS="$(SRT_CFLAGS)" CXXFLAGS="$(SRT_CXXFLAGS)" $(CMAKE) \
>  		-DENABLE_SHARED=OFF -DUSE_GNUTLS=ON -DENABLE_CXX11=OFF -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_BINDIR=bin -DCMAKE_INSTALL_INCLUDEDIR=include
> -	cd $< && $(MAKE) install
> +	cd $< && $(CMAKEBUILD) . --target install
>  	touch $@
> diff --git a/contrib/src/taglib/rules.mak b/contrib/src/taglib/rules.mak
> index 214b1ac1a1..b6204859e9 100644
> --- a/contrib/src/taglib/rules.mak
> +++ b/contrib/src/taglib/rules.mak
> @@ -24,5 +24,5 @@ taglib: taglib-$(TAGLIB_VERSION).tar.gz .sum-taglib
>
>  .taglib: taglib toolchain.cmake
>  	cd $< && $(HOSTVARS_PIC) $(CMAKE) .
> -	cd $< && $(MAKE) install
> +	cd $< && $(CMAKEBUILD) . --target install
>  	touch $@
> diff --git a/contrib/src/x265/rules.mak b/contrib/src/x265/rules.mak
> index 0ed3de65d6..ad6cb7fbd3 100644
> --- a/contrib/src/x265/rules.mak
> +++ b/contrib/src/x265/rules.mak
> @@ -37,6 +37,6 @@ endif
>  .x265: x265 toolchain.cmake
>  	$(REQUIRE_GPL)
>  	cd $</source && $(HOSTVARS_PIC) $(CMAKE) -DENABLE_SHARED=OFF -DCMAKE_SYSTEM_PROCESSOR=$(ARCH) -DENABLE_CLI=OFF
> -	cd $< && $(MAKE) -C source install
> +	cd $< && $(CMAKEBUILD) source --target install
>  	sed -e s/'[^ ]*clang_rt[^ ]*'//g -i.orig "$(PREFIX)/lib/pkgconfig/x265.pc"
>  	touch $@
> --
> 2.28.0
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list