release for windows with static librarys
This commit is contained in:
@@ -12,6 +12,9 @@ if (ENABLE_GROUND_BUILD)
|
|||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_definitions(-DWIN32_LEAN_AND_MEAN)
|
add_definitions(-DWIN32_LEAN_AND_MEAN)
|
||||||
set(EXTRA_LIBS ws2_32)
|
set(EXTRA_LIBS ws2_32)
|
||||||
|
if (MSVC)
|
||||||
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2 REQUIRED)
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
#include "joystick-reader.h"
|
#include "joystick-reader.h"
|
||||||
#include "udp-driver.h"
|
#include "udp-driver.h"
|
||||||
|
|
||||||
int64_t milliseconds() {
|
|
||||||
timeval tv{};
|
|
||||||
gettimeofday(&tv,nullptr);
|
|
||||||
return ((tv.tv_sec * 1000000l) + tv.tv_usec) / 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
// Парсим аргументы командной строки для частоты
|
// Парсим аргументы командной строки для частоты
|
||||||
@@ -43,7 +37,6 @@ int main(int argc, char* argv[]) {
|
|||||||
std::cout << "Sending data to " << sendAddress << ":1066" << std::endl;
|
std::cout << "Sending data to " << sendAddress << ":1066" << std::endl;
|
||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
auto now = milliseconds();
|
|
||||||
while (reader.readData(data)) {
|
while (reader.readData(data)) {
|
||||||
if (!udp.sendFrame(data)) {
|
if (!udp.sendFrame(data)) {
|
||||||
std::cerr << "Failed to send UDP packet" << std::endl;
|
std::cerr << "Failed to send UDP packet" << std::endl;
|
||||||
@@ -56,12 +49,8 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
// вычислим время для сна
|
// вычислим время для сна
|
||||||
// должно быть время now+timeInterval
|
// должно быть время now+timeInterval
|
||||||
auto targetTime = now + timeInterval;
|
|
||||||
auto nowTime = milliseconds();
|
std::this_thread::sleep_for(std::chrono::milliseconds(timeInterval));
|
||||||
if (targetTime > nowTime) {
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(targetTime - nowTime));
|
|
||||||
}
|
|
||||||
now = milliseconds();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Exiting..." << std::endl;
|
std::cout << "Exiting..." << std::endl;
|
||||||
|
|||||||
5
vcpkg.json
Normal file
5
vcpkg.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"sdl2"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user