mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-10 05:11:10 +00:00
commit
6ad0313dbe
42
Makefile
42
Makefile
@ -2,33 +2,51 @@ UNAME := $(shell uname -s)
|
|||||||
SHLIB := libi2pd.so
|
SHLIB := libi2pd.so
|
||||||
I2PD := i2p
|
I2PD := i2p
|
||||||
|
|
||||||
|
include filelist.mk
|
||||||
|
|
||||||
|
USE_AESNI := yes
|
||||||
|
USE_STATIC := no
|
||||||
|
|
||||||
ifeq ($(UNAME),Darwin)
|
ifeq ($(UNAME),Darwin)
|
||||||
|
DAEMON_SRC += DaemonLinux.cpp
|
||||||
include Makefile.osx
|
include Makefile.osx
|
||||||
else ifeq ($(UNAME), FreeBSD)
|
else ifeq ($(UNAME),FreeBSD)
|
||||||
|
DAEMON_SRC += DaemonLinux.cpp
|
||||||
include Makefile.bsd
|
include Makefile.bsd
|
||||||
else
|
else ifeq ($(UNAME),Linux)
|
||||||
|
DAEMON_SRC += DaemonLinux.cpp
|
||||||
include Makefile.linux
|
include Makefile.linux
|
||||||
|
else # win32
|
||||||
|
DAEMON_SRC += DaemonWin32.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: obj $(SHLIB) $(I2PD)
|
all: obj $(SHLIB) $(I2PD)
|
||||||
|
|
||||||
.SUFFIXES:
|
|
||||||
.SUFFIXES: .c .cc .C .cpp .o
|
|
||||||
|
|
||||||
obj/%.o : %.cpp
|
|
||||||
$(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
obj:
|
obj:
|
||||||
mkdir -p obj
|
mkdir -p obj
|
||||||
|
|
||||||
$(I2PD): $(OBJECTS:obj/%=obj/%)
|
obj/%.o : %.cpp %.h
|
||||||
$(CXX) -o $@ $^ $(LDLIBS) $(LDFLAGS) $(LIBS)
|
$(CXX) $(CXXFLAGS) $(INCFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
$(SHLIB): $(OBJECTS:obj/%=obj/%) api.cpp
|
# weaker rule for building files without headers
|
||||||
$(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) -shared -o $@ $^
|
obj/%.o : %.cpp
|
||||||
|
$(CXX) $(CXXFLAGS) $(INCFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
$(I2PD): $(patsubst %.cpp,obj/%.o,$(DAEMON_SRC))
|
||||||
|
$(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS)
|
||||||
|
|
||||||
|
$(SHLIB): $(patsubst %.cpp,obj/%.o,$(LIB_SRC))
|
||||||
|
$(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -fr obj $(I2PD) $(SHLIB)
|
rm -fr obj $(I2PD) $(SHLIB)
|
||||||
|
|
||||||
|
LATEST_TAG=$(shell git describe --tags --abbrev=0 master)
|
||||||
|
dist:
|
||||||
|
git archive --format=tar.gz -9 --worktree-attributes \
|
||||||
|
--prefix=i2pd_$(LATEST_TAG)/ $(LATEST_TAG) -o i2pd_$(LATEST_TAG).tar.gz
|
||||||
|
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
.PHONY: dist
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
CXX = g++
|
CXX = g++
|
||||||
CXXFLAGS = -O2
|
CXXFLAGS = -g -Wall -O2 -std=c++11
|
||||||
NEEDED_CXXFLAGS = -std=c++11
|
|
||||||
include filelist.mk
|
|
||||||
INCFLAGS = -I/usr/include/ -I/usr/local/include/
|
INCFLAGS = -I/usr/include/ -I/usr/local/include/
|
||||||
LDFLAGS = -Wl,-rpath,/usr/local/lib -L/usr/local/lib
|
LDFLAGS = -Wl,-rpath,/usr/local/lib -L/usr/local/lib
|
||||||
LDLIBS = -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread
|
LDLIBS = -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread
|
||||||
LIBS =
|
|
||||||
|
@ -1,43 +1,43 @@
|
|||||||
CXXFLAGS = -g -Wall -fPIC
|
CXXFLAGS = -g -Wall -fPIC
|
||||||
CXXVER := $(shell $(CXX) -dumpversion)
|
|
||||||
|
|
||||||
FGREP = fgrep
|
|
||||||
IS_64 := $(shell $(CXX) -dumpmachine 2>&1 | $(FGREP) -c "64")
|
|
||||||
USE_AESNI := yes
|
|
||||||
ifeq ($(shell expr match ${CXXVER} "4\.[0-9][0-9]"),4) # >= 4.10
|
|
||||||
NEEDED_CXXFLAGS += -std=c++11
|
|
||||||
else ifeq ($(shell expr match ${CXXVER} "4\.[7-9]"),3) # >= 4.7
|
|
||||||
NEEDED_CXXFLAGS += -std=c++11
|
|
||||||
else ifeq ($(shell expr match ${CXXVER} "4\.6"),3) # = 4.6
|
|
||||||
NEEDED_CXXFLAGS += -std=c++0x
|
|
||||||
else ifeq ($(shell expr match $(CXX) 'clang'),5)
|
|
||||||
NEEDED_CXXFLAGS += -std=c++11
|
|
||||||
else # not supported
|
|
||||||
$(error Compiler too old)
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBDIR := /usr/lib
|
|
||||||
|
|
||||||
include filelist.mk
|
|
||||||
INCFLAGS =
|
INCFLAGS =
|
||||||
ifeq ($(STATIC),yes)
|
|
||||||
LDLIBS += $(LIBDIR)/libcryptopp.a $(LIBDIR)/libboost_system.a
|
# detect proper flag for c++11 support by gcc
|
||||||
LDLIBS += $(LIBDIR)/libboost_date_time.a $(LIBDIR)/libboost_filesystem.a
|
CXXVER := $(shell $(CXX) -dumpversion)
|
||||||
LDLIBS += $(LIBDIR)/libboost_regex.a $(LIBDIR)/libboost_program_options.a
|
ifeq ($(shell expr match ${CXXVER} "4\.[0-9][0-9]"),4) # >= 4.10
|
||||||
LDLIBS += -lpthread -static-libstdc++ -static-libgcc
|
CXXFLAGS += -std=c++11
|
||||||
USE_AESNI := no
|
else ifeq ($(shell expr match ${CXXVER} "4\.[7-9]"),3) # >= 4.7
|
||||||
else
|
CXXFLAGS += -std=c++11
|
||||||
LDLIBS = -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread
|
else ifeq ($(shell expr match ${CXXVER} "4\.6"),3) # = 4.6
|
||||||
|
CXXFLAGS += -std=c++0x
|
||||||
|
else ifeq ($(shell expr match $(CXX) 'clang'),5)
|
||||||
|
CXXFLAGS += -std=c++11
|
||||||
|
else # not supported
|
||||||
|
$(error Compiler too old)
|
||||||
endif
|
endif
|
||||||
LIBS =
|
|
||||||
|
|
||||||
|
ifeq ($(USE_STATIC),yes)
|
||||||
|
LIBDIR := /usr/lib
|
||||||
|
LDLIBS = $(LIBDIR)/libboost_system.a
|
||||||
|
LDLIBS += $(LIBDIR)/libboost_date_time.a
|
||||||
|
LDLIBS += $(LIBDIR)/libboost_filesystem.a
|
||||||
|
LDLIBS += $(LIBDIR)/libboost_regex.a
|
||||||
|
LDLIBS += $(LIBDIR)/libboost_program_options.a
|
||||||
|
LDLIBS += $(LIBDIR)/libcryptopp.a
|
||||||
|
LDLIBS += -lpthread -static-libstdc++ -static-libgcc
|
||||||
|
USE_AESNI := no
|
||||||
|
else
|
||||||
|
LDLIBS = -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread -shared
|
||||||
|
endif
|
||||||
|
|
||||||
|
GREP = fgrep
|
||||||
|
IS_64 := $(shell $(CXX) -dumpmachine 2>&1 | $(GREP) -c "64")
|
||||||
ifeq ($(USE_AESNI),yes)
|
ifeq ($(USE_AESNI),yes)
|
||||||
ifeq ($(IS_64),1)
|
ifeq ($(IS_64),1)
|
||||||
#check if AES-NI is supported by CPU
|
#check if AES-NI is supported by CPU
|
||||||
ifneq ($(shell grep -c aes /proc/cpuinfo),0)
|
ifneq ($(shell $(GREP) -c aes /proc/cpuinfo),1)
|
||||||
CPU_FLAGS = -maes -DAESNI
|
CXXFLAGS += -maes -DAESNI
|
||||||
|
else
|
||||||
|
$(warning "AESNI support enabled requested but not supported by this CPU")
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
20
Makefile.osx
20
Makefile.osx
@ -1,27 +1,17 @@
|
|||||||
CXX = clang++
|
CXX = clang++
|
||||||
CXXFLAGS = -g -Wall -std=c++11 -lstdc++ -I/usr/local/include
|
CXXFLAGS = -g -Wall -std=c++11 -lstdc++ -DCRYPTOPP_DISABLE_ASM
|
||||||
include filelist.mk
|
INCFLAGS = -I/usr/local/include
|
||||||
INCFLAGS = -DCRYPTOPP_DISABLE_ASM
|
|
||||||
LDFLAGS = -Wl,-rpath,/usr/local/lib -L/usr/local/lib
|
LDFLAGS = -Wl,-rpath,/usr/local/lib -L/usr/local/lib
|
||||||
LDLIBS = -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread
|
LDLIBS = -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread
|
||||||
LIBS =
|
|
||||||
|
|
||||||
# OSX Notes
|
# OSX Notes
|
||||||
# http://www.hutsby.net/2011/08/macs-with-aes-ni.html
|
# http://www.hutsby.net/2011/08/macs-with-aes-ni.html
|
||||||
# Seems like all recent Mac's have AES-NI, after firmware upgrade 2.2
|
# Seems like all recent Mac's have AES-NI, after firmware upgrade 2.2
|
||||||
# Found no good way to detect it from command line. TODO: Might be some osx sysinfo magic
|
# Found no good way to detect it from command line. TODO: Might be some osx sysinfo magic
|
||||||
CXXFLAGS += -maes -DAESNI
|
ifeq ($(USE_AESNI),yes)
|
||||||
|
CXXFLAGS += -maes -DAESNI
|
||||||
|
endif
|
||||||
${PREFIX}:
|
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
mkdir -p ${PREFIX}/
|
mkdir -p ${PREFIX}/
|
||||||
cp -r i2p ${PREFIX}/
|
cp -r i2p ${PREFIX}/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Apple Mac OSX
|
|
||||||
UNAME_S := $(shell uname -s)
|
|
||||||
ifeq ($(UNAME_S),Darwin)
|
|
||||||
endif
|
|
||||||
|
23
api/Makefile
23
api/Makefile
@ -1,23 +0,0 @@
|
|||||||
UNAME := $(shell uname -s)
|
|
||||||
ifeq ($(UNAME),Darwin)
|
|
||||||
include ../Makefile.osx
|
|
||||||
else ifeq ($(UNAME), FreeBSD)
|
|
||||||
include ../Makefile.bsd
|
|
||||||
else
|
|
||||||
include ../Makefile.linux
|
|
||||||
endif
|
|
||||||
SHARED_LIB = libi2pd.so
|
|
||||||
all: obj $(SHARED_LIB)
|
|
||||||
$(SHARED_LIB): $(OBJECTS:obj/%=obj/%)
|
|
||||||
$(CXX) -shared -o $(SHARED_LIB) $^
|
|
||||||
.SUFFIXES:
|
|
||||||
.SUFFIXES: .c .cc .C .cpp .o
|
|
||||||
obj/%.o : ../%.cpp
|
|
||||||
$(CXX) -o $@ $< -c $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -I.. -fPIC $(CPU_FLAGS)
|
|
||||||
obj:
|
|
||||||
mkdir -p obj
|
|
||||||
clean:
|
|
||||||
rm -fr obj $(SHARED_LIB)
|
|
||||||
.PHONY: all
|
|
||||||
.PHONY: clean
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
CPP_FILES := ../CryptoConst.cpp ../base64.cpp ../NTCPSession.cpp ../RouterInfo.cpp \
|
|
||||||
../Transports.cpp ../RouterContext.cpp ../NetDb.cpp ../LeaseSet.cpp Tunnel.cpp \
|
|
||||||
../TunnelEndpoint.cpp ../TunnelGateway.cpp ../TransitTunnel.cpp ../I2NPProtocol.cpp \
|
|
||||||
../Log.cpp ../Garlic.cpp ../Streaming.cpp ../Destination.cpp ../Identity.cpp \
|
|
||||||
../SSU.cpp ../SSUSession.cpp ../SSUData.cpp ../util.cpp ../Reseed.cpp ../SSUData.cpp \
|
|
||||||
../aes.cpp ../TunnelPool.cpp ../AddressBook.cpp ../Datagram.cpp ../api.cpp
|
|
||||||
H_FILES := ../CryptoConst.h ../base64.h ../NTCPSession.h ../RouterInfo.h ../Transports.h \
|
|
||||||
../RouterContext.h ../NetDb.h ../LeaseSet.h ../Tunnel.h ../TunnelEndpoint.h \
|
|
||||||
../TunnelGateway.h ../TransitTunnel.h ../I2NPProtocol.h ../Log.h ../Garlic.h \
|
|
||||||
../Streaming.h ../Destination.h ../Identity.h ../SSU.h ../SSUSession.h ../SSUData.h \
|
|
||||||
../util.h ../Reseed.h ../SSUData.h ../aes.h ../TunnelPool.h ../AddressBook.h ../version.h \
|
|
||||||
../Signature.h ../TransportSession.h ../Datagram.h ../api.h
|
|
||||||
OBJECTS = $(addprefix obj/, $(notdir $(CPP_FILES:.cpp=.o)))
|
|
@ -4,21 +4,18 @@ project ( "i2pd" )
|
|||||||
# configurale options
|
# configurale options
|
||||||
option(WITH_AESNI "Use AES-NI instructions set" OFF)
|
option(WITH_AESNI "Use AES-NI instructions set" OFF)
|
||||||
option(WITH_HARDENING "Use hardening compiler flags" OFF)
|
option(WITH_HARDENING "Use hardening compiler flags" OFF)
|
||||||
option(WITH_SHLIB "Build shared library" OFF)
|
option(WITH_LIBRARY "Build library" ON)
|
||||||
|
option(WITH_STATIC "Static build" OFF)
|
||||||
|
|
||||||
# paths
|
# paths
|
||||||
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 (SOURCES
|
set (COMMON_SRC
|
||||||
"${CMAKE_SOURCE_DIR}/AddressBook.cpp"
|
"${CMAKE_SOURCE_DIR}/AddressBook.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/CryptoConst.cpp"
|
"${CMAKE_SOURCE_DIR}/CryptoConst.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Daemon.cpp"
|
|
||||||
"${CMAKE_SOURCE_DIR}/Garlic.cpp"
|
"${CMAKE_SOURCE_DIR}/Garlic.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/HTTPProxy.cpp"
|
|
||||||
"${CMAKE_SOURCE_DIR}/HTTPServer.cpp"
|
|
||||||
"${CMAKE_SOURCE_DIR}/I2NPProtocol.cpp"
|
"${CMAKE_SOURCE_DIR}/I2NPProtocol.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/I2PTunnel.cpp"
|
|
||||||
"${CMAKE_SOURCE_DIR}/Identity.cpp"
|
"${CMAKE_SOURCE_DIR}/Identity.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/LeaseSet.cpp"
|
"${CMAKE_SOURCE_DIR}/LeaseSet.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Log.cpp"
|
"${CMAKE_SOURCE_DIR}/Log.cpp"
|
||||||
@ -27,10 +24,9 @@ set (SOURCES
|
|||||||
"${CMAKE_SOURCE_DIR}/Reseed.cpp"
|
"${CMAKE_SOURCE_DIR}/Reseed.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/RouterContext.cpp"
|
"${CMAKE_SOURCE_DIR}/RouterContext.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/RouterInfo.cpp"
|
"${CMAKE_SOURCE_DIR}/RouterInfo.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/SOCKS.cpp"
|
|
||||||
"${CMAKE_SOURCE_DIR}/SSU.cpp"
|
"${CMAKE_SOURCE_DIR}/SSU.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/SSUData.cpp"
|
"${CMAKE_SOURCE_DIR}/SSUData.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/SSUSession.cpp"
|
"${CMAKE_SOURCE_DIR}/SSUSession.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Streaming.cpp"
|
"${CMAKE_SOURCE_DIR}/Streaming.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Destination.cpp"
|
"${CMAKE_SOURCE_DIR}/Destination.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/TransitTunnel.cpp"
|
"${CMAKE_SOURCE_DIR}/TransitTunnel.cpp"
|
||||||
@ -39,22 +35,34 @@ set (SOURCES
|
|||||||
"${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}/UPnP.cpp"
|
|
||||||
"${CMAKE_SOURCE_DIR}/aes.cpp"
|
"${CMAKE_SOURCE_DIR}/aes.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/base64.cpp"
|
"${CMAKE_SOURCE_DIR}/base64.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/i2p.cpp"
|
|
||||||
"${CMAKE_SOURCE_DIR}/util.cpp"
|
"${CMAKE_SOURCE_DIR}/util.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/SAM.cpp"
|
"${CMAKE_SOURCE_DIR}/Datagram.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
set (DAEMON_SRC
|
||||||
"${CMAKE_SOURCE_DIR}/BOB.cpp"
|
"${CMAKE_SOURCE_DIR}/BOB.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/ClientContext.cpp"
|
"${CMAKE_SOURCE_DIR}/ClientContext.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Datagram.cpp"
|
"${CMAKE_SOURCE_DIR}/Daemon.cpp"
|
||||||
|
"${CMAKE_SOURCE_DIR}/HTTPProxy.cpp"
|
||||||
|
"${CMAKE_SOURCE_DIR}/HTTPServer.cpp"
|
||||||
|
"${CMAKE_SOURCE_DIR}/I2PTunnel.cpp"
|
||||||
|
"${CMAKE_SOURCE_DIR}/SAM.cpp"
|
||||||
|
"${CMAKE_SOURCE_DIR}/SOCKS.cpp"
|
||||||
|
"${CMAKE_SOURCE_DIR}/UPnP.cpp"
|
||||||
|
"${CMAKE_SOURCE_DIR}/i2p.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
set (LIBRARY_SRC
|
||||||
|
"${CMAKE_SOURCE_DIR}/api.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
file (GLOB HEADERS "${CMAKE_SOURCE_DIR}/*.h")
|
file (GLOB HEADERS "${CMAKE_SOURCE_DIR}/*.h")
|
||||||
|
|
||||||
# MSVS grouping
|
# MSVS grouping
|
||||||
source_group ("Header Files" FILES ${HEADERS})
|
source_group ("Header Files" FILES ${HEADERS})
|
||||||
source_group ("Source Files" FILES ${SOURCES})
|
source_group ("Source Files" FILES ${COMMON_SRC} ${DAEMON_SRC} ${LIBRARY_SRC})
|
||||||
|
|
||||||
# Default build is Debug
|
# Default build is Debug
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
@ -64,7 +72,7 @@ else ()
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# compiler flags customization (by vendor)
|
# compiler flags customization (by vendor)
|
||||||
add_definitions ( "-Wall -Wextra" )
|
add_definitions ( "-Wall -Wextra -fPIC" )
|
||||||
|
|
||||||
# check for c++11 support
|
# check for c++11 support
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
@ -83,7 +91,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
add_definitions( "-D_FORTIFY_SOURCE=2" )
|
add_definitions( "-D_FORTIFY_SOURCE=2" )
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat -Wformat-security -Werror=format-security" )
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat -Wformat-security -Werror=format-security" )
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector --param ssp-buffer-size=4" )
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector --param ssp-buffer-size=4" )
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE -pie" )
|
|
||||||
endif ()
|
endif ()
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
# more tweaks
|
# more tweaks
|
||||||
@ -91,13 +98,15 @@ 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 SOURCES "../DaemonLinux.cpp")
|
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/DaemonLinux.cpp")
|
||||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
list (APPEND SOURCES "../DaemonLinux.cpp")
|
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/DaemonLinux.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")
|
||||||
|
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/DaemonLinux.cpp")
|
||||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
list (APPEND SOURCES "../DaemonWin32.cpp")
|
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/DaemonWin32.cpp")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (WITH_AESNI)
|
if (WITH_AESNI)
|
||||||
@ -130,21 +139,26 @@ message(STATUS "Install prefix: : ${CMAKE_INSTALL_PREFIX}")
|
|||||||
message(STATUS "Options:")
|
message(STATUS "Options:")
|
||||||
message(STATUS " AESNI : ${WITH_AESNI}")
|
message(STATUS " AESNI : ${WITH_AESNI}")
|
||||||
message(STATUS " HARDENING : ${WITH_HARDENING}")
|
message(STATUS " HARDENING : ${WITH_HARDENING}")
|
||||||
message(STATUS " SHARED LIB : ${WITH_SHLIB}")
|
message(STATUS " LIBRARY : ${WITH_LIBRARY}")
|
||||||
|
message(STATUS " STATIC BUILD : ${WITH_STATIC}")
|
||||||
message(STATUS "---------------------------------------")
|
message(STATUS "---------------------------------------")
|
||||||
|
|
||||||
add_executable ( ${PROJECT_NAME} ${SOURCES} )
|
add_executable ( ${PROJECT_NAME} ${COMMON_SRC} ${DAEMON_SRC})
|
||||||
|
|
||||||
if (WITH_HARDENING AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if (WITH_HARDENING AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-z relro -z now" )
|
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-z relro -z now" )
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (WITH_STATIC)
|
||||||
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-static" )
|
||||||
|
endif ()
|
||||||
|
|
||||||
target_link_libraries( ${PROJECT_NAME} ${Boost_LIBRARIES} ${CRYPTO++_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
|
target_link_libraries( ${PROJECT_NAME} ${Boost_LIBRARIES} ${CRYPTO++_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
|
||||||
|
|
||||||
install(TARGETS i2pd RUNTIME DESTINATION "bin")
|
install(TARGETS i2pd RUNTIME DESTINATION "bin")
|
||||||
|
|
||||||
if (WITH_SHLIB)
|
if (WITH_LIBRARY)
|
||||||
list(APPEND SOURCES "${CMAKE_SOURCE_DIR}/api.cpp")
|
add_library("lib${PROJECT_NAME}" SHARED ${COMMON_SRC} ${LIBRARY_SRC})
|
||||||
add_library("lib${PROJECT_NAME}" SHARED ${SOURCES})
|
|
||||||
install(TARGETS "lib${PROJECT_NAME}" LIBRARY DESTINATION "lib")
|
install(TARGETS "lib${PROJECT_NAME}" LIBRARY DESTINATION "lib")
|
||||||
endif ()
|
endif ()
|
||||||
|
31
filelist.mk
31
filelist.mk
@ -1,21 +1,14 @@
|
|||||||
|
COMMON_SRC = \
|
||||||
|
AddressBook.cpp CryptoConst.cpp Datagram.cpp Garlic.cpp I2NPProtocol.cpp \
|
||||||
|
LeaseSet.cpp Log.cpp NTCPSession.cpp NetDb.cpp Reseed.cpp RouterContext.cpp \
|
||||||
|
RouterInfo.cpp SSU.cpp SSUSession.cpp SSUData.cpp Streaming.cpp Identity.cpp \
|
||||||
|
TransitTunnel.cpp Transports.cpp Tunnel.cpp TunnelEndpoint.cpp TunnelPool.cpp \
|
||||||
|
TunnelGateway.cpp Destination.cpp util.cpp aes.cpp base64.cpp
|
||||||
|
|
||||||
|
# also: Daemon{Linux,Win32}.cpp will be added later
|
||||||
|
DAEMON_SRC = $(COMMON_SRC) \
|
||||||
|
BOB.cpp ClientContext.cpp Daemon.cpp I2PTunnel.cpp SAM.cpp SOCKS.cpp UPnP.cpp \
|
||||||
|
HTTPServer.cpp HTTPProxy.cpp i2p.cpp
|
||||||
|
|
||||||
CPP_FILES := CryptoConst.cpp base64.cpp NTCPSession.cpp RouterInfo.cpp Transports.cpp \
|
LIB_SRC := $(COMMON_SRC) \
|
||||||
RouterContext.cpp NetDb.cpp LeaseSet.cpp Tunnel.cpp TunnelEndpoint.cpp TunnelGateway.cpp \
|
api.cpp
|
||||||
TransitTunnel.cpp I2NPProtocol.cpp Log.cpp Garlic.cpp HTTPServer.cpp Streaming.cpp \
|
|
||||||
Destination.cpp Identity.cpp SSU.cpp SSUSession.cpp SSUData.cpp util.cpp Reseed.cpp \
|
|
||||||
DaemonLinux.cpp SSUData.cpp aes.cpp SOCKS.cpp UPnP.cpp TunnelPool.cpp HTTPProxy.cpp \
|
|
||||||
AddressBook.cpp Daemon.cpp I2PTunnel.cpp SAM.cpp BOB.cpp ClientContext.cpp \
|
|
||||||
Datagram.cpp i2p.cpp
|
|
||||||
|
|
||||||
|
|
||||||
H_FILES := CryptoConst.h base64.h NTCPSession.h RouterInfo.h Transports.h \
|
|
||||||
RouterContext.h NetDb.h LeaseSet.h Tunnel.h TunnelEndpoint.h TunnelGateway.h \
|
|
||||||
TransitTunnel.h I2NPProtocol.h Log.h Garlic.h HTTPServer.h Streaming.h Destination.h \
|
|
||||||
Identity.h SSU.h SSUSession.h SSUData.h util.h Reseed.h DaemonLinux.h SSUData.h \
|
|
||||||
aes.h SOCKS.h UPnP.h TunnelPool.h HTTPProxy.h AddressBook.h Daemon.h I2PTunnel.h \
|
|
||||||
version.h Signature.h SAM.h BOB.h ClientContext.h TransportSession.h Datagram.h
|
|
||||||
|
|
||||||
|
|
||||||
OBJECTS = $(addprefix obj/, $(notdir $(CPP_FILES:.cpp=.o)))
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user