mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-21 07:19:57 +00:00
Merge pull request #294 from mlt/openssl-cmake
Updated CMake stuff to build OpenSSL version with MSVC++
This commit is contained in:
commit
64295e3541
@ -1,6 +1,5 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <openssl/ssl.h>
|
|
||||||
|
|
||||||
#include "Daemon.h"
|
#include "Daemon.h"
|
||||||
|
|
||||||
@ -20,6 +19,8 @@
|
|||||||
#include "HTTPServer.h"
|
#include "HTTPServer.h"
|
||||||
#include "I2PControl.h"
|
#include "I2PControl.h"
|
||||||
#include "ClientContext.h"
|
#include "ClientContext.h"
|
||||||
|
// ssl.h somehow pulls Windows.h stuff that has to go after asio
|
||||||
|
#include <openssl/ssl.h>
|
||||||
|
|
||||||
#ifdef USE_UPNP
|
#ifdef USE_UPNP
|
||||||
#include "UPnP.h"
|
#include "UPnP.h"
|
||||||
@ -39,7 +40,7 @@ namespace i2p
|
|||||||
std::unique_ptr<i2p::client::I2PControlService> m_I2PControlService;
|
std::unique_ptr<i2p::client::I2PControlService> m_I2PControlService;
|
||||||
|
|
||||||
#ifdef USE_UPNP
|
#ifdef USE_UPNP
|
||||||
UPnP m_UPnP;
|
i2p::transport::UPnP m_UPnP;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
2
SAM.cpp
2
SAM.cpp
@ -450,7 +450,7 @@ namespace client
|
|||||||
auto keys = i2p::data::PrivateKeys::CreateRandomKeys ();
|
auto keys = i2p::data::PrivateKeys::CreateRandomKeys ();
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
size_t len = sprintf_s (m_Buffer, SAM_SOCKET_BUFFER_SIZE, SAM_DEST_REPLY,
|
size_t len = sprintf_s (m_Buffer, SAM_SOCKET_BUFFER_SIZE, SAM_DEST_REPLY,
|
||||||
keys.GetPublic ().ToBase64 ().c_str (), keys.ToBase64 ().c_str ());
|
keys.GetPublic ()->ToBase64 ().c_str (), keys.ToBase64 ().c_str ());
|
||||||
#else
|
#else
|
||||||
size_t len = snprintf (m_Buffer, SAM_SOCKET_BUFFER_SIZE, SAM_DEST_REPLY,
|
size_t len = snprintf (m_Buffer, SAM_SOCKET_BUFFER_SIZE, SAM_DEST_REPLY,
|
||||||
keys.GetPublic ()->ToBase64 ().c_str (), keys.ToBase64 ().c_str ());
|
keys.GetPublic ()->ToBase64 ().c_str (), keys.ToBase64 ().c_str ());
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#define WIN_32_SERVICE_H__
|
#define WIN_32_SERVICE_H__
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ set ( CMAKE_SOURCE_DIR ".." )
|
|||||||
|
|
||||||
set (COMMON_SRC
|
set (COMMON_SRC
|
||||||
"${CMAKE_SOURCE_DIR}/AddressBook.cpp"
|
"${CMAKE_SOURCE_DIR}/AddressBook.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/CryptoConst.cpp"
|
"${CMAKE_SOURCE_DIR}/Crypto.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Garlic.cpp"
|
"${CMAKE_SOURCE_DIR}/Garlic.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/I2NPProtocol.cpp"
|
"${CMAKE_SOURCE_DIR}/I2NPProtocol.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Identity.cpp"
|
"${CMAKE_SOURCE_DIR}/Identity.cpp"
|
||||||
@ -40,8 +40,7 @@ set (COMMON_SRC
|
|||||||
"${CMAKE_SOURCE_DIR}/Transports.cpp"
|
"${CMAKE_SOURCE_DIR}/Transports.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/TunnelEndpoint.cpp"
|
"${CMAKE_SOURCE_DIR}/TunnelEndpoint.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/TunnelPool.cpp"
|
"${CMAKE_SOURCE_DIR}/TunnelPool.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/aes.cpp"
|
"${CMAKE_SOURCE_DIR}/Base.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/base64.cpp"
|
|
||||||
"${CMAKE_SOURCE_DIR}/util.cpp"
|
"${CMAKE_SOURCE_DIR}/util.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Datagram.cpp"
|
"${CMAKE_SOURCE_DIR}/Datagram.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Signature.cpp"
|
"${CMAKE_SOURCE_DIR}/Signature.cpp"
|
||||||
@ -65,7 +64,7 @@ set (DAEMON_SRC
|
|||||||
"${CMAKE_SOURCE_DIR}/I2PTunnel.cpp"
|
"${CMAKE_SOURCE_DIR}/I2PTunnel.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/SAM.cpp"
|
"${CMAKE_SOURCE_DIR}/SAM.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/SOCKS.cpp"
|
"${CMAKE_SOURCE_DIR}/SOCKS.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/i2p.cpp"
|
"${CMAKE_SOURCE_DIR}/i2pd.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WITH_UPNP)
|
if (WITH_UPNP)
|
||||||
@ -91,7 +90,9 @@ if (NOT CMAKE_BUILD_TYPE)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# compiler flags customization (by vendor)
|
# compiler flags customization (by vendor)
|
||||||
if (NOT MSVC)
|
if (MSVC)
|
||||||
|
add_definitions( -D_WIN32_WINNT=_WIN32_WINNT_WINXP -DWIN32_LEAN_AND_MEAN -DNOMINMAX ) #-DOPENSSL_NO_SSL2 -DOPENSSL_USE_DEPRECATED
|
||||||
|
else()
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Winvalid-pch" )
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Winvalid-pch" )
|
||||||
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pedantic" )
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pedantic" )
|
||||||
# TODO: The following is incompatible with static build and enabled hardening for OpenWRT.
|
# TODO: The following is incompatible with static build and enabled hardening for OpenWRT.
|
||||||
@ -212,18 +213,34 @@ if(NOT DEFINED Boost_INCLUDE_DIRS)
|
|||||||
message(SEND_ERROR "Boost is not found, or your boost version was bellow 1.46. Please download Boost!")
|
message(SEND_ERROR "Boost is not found, or your boost version was bellow 1.46. Please download Boost!")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package ( CryptoPP REQUIRED )
|
find_package ( OpenSSL REQUIRED )
|
||||||
if(NOT DEFINED CRYPTO++_INCLUDE_DIR)
|
if(NOT DEFINED OPENSSL_INCLUDE_DIR)
|
||||||
message(SEND_ERROR "Could not find Crypto++. Please download and install it first!")
|
message(SEND_ERROR "Could not find OpenSSL. Please download and install it first!")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package ( MiniUPnPc )
|
find_package ( MiniUPnPc )
|
||||||
if (NOT ${MINIUPNPC_FOUND})
|
if (MINIUPNPC_FOUND)
|
||||||
|
include_directories( ${MINIUPNPC_INCLUDE_DIR} )
|
||||||
|
else ()
|
||||||
set(WITH_UPNP OFF)
|
set(WITH_UPNP OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
find_package ( ZLIB )
|
||||||
|
if (NOT DEFINED ZLIB-FOUND )
|
||||||
|
include( ExternalProject )
|
||||||
|
ExternalProject_Add(zlib
|
||||||
|
URL http://zlib.net/zlib-1.2.8.tar.gz
|
||||||
|
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/zlib
|
||||||
|
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
|
||||||
|
)
|
||||||
|
add_dependencies( common zlib )
|
||||||
|
ExternalProject_Get_Property(zlib install_dir)
|
||||||
|
set (ZLIB_ROOT ${install_dir} )
|
||||||
|
find_package ( ZLIB REQUIRED )
|
||||||
|
endif ()
|
||||||
|
|
||||||
# load includes
|
# load includes
|
||||||
include_directories( ${Boost_INCLUDE_DIRS} ${CRYPTO++_INCLUDE_DIR} )
|
include_directories( ${Boost_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
|
||||||
|
|
||||||
# show summary
|
# show summary
|
||||||
message(STATUS "---------------------------------------")
|
message(STATUS "---------------------------------------")
|
||||||
@ -271,7 +288,7 @@ if (WITH_BINARY)
|
|||||||
if(${LAST_Boost_LIBRARIES} MATCHES ".*pthread.*")
|
if(${LAST_Boost_LIBRARIES} MATCHES ".*pthread.*")
|
||||||
list(REMOVE_AT Boost_LIBRARIES -1)
|
list(REMOVE_AT Boost_LIBRARIES -1)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries( "${PROJECT_NAME}-bin" common ${DL_LIB} ${Boost_LIBRARIES} ${CRYPTO++_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
|
target_link_libraries( "${PROJECT_NAME}-bin" common ${DL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} )
|
||||||
|
|
||||||
install(TARGETS "${PROJECT_NAME}-bin" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
install(TARGETS "${PROJECT_NAME}-bin" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
@ -285,7 +302,7 @@ if (WITH_LIBRARY)
|
|||||||
add_library(${PROJECT_NAME} STATIC ${LIBRARY_SRC})
|
add_library(${PROJECT_NAME} STATIC ${LIBRARY_SRC})
|
||||||
else ()
|
else ()
|
||||||
add_library(${PROJECT_NAME} ${LIBRARY_SRC})
|
add_library(${PROJECT_NAME} ${LIBRARY_SRC})
|
||||||
target_link_libraries( ${PROJECT_NAME} common ${Boost_LIBRARIES} ${CRYPTO++_LIBRARIES})
|
target_link_libraries( ${PROJECT_NAME} common ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES})
|
||||||
endif ()
|
endif ()
|
||||||
if (WITH_PCH)
|
if (WITH_PCH)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
@ -4,12 +4,12 @@ if(MINIUPNPC_INCLUDE_DIR)
|
|||||||
set(MINIUPNPC_FOUND TRUE)
|
set(MINIUPNPC_FOUND TRUE)
|
||||||
|
|
||||||
else()
|
else()
|
||||||
find_path(MINIUPNPC_INCLUDE_DIR miniupnpc.h
|
find_path(MINIUPNPC_INCLUDE_DIR miniupnpc/miniupnpc.h
|
||||||
/usr/include/miniupnpc
|
/usr/include
|
||||||
/usr/local/include/miniupnpc
|
/usr/local/include
|
||||||
/opt/local/include/miniupnpc
|
/opt/local/include
|
||||||
$ENV{SystemDrive}/miniupnpc
|
$ENV{SystemDrive}
|
||||||
${PROJECT_SOURCE_DIR}/../../miniupnpc
|
${PROJECT_SOURCE_DIR}/../..
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MINIUPNPC_INCLUDE_DIR)
|
if(MINIUPNPC_INCLUDE_DIR)
|
||||||
|
30
stdafx.h
30
stdafx.h
@ -48,20 +48,20 @@
|
|||||||
#include <boost/program_options/parsers.hpp>
|
#include <boost/program_options/parsers.hpp>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
#include <cryptopp/aes.h>
|
#include <zlib.h>
|
||||||
#include <cryptopp/adler32.h>
|
|
||||||
#include <cryptopp/asn.h>
|
#include <openssl/ssl.h>
|
||||||
#include <cryptopp/base64.h>
|
#include <openssl/err.h>
|
||||||
#include <cryptopp/crc.h>
|
#include <openssl/bn.h>
|
||||||
#include <cryptopp/dh.h>
|
#include <openssl/dh.h>
|
||||||
#include <cryptopp/dsa.h>
|
#include <openssl/aes.h>
|
||||||
#include <cryptopp/eccrypto.h>
|
#include <openssl/sha.h>
|
||||||
#include <cryptopp/gzip.h>
|
#include <openssl/md5.h>
|
||||||
#include <cryptopp/hmac.h>
|
#include <openssl/rand.h>
|
||||||
#include <cryptopp/integer.h>
|
#include <openssl/dsa.h>
|
||||||
#include <cryptopp/modes.h>
|
#include <openssl/ec.h>
|
||||||
#include <cryptopp/osrng.h>
|
#include <openssl/ecdsa.h>
|
||||||
#include <cryptopp/sha.h>
|
#include <openssl/rsa.h>
|
||||||
#include <cryptopp/zinflate.h>
|
#include <openssl/evp.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user