mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
refactor(Cmake): add support build selected applications and tools (#11836)
This commit is contained in:
@@ -7,10 +7,9 @@ MTHREADS=$(($(grep -c ^processor /proc/cpuinfo) + 2))
|
||||
CWARNINGS=ON
|
||||
CDEBUG=OFF
|
||||
CTYPE=Release
|
||||
CTOOLS_BUILD=all
|
||||
CSCRIPTS=static
|
||||
CBUILD_TESTING=ON
|
||||
CSERVERS=ON
|
||||
CTOOLS=ON
|
||||
CSCRIPTPCH=OFF
|
||||
CCOREPCH=OFF
|
||||
CCUSTOMOPTIONS='-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"'
|
||||
@@ -19,10 +18,6 @@ DB_AUTH_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';"
|
||||
DB_WORLD_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';"
|
||||
CONFIG_SH
|
||||
|
||||
if [[ $ENABLE_CPP_20 -eq 1 ]]; then
|
||||
echo "CUSE_CPP_20=ON" >> ./conf/config.sh
|
||||
fi
|
||||
|
||||
case $COMPILER in
|
||||
|
||||
# this is in order to use the "default" gcc version of the OS, without forcing a specific version
|
||||
68
apps/ci/ci-conf-tools.sh
Normal file
68
apps/ci/ci-conf-tools.sh
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cat >>conf/config.sh <<CONFIG_SH
|
||||
MTHREADS=$(($(grep -c ^processor /proc/cpuinfo) + 2))
|
||||
CWARNINGS=ON
|
||||
CDEBUG=OFF
|
||||
CTYPE=Release
|
||||
CSCRIPTS=static
|
||||
CAPPS_BUILD=none
|
||||
CTOOLS_BUILD=maps-only
|
||||
CSCRIPTPCH=OFF
|
||||
CCOREPCH=OFF
|
||||
CCUSTOMOPTIONS='-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"'
|
||||
CONFIG_SH
|
||||
|
||||
case $COMPILER in
|
||||
|
||||
# this is in order to use the "default" gcc version of the OS, without forcing a specific version
|
||||
"gcc" )
|
||||
time sudo apt-get install -y gcc g++
|
||||
echo "CCOMPILERC=\"gcc\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"g++\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"gcc8" )
|
||||
time sudo apt-get install -y gcc-8 g++-8
|
||||
echo "CCOMPILERC=\"gcc-8\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"g++-8\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"gcc10" )
|
||||
time sudo apt-get install -y gcc-10 g++-10
|
||||
echo "CCOMPILERC=\"gcc-10\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"g++-10\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
# this is in order to use the "default" clang version of the OS, without forcing a specific version
|
||||
"clang" )
|
||||
time sudo apt-get install -y clang
|
||||
echo "CCOMPILERC=\"clang\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang10" )
|
||||
time sudo apt-get install -y clang-10
|
||||
echo "CCOMPILERC=\"clang-10\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-10\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang11" )
|
||||
time sudo apt-get install -y clang-11
|
||||
echo "CCOMPILERC=\"clang-11\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-11\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang12" )
|
||||
time sudo apt-get install -y clang-12
|
||||
echo "CCOMPILERC=\"clang-12\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-12\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
* )
|
||||
echo "Unknown compiler $COMPILER"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
28
apps/ci/ci-dry-run.sh
Normal file
28
apps/ci/ci-dry-run.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Start mysql
|
||||
sudo systemctl start mysql
|
||||
|
||||
APP_NAME=$1
|
||||
|
||||
echo "LoginDatabaseInfo = \"localhost;3306;root;root;acore_auth\"" >> ./env/dist/etc/$APP_NAME.conf
|
||||
|
||||
if [[ $APP_NAME != "authserver" ]]; then
|
||||
{
|
||||
echo "WorldDatabaseInfo = \"localhost;3306;root;root;acore_world\""
|
||||
echo "CharacterDatabaseInfo = \"localhost;3306;root;root;acore_characters\""
|
||||
} >> ./env/dist/etc/$APP_NAME.conf
|
||||
fi
|
||||
|
||||
if [[ $APP_NAME == "worldserver" ]]; then
|
||||
echo "DataDir = \"../data/\"" >> ./env/dist/etc/$APP_NAME.conf
|
||||
|
||||
git clone --depth=1 --branch=master --single-branch https://github.com/ac-data/ac-data.git ./env/dist/data
|
||||
fi
|
||||
|
||||
(cd ./env/dist/bin/ && timeout 5m ./$APP_NAME -dry-run)
|
||||
|
||||
# Stop mysql
|
||||
sudo systemctl stop mysql
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "[worldserver]" >> ./env/dist/etc/worldserver.conf
|
||||
echo "DataDir = \"../data/\"" >> ./env/dist/etc/worldserver.conf
|
||||
echo "LoginDatabaseInfo = \"localhost;3306;root;root;acore_auth\"" >> ./env/dist/etc/worldserver.conf
|
||||
echo "WorldDatabaseInfo = \"localhost;3306;root;root;acore_world\"" >> ./env/dist/etc/worldserver.conf
|
||||
echo "CharacterDatabaseInfo = \"localhost;3306;root;root;acore_characters\"" >> ./env/dist/etc/worldserver.conf
|
||||
git clone --depth=1 --branch=master --single-branch https://github.com/ac-data/ac-data.git ./env/dist/data
|
||||
(cd ./env/dist/bin/ && timeout 5m ./worldserver --dry-run)
|
||||
@@ -70,27 +70,25 @@ function comp_configure() {
|
||||
|
||||
comp_ccacheEnable
|
||||
|
||||
cmake $SRCPATH -DCMAKE_INSTALL_PREFIX=$BINPATH $DCONF -DSERVERS=$CSERVERS \
|
||||
cmake $SRCPATH -DCMAKE_INSTALL_PREFIX=$BINPATH $DCONF \
|
||||
-DAPPS_BUILD=$CAPPS_BUILD \
|
||||
-DTOOLS_BUILD=$CTOOLS_BUILD \
|
||||
-DSCRIPTS=$CSCRIPTS \
|
||||
-DUSE_CPP_20=$CUSE_CPP_20 \
|
||||
-DMODULES=$CMODULES \
|
||||
-DBUILD_TESTING=$CBUILD_TESTING \
|
||||
-DTOOLS=$CTOOLS \
|
||||
-DUSE_SCRIPTPCH=$CSCRIPTPCH \
|
||||
-DUSE_COREPCH=$CCOREPCH \
|
||||
-DWITH_COREDEBUG=$CDEBUG \
|
||||
-DCMAKE_BUILD_TYPE=$CTYPE \
|
||||
-DWITH_WARNINGS=$CWARNINGS \
|
||||
-DCMAKE_C_COMPILER=$CCOMPILERC \
|
||||
-DCMAKE_CXX_COMPILER=$CCOMPILERCXX \
|
||||
"-DDISABLED_AC_MODULES=$CDISABLED_AC_MODULES" \
|
||||
$CCUSTOMOPTIONS
|
||||
$CBUILD_APPS_LIST $CBUILD_TOOLS_LIST $CCUSTOMOPTIONS
|
||||
|
||||
cd $CWD
|
||||
|
||||
runHooks "ON_AFTER_CONFIG"
|
||||
}
|
||||
|
||||
|
||||
function comp_compile() {
|
||||
[ $MTHREADS == 0 ] && MTHREADS=$(grep -c ^processor /proc/cpuinfo) && MTHREADS=$(($MTHREADS + 2))
|
||||
|
||||
@@ -117,9 +115,9 @@ function comp_compile() {
|
||||
|
||||
runHooks "ON_AFTER_BUILD"
|
||||
|
||||
# set worldserver SUID bit
|
||||
sudo chown root:root "$AC_BINPATH_FULL/worldserver"
|
||||
sudo chmod u+s "$AC_BINPATH_FULL/worldserver"
|
||||
# set all aplications SUID bit
|
||||
sudo chown -R root:root "$AC_BINPATH_FULL"
|
||||
sudo chmod -R u+s "$AC_BINPATH_FULL"
|
||||
}
|
||||
|
||||
function comp_build() {
|
||||
@@ -128,6 +126,6 @@ function comp_build() {
|
||||
}
|
||||
|
||||
function comp_all() {
|
||||
comp_clean
|
||||
comp_build
|
||||
comp_clean
|
||||
comp_build
|
||||
}
|
||||
|
||||
@@ -189,7 +189,8 @@ ENV AC_CCACHE=true
|
||||
ENV CCACHE_CPP2=true
|
||||
ENV CSCRIPTPCH=OFF
|
||||
ENV CCOREPCH=OFF
|
||||
ENV CTOOLS=ON
|
||||
# ENV CTOOLS_BUILD=all
|
||||
ENV CTOOLS_BUILD=maps-only
|
||||
ENV CSCRIPTS=static
|
||||
RUN bash apps/docker/docker-build-prod.sh
|
||||
|
||||
@@ -303,8 +304,9 @@ RUN mkdir -p /azerothcore/env/client/maps
|
||||
RUN mkdir -p /azerothcore/env/client/mmaps
|
||||
RUN mkdir -p /azerothcore/env/client/vmaps
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/mapextractor /azerothcore/env/client/mapextractor
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/mmaps_generator /azerothcore/env/client/mmaps_generator
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/vmap4assembler /azerothcore/env/client/vmap4assembler
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/vmap4extractor /azerothcore/env/client/vmap4extractor
|
||||
# Need fix
|
||||
# COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/mapextractor /azerothcore/env/client/mapextractor
|
||||
# COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/mmaps_generator /azerothcore/env/client/mmaps_generator
|
||||
# COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/vmap4assembler /azerothcore/env/client/vmap4assembler
|
||||
# COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/vmap4extractor /azerothcore/env/client/vmap4extractor
|
||||
|
||||
|
||||
Reference in New Issue
Block a user