fix github actions

Possible fix for sentry url not showing up in windows build

possible fix for sentry, again

add static_assert in attempt to fix issue with sentry

use target_compile_definitions instead of add_compile_definitions
This commit is contained in:
Lion Kortlepel 2021-08-19 15:41:27 +02:00 committed by Lion
parent 7d137eb496
commit fe36191baf
4 changed files with 14 additions and 7 deletions

View File

@ -29,7 +29,7 @@ jobs:
working-directory: ${{github.workspace}}/build-linux
env:
beammp_sentry_url: ${{ secrets.BEAMMP_SECRET_SENTRY_URL }}
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=g++-10 -DBEAMMP_SECRET_SENTRY_URL=$beammp_sentry_url
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_COMPILER=g++-10 -DBEAMMP_SECRET_SENTRY_URL="$beammp_sentry_url"
- name: Build
working-directory: ${{github.workspace}}/build-linux

View File

@ -29,7 +29,9 @@ jobs:
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build-windows
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE='${{ runner.workspace }}/b/vcpkg/scripts/buildsystems/vcpkg.cmake' -DVCPKG_TARGET_TRIPLET=x64-windows-static
env:
beammp_sentry_url: ${{ secrets.BEAMMP_SECRET_SENTRY_URL }}
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE='${{ runner.workspace }}/b/vcpkg/scripts/buildsystems/vcpkg.cmake' -DVCPKG_TARGET_TRIPLET=x64-windows-static -DBEAMMP_SECRET_SENTRY_URL="$beammp_sentry_url"
- name: Build
working-directory: ${{github.workspace}}/build-windows

View File

@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.0)
message(STATUS "You can find build instructions and a list of dependencies in the README at \
https://github.com/BeamMP/BeamMP-Server")
# ---- start of CXX section -----
project(BeamMP-Server
DESCRIPTION "Server for BeamMP - The Multiplayer Mod for BeamNG.drive"
HOMEPAGE_URL https://beammp.com
@ -84,6 +83,8 @@ add_executable(BeamMP-Server
include/TPPSMonitor.h src/TPPSMonitor.cpp
include/TNetwork.h src/TNetwork.cpp)
target_compile_definitions(BeamMP-Server PRIVATE SECRET_SENTRY_URL="${BEAMMP_SECRET_SENTRY_URL}")
target_include_directories(BeamMP-Server PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/commandline")
@ -105,7 +106,6 @@ find_package(OpenSSL REQUIRED)
message(STATUS "CURL IS ${CURL_LIBRARIES}")
if (UNIX)
add_definitions(-DSECRET_SENTRY_URL="${BEAMMP_SECRET_SENTRY_URL}")
target_link_libraries(BeamMP-Server
z
pthread
@ -117,7 +117,6 @@ if (UNIX)
sioclient_tls
sentry)
elseif (WIN32)
add_definitions(/DSECRET_SENTRY_URL="${BEAMMP_SECRET_SENTRY_URL}")
include(FindLua)
message(STATUS "Looking for libz")
find_package(ZLIB REQUIRED)

View File

@ -36,6 +36,10 @@ void UnixSignalHandler(int sig) {
}
#endif // __unix
int constexpr length(const char* str) {
return *str ? 1 + length(str + 1) : 0;
}
// this is provided by the build system, leave empty for source builds
// global, yes, this is ugly, no, it cant be done another way
TSentry Sentry { SECRET_SENTRY_URL };
@ -55,6 +59,8 @@ int main(int argc, char** argv) try {
#endif // __unix
setlocale(LC_ALL, "C");
static_assert(length(SECRET_SENTRY_URL) != 0);
bool Shutdown = false;
Application::RegisterShutdownHandler([&Shutdown] { Shutdown = true; });
@ -66,9 +72,9 @@ int main(int argc, char** argv) try {
Assert(!Application::IsOutdated(std::array<int, 3> { 2, 0, 0 }, std::array<int, 3> { 1, 0, 1 }));
TServer Server(argc, argv);
Application::CheckForUpdates();
TConfig Config;
if (Config.Failed()) {