[vlc-commits] contrib: support CMAKE_GENERATOR other than makefile

Zhao Zhili git at videolan.org
Wed Nov 25 07:37:22 CET 2020


vlc/vlc-3.0 | branch: master | Zhao Zhili <quinkblack at foxmail.com> | Wed Nov  4 20:12:49 2020 +0800| [1ad69a1f0ca325a93d24bfbbab454ca9e41d4a5d] | committer: Steve Lhomme

contrib: support CMAKE_GENERATOR other than makefile

First, fix the conflict setting/using of CMAKE_GENERATOR. Second,
call build via cmake instead of run make directly.

Signed-off-by: Alexandre Janniaux <ajanni at videolabs.io>
(cherry picked from commit c74a77e7eba252d0e126e71b59910fc9507ba9ed) (edited)

rebased:
- aom doesn't delete the build folder in this branch
- aom doesn't force CFLAGS/CXXFLAGS in the original branch
- chromaprint depends on .ffmpeg in this branch
- mysofa doesn't force CFLAGS/CXXFLAGS in the original branch
- srt forces CFLAGS/CXXFLAGS and other variables in the original branch

edited:
- glew doesn't use cmake in this branch
- glslang, libebur128 are not found in this branch

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=1ad69a1f0ca325a93d24bfbbab454ca9e41d4a5d
---

 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/gme/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 +-
 17 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/contrib/bootstrap b/contrib/bootstrap
index 5a33182722..8b389bb747 100755
--- a/contrib/bootstrap
+++ b/contrib/bootstrap
@@ -266,7 +266,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 de3d13fc92..2fb351e2a2 100644
--- a/contrib/src/aom/rules.mak
+++ b/contrib/src/aom/rules.mak
@@ -94,7 +94,7 @@ endif
 .aom: aom toolchain.cmake
 	cd $< && mkdir -p aom_build
 	cd $</aom_build && LDFLAGS="$(AOM_LDFLAGS)" $(HOSTVARS) CFLAGS="$(AOM_CFLAGS)" CXXFLAGS="$(AOM_CXXFLAGS)" $(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 fe50f1a332..5ceab7292a 100644
--- a/contrib/src/chromaprint/rules.mak
+++ b/contrib/src/chromaprint/rules.mak
@@ -22,5 +22,5 @@ DEPS_chromaprint = ffmpeg $(DEPS_ffmpeg)
 
 .chromaprint: chromaprint .ffmpeg 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 4ab3cc6029..c801d2d25a 100644
--- a/contrib/src/fluidlite/rules.mak
+++ b/contrib/src/fluidlite/rules.mak
@@ -27,5 +27,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/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/main.mak b/contrib/src/main.mak
index a803c98071..5f194a003b 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -378,8 +378,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 8b1d3c74a3..cf513dc47e 100644
--- a/contrib/src/mpcdec/rules.mak
+++ b/contrib/src/mpcdec/rules.mak
@@ -44,7 +44,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 a42a9822cc..cfdf86b746 100644
--- a/contrib/src/mysofa/rules.mak
+++ b/contrib/src/mysofa/rules.mak
@@ -30,6 +30,6 @@ mysofa: libmysofa-$(MYSOFA_VERSION).tar.gz .sum-mysofa
 .mysofa: mysofa toolchain.cmake
 	cd $< && rm -f CMakeCache.txt
 	cd $< && $(HOSTVARS) CFLAGS="$(MYSOFA_CFLAGS)" CXXFLAGS="$(MYSOFA_CXXFLAGS)" $(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 7e66021159..6dede81fe3 100644
--- a/contrib/src/openjpeg/rules.mak
+++ b/contrib/src/openjpeg/rules.mak
@@ -34,5 +34,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 9674b25951..63a781d3fb 100644
--- a/contrib/src/projectM/rules.mak
+++ b/contrib/src/projectM/rules.mak
@@ -41,6 +41,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 a35bab6110..c06044193e 100644
--- a/contrib/src/soxr/rules.mak
+++ b/contrib/src/soxr/rules.mak
@@ -37,6 +37,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 bef15200f2..5cdbef7af7 100644
--- a/contrib/src/srt/rules.mak
+++ b/contrib/src/srt/rules.mak
@@ -36,5 +36,5 @@ DEPS_srt = gnutls $(DEPS_gnutls)
 .srt: srt toolchain.cmake
 	cd $< && $(HOSTVARS_PIC) $(CMAKE) \
 		-DENABLE_SHARED=OFF -DUSE_GNUTLS=ON -DENABLE_CXX11=OFF
-	cd $< && $(MAKE) install
+	cd $< && $(CMAKEBUILD) . --target install
 	touch $@
diff --git a/contrib/src/taglib/rules.mak b/contrib/src/taglib/rules.mak
index 1763f05743..9568c973aa 100644
--- a/contrib/src/taglib/rules.mak
+++ b/contrib/src/taglib/rules.mak
@@ -23,5 +23,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 0b0fce3187..83187d40c5 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 $@



More information about the vlc-commits mailing list