Bladeren bron

Fix few issues in windows build

- Add export for qtprotobuflog logging category
- Add custom flags definition for referense servers
Alexey Edelev 5 jaren geleden
bovenliggende
commit
2b8f516bc4

+ 3 - 0
examples/addressbookserver/CMakeLists.txt

@@ -16,4 +16,7 @@ protobuf_generate_all(TARGET ${TARGET}
     PROTO_FILES ${PROTO_FILES})
 
 target_link_libraries(${TARGET} protobuf::libprotobuf gRPC::grpc++ gRPC::grpc)
+if(MSVC)
+   target_compile_definitions(${TARGET} PRIVATE _WIN32_WINNT=0x600 _SCL_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS _WINSOCK_DEPRECATED_NO_WARNINGS)
+endif()
 file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/cert.pem ${CMAKE_CURRENT_SOURCE_DIR}/key.pem DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

+ 3 - 0
examples/simplechatserver/CMakeLists.txt

@@ -16,4 +16,7 @@ protobuf_generate_all(TARGET ${TARGET}
     PROTO_FILES ${PROTO_FILES})
 
 target_link_libraries(${TARGET} protobuf::libprotobuf gRPC::grpc++ gRPC::grpc)
+if(MSVC)
+   target_compile_definitions(${TARGET} PRIVATE _WIN32_WINNT=0x600 _SCL_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS _WINSOCK_DEPRECATED_NO_WARNINGS)
+endif()
 file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/cert.pem ${CMAKE_CURRENT_SOURCE_DIR}/key.pem DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

+ 2 - 1
src/protobuf/qtprotobuflogging.h

@@ -25,8 +25,9 @@
 
 #pragma once
 #include <QLoggingCategory>
+#include <qtprotobuf_global.h>
 
-Q_DECLARE_LOGGING_CATEGORY(qtprotobuflog)
+QTPROTOBUFSHARED_EXPORT Q_DECLARE_LOGGING_CATEGORY(qtprotobuflog)
 
 #define qProtoDebug(...) qCDebug(qtprotobuflog, __VA_ARGS__)
 #define qProtoInfo(...) qCInfo(qtprotobuflog, __VA_ARGS__)

+ 3 - 1
tests/test_grpc/echoserver/CMakeLists.txt

@@ -10,7 +10,9 @@ set_source_files_properties(${GENERATED_SOURCES} PROPERTIES GENERATED TRUE)
 add_executable(${TARGET} main.cpp ${GENERATED_SOURCES})
 target_link_libraries(${TARGET} gRPC::grpc++ protobuf::libprotobuf)
 target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
-
+if(MSVC)
+   target_compile_definitions(${TARGET} PRIVATE _WIN32_WINNT=0x600 _SCL_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS _WINSOCK_DEPRECATED_NO_WARNINGS)
+endif()
 file(GLOB PROTO_FILES ABSOLUTE ${CMAKE_CURRENT_SOURCE_DIR}/../proto/*.proto)
 protobuf_generate_all(TARGET ${TARGET}
     GENERATED_SOURCES ${GENERATED_SOURCES}