diff options
-rw-r--r-- | .github/workflows/windows_build.yml | 37 | ||||
-rw-r--r-- | .vscode/settings.json | 3 | ||||
-rw-r--r-- | apps/ci/ci-dry-run.sh | 19 | ||||
-rw-r--r-- | apps/ci/ci-gen-server-conf-files.sh | 21 | ||||
-rw-r--r-- | apps/ci/ci-install.sh | 2 | ||||
-rw-r--r-- | apps/compiler/includes/functions.sh | 75 | ||||
-rw-r--r-- | apps/installer/includes/os_configs/windows.sh | 26 | ||||
-rw-r--r-- | src/cmake/macros/FindMySQL.cmake | 3 |
8 files changed, 131 insertions, 55 deletions
diff --git a/.github/workflows/windows_build.yml b/.github/workflows/windows_build.yml index a57f6d5321..527abc33ea 100644 --- a/.github/workflows/windows_build.yml +++ b/.github/workflows/windows_build.yml @@ -24,22 +24,41 @@ jobs: steps: - uses: actions/checkout@v2 - name: Configure OS + shell: bash + env: + CONTINUOUS_INTEGRATION: true run: | - choco install --no-progress openssl - choco install --no-progress boost-msvc-14.3 --version=1.79.0 + ./acore.sh install-deps + - name: Process pending sql + shell: bash + run: bash bin/acore-db-pendings - name: Build shell: bash run: | - mkdir -p build && cd build - cmake .. -DTOOLS_BUILD=all - cmake --build . --config Release --parallel 4 + export CTOOLS_BUILD=all + ./acore.sh compiler build + - name: Dry run authserver + shell: bash + run: | + source ./apps/ci/ci-gen-server-conf-files.sh "authserver" "configs" "." + cd env/dist + ./authserver -dry-run + - name: Dry run worldserver + shell: bash + run: | + source ./apps/ci/ci-gen-server-conf-files.sh "worldserver" "configs" "." + cd env/dist + ./worldserver -dry-run + - name: Stop MySQL + run: net stop mysql - name: Copy dll files shell: bash run: | - cp "/c/mysql/lib/libmysql.dll" "build/bin/Release/" - cp "/c/Program Files/OpenSSL-Win64/bin/libcrypto-1_1-x64.dll" "build/bin/Release/" - cp "/c/Program Files/OpenSSL-Win64/bin/libssl-1_1-x64.dll" "build/bin/Release/" + rm -rf env/dist/data + cp "/c/tools/mysql/current/lib/libmysql.dll" "env/dist" + cp "/c/Program Files/OpenSSL-Win64/bin/libcrypto-1_1-x64.dll" "env/dist" + cp "/c/Program Files/OpenSSL-Win64/bin/libssl-1_1-x64.dll" "env/dist" - uses: actions/upload-artifact@v2 with: name: windows-2022-MSVC17-release - path: build/bin/Release + path: env/dist diff --git a/.vscode/settings.json b/.vscode/settings.json index a4f105dd26..d3250c271d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -113,7 +113,8 @@ "xtr1common": "cpp", "xtree": "cpp", "xutility": "cpp", - "*.ipp": "cpp" + "*.ipp": "cpp", + "resumable": "cpp" }, "deno.enable": true, "deno.path": "deps/deno/bin/deno", diff --git a/apps/ci/ci-dry-run.sh b/apps/ci/ci-dry-run.sh index 2d234ea9a7..335d6a5352 100644 --- a/apps/ci/ci-dry-run.sh +++ b/apps/ci/ci-dry-run.sh @@ -2,25 +2,12 @@ set -e +CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + # 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 +source "$CURRENT_PATH/ci-gen-server-conf-files.sh" $1 "etc" "bin" "root" (cd ./env/dist/bin/ && timeout 5m ./$APP_NAME -dry-run) diff --git a/apps/ci/ci-gen-server-conf-files.sh b/apps/ci/ci-gen-server-conf-files.sh new file mode 100644 index 0000000000..c6b7b1af75 --- /dev/null +++ b/apps/ci/ci-gen-server-conf-files.sh @@ -0,0 +1,21 @@ +APP_NAME=$1 +CONFIG_FOLDER=${2:-"etc"} +BIN_FOLDER=${3-"bin"} +MYSQL_ROOT_PASSWORD=${4:-""} + + +echo "LoginDatabaseInfo = \"localhost;3306;root;$MYSQL_ROOT_PASSWORD;acore_auth\"" >> ./env/dist/$CONFIG_FOLDER/$APP_NAME.conf + +# worldserver or dbimport +if [[ $APP_NAME != "authserver" ]]; then + { + echo "WorldDatabaseInfo = \"localhost;3306;root;$MYSQL_ROOT_PASSWORD;acore_world\"" + echo "CharacterDatabaseInfo = \"localhost;3306;root;$MYSQL_ROOT_PASSWORD;acore_characters\"" + } >> ./env/dist/$CONFIG_FOLDER/$APP_NAME.conf +fi + +if [[ $APP_NAME == "worldserver" ]]; then + echo "DataDir = \"./data/\"" >> ./env/dist/$CONFIG_FOLDER/$APP_NAME.conf + + git clone --depth=1 --branch=master --single-branch https://github.com/ac-data/ac-data.git ./env/dist/$BIN_FOLDER/data +fi diff --git a/apps/ci/ci-install.sh b/apps/ci/ci-install.sh index 5ed81e26ce..c333d9685c 100644 --- a/apps/ci/ci-install.sh +++ b/apps/ci/ci-install.sh @@ -21,7 +21,7 @@ CONFIG_SH time sudo apt-get update -y # time sudo apt-get upgrade -y -time sudo apt-get install -y git lsb-release sudo ccache +time sudo apt-get install -y git lsb-release sudo time ./acore.sh install-deps case $COMPILER in diff --git a/apps/compiler/includes/functions.sh b/apps/compiler/includes/functions.sh index 04467cbf07..3fa7e8a4cc 100644 --- a/apps/compiler/includes/functions.sh +++ b/apps/compiler/includes/functions.sh @@ -19,12 +19,7 @@ function comp_ccacheEnable() { export CCACHE_COMPRESSLEVEL=${CCACHE_COMPRESSLEVEL:-9} #export CCACHE_NODIRECT=true - unamestr=$(uname) - if [[ "$unamestr" == 'Darwin' ]]; then - export CCUSTOMOPTIONS="$CCUSTOMOPTIONS -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DMYSQL_ADD_INCLUDE_PATH=/usr/local/include -DMYSQL_LIBRARY=/usr/local/lib/libmysqlclient.dylib -DREADLINE_INCLUDE_DIR=/usr/local/opt/readline/include -DREADLINE_LIBRARY=/usr/local/opt/readline/lib/libreadline.dylib -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl@1.1/include -DOPENSSL_SSL_LIBRARIES=/usr/local/opt/openssl@1.1/lib/libssl.dylib -DOPENSSL_CRYPTO_LIBRARIES=/usr/local/opt/openssl@1.1/lib/libcrypto.dylib" - else - export CCUSTOMOPTIONS="$CCUSTOMOPTIONS -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache" - fi + export CCUSTOMOPTIONS="$CCUSTOMOPTIONS -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache" } function comp_ccacheClean() { @@ -70,6 +65,19 @@ function comp_configure() { comp_ccacheEnable + OSOPTIONS="" + + + echo "Platform: $OSTYPE" + case "$OSTYPE" in + darwin*) + OSOPTIONS=" -DMYSQL_ADD_INCLUDE_PATH=/usr/local/include -DMYSQL_LIBRARY=/usr/local/lib/libmysqlclient.dylib -DREADLINE_INCLUDE_DIR=/usr/local/opt/readline/include -DREADLINE_LIBRARY=/usr/local/opt/readline/lib/libreadline.dylib -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl@1.1/include -DOPENSSL_SSL_LIBRARIES=/usr/local/opt/openssl@1.1/lib/libssl.dylib -DOPENSSL_CRYPTO_LIBRARIES=/usr/local/opt/openssl@1.1/lib/libcrypto.dylib " + ;; + msys*) + OSOPTIONS=" -DMYSQL_INCLUDE_DIR=C:\tools\mysql\current\include -DMYSQL_LIBRARY=C:\tools\mysql\current\lib\mysqlclient.lib " + ;; + esac + cmake $SRCPATH -DCMAKE_INSTALL_PREFIX=$BINPATH $DCONF \ -DAPPS_BUILD=$CAPPS_BUILD \ -DTOOLS_BUILD=$CTOOLS_BUILD \ @@ -82,7 +90,7 @@ function comp_configure() { -DWITH_WARNINGS=$CWARNINGS \ -DCMAKE_C_COMPILER=$CCOMPILERC \ -DCMAKE_CXX_COMPILER=$CCOMPILERCXX \ - $CBUILD_APPS_LIST $CBUILD_TOOLS_LIST $CCUSTOMOPTIONS + $CBUILD_APPS_LIST $CBUILD_TOOLS_LIST $OSOPTIONS $CCUSTOMOPTIONS cd $CWD @@ -100,25 +108,50 @@ function comp_compile() { comp_ccacheResetStats - time make -j $MTHREADS - make -j $MTHREADS install + time cmake --build . --config $CTYPE -j $MTHREADS comp_ccacheShowStats - cd $CWD - - if [[ $DOCKER = 1 ]]; then - echo "Generating confs..." - cp -n "env/dist/etc/worldserver.conf.dockerdist" "env/dist/etc/worldserver.conf" - cp -n "env/dist/etc/authserver.conf.dockerdist" "env/dist/etc/authserver.conf" - cp -n "env/dist/etc/dbimport.conf.dockerdist" "env/dist/etc/dbimport.conf" - fi + echo "Platform: $OSTYPE" + case "$OSTYPE" in + msys*) + cmake --install . --config $CTYPE + + cd $CWD + + echo "Done" + ;; + linux*|darwin*) + local confDir=${CONFDIR:-"$AC_BINPATH_FULL/../etc"} + + # create the folders before installing to + # set the current user and permissions + echo "Creating $AC_BINPATH_FULL..." + mkdir -p "$AC_BINPATH_FULL" + echo "Creating $confDir..." + mkdir -p "$confDir" + + echo "Cmake install..." + sudo cmake --install . --config $CTYPE + + cd $CWD + + if [[ $DOCKER = 1 ]]; then + echo "Generating confs..." + cp -n "env/dist/etc/worldserver.conf.dockerdist" "env/dist/${confDir}/worldserver.conf" + cp -n "env/dist/etc/authserver.conf.dockerdist" "env/dist/${confDir}/authserver.conf" + cp -n "env/dist/etc/dbimport.conf.dockerdist" "env/dist/${confDir}/dbimport.conf" + fi + # set all aplications SUID bit + echo "Setting permissions on binary files" + find "$AC_BINPATH_FULL" -type f -exec sudo chown root:root -- {} + + find "$AC_BINPATH_FULL" -type f -exec sudo chmod u+s -- {} + + + echo "Done" + ;; + esac runHooks "ON_AFTER_BUILD" - - # set all aplications SUID bit - sudo chown -R root:root "$AC_BINPATH_FULL" - sudo chmod -R u+s "$AC_BINPATH_FULL" } function comp_build() { diff --git a/apps/installer/includes/os_configs/windows.sh b/apps/installer/includes/os_configs/windows.sh index 95a80cbf1c..227a0258db 100644 --- a/apps/installer/includes/os_configs/windows.sh +++ b/apps/installer/includes/os_configs/windows.sh @@ -1,6 +1,3 @@ -echo "WARNING: Installer Script for Windows is not fully supported yet. Work in progress.." -echo "!!README!!: Please install openssl and mysql libraries manually following our wiki" - # install chocolatey before @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" @@ -9,9 +6,24 @@ echo "!!README!!: Please install openssl and mysql libraries manually following # cmake # git # microsoft-build-tools -# mysql 5.6 +# mysql + +INSTALL_ARGS="" + +if [[ $CONTINUOUS_INTEGRATION ]]; then + INSTALL_ARGS=" --no-progress " +else + { # try + choco uninstall -y -n cmake.install cmake # needed to make sure that following install set the env properly + } || { # catch + echo "nothing to do" + } + + choco install -y --skip-checksums $INSTALL_ARGS git visualstudio2022community +fi -choco install -y --skip-checksums cmake git git.install microsoft-build-tools ccache -choco install -y --skip-checksums mysql --version 5.6.12 +choco install -y --skip-checksums $INSTALL_ARGS cmake.install -y --installargs 'ADD_CMAKE_TO_PATH=System' +choco install -y --skip-checksums $INSTALL_ARGS visualstudio2022-workload-nativedesktop openssl +choco install -y --skip-checksums $INSTALL_ARGS boost-msvc-14.3 --version=1.79.0 +choco install -y --skip-checksums $INSTALL_ARGS mysql --version 8.0.31 -echo "!!README!!: Please remember to install openssl and mysql libraries manually following our wiki" diff --git a/src/cmake/macros/FindMySQL.cmake b/src/cmake/macros/FindMySQL.cmake index 81f6dd18b5..2feb770558 100644 --- a/src/cmake/macros/FindMySQL.cmake +++ b/src/cmake/macros/FindMySQL.cmake @@ -170,6 +170,7 @@ find_path(MYSQL_INCLUDE_DIR /usr/local/include /usr/local/include/mysql /usr/local/mysql/include + "C:/tools/mysql/current/include" # chocolatey package "C:/Program Files/MySQL/MySQL Server 8.0/include" "C:/Program Files/MySQL/MySQL Server 5.7/include" "C:/Program Files/MySQL/include" @@ -209,6 +210,7 @@ if( WIN32 ) libmysql PATHS ${MYSQL_ADD_LIBRARIES_PATH} + "C:/tools/mysql/current/lib" # chocolatey package "C:/Program Files/MySQL/MySQL Server 8.0/lib" "C:/Program Files/MySQL/MySQL Server 8.0/lib/opt" "C:/Program Files/MySQL/MySQL Server 5.7/lib/opt" @@ -261,6 +263,7 @@ endif( UNIX ) if( WIN32 ) find_program(MYSQL_EXECUTABLE mysql PATHS + "C:/tools/mysql/current/bin" # chocolatey package "${PROGRAM_FILES_64}/MySQL/MySQL Server 8.0/bin" "${PROGRAM_FILES_64}/MySQL/MySQL Server 5.7/bin" "${PROGRAM_FILES_64}/MySQL/MySQL Server 8.0/bin/opt" |