Use CMake's -B, --build, and --install options

This commit is contained in:
ShadowNinja 2022-01-31 19:42:24 -05:00 committed by rubenwardy
parent f5e54cd398
commit 24a0f55c9c
6 changed files with 22 additions and 33 deletions

@ -20,7 +20,9 @@ variables:
- DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential git cmake libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libleveldb-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libzstd-dev - DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential git cmake libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libleveldb-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libzstd-dev
script: script:
- git clone https://github.com/minetest/irrlicht -b $IRRLICHT_TAG lib/irrlichtmt - git clone https://github.com/minetest/irrlicht -b $IRRLICHT_TAG lib/irrlichtmt
- make -j$(($(nproc) + 1)) - cmake -B build -DCMAKE_INSTALL_PREFIX=../artifact/minetest/usr/ -DCMAKE_BUILD_TYPE=Release -DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE -DBUILD_SERVER=TRUE ..
- cmake --build build --parallel $(($(nproc) + 1))
- cmake --install build
artifacts: artifacts:
when: on_success when: on_success
expire_in: 1h expire_in: 1h

@ -27,23 +27,20 @@ RUN apk add --no-cache git build-base cmake sqlite-dev curl-dev zlib-dev zstd-de
WORKDIR /usr/src/ WORKDIR /usr/src/
RUN git clone --recursive https://github.com/jupp0r/prometheus-cpp/ && \ RUN git clone --recursive https://github.com/jupp0r/prometheus-cpp/ && \
mkdir prometheus-cpp/build && \ cd prometheus-cpp && \
cd prometheus-cpp/build && \ cmake -B build \
cmake .. \
-DCMAKE_INSTALL_PREFIX=/usr/local \ -DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DENABLE_TESTING=0 \ -DENABLE_TESTING=0 \
-GNinja && \ -GNinja && \
ninja && \ cmake --build build && \
ninja install cmake --install build
RUN git clone --depth=1 https://github.com/minetest/irrlicht/ -b ${IRRLICHT_VERSION} && \ RUN git clone --depth=1 https://github.com/minetest/irrlicht/ -b ${IRRLICHT_VERSION} && \
cp -r irrlicht/include /usr/include/irrlichtmt cp -r irrlicht/include /usr/include/irrlichtmt
WORKDIR /usr/src/minetest WORKDIR /usr/src/minetest
RUN mkdir build && \ RUN cmake -B build \
cd build && \
cmake .. \
-DCMAKE_INSTALL_PREFIX=/usr/local \ -DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SERVER=TRUE \ -DBUILD_SERVER=TRUE \
@ -51,8 +48,8 @@ RUN mkdir build && \
-DBUILD_UNITTESTS=FALSE \ -DBUILD_UNITTESTS=FALSE \
-DBUILD_CLIENT=FALSE \ -DBUILD_CLIENT=FALSE \
-GNinja && \ -GNinja && \
ninja && \ cmake --build build && \
ninja install cmake --install build
ARG DOCKER_IMAGE=alpine:3.14 ARG DOCKER_IMAGE=alpine:3.14
FROM $DOCKER_IMAGE AS runtime FROM $DOCKER_IMAGE AS runtime

@ -116,14 +116,12 @@ git_hash=$(cd $sourcedir && git rev-parse --short HEAD)
# Build the thing # Build the thing
cd $builddir cd $builddir
[ -d build ] && rm -rf build [ -d build ] && rm -rf build
mkdir build
cd build
irr_dlls=$(echo $libdir/irrlicht/lib/*.dll | tr ' ' ';') irr_dlls=$(echo $libdir/irrlicht/lib/*.dll | tr ' ' ';')
vorbis_dlls=$(echo $libdir/libvorbis/bin/libvorbis{,file}-*.dll | tr ' ' ';') vorbis_dlls=$(echo $libdir/libvorbis/bin/libvorbis{,file}-*.dll | tr ' ' ';')
gettext_dlls=$(echo $libdir/gettext/bin/lib{intl,iconv}-*.dll | tr ' ' ';') gettext_dlls=$(echo $libdir/gettext/bin/lib{intl,iconv}-*.dll | tr ' ' ';')
cmake -S $sourcedir -B . \ cmake -S $sourcedir -B build \
-DCMAKE_TOOLCHAIN_FILE=$toolchain_file \ -DCMAKE_TOOLCHAIN_FILE=$toolchain_file \
-DCMAKE_INSTALL_PREFIX=/tmp \ -DCMAKE_INSTALL_PREFIX=/tmp \
-DVERSION_EXTRA=$git_hash \ -DVERSION_EXTRA=$git_hash \
@ -184,9 +182,9 @@ cmake -S $sourcedir -B . \
-DLEVELDB_LIBRARY=$libdir/leveldb/lib/libleveldb.dll.a \ -DLEVELDB_LIBRARY=$libdir/leveldb/lib/libleveldb.dll.a \
-DLEVELDB_DLL=$libdir/leveldb/bin/libleveldb.dll -DLEVELDB_DLL=$libdir/leveldb/bin/libleveldb.dll
make -j$(nproc) cmake --build build -j$(nproc)
[ -z "$NO_PACKAGE" ] && make package [ -z "$NO_PACKAGE" ] && cmake --build build --target package
exit 0 exit 0
# EOF # EOF

@ -113,14 +113,12 @@ git_hash=$(cd $sourcedir && git rev-parse --short HEAD)
# Build the thing # Build the thing
cd $builddir cd $builddir
[ -d build ] && rm -rf build [ -d build ] && rm -rf build
mkdir build
cd build
irr_dlls=$(echo $libdir/irrlicht/lib/*.dll | tr ' ' ';') irr_dlls=$(echo $libdir/irrlicht/lib/*.dll | tr ' ' ';')
vorbis_dlls=$(echo $libdir/libvorbis/bin/libvorbis{,file}-*.dll | tr ' ' ';') vorbis_dlls=$(echo $libdir/libvorbis/bin/libvorbis{,file}-*.dll | tr ' ' ';')
gettext_dlls=$(echo $libdir/gettext/bin/lib{intl,iconv}-*.dll | tr ' ' ';') gettext_dlls=$(echo $libdir/gettext/bin/lib{intl,iconv}-*.dll | tr ' ' ';')
cmake -S $sourcedir -B . \ cmake -S $sourcedir -B build \
-DCMAKE_TOOLCHAIN_FILE=$toolchain_file \ -DCMAKE_TOOLCHAIN_FILE=$toolchain_file \
-DCMAKE_INSTALL_PREFIX=/tmp \ -DCMAKE_INSTALL_PREFIX=/tmp \
-DVERSION_EXTRA=$git_hash \ -DVERSION_EXTRA=$git_hash \
@ -181,9 +179,9 @@ cmake -S $sourcedir -B . \
-DLEVELDB_LIBRARY=$libdir/leveldb/lib/libleveldb.dll.a \ -DLEVELDB_LIBRARY=$libdir/leveldb/lib/libleveldb.dll.a \
-DLEVELDB_DLL=$libdir/leveldb/bin/libleveldb.dll -DLEVELDB_DLL=$libdir/leveldb/bin/libleveldb.dll
make -j$(nproc) cmake --build build -j$(nproc)
[ -z "$NO_PACKAGE" ] && make package [ -z "$NO_PACKAGE" ] && cmake --build build --target package
exit 0 exit 0
# EOF # EOF

@ -1,8 +1,6 @@
#! /bin/bash -e #! /bin/bash -e
mkdir build cmake -B build -DCMAKE_BUILD_TYPE=Debug \
cd build
cmake -DCMAKE_BUILD_TYPE=Debug \
-DRUN_IN_PLACE=TRUE -DENABLE_GETTEXT=TRUE \ -DRUN_IN_PLACE=TRUE -DENABLE_GETTEXT=TRUE \
-DBUILD_SERVER=TRUE ${CMAKE_FLAGS} .. -DBUILD_SERVER=TRUE ${CMAKE_FLAGS}
make -j$(($(nproc) + 1)) cmake --build build --parallel $(($(nproc) + 1))

@ -1,15 +1,11 @@
#! /bin/bash -eu #! /bin/bash -eu
mkdir -p build cmake -B build -DCMAKE_BUILD_TYPE=Debug \
cd build
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DRUN_IN_PLACE=TRUE \ -DRUN_IN_PLACE=TRUE \
-DENABLE_{GETTEXT,SOUND}=FALSE \ -DENABLE_{GETTEXT,SOUND}=FALSE \
-DBUILD_SERVER=TRUE .. -DBUILD_SERVER=TRUE
make GenerateVersion cmake --build build --target GenerateVersion
cd ..
./util/ci/run-clang-tidy.py \ ./util/ci/run-clang-tidy.py \
-clang-tidy-binary=clang-tidy-9 -p build \ -clang-tidy-binary=clang-tidy-9 -p build \