add curl as in-tree dependency, add sentry ok/not ok notice on startup

This commit is contained in:
Lion Kortlepel 2021-08-09 00:27:55 +02:00 committed by Lion
parent 4512f44ea1
commit 28fe6e9634
4 changed files with 41 additions and 6 deletions

3
.gitmodules vendored
View File

@ -16,3 +16,6 @@
[submodule "include/sentry-native"]
path = include/sentry-native
url = https://github.com/getsentry/sentry-native
[submodule "include/curl"]
path = include/curl
url = https://github.com/curl/curl

View File

@ -18,6 +18,7 @@ if (WIN32)
set(VcpkgRoot ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET})
include_directories(${VcpkgRoot}/include)
link_directories(${VcpkgRoot}/lib)
set(CURL_STATIC_CRT ON)
elseif (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -static-libstdc++")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g")
@ -28,6 +29,11 @@ elseif (UNIX)
endif (SANITIZE)
endif ()
set(BUILD_CURL_EXE OFF)
set(BUILD_SHARED_LIBS ON)
set(CURL_WERROR OFF)
add_subdirectory("include/curl")
message(STATUS "Checking for Sentry URL")
# this is set by the build system.
# IMPORTANT: if you're building from source, just leave this empty
@ -69,20 +75,36 @@ add_executable(BeamMP-Server
include/TPPSMonitor.h src/TPPSMonitor.cpp
include/TNetwork.h src/TNetwork.cpp)
target_include_directories(BeamMP-Server PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/commandline")
target_include_directories(BeamMP-Server PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/commandline")
message(STATUS "Looking for Lua")
find_package(Lua REQUIRED)
message(STATUS "Looking for CURL")
find_package(CURL REQUIRED)
target_include_directories(BeamMP-Server PUBLIC ${Boost_INCLUDE_DIRS} ${LUA_INCLUDE_DIR} "socket.io-client-cpp/src" "include/tomlplusplus" "include/sentry-native" ${CURL_INCLUDE_DIRS})
target_include_directories(BeamMP-Server PUBLIC
${Boost_INCLUDE_DIRS}
${LUA_INCLUDE_DIR}
"socket.io-client-cpp/src"
"include/tomlplusplus"
"include/sentry-native"
"include/curl/include")
message(STATUS "Looking for SSL")
find_package(OpenSSL REQUIRED)
if (UNIX)
add_definitions(-DSECRET_SENTRY_URL="${BEAMMP_SECRET_SENTRY_URL}")
target_link_libraries(BeamMP-Server z pthread stdc++fs ${LUA_LIBRARIES} crypto ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES} commandline sioclient_tls sentry)
target_link_libraries(BeamMP-Server
z
pthread
stdc++fs
${LUA_LIBRARIES}
crypto
${CURL_LIBS}
${OPENSSL_LIBRARIES}
commandline
sioclient_tls
sentry)
elseif (WIN32)
add_definitions(/DSECRET_SENTRY_URL="${BEAMMP_SECRET_SENTRY_URL}")
include(FindLua)
@ -91,5 +113,12 @@ elseif (WIN32)
message(STATUS "Looking for RapidJSON")
find_package(RapidJSON CONFIG REQUIRED)
target_include_directories(BeamMP-Server PRIVATE ${RAPIDJSON_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
target_link_libraries(BeamMP-Server PRIVATE ws2_32 ZLIB::ZLIB ${LUA_LIBRARIES} ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES} commandline sioclient_tls)
target_link_libraries(BeamMP-Server PRIVATE
ws2_32
ZLIB::ZLIB
${LUA_LIBRARIES}
${OPENSSL_LIBRARIES}
${CURL_LIBS}
commandline
sioclient_tls)
endif ()

1
include/curl Submodule

@ -0,0 +1 @@
Subproject commit b836b065bd6598a8c549863825fcfcd0306b3cb5

View File

@ -4,6 +4,7 @@
TSentry::TSentry(const std::string& SentryUrl) {
if (SentryUrl.empty()) {
mValid = false;
info("Sentry disabled in unofficial build");
} else {
mValid = true;
sentry_options_t* options = sentry_options_new();
@ -12,6 +13,7 @@ TSentry::TSentry(const std::string& SentryUrl) {
sentry_options_set_release(options, ReleaseString.c_str());
sentry_options_set_max_breadcrumbs(options, 10);
sentry_init(options);
info("Sentry started");
}
}