From 2689ad058d66b7d933a7bd5716218ef99577a1bc Mon Sep 17 00:00:00 2001 From: Logan Aerl Arias Date: Sun, 16 Feb 2025 19:02:07 +0000 Subject: [PATCH] Fix building pt2 --- .../ci/jobs/debian-stable-amd64-makefile.yml | 4 + .gitlab/ci/jobs/debian-stable-clang-amd64.yml | 3 +- .../ci/jobs/debian-testing-clang-amd64.yml | 2 +- .gitlab/ci/jobs/windows-x64.yml | 77 ++++++++++++++++++- .gitlab/ci/jobs/windows-x86-makefile.yml | 4 +- .gitlab/ci/jobs/windows-x86.yml | 14 ++-- src/CMakeLists.txt | 9 ++- src/Makefile.d/versions.mk | 6 +- src/acs/acsvm.hpp | 58 +++++++------- src/acs/call-funcs.cpp | 6 +- src/acs/environment.cpp | 8 +- src/sdl/CMakeLists.txt | 1 + 12 files changed, 138 insertions(+), 54 deletions(-) diff --git a/.gitlab/ci/jobs/debian-stable-amd64-makefile.yml b/.gitlab/ci/jobs/debian-stable-amd64-makefile.yml index a6aebfac3..3255a3a69 100644 --- a/.gitlab/ci/jobs/debian-stable-amd64-makefile.yml +++ b/.gitlab/ci/jobs/debian-stable-amd64-makefile.yml @@ -1,6 +1,10 @@ Debian stable:amd64 Makefile: extends: .srb2ci + when: manual + + allow_failure: true + stage: build artifacts: diff --git a/.gitlab/ci/jobs/debian-stable-clang-amd64.yml b/.gitlab/ci/jobs/debian-stable-clang-amd64.yml index c40998e17..870e96bc7 100644 --- a/.gitlab/ci/jobs/debian-stable-clang-amd64.yml +++ b/.gitlab/ci/jobs/debian-stable-clang-amd64.yml @@ -16,10 +16,9 @@ Debian stable Clang: variables: CC: clang - CXX: clang + CXX: clang++ WFLAGS: -Wno-cast-align -Wno-implicit-const-int-float-conversion -Werror CFLAGS: -Wno-cast-align -Wno-implicit-const-int-float-conversion -Werror - LDFLAGS: -Wl,-fuse-ld=gold script: - - | diff --git a/.gitlab/ci/jobs/debian-testing-clang-amd64.yml b/.gitlab/ci/jobs/debian-testing-clang-amd64.yml index dc790b397..e53d0e727 100644 --- a/.gitlab/ci/jobs/debian-testing-clang-amd64.yml +++ b/.gitlab/ci/jobs/debian-testing-clang-amd64.yml @@ -16,7 +16,7 @@ Debian testing Clang: variables: CC: clang - CXX: clang + CXX: clang++ WFLAGS: -Wno-cast-align -Wno-implicit-const-int-float-conversion -Werror -Wno-deprecated-non-prototype -Wno-single-bit-bitfield-constant-conversion CFLAGS: -Wno-cast-align -Wno-implicit-const-int-float-conversion -Werror -Wno-deprecated-non-prototype -Wno-single-bit-bitfield-constant-conversion LDFLAGS: -Wl,-fuse-ld=gold diff --git a/.gitlab/ci/jobs/windows-x64.yml b/.gitlab/ci/jobs/windows-x64.yml index ca7f4ae08..73791e82a 100644 --- a/.gitlab/ci/jobs/windows-x64.yml +++ b/.gitlab/ci/jobs/windows-x64.yml @@ -7,6 +7,30 @@ Windows x64: allow_failure: true + cache: + - key: ccache-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG + fallback_keys: + - ccache-$CI_JOB_NAME_SLUG-$CI_DEFAULT_BRANCH + - ccache-$CI_JOB_NAME_SLUG-master + paths: + - build/ccache + - build/ccache_statslog + + - key: apt-$CI_JOB_IMAGE + paths: + - build/apt-cache + unprotect: true + + - key: vcpkg-root + paths: + - build/vcpkg-root + unprotect: true + + - key: vcpkg-binary-cache-x64-mingw-static + paths: + - build/vcpkg-binary-cache + unprotect: true + artifacts: paths: - "build.cmake/bin/" @@ -20,6 +44,27 @@ Windows x64: CXX: /usr/lib/ccache/x86_64-w64-mingw32-g++ script: + - | + # vcpkg + echo -e "\e[0Ksection_start:`date +%s`:vcpkg-root[collapsed=true]\r\e[0KUpdating vcpkg" + + if [ -d "build/vcpkg-root" ]; then + pushd build/vcpkg-root + git fetch https://github.com/Microsoft/vcpkg master + git reset --hard FETCH_HEAD + popd + else + mkdir -p build + git clone https://github.com/Microsoft/vcpkg build/vcpkg-root + fi + + export VCPKG_ROOT=$(pwd)/build/vcpkg-root + export VCPKG_BINARY_SOURCES="clear;files,/opt/vcpkg.bsources,read;files,$(pwd)/build/vcpkg-binary-cache,readwrite" + + mkdir -p "build/vcpkg-binary-cache" + + echo -e "\e[0Ksection_end:`date +%s`:vcpkg-root\r\e[0K" + - - | # apt_toolchain echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages" @@ -39,7 +84,7 @@ Windows x64: - - | # cmake echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" - - cmake -B build.cmake -DSRB2_USE_CCACHE=NO -DSRB2_CONFIG_ERRORMODE=ON -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/toolchains/mingw.cmake + - cmake -B build.cmake -DSRB2_USE_CCACHE=NO -DSRB2_CONFIG_ERRORMODE=ON -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/toolchains/mingw.cmake -G "Unix Makefiles" - | # cmake echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K" @@ -51,3 +96,33 @@ Windows x64: - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" + + after_script: + - - | + # apt_clean + echo -e "\e[0Ksection_start:`date +%s`:apt_clean[collapsed=true]\r\e[0KCleaning of unneeded APT packages" + - apt-get autoclean + - | + # apt_clean + echo -e "\e[0Ksection_end:`date +%s`:apt_clean\r\e[0K" + + - - | + # vcpkg_clean + echo -e "\e[0Ksection_start:`date +%s`:vcpkg_clean[collapsed=true]\r\e[0KCleaning vcpkg-root" + + if [ -d "build/vcpkg-root" ]; then + pushd "build/vcpkg-root" + git clean -f + popd + fi + + echo -e "\e[0Ksection_end:`date +%s`:vcpkg_clean\r\e[0K" + + - - | + # ccache_stats + echo -e "\e[0Ksection_start:`date +%s`:ccache_stats[collapsed=true]\r\e[0Kccache statistics:" + - ccache --show-stats + - ccache --show-log-stats || true + - | + # ccahe_stats + echo -e "\e[0Ksection_end:`date +%s`:ccache_stats\r\e[0K" diff --git a/.gitlab/ci/jobs/windows-x86-makefile.yml b/.gitlab/ci/jobs/windows-x86-makefile.yml index 213342cda..f90fdbd51 100644 --- a/.gitlab/ci/jobs/windows-x86-makefile.yml +++ b/.gitlab/ci/jobs/windows-x86-makefile.yml @@ -3,7 +3,9 @@ Windows x86 Makefile: stage: build - when: on_success + when: manual + + allow_failure: true artifacts: paths: diff --git a/.gitlab/ci/jobs/windows-x86.yml b/.gitlab/ci/jobs/windows-x86.yml index c8293eb7d..9a33364b2 100644 --- a/.gitlab/ci/jobs/windows-x86.yml +++ b/.gitlab/ci/jobs/windows-x86.yml @@ -3,10 +3,6 @@ Windows x86: stage: build - when: manual - - allow_failure: true - cache: - key: ccache-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG fallback_keys: @@ -33,8 +29,8 @@ Windows x86: artifacts: paths: - - "build/ninja-x86_mingw_static_vcpkg-debug/bin/" - - "build/ninja-x86_mingw_static_vcpkg-debug/src/config.h" + - "build.cmake/bin/" + - "build.cmake/src/config.h" expose_as: "Win32" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win32" @@ -59,7 +55,7 @@ Windows x86: fi export VCPKG_ROOT=$(pwd)/build/vcpkg-root - export VCPKG_BINARY_SOURCES="clear;files,$(pwd)/build/vcpkg-binary-cache,readwrite" + export VCPKG_BINARY_SOURCES="clear;files,/opt/vcpkg.bsources,read;files,$(pwd)/build/vcpkg-binary-cache,readwrite" mkdir -p "build/vcpkg-binary-cache" @@ -84,7 +80,7 @@ Windows x86: - - | # cmake echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" - - cmake -B build.cmake --preset ninja-x86_mingw_static_vcpkg-debug -DSRB2_USE_CCACHE=NO -DSRB2_CONFIG_ERRORMODE=ON + - cmake -B build.cmake -DSRB2_USE_CCACHE=NO -DSRB2_CONFIG_ERRORMODE=ON -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x86-mingw-static -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/toolchains/mingw.cmake -G "Unix Makefiles" - | # cmake echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K" @@ -92,7 +88,7 @@ Windows x86: - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - cmake -build build.cmake --parallel 1 --verbose --preset ninja-x86_mingw_static_vcpkg-debug + - cmake --build build.cmake --parallel 1 --verbose - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e763859b0..48310f257 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -463,8 +463,13 @@ else() endif() if(TARGET miniupnpc::miniupnpc) - target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC) - target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc) + if("${VCPKG_TARGET_TRIPLET}" MATCHES "-mingw-static$") + target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC -DMINIUPNP_STATICLIB) + target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc -liphlpapi) + else() + target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC) + target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc) + endif() message(STATUS "miniupnpc Found") else() message(STATUS "No miniupnpc Found") diff --git a/src/Makefile.d/versions.mk b/src/Makefile.d/versions.mk index 7dee2b657..6afcb13f2 100644 --- a/src/Makefile.d/versions.mk +++ b/src/Makefile.d/versions.mk @@ -35,7 +35,7 @@ ifndef GCC295 WFLAGS+=-Wendif-labels endif ifdef GCC41 - WFLAGS+=-Wshadow + WFLAGS+=-Wno-shadow endif #WFLAGS+=-Wlarger-than-%len% WFLAGS+=-Wpointer-arith @@ -61,7 +61,7 @@ endif ifdef GCC45 WFLAGS+=-Wlogical-op endif - WFLAGS+=-Waggregate-return + WFLAGS+=-Wno-aggregate-return ifdef HAIKU ifdef GCC41 #WFLAGS+=-Wno-attributes @@ -125,6 +125,8 @@ ifdef GCC44 endif ifdef GCC46 WFLAGS+=-Wno-error=suggest-attribute=noreturn + WFLAGS+=-Wno-error=maybe-uninitialized + WFLAGS+=-Wno-error=inline endif ifdef GCC54 WFLAGS+=-Wno-logical-op -Wno-error=logical-op diff --git a/src/acs/acsvm.hpp b/src/acs/acsvm.hpp index 849dca0aa..5974189d8 100644 --- a/src/acs/acsvm.hpp +++ b/src/acs/acsvm.hpp @@ -16,35 +16,35 @@ #ifndef __SRB2_ACSVM_HPP__ #define __SRB2_ACSVM_HPP__ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "vm/ACSVM/Action.hpp" +#include "vm/ACSVM/Array.hpp" +#include "vm/ACSVM/BinaryIO.hpp" +#include "vm/ACSVM/CallFunc.hpp" +#include "vm/ACSVM/Code.hpp" +#include "vm/ACSVM/CodeData.hpp" +#include "vm/ACSVM/CodeList.hpp" +#include "vm/ACSVM/Environment.hpp" +#include "vm/ACSVM/Error.hpp" +#include "vm/ACSVM/Function.hpp" +#include "vm/ACSVM/HashMap.hpp" +#include "vm/ACSVM/HashMapFixed.hpp" +#include "vm/ACSVM/ID.hpp" +#include "vm/ACSVM/Init.hpp" +#include "vm/ACSVM/Jump.hpp" +#include "vm/ACSVM/List.hpp" +#include "vm/ACSVM/Module.hpp" +#include "vm/ACSVM/PrintBuf.hpp" +#include "vm/ACSVM/Scope.hpp" +#include "vm/ACSVM/Script.hpp" +#include "vm/ACSVM/Serial.hpp" +#include "vm/ACSVM/Stack.hpp" +#include "vm/ACSVM/Store.hpp" +#include "vm/ACSVM/String.hpp" +#include "vm/ACSVM/Thread.hpp" +#include "vm/ACSVM/Tracer.hpp" +#include "vm/ACSVM/Types.hpp" +#include "vm/ACSVM/Vector.hpp" -#include +#include "vm/Util/Floats.hpp" #endif //__SRB2_ACSVM_HPP__ diff --git a/src/acs/call-funcs.cpp b/src/acs/call-funcs.cpp index 17e7dc085..07ccbe31a 100644 --- a/src/acs/call-funcs.cpp +++ b/src/acs/call-funcs.cpp @@ -626,7 +626,7 @@ bool CallFunc_Random(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word no tid means search thru all thinkers. --------------------------------------------------*/ static mobjtype_t filter_for_mobjtype = MT_NULL; // annoying but I don't wanna mess with other code -bool ACS_ThingTypeFilter(mobj_t *mo) +static bool ACS_ThingTypeFilter(mobj_t *mo) { return (ACS_CountThing(mo, filter_for_mobjtype)); } @@ -1590,7 +1590,7 @@ bool CallFunc_strcasecmp(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM:: Returns the number of enemies in the tagged sectors. --------------------------------------------------*/ -bool ACS_EnemyFilter(mobj_t *mo) +static bool ACS_EnemyFilter(mobj_t *mo) { return ((mo->flags & (MF_ENEMY|MF_BOSS)) && mo->health > 0); } @@ -1618,7 +1618,7 @@ bool CallFunc_CountEnemies(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM Returns the number of pushables in the tagged sectors. --------------------------------------------------*/ -bool ACS_PushableFilter(mobj_t *mo) +static bool ACS_PushableFilter(mobj_t *mo) { return ((mo->flags & MF_PUSHABLE) || ((mo->info->flags & MF_PUSHABLE) && mo->fuse)); diff --git a/src/acs/environment.cpp b/src/acs/environment.cpp index a0e920f4c..785587a6e 100644 --- a/src/acs/environment.cpp +++ b/src/acs/environment.cpp @@ -471,13 +471,13 @@ void Environment::printKill(ACSVM::Thread *thread, ACSVM::Word type, ACSVM::Word } else if (killType == ACSVM::KillType::OutOfBounds) { - CONS_Alert(CONS_ERROR, "ACSVM ERROR: Jumped to out of bounds location %lu in script %s\n", - (thread->codePtr - thread->module->codeV.data() - 1), scriptName.c_str()); + CONS_Alert(CONS_ERROR, "ACSVM ERROR: Jumped to out of bounds location %s in script %s\n", + sizeu1((thread->codePtr - thread->module->codeV.data() - 1)), scriptName.c_str()); } else { - CONS_Alert(CONS_ERROR, "ACSVM ERROR: Kill %u:%d at %lu in script %s\n", - type, data, (thread->codePtr - thread->module->codeV.data() - 1), scriptName.c_str()); + CONS_Alert(CONS_ERROR, "ACSVM ERROR: Kill %u:%d at %s in script %s\n", + type, data, sizeu1((thread->codePtr - thread->module->codeV.data() - 1)), scriptName.c_str()); } CONS_Printf("Script terminated.\n"); diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 8950846ee..114775786 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -139,6 +139,7 @@ target_compile_options(SRB2SDL2 PRIVATE -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-private-field + -Wno-error=inline > # C++, MSVC