Merge pull request #858 from majestrate/restructure

Restructure
This commit is contained in:
orignal 2017-04-21 08:52:59 -04:00 committed by GitHub
commit dfa14a73a8
143 changed files with 226 additions and 224 deletions

10
.gitignore vendored
View File

@ -1,5 +1,5 @@
# i2pd # i2pd
obj/*.o *.o
router.info router.info
router.keys router.keys
i2p i2p
@ -248,4 +248,10 @@ docs/generated
*\#* *\#*
# gdb files # gdb files
.gdb_history .gdb_history
# cmake makefile
build/Makefile
# debian stuff
.pc/

View File

@ -7,6 +7,10 @@ I2PD := i2pd
GREP := grep GREP := grep
DEPS := obj/make.dep DEPS := obj/make.dep
LIB_SRC_DIR := libi2pd
LIB_CLIENT_SRC_DIR := libi2pd_client
DAEMON_SRC_DIR := daemon
include filelist.mk include filelist.mk
USE_AESNI := yes USE_AESNI := yes
@ -17,24 +21,23 @@ USE_UPNP := no
ifeq ($(WEBSOCKETS),1) ifeq ($(WEBSOCKETS),1)
NEEDED_CXXFLAGS += -DWITH_EVENTS NEEDED_CXXFLAGS += -DWITH_EVENTS
DAEMON_SRC += Websocket.cpp
endif endif
ifeq ($(UNAME),Darwin) ifeq ($(UNAME),Darwin)
DAEMON_SRC += DaemonLinux.cpp DAEMON_SRC += $(DAEMON_SRC_DIR)/UnixDaemon.cpp
ifeq ($(HOMEBREW),1) ifeq ($(HOMEBREW),1)
include Makefile.homebrew include Makefile.homebrew
else else
include Makefile.osx include Makefile.osx
endif endif
else ifeq ($(shell echo $(UNAME) | $(GREP) -Ec '(Free|Open)BSD'),1) else ifeq ($(shell echo $(UNAME) | $(GREP) -Ec '(Free|Open)BSD'),1)
DAEMON_SRC += DaemonLinux.cpp DAEMON_SRC += $(DAEMON_SRC_DIR)/UnixDaemon.cpp
include Makefile.bsd include Makefile.bsd
else ifeq ($(UNAME),Linux) else ifeq ($(UNAME),Linux)
DAEMON_SRC += DaemonLinux.cpp DAEMON_SRC += $(DAEMON_SRC_DIR)/UnixDaemon.cpp
include Makefile.linux include Makefile.linux
else # win32 mingw else
DAEMON_SRC += DaemonWin32.cpp Win32/Win32Service.cpp Win32/Win32App.cpp DAEMON_SRC += Win32/DaemonWin32.cpp Win32/Win32Service.cpp Win32/Win32App.cpp
include Makefile.mingw include Makefile.mingw
endif endif
@ -42,11 +45,16 @@ ifeq ($(USE_MESHNET),yes)
NEEDED_CXXFLAGS += -DMESHNET NEEDED_CXXFLAGS += -DMESHNET
endif endif
NEEDED_CXXFLAGS += -I$(LIB_SRC_DIR) -I$(LIB_CLIENT_SRC_DIR)
all: mk_obj_dir $(ARLIB) $(ARLIB_CLIENT) $(I2PD) all: mk_obj_dir $(ARLIB) $(ARLIB_CLIENT) $(I2PD)
mk_obj_dir: mk_obj_dir:
@mkdir -p obj @mkdir -p obj
@mkdir -p obj/Win32 @mkdir -p obj/Win32
@mkdir -p obj/$(LIB_SRC_DIR)
@mkdir -p obj/$(LIB_CLIENT_SRC_DIR)
@mkdir -p obj/$(DAEMON_SRC_DIR)
api: mk_obj_dir $(SHLIB) $(ARLIB) api: mk_obj_dir $(SHLIB) $(ARLIB)
api_client: mk_obj_dir $(SHLIB) $(ARLIB) $(SHLIB_CLIENT) $(ARLIB_CLIENT) api_client: mk_obj_dir $(SHLIB) $(ARLIB) $(SHLIB_CLIENT) $(ARLIB_CLIENT)

View File

@ -4,14 +4,13 @@ WINDRES = windres
CXXFLAGS = -Os -D_MT -DWIN32 -D_WINDOWS -DWIN32_LEAN_AND_MEAN CXXFLAGS = -Os -D_MT -DWIN32 -D_WINDOWS -DWIN32_LEAN_AND_MEAN
NEEDED_CXXFLAGS = -std=c++11 NEEDED_CXXFLAGS = -std=c++11
BOOST_SUFFIX = -mt BOOST_SUFFIX = -mt
INCFLAGS = -I/usr/include/ -I/usr/local/include/ INCFLAGS = -I/usr/include/ -I/usr/local/include/ -I. -Idaemon
LDFLAGS = -Wl,-rpath,/usr/local/lib \ LDFLAGS = -Wl,-rpath,/usr/local/lib -L/usr/local/lib
-L/usr/local/lib
# UPNP Support # UPNP Support
ifeq ($(USE_UPNP),yes) ifeq ($(USE_UPNP),yes)
CXXFLAGS += -DUSE_UPNP -DMINIUPNP_STATICLIB CXXFLAGS += -DUSE_UPNP -DMINIUPNP_STATICLIB
LDLIBS = -Wl,-Bstatic -lminiupnpc LDLIBS = -Wl,-Bstatic -lminiupnpc
endif endif
LDLIBS += \ LDLIBS += \

View File

@ -6,7 +6,7 @@
#error this file is not editable by Microsoft Visual C++ #error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED #endif //APSTUDIO_INVOKED
#include "../version.h" #include "../libi2pd/version.h"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //

View File

@ -1,13 +1,13 @@
#include <string.h> #include <string.h>
#include <windows.h> #include <windows.h>
#include <shellapi.h> #include <shellapi.h>
#include "../ClientContext.h" #include "ClientContext.h"
#include "../Config.h" #include "Config.h"
#include "../NetDb.h" #include "NetDb.h"
#include "../RouterContext.h" #include "RouterContext.h"
#include "../Transports.h" #include "Transports.h"
#include "../Tunnel.h" #include "Tunnel.h"
#include "../version.h" #include "version.h"
#include "resource.h" #include "resource.h"
#include "Win32App.h" #include "Win32App.h"
#include <stdio.h> #include <stdio.h>
@ -80,7 +80,7 @@ namespace win32
Shell_NotifyIcon (NIM_DELETE, &nid); Shell_NotifyIcon (NIM_DELETE, &nid);
} }
static void ShowUptime (std::stringstream& s, int seconds) static void ShowUptime (std::stringstream& s, int seconds)
{ {
int num; int num;
@ -125,8 +125,8 @@ namespace win32
{ {
case eRouterStatusOK: s << "OK"; break; case eRouterStatusOK: s << "OK"; break;
case eRouterStatusTesting: s << "Testing"; break; case eRouterStatusTesting: s << "Testing"; break;
case eRouterStatusFirewalled: s << "Firewalled"; break; case eRouterStatusFirewalled: s << "Firewalled"; break;
case eRouterStatusError: case eRouterStatusError:
{ {
switch (i2p::context.GetError()) switch (i2p::context.GetError())
{ {

View File

@ -7,8 +7,8 @@
#include <strsafe.h> #include <strsafe.h>
#include <windows.h> #include <windows.h>
#include "../Daemon.h" #include "Daemon.h"
#include "../Log.h" #include "Log.h"
I2PService *I2PService::s_service = NULL; I2PService *I2PService::s_service = NULL;
@ -100,7 +100,7 @@ I2PService::I2PService(PSTR pszServiceName,
m_fStopping = FALSE; m_fStopping = FALSE;
// Create a manual-reset event that is not signaled at first to indicate // Create a manual-reset event that is not signaled at first to indicate
// the stopped signal of the service. // the stopped signal of the service.
m_hStoppedEvent = CreateEvent(NULL, TRUE, FALSE, NULL); m_hStoppedEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if (m_hStoppedEvent == NULL) if (m_hStoppedEvent == NULL)

View File

@ -93,5 +93,4 @@
--> -->
<!-- version-tag: 1 --> <!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" /> <import file="${sdk.dir}/tools/ant/build.xml" />
</project> </project>

View File

@ -2,7 +2,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := i2pd LOCAL_MODULE := i2pd
LOCAL_CPP_FEATURES := rtti exceptions LOCAL_CPP_FEATURES := rtti exceptions
LOCAL_C_INCLUDES += $(IFADDRS_PATH) ../.. LOCAL_C_INCLUDES += $(IFADDRS_PATH) $(LIB_SRC_PATH) $(LIB_CLIENT_SRC_PATH) $(DAEMON_SRC_PATH)
LOCAL_STATIC_LIBRARIES := \ LOCAL_STATIC_LIBRARIES := \
boost_system \ boost_system \
boost_date_time \ boost_date_time \
@ -12,59 +12,13 @@ LOCAL_STATIC_LIBRARIES := \
miniupnpc miniupnpc
LOCAL_LDLIBS := -lz LOCAL_LDLIBS := -lz
LOCAL_SRC_FILES := DaemonAndroid.cpp i2pd_android.cpp \ LOCAL_SRC_FILES := DaemonAndroid.cpp i2pd_android.cpp $(IFADDRS_PATH)/ifaddrs.c \
$(IFADDRS_PATH)/ifaddrs.c \ $(wildcard $(LIB_SRC_PATH)/*.cpp)\
../../HTTPServer.cpp ../../I2PControl.cpp ../../Daemon.cpp ../../Config.cpp \ $(wildcard $(LIB_CLIENT_SRC_PATH)/*.cpp)\
../../AddressBook.cpp \ $(DAEMON_SRC_PATH)/Daemon.cpp \
../../api.cpp \ $(DAEMON_SRC_PATH)/UPnP.cpp \
../../Base.cpp \ $(DAEMON_SRC_PATH)/HTTPServer.cpp \
../../BOB.cpp \ $(DAEMON_SRC_PATH)/I2PControl.cpp
../../ClientContext.cpp \
../../Crypto.cpp \
../../Datagram.cpp \
../../Destination.cpp \
../../Family.cpp \
../../FS.cpp \
../../Garlic.cpp \
../../Gzip.cpp \
../../HTTP.cpp \
../../HTTPProxy.cpp \
../../I2CP.cpp \
../../I2NPProtocol.cpp \
../../I2PEndian.cpp \
../../I2PService.cpp \
../../I2PTunnel.cpp \
../../Identity.cpp \
../../LeaseSet.cpp \
../../Log.cpp \
../../NetDb.cpp \
../../NetDbRequests.cpp \
../../NTCPSession.cpp \
../../Profiling.cpp \
../../Reseed.cpp \
../../RouterContext.cpp \
../../RouterInfo.cpp \
../../SAM.cpp \
../../Signature.cpp \
../../SOCKS.cpp \
../../SSU.cpp \
../../SSUData.cpp \
../../SSUSession.cpp \
../../Streaming.cpp \
../../TransitTunnel.cpp \
../../Transports.cpp \
../../Tunnel.cpp \
../../TunnelEndpoint.cpp \
../../TunnelGateway.cpp \
../../TunnelPool.cpp \
../../Timestamp.cpp \
../../Event.cpp \
../../Gost.cpp \
../../WebSocks.cpp \
../../BloomFilter.cpp \
../../MatchedDestination.cpp \
../../util.cpp \
../../i2pd.cpp ../../UPnP.cpp
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)

View File

@ -25,8 +25,15 @@ APP_OPTIM := debug
# git clone https://github.com/PurpleI2P/MiniUPnP-for-Android-Prebuilt.git # git clone https://github.com/PurpleI2P/MiniUPnP-for-Android-Prebuilt.git
# git clone https://github.com/PurpleI2P/android-ifaddrs.git # git clone https://github.com/PurpleI2P/android-ifaddrs.git
# change to your own # change to your own
I2PD_LIBS_PATH=/path/to/libraries I2PD_LIBS_PATH=/tmp/i2pd
BOOST_PATH = $(I2PD_LIBS_PATH)/Boost-for-Android-Prebuilt BOOST_PATH = $(I2PD_LIBS_PATH)/Boost-for-Android-Prebuilt
OPENSSL_PATH = $(I2PD_LIBS_PATH)/OpenSSL-for-Android-Prebuilt OPENSSL_PATH = $(I2PD_LIBS_PATH)/OpenSSL-for-Android-Prebuilt
MINIUPNP_PATH = $(I2PD_LIBS_PATH)/MiniUPnP-for-Android-Prebuilt MINIUPNP_PATH = $(I2PD_LIBS_PATH)/MiniUPnP-for-Android-Prebuilt
IFADDRS_PATH = $(I2PD_LIBS_PATH)/android-ifaddrs IFADDRS_PATH = $(I2PD_LIBS_PATH)/android-ifaddrs
# don't change me
I2PD_SRC_PATH = $(PWD)/..
LIB_SRC_PATH = $(I2PD_SRC_PATH)/libi2pd
LIB_CLIENT_SRC_PATH = $(I2PD_SRC_PATH)/libi2pd_client
DAEMON_SRC_PATH = $(I2PD_SRC_PATH)/daemon

View File

@ -1,5 +1,5 @@
#include "DaemonAndroid.h" #include "DaemonAndroid.h"
#include "../../Daemon.h" #include "Daemon.h"
#include <iostream> #include <iostream>
#include <boost/exception/diagnostic_information.hpp> #include <boost/exception/diagnostic_information.hpp>
#include <boost/exception_ptr.hpp> #include <boost/exception_ptr.hpp>
@ -191,4 +191,3 @@ namespace android
} }
} }
} }

View File

@ -3,8 +3,8 @@
#include <jni.h> #include <jni.h>
#include "org_purplei2p_i2pd_I2PD_JNI.h" #include "org_purplei2p_i2pd_I2PD_JNI.h"
#include "DaemonAndroid.h" #include "DaemonAndroid.h"
#include "../../RouterContext.h" #include "RouterContext.h"
#include "../../Transports.h" #include "Transports.h"
JNIEXPORT jstring JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_getABICompiledWith JNIEXPORT jstring JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_getABICompiledWith
(JNIEnv * env, jclass clazz) { (JNIEnv * env, jclass clazz) {
@ -59,8 +59,8 @@ JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_stopAcceptingTunnels
} }
JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_onNetworkStateChanged JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_onNetworkStateChanged
(JNIEnv * env, jclass clazz, jboolean isConnected) (JNIEnv * env, jclass clazz, jboolean isConnected)
{ {
bool isConnectedBool = (bool) isConnected; bool isConnectedBool = (bool) isConnected;
i2p::transport::transports.SetOnline (isConnectedBool); i2p::transport::transports.SetOnline (isConnectedBool);
} }

View File

@ -25,44 +25,51 @@ option(WITH_WEBSOCKETS "Build with websocket ui" OFF)
set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules" ) set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules" )
set ( CMAKE_SOURCE_DIR ".." ) set ( CMAKE_SOURCE_DIR ".." )
set(LIBI2PD_SRC_DIR ../libi2pd)
set(LIBI2PD_CLIENT_SRC_DIR ../libi2pd_client)
include_directories(${LIBI2PD_SRC_DIR})
include_directories(${LIBI2PD_CLIENT_SRC_DIR})
set (LIBI2PD_SRC set (LIBI2PD_SRC
"${CMAKE_SOURCE_DIR}/BloomFilter.cpp" "${LIBI2PD_SRC_DIR}/BloomFilter.cpp"
"${CMAKE_SOURCE_DIR}/Config.cpp" "${LIBI2PD_SRC_DIR}/Config.cpp"
"${CMAKE_SOURCE_DIR}/Crypto.cpp" "${LIBI2PD_SRC_DIR}/Crypto.cpp"
"${CMAKE_SOURCE_DIR}/Garlic.cpp" "${LIBI2PD_SRC_DIR}/Garlic.cpp"
"${CMAKE_SOURCE_DIR}/Gzip.cpp" "${LIBI2PD_SRC_DIR}/Gzip.cpp"
"${CMAKE_SOURCE_DIR}/I2NPProtocol.cpp" "${LIBI2PD_SRC_DIR}/HTTP.cpp"
"${CMAKE_SOURCE_DIR}/Identity.cpp" "${LIBI2PD_SRC_DIR}/I2NPProtocol.cpp"
"${CMAKE_SOURCE_DIR}/LeaseSet.cpp" "${LIBI2PD_SRC_DIR}/Identity.cpp"
"${CMAKE_SOURCE_DIR}/FS.cpp" "${LIBI2PD_SRC_DIR}/LeaseSet.cpp"
"${CMAKE_SOURCE_DIR}/Log.cpp" "${LIBI2PD_SRC_DIR}/FS.cpp"
"${CMAKE_SOURCE_DIR}/NTCPSession.cpp" "${LIBI2PD_SRC_DIR}/Log.cpp"
"${CMAKE_SOURCE_DIR}/NetDbRequests.cpp" "${LIBI2PD_SRC_DIR}/NTCPSession.cpp"
"${CMAKE_SOURCE_DIR}/NetDb.cpp" "${LIBI2PD_SRC_DIR}/NetDbRequests.cpp"
"${CMAKE_SOURCE_DIR}/Profiling.cpp" "${LIBI2PD_SRC_DIR}/NetDb.cpp"
"${CMAKE_SOURCE_DIR}/Reseed.cpp" "${LIBI2PD_SRC_DIR}/Profiling.cpp"
"${CMAKE_SOURCE_DIR}/RouterContext.cpp" "${LIBI2PD_SRC_DIR}/Reseed.cpp"
"${CMAKE_SOURCE_DIR}/RouterInfo.cpp" "${LIBI2PD_SRC_DIR}/RouterContext.cpp"
"${CMAKE_SOURCE_DIR}/SSU.cpp" "${LIBI2PD_SRC_DIR}/RouterInfo.cpp"
"${CMAKE_SOURCE_DIR}/SSUData.cpp" "${LIBI2PD_SRC_DIR}/SSU.cpp"
"${CMAKE_SOURCE_DIR}/SSUSession.cpp" "${LIBI2PD_SRC_DIR}/SSUData.cpp"
"${CMAKE_SOURCE_DIR}/Streaming.cpp" "${LIBI2PD_SRC_DIR}/SSUSession.cpp"
"${CMAKE_SOURCE_DIR}/Destination.cpp" "${LIBI2PD_SRC_DIR}/Streaming.cpp"
"${CMAKE_SOURCE_DIR}/TransitTunnel.cpp" "${LIBI2PD_SRC_DIR}/Destination.cpp"
"${CMAKE_SOURCE_DIR}/Tunnel.cpp" "${LIBI2PD_SRC_DIR}/TransitTunnel.cpp"
"${CMAKE_SOURCE_DIR}/TunnelGateway.cpp" "${LIBI2PD_SRC_DIR}/Tunnel.cpp"
"${CMAKE_SOURCE_DIR}/Transports.cpp" "${LIBI2PD_SRC_DIR}/TunnelGateway.cpp"
"${CMAKE_SOURCE_DIR}/TunnelEndpoint.cpp" "${LIBI2PD_SRC_DIR}/Transports.cpp"
"${CMAKE_SOURCE_DIR}/TunnelPool.cpp" "${LIBI2PD_SRC_DIR}/TunnelEndpoint.cpp"
"${CMAKE_SOURCE_DIR}/Base.cpp" "${LIBI2PD_SRC_DIR}/TunnelPool.cpp"
"${CMAKE_SOURCE_DIR}/util.cpp" "${LIBI2PD_SRC_DIR}/Base.cpp"
"${CMAKE_SOURCE_DIR}/Datagram.cpp" "${LIBI2PD_SRC_DIR}/util.cpp"
"${CMAKE_SOURCE_DIR}/Family.cpp" "${LIBI2PD_SRC_DIR}/Datagram.cpp"
"${CMAKE_SOURCE_DIR}/Signature.cpp" "${LIBI2PD_SRC_DIR}/Family.cpp"
"${CMAKE_SOURCE_DIR}/Timestamp.cpp" "${LIBI2PD_SRC_DIR}/Signature.cpp"
"${CMAKE_SOURCE_DIR}/api.cpp" "${LIBI2PD_SRC_DIR}/Timestamp.cpp"
"${CMAKE_SOURCE_DIR}/Event.cpp" "${LIBI2PD_SRC_DIR}/api.cpp"
"${CMAKE_SOURCE_DIR}/Gost.cpp" "${LIBI2PD_SRC_DIR}/Event.cpp"
"${LIBI2PD_SRC_DIR}/Gost.cpp"
) )
if (WITH_WEBSOCKETS) if (WITH_WEBSOCKETS)
@ -89,31 +96,32 @@ install(TARGETS libi2pd
# install(EXPORT libi2pd DESTINATION ${CMAKE_INSTALL_LIBDIR}) # install(EXPORT libi2pd DESTINATION ${CMAKE_INSTALL_LIBDIR})
set (CLIENT_SRC set (CLIENT_SRC
"${CMAKE_SOURCE_DIR}/AddressBook.cpp" "${LIBI2PD_CLIENT_SRC_DIR}/AddressBook.cpp"
"${CMAKE_SOURCE_DIR}/BOB.cpp" "${LIBI2PD_CLIENT_SRC_DIR}/BOB.cpp"
"${CMAKE_SOURCE_DIR}/ClientContext.cpp" "${LIBI2PD_CLIENT_SRC_DIR}/ClientContext.cpp"
"${CMAKE_SOURCE_DIR}/MatchedDestination.cpp" "${LIBI2PD_CLIENT_SRC_DIR}/MatchedDestination.cpp"
"${CMAKE_SOURCE_DIR}/I2PTunnel.cpp" "${LIBI2PD_CLIENT_SRC_DIR}/I2PTunnel.cpp"
"${CMAKE_SOURCE_DIR}/I2PService.cpp" "${LIBI2PD_CLIENT_SRC_DIR}/I2PService.cpp"
"${CMAKE_SOURCE_DIR}/SAM.cpp" "${LIBI2PD_CLIENT_SRC_DIR}/SAM.cpp"
"${CMAKE_SOURCE_DIR}/SOCKS.cpp" "${LIBI2PD_CLIENT_SRC_DIR}/SOCKS.cpp"
"${CMAKE_SOURCE_DIR}/HTTP.cpp" "${LIBI2PD_CLIENT_SRC_DIR}/HTTPProxy.cpp"
"${CMAKE_SOURCE_DIR}/HTTPProxy.cpp" "${LIBI2PD_CLIENT_SRC_DIR}/I2CP.cpp"
"${CMAKE_SOURCE_DIR}/I2CP.cpp" "${LIBI2PD_CLIENT_SRC_DIR}/WebSocks.cpp"
"${CMAKE_SOURCE_DIR}/WebSocks.cpp" )
)
if(WITH_WEBSOCKETS) if(WITH_WEBSOCKETS)
list (APPEND CLIENT_SRC "${CMAKE_SOURCE_DIR}/Websocket.cpp") list (APPEND CLIENT_SRC "${LIBI2PD_SRC_DIR}/Websocket.cpp")
endif () endif ()
add_library(i2pdclient ${CLIENT_SRC}) add_library(i2pdclient ${CLIENT_SRC})
set(DAEMON_SRC_DIR ../daemon)
set (DAEMON_SRC set (DAEMON_SRC
"${CMAKE_SOURCE_DIR}/Daemon.cpp" "${DAEMON_SRC_DIR}/Daemon.cpp"
"${CMAKE_SOURCE_DIR}/HTTPServer.cpp" "${DAEMON_SRC_DIR}/HTTPServer.cpp"
"${CMAKE_SOURCE_DIR}/I2PControl.cpp" "${DAEMON_SRC_DIR}/I2PControl.cpp"
"${CMAKE_SOURCE_DIR}/i2pd.cpp" "${DAEMON_SRC_DIR}/i2pd.cpp"
"${CMAKE_SOURCE_DIR}/UPnP.cpp" "${DAEMON_SRC_DIR}/UPnP.cpp"
) )
if (WITH_MESHNET) if (WITH_MESHNET)
@ -178,22 +186,22 @@ endif ()
# compiler flags customization (by system) # compiler flags customization (by system)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux") if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/DaemonLinux.cpp") list (APPEND DAEMON_SRC "${DAEMON_SRC_DIR}/UnixDaemon.cpp")
# "'sleep_for' is not a member of 'std::this_thread'" in gcc 4.7/4.8 # "'sleep_for' is not a member of 'std::this_thread'" in gcc 4.7/4.8
add_definitions( "-D_GLIBCXX_USE_NANOSLEEP=1" ) add_definitions( "-D_GLIBCXX_USE_NANOSLEEP=1" )
elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/DaemonLinux.cpp") list (APPEND DAEMON_SRC "${DAEMON_SRC_DIR}/UnixDaemon.cpp")
# "'sleep_for' is not a member of 'std::this_thread'" in gcc 4.7/4.8 # "'sleep_for' is not a member of 'std::this_thread'" in gcc 4.7/4.8
add_definitions( "-D_GLIBCXX_USE_NANOSLEEP=1" ) add_definitions( "-D_GLIBCXX_USE_NANOSLEEP=1" )
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin") elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/DaemonLinux.cpp") list (APPEND DAEMON_SRC "${DAEMON_SRC_DIR}/UnixDaemon.cpp")
elseif (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") elseif (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/DaemonLinux.cpp") list (APPEND DAEMON_SRC "${DAEMON_SRC_DIR}/UnixDaemon.cpp")
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR MSYS) elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR MSYS)
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/DaemonWin32.cpp") list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/Win32/DaemonWin32.cpp")
if (WITH_GUI) if (WITH_GUI)
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/Win32/Win32App.cpp") list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/Win32/Win32App.cpp")
set_source_files_properties("${CMAKE_SOURCE_DIR}/DaemonWin32.cpp" set_source_files_properties("${CMAKE_SOURCE_DIR}/Win32/DaemonWin32.cpp"
PROPERTIES COMPILE_DEFINITIONS WIN32_APP) PROPERTIES COMPILE_DEFINITIONS WIN32_APP)
endif () endif ()
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/Win32/Win32Service.cpp") list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/Win32/Win32Service.cpp")
@ -275,7 +283,7 @@ endif ()
if (WITH_PCH) if (WITH_PCH)
include_directories(BEFORE ${CMAKE_BINARY_DIR}) include_directories(BEFORE ${CMAKE_BINARY_DIR})
add_library(stdafx STATIC "${CMAKE_SOURCE_DIR}/stdafx.cpp") add_library(stdafx STATIC "${LIBI2PD_SRC_DIR}/stdafx.cpp")
if(MSVC) if(MSVC)
target_compile_options(stdafx PRIVATE /Ycstdafx.h /Zm155) target_compile_options(stdafx PRIVATE /Ycstdafx.h /Zm155)
add_custom_command(TARGET stdafx POST_BUILD add_custom_command(TARGET stdafx POST_BUILD
@ -291,10 +299,10 @@ if (WITH_PCH)
get_directory_property(DEFS DEFINITIONS) get_directory_property(DEFS DEFINITIONS)
string(REPLACE " " ";" FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTU}} ${DEFS}") string(REPLACE " " ";" FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTU}} ${DEFS}")
add_custom_command(TARGET stdafx PRE_BUILD add_custom_command(TARGET stdafx PRE_BUILD
COMMAND ${CMAKE_CXX_COMPILER} ${FLAGS} -c ${CMAKE_CURRENT_SOURCE_DIR}/../stdafx.h -o ${CMAKE_BINARY_DIR}/stdafx.h.gch COMMAND ${CMAKE_CXX_COMPILER} ${FLAGS} -c ${CMAKE_CURRENT_SOURCE_DIR}/../libi2pd/stdafx.h -o ${CMAKE_BINARY_DIR}/stdafx.h.gch
) )
target_compile_options(libi2pd PRIVATE -include stdafx.h) target_compile_options(libi2pd PRIVATE -include libi2pd/stdafx.h)
target_compile_options(i2pdclient PRIVATE -include stdafx.h) target_compile_options(i2pdclient PRIVATE -include libi2pd/stdafx.h)
endif() endif()
target_link_libraries(libi2pd stdafx) target_link_libraries(libi2pd stdafx)
endif() endif()
@ -402,7 +410,7 @@ if (WITH_BINARY)
if (MSVC) if (MSVC)
target_compile_options("${PROJECT_NAME}" PRIVATE /FIstdafx.h /Yustdafx.h /Zm155 "/Fp${CMAKE_BINARY_DIR}/stdafx.dir/$<CONFIG>/stdafx.pch") target_compile_options("${PROJECT_NAME}" PRIVATE /FIstdafx.h /Yustdafx.h /Zm155 "/Fp${CMAKE_BINARY_DIR}/stdafx.dir/$<CONFIG>/stdafx.pch")
else() else()
target_compile_options("${PROJECT_NAME}" PRIVATE -include stdafx.h) target_compile_options("${PROJECT_NAME}" PRIVATE -include libi2pd/stdafx.h)
endif() endif()
endif() endif()
@ -453,7 +461,7 @@ install(FILES "C:/projects/openssl-$ENV{OPENSSL}/LICENSE"
OPTIONAL # for local builds only! OPTIONAL # for local builds only!
) )
file(GLOB_RECURSE I2PD_SOURCES "../*.cpp" "../build" "../Win32" "../Makefile*") file(GLOB_RECURSE I2PD_SOURCES "../libi2pd/*.cpp" "../libi2pd_client/*.cpp" "../daemon/*.cpp" "../build" "../Win32" "../Makefile*")
install(FILES ${I2PD_SOURCES} DESTINATION src/ COMPONENT Source) install(FILES ${I2PD_SOURCES} DESTINATION src/ COMPONENT Source)
# install(DIRECTORY ../ DESTINATION src/ # install(DIRECTORY ../ DESTINATION src/
# # OPTIONAL # # OPTIONAL
@ -462,7 +470,7 @@ install(FILES ${I2PD_SOURCES} DESTINATION src/ COMPONENT Source)
# PATTERN "*.cpp" # PATTERN "*.cpp"
# ) # )
file(GLOB I2PD_HEADERS "../*.h") file(GLOB I2PD_HEADERS "../libi2pd/*.h" "../libi2pd_client/*.h" "../daemon/*.h")
install(FILES ${I2PD_HEADERS} DESTINATION src/ COMPONENT Headers) install(FILES ${I2PD_HEADERS} DESTINATION src/ COMPONENT Headers)
# install(DIRECTORY ../ DESTINATION src/ # install(DIRECTORY ../ DESTINATION src/
# # OPTIONAL # # OPTIONAL
@ -475,7 +483,7 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Purple I2P, a C++ I2P daemon")
set(CPACK_PACKAGE_VENDOR "Purple I2P") set(CPACK_PACKAGE_VENDOR "Purple I2P")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../README.md") set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE")
file(READ ../version.h version_h) file(READ ../libi2pd/version.h version_h)
string(REGEX REPLACE ".*I2PD_VERSION_MAJOR ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MAJOR "${version_h}") string(REGEX REPLACE ".*I2PD_VERSION_MAJOR ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MAJOR "${version_h}")
string(REGEX REPLACE ".*I2PD_VERSION_MINOR ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MINOR "${version_h}") string(REGEX REPLACE ".*I2PD_VERSION_MINOR ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MINOR "${version_h}")
string(REGEX REPLACE ".*I2PD_VERSION_MICRO ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MICRO "${version_h}") string(REGEX REPLACE ".*I2PD_VERSION_MICRO ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MICRO "${version_h}")

View File

@ -1,16 +1,22 @@
LIB_SRC = \ #LIB_SRC = \
BloomFilter.cpp Gzip.cpp Crypto.cpp Datagram.cpp Garlic.cpp I2NPProtocol.cpp LeaseSet.cpp \ # BloomFilter.cpp Gzip.cpp Crypto.cpp Datagram.cpp Garlic.cpp I2NPProtocol.cpp LeaseSet.cpp \
Log.cpp NTCPSession.cpp NetDb.cpp NetDbRequests.cpp Profiling.cpp \ # Log.cpp NTCPSession.cpp NetDb.cpp NetDbRequests.cpp Profiling.cpp \
Reseed.cpp RouterContext.cpp RouterInfo.cpp Signature.cpp SSU.cpp \ # Reseed.cpp RouterContext.cpp RouterInfo.cpp Signature.cpp SSU.cpp \
SSUSession.cpp SSUData.cpp Streaming.cpp Identity.cpp TransitTunnel.cpp \ # SSUSession.cpp SSUData.cpp Streaming.cpp Identity.cpp TransitTunnel.cpp \
Transports.cpp Tunnel.cpp TunnelEndpoint.cpp TunnelPool.cpp TunnelGateway.cpp \ # Transports.cpp Tunnel.cpp TunnelEndpoint.cpp TunnelPool.cpp TunnelGateway.cpp \
Destination.cpp Base.cpp I2PEndian.cpp FS.cpp Config.cpp Family.cpp \ # Destination.cpp Base.cpp I2PEndian.cpp FS.cpp Config.cpp Family.cpp \
Config.cpp HTTP.cpp Timestamp.cpp util.cpp api.cpp Event.cpp Gost.cpp # Config.cpp HTTP.cpp Timestamp.cpp util.cpp api.cpp Event.cpp Gost.cpp
LIB_CLIENT_SRC = \ LIB_SRC = $(wildcard $(LIB_SRC_DIR)/*.cpp)
AddressBook.cpp BOB.cpp ClientContext.cpp I2PTunnel.cpp I2PService.cpp MatchedDestination.cpp \
SAM.cpp SOCKS.cpp HTTPProxy.cpp I2CP.cpp WebSocks.cpp #LIB_CLIENT_SRC = \
# AddressBook.cpp BOB.cpp ClientContext.cpp I2PTunnel.cpp I2PService.cpp MatchedDestination.cpp \
# SAM.cpp SOCKS.cpp HTTPProxy.cpp I2CP.cpp WebSocks.cpp
LIB_CLIENT_SRC = $(wildcard $(LIB_CLIENT_SRC_DIR)/*.cpp)
# also: Daemon{Linux,Win32}.cpp will be added later # also: Daemon{Linux,Win32}.cpp will be added later
DAEMON_SRC = \ #DAEMON_SRC = \
HTTPServer.cpp I2PControl.cpp UPnP.cpp Daemon.cpp i2pd.cpp # HTTPServer.cpp I2PControl.cpp UPnP.cpp Daemon.cpp i2pd.cpp
DAEMON_SRC = $(wildcard $(DAEMON_SRC_DIR)/*.cpp)

View File

Some files were not shown because too many files have changed in this diff Show More