Skip to content

Commit

Permalink
disable warnings in plugin release builds
Browse files Browse the repository at this point in the history
for finding compile errors in github. Also fixed scripts not building plugins in release mode.
  • Loading branch information
wootguy committed Dec 14, 2024
1 parent c55da63 commit cea580e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions scripts/build_game.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
4 changes: 2 additions & 2 deletions scripts/build_game_and_plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
18 changes: 9 additions & 9 deletions scripts/hlcoop_plugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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()
Expand Down

0 comments on commit cea580e

Please sign in to comment.