From cea580e984737cd3767e2dcb1e09e1aa404ba220 Mon Sep 17 00:00:00 2001 From: wootguy Date: Sat, 14 Dec 2024 14:33:53 -0800 Subject: [PATCH] disable warnings in plugin release builds for finding compile errors in github. Also fixed scripts not building plugins in release mode. --- .github/workflows/build.yml | 12 ++++++------ scripts/build_game.sh | 4 ++-- scripts/build_game_and_plugins.sh | 4 ++-- scripts/hlcoop_plugin.cmake | 18 +++++++++--------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3437adbf..024d398a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,20 +60,20 @@ jobs: run: | mkdir build cd build - cmake .. -DBUILD_CLIENT=OFF -DBUILD_SERVER=ON -DBUILD_PLUGINS=OFF - cmake --build . --config Release + cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_CLIENT=OFF -DBUILD_SERVER=ON -DBUILD_PLUGINS=OFF + cmake --build . - name: Build plugins run: | cd build - cmake .. -DBUILD_CLIENT=OFF -DBUILD_SERVER=ON -DBUILD_PLUGINS=ON - cmake --build . --config Release + cmake ..-DCMAKE_BUILD_TYPE=Release -DBUILD_CLIENT=OFF -DBUILD_SERVER=ON -DBUILD_PLUGINS=ON + cmake --build . - name: Build client run: | cd build - cmake .. -DBUILD_CLIENT=ON -DBUILD_SERVER=OFF -DBUILD_PLUGINS=OFF - cmake --build . --config Release + cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_CLIENT=ON -DBUILD_SERVER=OFF -DBUILD_PLUGINS=OFF + cmake --build . - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/scripts/build_game.sh b/scripts/build_game.sh index 4112ef9c..d75595b3 100644 --- a/scripts/build_game.sh +++ b/scripts/build_game.sh @@ -8,5 +8,5 @@ cd .. rm -rf build mkdir build cd build -cmake -DBUILD_SERVER=ON -DINCREASED_SERVER_LIMITS=OFF .. -cmake --build . --config Release +cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SERVER=ON -DINCREASED_SERVER_LIMITS=OFF .. +cmake --build . diff --git a/scripts/build_game_and_plugins.sh b/scripts/build_game_and_plugins.sh index a1b7dba4..2b515c7f 100644 --- a/scripts/build_game_and_plugins.sh +++ b/scripts/build_game_and_plugins.sh @@ -8,5 +8,5 @@ cd .. rm -rf build mkdir build cd build -cmake -DBUILD_SERVER=ON -DBUILD_PLUGINS=ON -DUPDATE_PLUGINS=ON -DINCREASED_SERVER_LIMITS=OFF .. -cmake --build . --config Release +cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SERVER=ON -DBUILD_PLUGINS=ON -DUPDATE_PLUGINS=ON -DINCREASED_SERVER_LIMITS=OFF .. +cmake --build . diff --git a/scripts/hlcoop_plugin.cmake b/scripts/hlcoop_plugin.cmake index 11338461..79ab9f10 100644 --- a/scripts/hlcoop_plugin.cmake +++ b/scripts/hlcoop_plugin.cmake @@ -3,8 +3,7 @@ cmake_minimum_required(VERSION 3.6) # setup standard include directories and compile settings function(hlcoop_setup_plugin OUTPUT_PATH) if(UNIX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -g -O2 -fno-strict-aliasing -Wall -Wextra -Wpedantic -Wno-invalid-offsetof -Wno-class-memaccess -Wno-unused-parameter") - set(CMAKE_SHARED_LINKER_FLAGS "m32 -g") + set(DEBUG_WARN_FLAGS "-Wall -Wextra -Wpedantic -Wno-invalid-offsetof -Wno-class-memaccess -Wno-unused-parameter") # Static linking libstd++ and libgcc so that the plugin can load on distros other than one it was compiled on. # -fvisibility=hidden fixes a weird bug where the metamod confuses game functions with plugin functions. @@ -14,22 +13,23 @@ function(hlcoop_setup_plugin OUTPUT_PATH) #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -static-libgcc -g" PARENT_SCOPE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -std=c++11 -fvisibility=hidden -g" PARENT_SCOPE) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0" PARENT_SCOPE) - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -w -Wfatal-errors" PARENT_SCOPE) + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 ${DEBUG_WARN_FLAGS}" PARENT_SCOPE) + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -w" PARENT_SCOPE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -g" PARENT_SCOPE) - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -Wall" PARENT_SCOPE) - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os -w -Wfatal-errors" PARENT_SCOPE) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 ${DEBUG_WARN_FLAGS}" PARENT_SCOPE) + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -w" PARENT_SCOPE) set(CMAKE_SHARED_LIBRARY_PREFIX "" PARENT_SCOPE) elseif(MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /W4") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /w" PARENT_SCOPE) - #set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" PARENT_SCOPE) + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W4" PARENT_SCOPE) set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /w" PARENT_SCOPE) - #set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" PARENT_SCOPE) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /W4" PARENT_SCOPE) else() message(FATAL_ERROR "TODO: Mac support") endif()