chore: made pqxx statically linked
This commit is contained in:
+2
-6
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.26)
|
||||
project(towards)
|
||||
project(tw_common)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
@@ -42,11 +42,7 @@ target_include_directories(${PROJECT_NAME}
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
tw::network
|
||||
tw::protocol
|
||||
loft::common
|
||||
loft::base
|
||||
loft::render_graph
|
||||
spdlog::spdlog
|
||||
glm::glm
|
||||
EnTT::EnTT
|
||||
Jolt
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
[requires]
|
||||
protobuf/7.35.0
|
||||
sdl/3.4.8
|
||||
libpqxx/8.0.2
|
||||
|
||||
[tool_requires]
|
||||
protobuf/7.35.0
|
||||
|
||||
[options]
|
||||
protobuf/*:shared=False
|
||||
libpqxx/*:shared=False
|
||||
libpq/*:shared=True
|
||||
sdl/*:shared=False
|
||||
sdl/*:camera=False
|
||||
sdl/*:dialog=False
|
||||
|
||||
@@ -83,6 +83,7 @@ RUN --mount=type=cache,target=/build \
|
||||
&& mkdir -p /out/bin /out/shaders \
|
||||
&& cp /build/modules/client/tw_client \
|
||||
/build/modules/mock_client/tw_mock_client \
|
||||
/build/modules/server/tw_server \
|
||||
/build/modules/chat_service/chat_server_exe/tw_chat_server_exe \
|
||||
/build/modules/chat_service/chat_service/tests/chat_mock_client/tw_chat_mock_client \
|
||||
/out/bin/ \
|
||||
@@ -94,6 +95,8 @@ RUN --mount=type=cache,target=/build \
|
||||
FROM scratch AS export
|
||||
|
||||
COPY --from=builder /out/bin/tw_client /tw_client
|
||||
COPY --from=builder /out/bin/tw_server /tw_server
|
||||
COPY --from=builder /out/bin/tw_mock_client /tw_mock_client
|
||||
COPY --from=builder /out/shaders/ /shaders/
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ add_dependencies(tw_shaders imgui::plot imgui::plot)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
towards
|
||||
tw_common
|
||||
tw::network
|
||||
tw::metrics
|
||||
tw::quicr
|
||||
@@ -41,8 +41,6 @@ target_link_libraries(${PROJECT_NAME}
|
||||
Jolt
|
||||
Tracy::TracyClient
|
||||
TracyClient
|
||||
# pqxx
|
||||
# pq
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
|
||||
@@ -10,34 +10,5 @@ class tw::dbg::ComponentGui<tw::CharacterController> {
|
||||
public:
|
||||
void draw(tw::CharacterController* instance) {
|
||||
ImGui::SeparatorText("Character Controller Component");
|
||||
|
||||
if(ImGui::BeginTable("history", 3)) {
|
||||
for(auto key : instance->input_history().buffer()) {
|
||||
// ImGui::TableNextRow();
|
||||
|
||||
// ImGui::TableNextColumn();
|
||||
// ImGui::Text("%u", key.first);
|
||||
|
||||
// ImGui::TableNextColumn();
|
||||
// if(instance->input_history().get(key.first).has_value()) {
|
||||
// glm::vec3 input_vec = *instance->input_history().get(key.first).value();
|
||||
// std::string input = std::format("{} {} {}", input_vec.x, input_vec.y, input_vec.z);
|
||||
// ImGui::Text("%s", input.c_str());
|
||||
// } else {
|
||||
// ImGui::Text("None");
|
||||
// }
|
||||
|
||||
// ImGui::TableNextColumn();
|
||||
// if(instance->position_history().get(key).has_value()) {
|
||||
// glm::vec3 position_vec = *instance->position_history().get(key).value();
|
||||
// std::string position = std::format("{} {} {}", position_vec.x, position_vec.y, position_vec.z);
|
||||
// ImGui::Text("%s", position.c_str());
|
||||
// } else {
|
||||
// ImGui::Text("None");
|
||||
// }
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ add_executable(${PROJECT_NAME} ${FILES})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
towards
|
||||
tw_common
|
||||
tw::network
|
||||
tw::quicr
|
||||
tw::protocol
|
||||
|
||||
@@ -22,7 +22,7 @@ target_include_directories(tw_peer_to_peer_lib
|
||||
|
||||
target_link_libraries(tw_peer_to_peer_lib
|
||||
PUBLIC
|
||||
towards
|
||||
tw_common
|
||||
tw::network
|
||||
tw::quicr
|
||||
tw::protocol
|
||||
@@ -32,8 +32,6 @@ target_link_libraries(tw_peer_to_peer_lib
|
||||
spdlog::spdlog
|
||||
)
|
||||
|
||||
# ── standalone executable ─────────────────────────────────────────────────────
|
||||
|
||||
add_executable(${PROJECT_NAME} src/PeerToPeer.cpp)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
@@ -41,6 +39,4 @@ target_link_libraries(${PROJECT_NAME}
|
||||
tw_peer_to_peer_lib
|
||||
)
|
||||
|
||||
# ── tests ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
add_subdirectory(tests)
|
||||
|
||||
@@ -20,8 +20,6 @@ target_link_libraries(tw_serialization
|
||||
EnTT::EnTT
|
||||
)
|
||||
|
||||
# Require C++20 for concepts / span
|
||||
target_compile_features(tw_serialization INTERFACE cxx_std_20)
|
||||
|
||||
# ── Tests / benchmarks ───────────────────────────────────────────────────────
|
||||
add_subdirectory(tests)
|
||||
# add_subdirectory(tests)
|
||||
|
||||
@@ -17,7 +17,7 @@ file(GLOB FILES
|
||||
# )
|
||||
|
||||
# add_executable(${PROJECT_NAME})
|
||||
add_executable(SerializationBenchmarks ./SerializationBenchmarks.cpp)
|
||||
# add_executable(SerializationBenchmarks ./SerializationBenchmarks.cpp)
|
||||
|
||||
target_compile_definitions(SerializationBenchmarks PRIVATE TRACY_ON_DEMAND=1)
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ file(GLOB FILES
|
||||
src/network/*.cpp
|
||||
)
|
||||
|
||||
find_package(libpqxx CONFIG REQUIRED)
|
||||
add_library(tw_server_lib STATIC ${FILES})
|
||||
|
||||
target_include_directories(tw_server_lib
|
||||
@@ -23,7 +24,7 @@ target_include_directories(tw_server_lib
|
||||
|
||||
target_link_libraries(tw_server_lib
|
||||
PUBLIC
|
||||
towards
|
||||
tw_common
|
||||
tw::io
|
||||
tw::network
|
||||
tw::protocol
|
||||
@@ -35,10 +36,8 @@ target_link_libraries(tw_server_lib
|
||||
Jolt
|
||||
protobuf::libprotobuf
|
||||
${Boost_LIBRARIES}
|
||||
${LIBDECOR_LIB}
|
||||
Tracy::TracyClient
|
||||
pqxx
|
||||
pq
|
||||
libpqxx::pqxx
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} src/server.cpp)
|
||||
|
||||
@@ -7,7 +7,7 @@ TimescaleDbMetricsReporter::TimescaleDbMetricsReporter(const TimescaleDbConfigur
|
||||
m_last_flush_time(std::chrono::steady_clock::now())
|
||||
{
|
||||
try {
|
||||
m_connection = pqxx::connection(config.connection.to_string());
|
||||
m_connection.emplace(config.connection.to_string());
|
||||
spdlog::info("Connected to TimescaleDB at {}:{}", config.connection.host, config.connection.port);
|
||||
} catch (const std::exception& e) {
|
||||
spdlog::error("Failed to connect to TimescaleDB: {}", e.what());
|
||||
@@ -23,9 +23,9 @@ void TimescaleDbMetricsReporter::flush() {
|
||||
pqxx::work tx{*m_connection};
|
||||
|
||||
const auto table = m_connection->quote_name(m_metrics_table);
|
||||
tx.exec("INSERT INTO " + table + " (time, outbound, inbound, player_count) VALUES (NOW(), $1, $2, $3)",
|
||||
pqxx::params(m_outbound_bucket, m_inbound_bucket, m_player_count))
|
||||
.no_rows();
|
||||
tx.exec_prepared("INSERT INTO " + table + " (time, outbound, inbound, player_count) VALUES (NOW(), $1, $2, $3)",
|
||||
m_outbound_bucket, m_inbound_bucket, m_player_count)
|
||||
.empty();
|
||||
tx.commit();
|
||||
|
||||
TracyPlot("outbound", (int64_t)m_outbound_bucket);
|
||||
|
||||
@@ -24,7 +24,7 @@ target_link_libraries(
|
||||
tw::protocol
|
||||
tw::message_protocol
|
||||
tw::quicr
|
||||
towards
|
||||
tw_common
|
||||
tw::gui
|
||||
imgui::imgui
|
||||
imgui::plot
|
||||
|
||||
@@ -33,8 +33,6 @@ target_link_libraries(tw_server_lib
|
||||
protobuf::libprotobuf
|
||||
${Boost_LIBRARIES}
|
||||
Tracy::TracyClient
|
||||
pqxx
|
||||
pq
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} src/server.cpp)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "metrics/HistoryBuffer.hpp"
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <Jolt/Jolt.h>
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
#include <vector>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include "metrics/HistoryBuffer.hpp"
|
||||
|
||||
namespace tw {
|
||||
|
||||
/**
|
||||
@@ -17,9 +15,6 @@ private:
|
||||
|
||||
using Clock = std::chrono::steady_clock;
|
||||
|
||||
HistoryBuffer<Clock::time_point, glm::vec3> m_history;
|
||||
HistoryBuffer<Clock::time_point, glm::vec3> m_position_history;
|
||||
|
||||
struct InputSlot {
|
||||
uint32_t frame;
|
||||
glm::vec3 input;
|
||||
@@ -34,13 +29,9 @@ private:
|
||||
|
||||
public:
|
||||
GET(m_speed, speed);
|
||||
GET_MUT_REF(m_history, input_history);
|
||||
GET_MUT_REF(m_position_history, position_history);
|
||||
|
||||
CharacterController(float speed) :
|
||||
m_speed(speed),
|
||||
m_history(Clock::now(), glm::vec3(), 10 * 20),
|
||||
m_position_history(Clock::now(), glm::vec3(), 10 * 20),
|
||||
m_input_ring(64),
|
||||
m_last_input_frame(0),
|
||||
m_frame_idx(0)
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "world/RigidBody.hpp"
|
||||
#include <iostream>
|
||||
#include <print>
|
||||
#include "metrics/HistoryBuffer.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
Reference in New Issue
Block a user