vcpkg/ports/quickfix/00001-fix-build.patch
zi-m bc5a1bf1a0 [quickfix] Add new port (#7796)
* quickfix

* simplify patch and add _CRT_SECURE_NO_WARNINGS

* fix replace and add more _CRT_SECURE_NO_WARNINGS

* add _CRT_NONSTDC_NO_DEPRECATE

* win GetCurrentProcessId instead of getpid

* add _WINSOCK_DEPRECATED_NO_WARNINGS

* DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS for _M_ARM and _M_ARM64
2019-08-23 09:20:10 -07:00

99 lines
3.7 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 48908ead..5022a019 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -96,9 +96,12 @@ add_subdirectory(UnitTest++)
endif()
add_subdirectory(src)
-add_subdirectory(examples)
+#add_subdirectory(examples)
if( WIN32)
-add_subdirectory(test)
+#add_subdirectory(test)
+target_compile_definitions(TestUnitTest++ PRIVATE _CRT_SECURE_NO_WARNINGS)
+target_compile_definitions(UnitTest++ PRIVATE _CRT_SECURE_NO_WARNINGS)
+target_compile_definitions(ut PRIVATE _WINSOCK_DEPRECATED_NO_WARNINGS)
endif()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/spec/ DESTINATION share/quickfix
diff --git a/src/C++/CMakeLists.txt b/src/C++/CMakeLists.txt
index 07774c97..27692631 100644
--- a/src/C++/CMakeLists.txt
+++ b/src/C++/CMakeLists.txt
@@ -1,3 +1,4 @@
+project(quickfix)
set(quickfix_VERSION_MAJOR 16)
set(quickfix_VERSION_MINOR 0)
set(quickfix_VERSION_PATCH 1)
@@ -64,19 +65,22 @@ endif()
if (WIN32)
add_library(${PROJECT_NAME} STATIC ${quickfix_SOURCES})
- set_target_properties (${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX d)
target_link_libraries(${PROJECT_NAME} ${OPENSSL_LIBRARIES} ${MYSQL_CLIENT_LIBS} ${PostgreSQL_LIBRARIES} ws2_32)
+ target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE)
else()
- add_library(${PROJECT_NAME} SHARED ${quickfix_SOURCES})
+ add_library(${PROJECT_NAME} STATIC ${quickfix_SOURCES})
target_link_libraries(${PROJECT_NAME} ${OPENSSL_LIBRARIES} ${MYSQL_CLIENT_LIBS} ${PostgreSQL_LIBRARIES} pthread)
endif()
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/C++)
+target_include_directories(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${quickfix_VERSION} SOVERSION ${quickfix_VERSION_MAJOR} )
+target_compile_definitions(${PROJECT_NAME} PUBLIC HAVE_STD_UNIQUE_PTR HAVE_STD_SHARED_PTR HAVE_SSL=1)
-install(TARGETS ${PROJECT_NAME} DESTINATION lib)
+install(TARGETS ${PROJECT_NAME} EXPORT quickfix-config DESTINATION lib)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/C++/ DESTINATION include/quickfix
FILES_MATCHING PATTERN "*.h"
PATTERN double-conversion EXCLUDE
PATTERN test EXCLUDE)
+install(EXPORT quickfix-config DESTINATION share/cmake/quickfix)
diff --git a/src/C++/Utility.h b/src/C++/Utility.h
index 0aa2cd3e..2829e110 100644
--- a/src/C++/Utility.h
+++ b/src/C++/Utility.h
@@ -242,4 +242,10 @@ using std::strtol;
using std::strerror;
#endif
+#ifdef __cpp_noexcept_function_type
+#define QUICKFIX_THROW(...) noexcept(false)
+#else
+#define QUICKFIX_THROW(...) throw(__VA_ARGS__)
+#endif
+
#endif
diff --git a/src/C++/UtilitySSL.cpp b/src/C++/UtilitySSL.cpp
index a01606ac..aee41bbf 100644
--- a/src/C++/UtilitySSL.cpp
+++ b/src/C++/UtilitySSL.cpp
@@ -498,7 +498,11 @@ static void ssl_rand_seed(void)
/*
* seed in the current process id (usually just 4 bytes)
*/
+#ifdef _MSC_VER
+ pid = GetCurrentProcessId();
+#else
pid = getpid();
+#endif
l = sizeof(pid);
RAND_seed((unsigned char *)&pid, l);
/*
diff --git a/src/C++/double-conversion/utils.h b/src/C++/double-conversion/utils.h
index aef2f166..779b8ab7 100644
--- a/src/C++/double-conversion/utils.h
+++ b/src/C++/double-conversion/utils.h
@@ -61,7 +61,7 @@
// disabled.)
// On Linux,x86 89255e-22 != Div_double(89255.0/1e22)
#if defined(_M_X64) || defined(__x86_64__) || \
- defined(__ARMEL__) || defined(__avr32__) || \
+ defined(__ARMEL__) || defined(__avr32__) || defined(_M_ARM) || defined(_M_ARM64) || \
defined(__hppa__) || defined(__ia64__) || \
defined(__mips__) || \
defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \