diff --git a/.gitmodules b/.gitmodules index c49f87b..22610c4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "vendor/websocketpp"] path = vendor/websocketpp url = https://github.com/zaphoyd/websocketpp.git +[submodule "vendor/diff-match-patch-cpp-stl"] + path = vendor/diff-match-patch-cpp-stl + url = https://github.com/leutloff/diff-match-patch-cpp-stl diff --git a/CMakeLists.txt b/CMakeLists.txt index 9931b9a..f8d9e2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,7 +93,7 @@ endif ( WIN32 ) IF( WIN32 ) MESSAGE(STATUS "Configuring fc to build on Win32") - set( RPCRT4 Rpcrt4 ) + set( RPCRT4 rpcrt4 ) #boost SET(BOOST_ROOT $ENV{BOOST_ROOT}) @@ -110,7 +110,7 @@ IF( WIN32 ) SET(Boost_LIBRARIES ${BOOST_LIBRARIES_TEMP} ${Boost_LIBRARIES}) ENDIF() - set( PLATFORM_SPECIFIC_LIBS WS2_32.lib Userenv.lib) + set( PLATFORM_SPECIFIC_LIBS wsock32.lib ws2_32.lib userenv.lib) # iphlpapi.lib ELSE(WIN32) @@ -272,9 +272,13 @@ IF(WIN32) # autodetecting code to do the right thing. _WEBSOCKETPP_CPP11_CHRONO_ ) - # Activate C++ exception handling, assume extern C calls don't throw - # Add /U options to be sure settings specific to dynamic boost link are ineffective - target_compile_options(fc PUBLIC /EHsc /UBOOST_ALL_DYN_LINK /UBOOST_LINKING_PYTHON /UBOOST_DEBUG_PYTHON) + if( MSVC ) + # Activate C++ exception handling, assume extern C calls don't throw + # Add /U options to be sure settings specific to dynamic boost link are ineffective + target_compile_options(fc PUBLIC /EHsc /UBOOST_ALL_DYN_LINK /UBOOST_LINKING_PYTHON /UBOOST_DEBUG_PYTHON) + elseif( MINGW ) + # Put MinGW specific compiler settings here + endif() ELSE() SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall") @@ -297,6 +301,7 @@ target_include_directories(fc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR} + "vendor/diff-match-patch-cpp-stl" "${readline_includes}" PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} @@ -319,11 +324,11 @@ endif(MSVC) IF(NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY MATCHES "\\.(a|lib)$") -IF(WIN32) +IF(MSVC) add_definitions(/DBOOST_TEST_DYN_LINK) -ELSE(WIN32) +ELSE(MSVC) add_definitions(-DBOOST_TEST_DYN_LINK) -ENDIF(WIN32) +ENDIF(MSVC) ENDIF() add_executable( api tests/api.cpp ) @@ -489,8 +494,15 @@ ELSE() ENDIF() IF(WIN32) -SET(POST_BUILD_STEP_COMMANDS ${POST_BUILD_STEP_COMMANDS} - COMMAND ${CMAKE_COMMAND} -E copy_if_different "${OPENSSL_ROOT_DIR}/ssl/openssl.cnf" "${OPENSSL_CONF_TARGET}/openssl.cnf") + IF("${OPENSSL_ROOT_DIR}" STREQUAL "") + get_filename_component(OPENSSL_ROOT_DIR "${OPENSSL_INCLUDE_DIR}/.." REALPATH) + ENDIF() + SET(OPENSSL_CONF_SOURCE "${OPENSSL_ROOT_DIR}/ssl/openssl.cnf") + IF(MINGW) + SET(OPENSSL_CONF_SOURCE "${OPENSSL_ROOT_DIR}/openssl.cnf") + ENDIF(MINGW) + SET(POST_BUILD_STEP_COMMANDS ${POST_BUILD_STEP_COMMANDS} + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${OPENSSL_CONF_SOURCE}" "${OPENSSL_CONF_TARGET}/openssl.cnf") ENDIF(WIN32) ADD_CUSTOM_COMMAND(TARGET fc POST_BUILD ${POST_BUILD_STEP_COMMANDS} diff --git a/src/byteswap.hpp b/src/byteswap.hpp index 1a0e534..e75b8e3 100644 --- a/src/byteswap.hpp +++ b/src/byteswap.hpp @@ -1,6 +1,6 @@ #pragma once -#ifdef _MSC_VER +#ifdef _WIN32 # include # define bswap_64(x) _byteswap_uint64(x) #elif defined(__APPLE__) diff --git a/src/compress/miniz.c b/src/compress/miniz.c index 358143a..7123d62 100644 --- a/src/compress/miniz.c +++ b/src/compress/miniz.c @@ -2848,7 +2848,7 @@ void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, #include #include - #if defined(_MSC_VER) || defined(__MINGW64__) + #if defined(_MSC_VER) static FILE *mz_fopen(const char *pFilename, const char *pMode) { FILE* pFile = NULL; diff --git a/src/crypto/aes.cpp b/src/crypto/aes.cpp index 0704b7b..7564816 100644 --- a/src/crypto/aes.cpp +++ b/src/crypto/aes.cpp @@ -16,8 +16,8 @@ #endif #include -#if defined(_MSC_VER) -# include +#if defined(_WIN32) +# include #endif namespace fc { @@ -396,7 +396,7 @@ boost::mutex* openssl_thread_config::openssl_mutexes = nullptr; unsigned long openssl_thread_config::get_thread_id() { -#ifdef _MSC_VER +#ifdef _WIN32 return (unsigned long)::GetCurrentThreadId(); #else return (unsigned long)(&fc::thread::current()); // TODO: should expose boost thread id diff --git a/src/crypto/city.cpp b/src/crypto/city.cpp index 18367fb..971b7bd 100644 --- a/src/crypto/city.cpp +++ b/src/crypto/city.cpp @@ -75,7 +75,7 @@ static uint32_t UNALIGNED_LOAD32(const char *p) { return result; } -#ifdef _MSC_VER +#ifdef _WIN32 #include #define bswap_32(x) _byteswap_ulong(x) diff --git a/src/crypto/elliptic_common.cpp b/src/crypto/elliptic_common.cpp index 88228b0..66b75d0 100644 --- a/src/crypto/elliptic_common.cpp +++ b/src/crypto/elliptic_common.cpp @@ -5,7 +5,7 @@ #include #include -#ifdef _MSC_VER +#ifdef _WIN32 # include #else # include diff --git a/src/crypto/elliptic_secp256k1.cpp b/src/crypto/elliptic_secp256k1.cpp index f4175d0..91edc18 100644 --- a/src/crypto/elliptic_secp256k1.cpp +++ b/src/crypto/elliptic_secp256k1.cpp @@ -12,7 +12,7 @@ #include #include -#ifdef _MSC_VER +#if _WIN32 # include #else # include diff --git a/src/filesystem.cpp b/src/filesystem.cpp index a590065..a7151c5 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -11,10 +11,10 @@ #include #include -#ifdef WIN32 -# include -# include -# include +#ifdef _WIN32 +# include +# include +# include #else #include #include diff --git a/src/network/tcp_socket.cpp b/src/network/tcp_socket.cpp index cb96bbb..499a0ed 100644 --- a/src/network/tcp_socket.cpp +++ b/src/network/tcp_socket.cpp @@ -8,7 +8,7 @@ #include #if defined _WIN32 || defined WIN32 || defined OS_WIN64 || defined _WIN64 || defined WIN64 || defined WINNT -# include +# include #endif namespace fc { diff --git a/src/thread/thread.cpp b/src/thread/thread.cpp index eaa8e40..7730a3a 100644 --- a/src/thread/thread.cpp +++ b/src/thread/thread.cpp @@ -5,7 +5,7 @@ #include "thread_d.hpp" #if defined(_MSC_VER) && !defined(NDEBUG) -# include +# include const DWORD MS_VC_EXCEPTION=0x406D1388; #pragma pack(push,8) diff --git a/vendor/diff-match-patch-cpp-stl b/vendor/diff-match-patch-cpp-stl new file mode 160000 index 0000000..aee799a --- /dev/null +++ b/vendor/diff-match-patch-cpp-stl @@ -0,0 +1 @@ +Subproject commit aee799a31d08977b166fb19cad794730717e3304 diff --git a/vendor/udt4/CMakeLists.txt b/vendor/udt4/CMakeLists.txt index 9d65ee7..cee52ed 100644 --- a/vendor/udt4/CMakeLists.txt +++ b/vendor/udt4/CMakeLists.txt @@ -2,7 +2,7 @@ IF( APPLE ) add_definitions( -DOSX ) ELSEIF( WIN32 ) - + add_definitions( -DWIN32 ) ELSE() add_definitions( -DLINUX ) ENDIF()