Compare commits

4 Commits

Author SHA1 Message Date
f6b9131f4a test excluded for android 2024-11-15 17:14:19 +03:00
c67f7a2b64 log fix 2024-11-15 16:23:48 +03:00
047d38ea59 http includes 2024-11-15 15:47:56 +03:00
3d07795515 add_custom_command(... pip_lang) on ninja brings to resursive cmake and ninja call ( 2024-11-15 15:43:03 +03:00
6 changed files with 58 additions and 16 deletions

View File

@@ -483,8 +483,10 @@ if (NOT CROSSTOOLS)
# libmicrohttpd
find_library(microhttpd_LIBRARIES microhttpd HINTS "${MINGW_LIB}")
set(microhttpd_FOUND FALSE)
if (microhttpd_LIBRARIES)
set(_microhttpd_add_libs)
set(microhttpd_FOUND TRUE)
set(_microhttpd_add_libs microhttpd)
if(WIN32)
if("${C_COMPILER}" STREQUAL "cl.exe")
else()
@@ -494,7 +496,9 @@ if (NOT CROSSTOOLS)
list(APPEND _microhttpd_add_libs dl)
find_library(tls_lib gnutls)
if (tls_lib)
list(APPEND _microhttpd_add_libs ${tls_lib})
set(gnutls_FOUND TRUE)
set(gnutls_LIBRARIES "${tls_lib}")
list(APPEND _microhttpd_add_libs gnutls)
endif()
if(DEFINED ENV{QNX_HOST})
list(APPEND _microhttpd_add_libs socket)
@@ -504,8 +508,8 @@ if (NOT CROSSTOOLS)
endif()
endif()
endif()
list(APPEND microhttpd_LIBRARIES "${_microhttpd_add_libs}")
pip_module(http_server "${microhttpd_LIBRARIES}" "PIP HTTP server" "" "" "")
#list(APPEND microhttpd_LIBRARIES "${_microhttpd_add_libs}")
pip_module(http_server "${_microhttpd_add_libs}" "PIP HTTP server" "" "" "")
endif()
# Test program
@@ -514,11 +518,15 @@ if (NOT CROSSTOOLS)
#add_library(pip_plugin SHARED "test_plugin.h" "test_plugin.cpp" "ccm.h" "ccm.cpp")
#target_link_libraries(pip_plugin pip)
add_executable(pip_test "main.cpp")
target_link_libraries(pip_test pip pip_io_utils pip_client_server pip_http_server)
if(sodium_FOUND)
add_executable(pip_cloud_test "main_picloud_test.cpp")
target_link_libraries(pip_cloud_test pip_cloud)
if (NOT DEFINED ANDROID_PLATFORM)
if(microhttpd_FOUND)
add_executable(pip_test "main.cpp")
target_link_libraries(pip_test pip pip_io_utils pip_client_server pip_http_server)
if(sodium_FOUND)
add_executable(pip_cloud_test "main_picloud_test.cpp")
target_link_libraries(pip_cloud_test pip_cloud)
endif()
endif()
endif()
endif()
@@ -563,8 +571,9 @@ endif()
# Translations
set(PIP_LANG)
if (NOT CROSSTOOLS)
pip_translation(PIP_LANG lang/pip_ru.ts)
add_custom_target(pip_lang SOURCES "${PIP_LANG}")
# pip_translation(PIP_LANG lang/pip_ru.ts)
# add_custom_target(pip_lang SOURCES "${PIP_LANG}")
file(GLOB PIP_LANG "lang/*.btf")
endif()

1
lang/compile.bat Normal file
View File

@@ -0,0 +1 @@
pip_tr --Compile -o pip_ru.btf pip_ru.ts

BIN
lang/pip_ru.btf Normal file

Binary file not shown.

View File

@@ -4,6 +4,30 @@
#include "piliterals_time.h"
#include <microhttpd.h>
// clang-format off
#ifdef QNX
# include <arpa/inet.h>
# include <sys/socket.h>
# include <sys/types.h>
# ifdef BLACKBERRY
# include <netinet/in.h>
# else
# include <sys/dcmd_io-net.h>
# endif
#else
# ifdef WINDOWS
# include <io.h>
# include <winsock2.h>
# include <ws2tcpip.h>
# else
# include <netinet/in.h>
# include <sys/socket.h>
# ifdef LWIP
# include <lwip/sockets.h>
# endif
# endif
#endif
// clang-format on
struct MicrohttpdServerConnection {
@@ -71,11 +95,14 @@ int MicrohttpdServerConnection::send_error() {
}
void log_callback(void * cls, const char * fm, va_list ap) {
void log_callback(void * cls, const char * fmt, va_list ap) {
MicrohttpdServer * server = (MicrohttpdServer *)cls;
piCout << "log" << server;
if (!server) return;
piCout << server << fm << ap;
char buffer[1024];
memset(buffer, 0, 1024);
std::vsnprintf(buffer, 1024, fmt, ap);
piCout << buffer;
}

View File

@@ -1716,6 +1716,14 @@ public:
//! \~russian Заменяет все вхождения типа "%1", "%2", ... с наименьшим значением на "v" и возвращает эту строку.
PIString & arg(uint v, int base = 10) { return arg(PIString::fromNumber(v, base)); }
//! \~english Replace all occurances like "%1", "%2", ... with lowest value to "v" and returns this string.
//! \~russian Заменяет все вхождения типа "%1", "%2", ... с наименьшим значением на "v" и возвращает эту строку.
PIString & arg(long v, int base = 10) { return arg(PIString::fromNumber(v, base)); }
//! \~english Replace all occurances like "%1", "%2", ... with lowest value to "v" and returns this string.
//! \~russian Заменяет все вхождения типа "%1", "%2", ... с наименьшим значением на "v" и возвращает эту строку.
PIString & arg(ulong v, int base = 10) { return arg(PIString::fromNumber(v, base)); }
//! \~english Replace all occurances like "%1", "%2", ... with lowest value to "v" and returns this string.
//! \~russian Заменяет все вхождения типа "%1", "%2", ... с наименьшим значением на "v" и возвращает эту строку.
PIString & arg(llong v, int base = 10) { return arg(PIString::fromNumber(v, base)); }

View File

@@ -18,6 +18,3 @@ if (DEFINED LIB)
else()
install(TARGETS pip_tr DESTINATION bin)
endif()
if (NOT CROSSTOOLS)
add_custom_command(TARGET pip_tr POST_BUILD COMMAND "${CMAKE_COMMAND}" --build "${PIP_DLL_DIR}" --target pip_lang)
endif()