[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
This commit is contained in:
zi-m 2019-08-23 18:20:10 +02:00 committed by Curtis J Bezault
parent 55f8250713
commit bc5a1bf1a0
4 changed files with 157 additions and 0 deletions

View File

@ -0,0 +1,98 @@
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__) || \

5
ports/quickfix/CONTROL Normal file
View File

@ -0,0 +1,5 @@
Source: quickfix
Version: 1.15.1
Build-Depends: openssl
Homepage: https://github.com/quickfix/quickfix
Description: QuickFIX is a free and open source implementation of the FIX protocol.

View File

@ -0,0 +1,50 @@
include(vcpkg_common_functions)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO quickfix/quickfix
REF v1.15.1
SHA512 6c3dc53f25932c9b7516ab9228f634511ae0f399719f87f0ec2b38c380c0a7d1c808f0f9a14a70a063e1956118550d1121222283a9139f23cd4f8f038f595f70
HEAD_REF master
PATCHES 00001-fix-build.patch
)
file(GLOB_RECURSE SRC_FILES RELATIVE ${SOURCE_PATH}
"${SOURCE_PATH}/src/*.cpp"
"${SOURCE_PATH}/src/*.h"
)
list(REMOVE_ITEM SRC_FILES "src/C++/Utility.h")
list(REMOVE_ITEM SRC_FILES "src/C++/pugixml.cpp")
foreach(SRC_FILE IN LISTS SRC_FILES)
file(READ "${SOURCE_PATH}/${SRC_FILE}" _contents)
string(REPLACE "throw(" "QUICKFIX_THROW(" _contents "${_contents}")
string(REPLACE "throw (" "QUICKFIX_THROW(" _contents "${_contents}")
file(WRITE "${SOURCE_PATH}/${SRC_FILE}" "${_contents}")
endforeach()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DHAVE_EMX=OFF
-DHAVE_MYSQL=OFF
-DHAVE_POSTGRESQL=OFF
-DHAVE_PYTHON=OFF
-DHAVE_PYTHON2=OFF
-DHAVE_PYTHON3=OFF
-DHAVE_SSL=ON
PREFER_NINJA
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/quickfix)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/quickfix/copyright COPYONLY)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/quickfix)

4
ports/quickfix/usage Normal file
View File

@ -0,0 +1,4 @@
The package quickfix provides CMake targets:
find_package(quickfix CONFIG REQUIRED)
target_link_libraries(main PRIVATE quickfix)