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

Steve Lhomme robux4 at ycbcr.xyz
Tue Nov 3 12:50:09 CET 2020


On 2020-11-03 11:59, Alexandre Janniaux wrote:
> Hi,
> 
> I don't really like the CONTRIB_CMAKE_CONFIG renaming from
> the CMAKE variable. Can you expand on why it is needed?
> 
> I guess it's for the $(CMAKE) --build, but maybe you can
> expose a $(CMAKE_BUILD) instead?

Or change both as CMAKE_CONFIGURE and CMAKE_BUILD so it's easier to tell 
who does what.

> Regardsm
> --
> Alexandre Janniaux
> Videolabs
> 
> On Tue, Nov 03, 2020 at 10:01:19AM +0800, Zhao Zhili wrote:
>> First, fix the conflict setting/using of CMAKE_GENERATOR. Second,
>> call build via cmake --build instead of run make directly.
>> ---
>> 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          |  6 +++---
>>   contrib/src/chromaprint/rules.mak  |  4 ++--
>>   contrib/src/ebml/rules.mak         |  4 ++--
>>   contrib/src/fluidlite/rules.mak    |  4 ++--
>>   contrib/src/glew/rules.mak         |  4 ++--
>>   contrib/src/glslang/rules.mak      |  4 ++--
>>   contrib/src/gme/rules.mak          |  4 ++--
>>   contrib/src/libebur128/rules.mak   |  4 ++--
>>   contrib/src/main.mak               | 13 +++++++------
>>   contrib/src/matroska/rules.mak     |  4 ++--
>>   contrib/src/mpcdec/rules.mak       |  4 ++--
>>   contrib/src/mysofa/rules.mak       |  4 ++--
>>   contrib/src/openjpeg/rules.mak     |  4 ++--
>>   contrib/src/projectM/rules.mak     |  4 ++--
>>   contrib/src/soxr/rules.mak         |  6 +++---
>>   contrib/src/spatialaudio/rules.mak |  4 ++--
>>   contrib/src/srt/rules.mak          |  4 ++--
>>   contrib/src/taglib/rules.mak       |  4 ++--
>>   contrib/src/x265/rules.mak         |  4 ++--
>>   20 files changed, 50 insertions(+), 45 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..9f0e2eb17b 100644
>> --- a/contrib/src/aom/rules.mak
>> +++ b/contrib/src/aom/rules.mak
>> @@ -88,8 +88,8 @@ endif
>>   .aom: aom toolchain.cmake
>>   	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 $</aom_build && LDFLAGS="$(AOM_LDFLAGS)" $(HOSTVARS) $(CONTRIB_CMAKE_CONFIG) ../ $(AOM_CONF)
>> +	cd $< && $(CMAKE) --build aom_build
>>   	$(call pkg_static,"aom_build/aom.pc")
>> -	cd $</aom_build && $(MAKE) install
>> +	cd $</aom_build && $(CMAKE) --build . --target install
>>   	touch $@
>> diff --git a/contrib/src/chromaprint/rules.mak b/contrib/src/chromaprint/rules.mak
>> index cac496d2c8..22dc2b88fa 100644
>> --- a/contrib/src/chromaprint/rules.mak
>> +++ b/contrib/src/chromaprint/rules.mak
>> @@ -21,6 +21,6 @@ chromaprint: chromaprint-$(CHROMAPRINT_VERSION).tar.gz .sum-chromaprint
>>   DEPS_chromaprint = ffmpeg $(DEPS_ffmpeg)
>>
>>   .chromaprint: chromaprint toolchain.cmake
>> -	cd $< && $(HOSTVARS_PIC) $(CMAKE)
>> -	cd $< && $(MAKE) install
>> +	cd $< && $(HOSTVARS_PIC) $(CONTRIB_CMAKE_CONFIG)
>> +	cd $< && $(CMAKE) --build . --target install
>>   	touch $@
>> diff --git a/contrib/src/ebml/rules.mak b/contrib/src/ebml/rules.mak
>> index 3aecd88c38..fc3ac81e78 100644
>> --- a/contrib/src/ebml/rules.mak
>> +++ b/contrib/src/ebml/rules.mak
>> @@ -17,6 +17,6 @@ ebml: libebml-$(EBML_VERSION).tar.xz .sum-ebml
>>   	$(MOVE)
>>
>>   .ebml: ebml toolchain.cmake
>> -	cd $< && $(HOSTVARS_PIC) $(CMAKE) -DENABLE_WIN32_IO=OFF
>> -	cd $< && $(MAKE) install
>> +	cd $< && $(HOSTVARS_PIC) $(CONTRIB_CMAKE_CONFIG) -DENABLE_WIN32_IO=OFF
>> +	cd $< && $(CMAKE) --build . --target install
>>   	touch $@
>> diff --git a/contrib/src/fluidlite/rules.mak b/contrib/src/fluidlite/rules.mak
>> index e893a46c1c..8e105e7026 100644
>> --- a/contrib/src/fluidlite/rules.mak
>> +++ b/contrib/src/fluidlite/rules.mak
>> @@ -27,6 +27,6 @@ fluidlite: fluidlite-$(FLUID_HASH).tar.xz .sum-fluidlite
>>
>>   .fluidlite: fluidlite toolchain.cmake
>>   	cd $< && rm -f CMakeCache.txt
>> -	cd $< && $(HOSTVARS) $(CMAKE)
>> -	cd $< && $(MAKE) install
>> +	cd $< && $(HOSTVARS) $(CONTRIB_CMAKE_CONFIG)
>> +	cd $< && $(CMAKE) --build . --target install
>>   	touch $@
>> diff --git a/contrib/src/glew/rules.mak b/contrib/src/glew/rules.mak
>> index 7477d149f6..fb80929eb9 100644
>> --- a/contrib/src/glew/rules.mak
>> +++ b/contrib/src/glew/rules.mak
>> @@ -17,6 +17,6 @@ glew: glew-$(GLEW_VERSION).tgz .sum-glew
>>   	$(MOVE)
>>
>>   .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 && $(HOSTVARS_PIC) $(CONTRIB_CMAKE_CONFIG) -DBUILD_SHARED_LIBS:BOOL=OFF -DGLEW_USE_STATIC_LIBS:BOOL=ON
>> +	cd $</build/cmake && $(CMAKE) --build . --target install
>>   	touch $@
>> diff --git a/contrib/src/glslang/rules.mak b/contrib/src/glslang/rules.mak
>> index 32c680b9f0..e2b0d78bd2 100644
>> --- a/contrib/src/glslang/rules.mak
>> +++ b/contrib/src/glslang/rules.mak
>> @@ -23,7 +23,7 @@ glslang: glslang-$(GLSLANG_BASENAME).tar.xz .sum-glslang
>>   	$(MOVE)
>>
>>   .glslang: glslang toolchain.cmake
>> -	cd $< && $(HOSTVARS_PIC) CXXFLAGS="-DYYDEBUG=0" $(CMAKE) -DBUILD_SHARED_LIBS=OFF \
>> +	cd $< && $(HOSTVARS_PIC) CXXFLAGS="-DYYDEBUG=0" $(CONTRIB_CMAKE_CONFIG) -DBUILD_SHARED_LIBS=OFF \
>>   	    -DENABLE_GLSLANG_BINARIES=OFF
>> -	cd $< && $(MAKE) install
>> +	cd $< && $(CMAKE) --build . --target install
>>   	touch $@
>> diff --git a/contrib/src/gme/rules.mak b/contrib/src/gme/rules.mak
>> index 60af152940..95a6faa742 100644
>> --- a/contrib/src/gme/rules.mak
>> +++ b/contrib/src/gme/rules.mak
>> @@ -18,6 +18,6 @@ game-music-emu: game-music-emu-$(GME_VERSION).tar.bz2 .sum-gme
>>   	$(MOVE)
>>
>>   .gme: game-music-emu toolchain.cmake
>> -	cd $< && $(HOSTVARS_PIC) $(CMAKE) .
>> -	cd $< && $(MAKE) install
>> +	cd $< && $(HOSTVARS_PIC) $(CONTRIB_CMAKE_CONFIG) .
>> +	cd $< && $(CMAKE) --build . --target install
>>   	touch $@
>> diff --git a/contrib/src/libebur128/rules.mak b/contrib/src/libebur128/rules.mak
>> index 7f74aabb76..d2819254d2 100644
>> --- a/contrib/src/libebur128/rules.mak
>> +++ b/contrib/src/libebur128/rules.mak
>> @@ -19,7 +19,7 @@ libebur128: libebur128-$(LIBEBUR128_VERSION).tar.gz .sum-libebur128
>>   	$(MOVE)
>>
>>   .libebur128: libebur128 toolchain.cmake
>> -	cd $< && $(HOSTVARS_PIC) $(CMAKE) -DENABLE_INTERNAL_QUEUE_H=TRUE
>> -	cd $< && $(MAKE) install
>> +	cd $< && $(HOSTVARS_PIC) $(CONTRIB_CMAKE_CONFIG) -DENABLE_INTERNAL_QUEUE_H=TRUE
>> +	cd $< && $(CMAKE) --build . --target install
>>   	rm -f $(PREFIX)/lib/libebur128.so*
>>   	touch $@
>> diff --git a/contrib/src/main.mak b/contrib/src/main.mak
>> index aa273ef89c..f245e151a5 100644
>> --- a/contrib/src/main.mak
>> +++ b/contrib/src/main.mak
>> @@ -392,19 +392,20 @@ AUTORECONF = autoreconf
>>   endif
>>   RECONF = mkdir -p -- $(PREFIX)/share/aclocal && \
>>   	cd $< && $(AUTORECONF) -fiv $(ACLOCAL_AMFLAGS)
>> -CMAKE = cmake . -DCMAKE_TOOLCHAIN_FILE=$(abspath toolchain.cmake) \
>> -		-DCMAKE_INSTALL_PREFIX=$(PREFIX) $(CMAKE_GENERATOR) \
>> +CMAKE := cmake
>> +CONTRIB_CMAKE_CONFIG = $(CMAKE) . -DCMAKE_TOOLCHAIN_FILE=$(abspath toolchain.cmake) \
>> +		-DCMAKE_INSTALL_PREFIX=$(PREFIX) \
>>   		-DBUILD_SHARED_LIBS:BOOL=OFF
>>   ifdef HAVE_WIN32
>> -CMAKE += -DCMAKE_DEBUG_POSTFIX:STRING=
>> +CONTRIB_CMAKE_CONFIG += -DCMAKE_DEBUG_POSTFIX:STRING=
>>   endif
>>   ifdef MSYS_BUILD
>> -CMAKE := PKG_CONFIG_LIBDIR="$(PKG_CONFIG_PATH)" $(CMAKE)
>> -CMAKE += -DCMAKE_LINK_LIBRARY_SUFFIX:STRING=.a
>> +CONTRIB_CMAKE_CONFIG := PKG_CONFIG_LIBDIR="$(PKG_CONFIG_PATH)" $(CONTRIB_CMAKE_CONFIG)
>> +CONTRIB_CMAKE_CONFIG += -DCMAKE_LINK_LIBRARY_SUFFIX:STRING=.a
>>   endif
>>
>>   ifeq ($(V),1)
>> -CMAKE += -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
>> +CONTRIB_CMAKE_CONFIG += -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
>>   endif
>>
>>   MESONFLAGS = --default-library static --prefix "$(PREFIX)" --backend ninja \
>> diff --git a/contrib/src/matroska/rules.mak b/contrib/src/matroska/rules.mak
>> index c455d2f912..66fb4b4c25 100644
>> --- a/contrib/src/matroska/rules.mak
>> +++ b/contrib/src/matroska/rules.mak
>> @@ -22,6 +22,6 @@ matroska: libmatroska-$(MATROSKA_VERSION).tar.xz .sum-matroska
>>   	$(MOVE)
>>
>>   .matroska: matroska toolchain.cmake
>> -	cd $< && $(HOSTVARS_PIC) $(CMAKE)
>> -	cd $< && $(MAKE) install
>> +	cd $< && $(HOSTVARS_PIC) $(CONTRIB_CMAKE_CONFIG)
>> +	cd $< && $(CMAKE) --build . --target install
>>   	touch $@
>> diff --git a/contrib/src/mpcdec/rules.mak b/contrib/src/mpcdec/rules.mak
>> index 9284ad4e99..bb4c6f530d 100644
>> --- a/contrib/src/mpcdec/rules.mak
>> +++ b/contrib/src/mpcdec/rules.mak
>> @@ -42,8 +42,8 @@ endif
>>   	$(MOVE)
>>
>>   .mpcdec: musepack toolchain.cmake
>> -	cd $< && $(HOSTVARS_PIC) $(CMAKE) -DSHARED=OFF .
>> -	cd $< && $(MAKE) install
>> +	cd $< && $(HOSTVARS_PIC) $(CONTRIB_CMAKE_CONFIG) -DSHARED=OFF .
>> +	cd $< && $(CMAKE) --build . --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..e5941e9665 100644
>> --- a/contrib/src/mysofa/rules.mak
>> +++ b/contrib/src/mysofa/rules.mak
>> @@ -25,7 +25,7 @@ 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 $< && $(HOSTVARS) $(CONTRIB_CMAKE_CONFIG) -DBUILD_TESTS=OFF
>> +	cd $< && $(CMAKE) --build . --target install
>>   	touch $@
>>
>> diff --git a/contrib/src/openjpeg/rules.mak b/contrib/src/openjpeg/rules.mak
>> index ad51638902..5d012a0a79 100644
>> --- a/contrib/src/openjpeg/rules.mak
>> +++ b/contrib/src/openjpeg/rules.mak
>> @@ -26,9 +26,9 @@ endif
>>   	$(MOVE)
>>
>>   .openjpeg: openjpeg toolchain.cmake
>> -	cd $< && $(HOSTVARS) $(CMAKE) \
>> +	cd $< && $(HOSTVARS) $(CONTRIB_CMAKE_CONFIG) \
>>   		-DBUILD_PKGCONFIG_FILES=ON \
>>   			-DBUILD_CODEC:bool=OFF \
>>   		.
>> -	cd $< && $(MAKE) install
>> +	cd $< && $(CMAKE) --build . --target install
>>   	touch $@
>> diff --git a/contrib/src/projectM/rules.mak b/contrib/src/projectM/rules.mak
>> index ee2652b6d2..2afde35436 100644
>> --- a/contrib/src/projectM/rules.mak
>> +++ b/contrib/src/projectM/rules.mak
>> @@ -36,13 +36,13 @@ DEPS_projectM = glew $(DEPS_glew)
>>
>>   .projectM: projectM toolchain.cmake
>>   	cd $< && rm -f CMakeCache.txt
>> -	cd $< && $(HOSTVARS) $(CMAKE) \
>> +	cd $< && $(HOSTVARS) $(CONTRIB_CMAKE_CONFIG) \
>>   		-DINCLUDE-PROJECTM-LIBVISUAL:BOOL=OFF \
>>   		-DDISABLE_NATIVE_PRESETS:BOOL=ON \
>>   		-DUSE_FTGL:BOOL=OFF \
>>   		-DINCLUDE-PROJECTM-PULSEAUDIO:BOOL=OFF \
>>   		-DINCLUDE-PROJECTM-QT:BOOL=OFF \
>>   		-DBUILD_PROJECTM_STATIC:BOOL=ON .
>> -	cd $< && $(MAKE) install
>> +	cd $< && $(CMAKE) --build . --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..71f04d051e 100644
>> --- a/contrib/src/soxr/rules.mak
>> +++ b/contrib/src/soxr/rules.mak
>> @@ -34,13 +34,13 @@ endif
>>
>>   .soxr: soxr toolchain.cmake
>>   	rm -f $</CMakeCache.txt
>> -	cd $< && $(HOSTVARS_PIC) $(CMAKE) \
>> +	cd $< && $(HOSTVARS_PIC) $(CONTRIB_CMAKE_CONFIG) \
>>   		$(SOXR_EXTRA_CONF) \
>>   		-DBUILD_EXAMPLES=OFF \
>>   		-DBUILD_TESTS=OFF \
>>   		-DWITH_LSR_BINDINGS=OFF \
>>   		-DWITH_OPENMP=OFF \
>>   		-DWITH_AVFFT=ON \
>> -		-Wno-dev $(CMAKE_GENERATOR)
>> -	cd $< && $(MAKE) install
>> +		-Wno-dev
>> +	cd $< && $(CMAKE) --build . --target install
>>   	touch $@
>> diff --git a/contrib/src/spatialaudio/rules.mak b/contrib/src/spatialaudio/rules.mak
>> index 60a6596fc2..7b1c4dab6c 100644
>> --- a/contrib/src/spatialaudio/rules.mak
>> +++ b/contrib/src/spatialaudio/rules.mak
>> @@ -22,6 +22,6 @@ 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 $< && $(HOSTVARS) $(CONTRIB_CMAKE_CONFIG) -DMYSOFA_ROOT_DIR=$(PREFIX) -DHAVE_MIT_HRTF=OFF
>> +	cd $< && $(CMAKE) --build . --target install
>>   	touch $@
>> diff --git a/contrib/src/srt/rules.mak b/contrib/src/srt/rules.mak
>> index c9dbb59db8..cd250fe95c 100644
>> --- a/contrib/src/srt/rules.mak
>> +++ b/contrib/src/srt/rules.mak
>> @@ -36,7 +36,7 @@ srt: srt-$(SRT_VERSION).tar.gz .sum-srt
>>   	mv srt-$(SRT_VERSION) $@ && touch $@
>>
>>   .srt: srt toolchain.cmake
>> -	cd $< && $(HOSTVARS_PIC) CFLAGS="$(SRT_CFLAGS)" CXXFLAGS="$(SRT_CXXFLAGS)" $(CMAKE) \
>> +	cd $< && $(HOSTVARS_PIC) CFLAGS="$(SRT_CFLAGS)" CXXFLAGS="$(SRT_CXXFLAGS)" $(CONTRIB_CMAKE_CONFIG) \
>>   		-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 $< && $(CMAKE) --build . --target install
>>   	touch $@
>> diff --git a/contrib/src/taglib/rules.mak b/contrib/src/taglib/rules.mak
>> index 214b1ac1a1..e211825196 100644
>> --- a/contrib/src/taglib/rules.mak
>> +++ b/contrib/src/taglib/rules.mak
>> @@ -23,6 +23,6 @@ taglib: taglib-$(TAGLIB_VERSION).tar.gz .sum-taglib
>>   	$(MOVE)
>>
>>   .taglib: taglib toolchain.cmake
>> -	cd $< && $(HOSTVARS_PIC) $(CMAKE) .
>> -	cd $< && $(MAKE) install
>> +	cd $< && $(HOSTVARS_PIC) $(CONTRIB_CMAKE_CONFIG) .
>> +	cd $< && $(CMAKE) --build . --target install
>>   	touch $@
>> diff --git a/contrib/src/x265/rules.mak b/contrib/src/x265/rules.mak
>> index 0ed3de65d6..bff75179d4 100644
>> --- a/contrib/src/x265/rules.mak
>> +++ b/contrib/src/x265/rules.mak
>> @@ -36,7 +36,7 @@ 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 $</source && $(HOSTVARS_PIC) $(CONTRIB_CMAKE_CONFIG) -DENABLE_SHARED=OFF -DCMAKE_SYSTEM_PROCESSOR=$(ARCH) -DENABLE_CLI=OFF
>> +	cd $< && $(CMAKE) --build 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
> _______________________________________________
> 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