remove curl submodule, add it as an external dependency

This commit is contained in:
Lion Kortlepel 2021-08-09 13:28:44 +02:00 committed by Lion
parent cee824ad46
commit b0475f262f
3 changed files with 10 additions and 19 deletions

3
.gitmodules vendored
View File

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

View File

@ -3,26 +3,14 @@ cmake_minimum_required(VERSION 3.0)
message(STATUS "You can find build instructions and a list of dependencies in the README at \ message(STATUS "You can find build instructions and a list of dependencies in the README at \
https://github.com/BeamMP/BeamMP-Server") https://github.com/BeamMP/BeamMP-Server")
set(BUILD_CURL_EXE OFF)
set(BUILD_SHARED_LIBS ON)
set(CURL_WERROR OFF)
if (WIN32)
set(CURL_STATIC_CRT ON)
endif()
add_subdirectory("include/curl")
set(CURL_LIBRARY CURL::libcurl)
set(CURL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include/curl/include)
add_subdirectory("include/sentry-native")
# ---- start of CXX section ----- # ---- start of CXX section -----
project(BeamMP-Server project(BeamMP-Server
DESCRIPTION "Server for BeamMP - The Multiplayer Mod for BeamNG.drive" DESCRIPTION "Server for BeamMP - The Multiplayer Mod for BeamNG.drive"
HOMEPAGE_URL https://beammp.com HOMEPAGE_URL https://beammp.com
LANGUAGES CXX) LANGUAGES CXX)
add_subdirectory("include/sentry-native")
message(STATUS "Setting compiler flags") message(STATUS "Setting compiler flags")
if (WIN32) if (WIN32)
message(STATUS "MSVC -> forcing use of statically-linked runtime.") message(STATUS "MSVC -> forcing use of statically-linked runtime.")
@ -92,6 +80,7 @@ find_package(Lua REQUIRED)
target_include_directories(BeamMP-Server PUBLIC target_include_directories(BeamMP-Server PUBLIC
${Boost_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
${LUA_INCLUDE_DIR} ${LUA_INCLUDE_DIR}
${CURL_INCLUDE_DIRS}
"socket.io-client-cpp/src" "socket.io-client-cpp/src"
"include/tomlplusplus" "include/tomlplusplus"
"include/sentry-native" "include/sentry-native"
@ -100,6 +89,8 @@ target_include_directories(BeamMP-Server PUBLIC
message(STATUS "Looking for SSL") message(STATUS "Looking for SSL")
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
message(STATUS "CURL IS ${CURL_LIBRARIES}")
if (UNIX) if (UNIX)
add_definitions(-DSECRET_SENTRY_URL="${BEAMMP_SECRET_SENTRY_URL}") add_definitions(-DSECRET_SENTRY_URL="${BEAMMP_SECRET_SENTRY_URL}")
target_link_libraries(BeamMP-Server target_link_libraries(BeamMP-Server
@ -108,7 +99,6 @@ if (UNIX)
stdc++fs stdc++fs
${LUA_LIBRARIES} ${LUA_LIBRARIES}
crypto crypto
CURL::libcurl
${OPENSSL_LIBRARIES} ${OPENSSL_LIBRARIES}
commandline commandline
sioclient_tls sioclient_tls
@ -126,7 +116,6 @@ elseif (WIN32)
ZLIB::ZLIB ZLIB::ZLIB
${LUA_LIBRARIES} ${LUA_LIBRARIES}
${OPENSSL_LIBRARIES} ${OPENSSL_LIBRARIES}
CURL::libcurl
commandline commandline
sioclient_tls) sioclient_tls)
endif () endif ()

View File

@ -123,6 +123,11 @@ std::string Http::POST(const std::string& host, const std::string& target, const
beast::flat_buffer buffer; beast::flat_buffer buffer;
http::response<http::string_body> response; http::response<http::string_body> response;
auto BackendName = response.base().find("Date");
if (BackendName != response.base().end()) {
Application::Console().Write("HTTP POST: Date is " + std::string(BackendName->value()));
}
http::read(stream, buffer, response); http::read(stream, buffer, response);
std::stringstream result; std::stringstream result;