@ -52,7 +52,6 @@ if(N2N_OPTION_USE_PTHREAD)
endif ( NOT PTHREAD_LIB )
endif ( NOT PTHREAD_LIB )
MESSAGE ( INFO "Using libpthread." )
MESSAGE ( INFO "Using libpthread." )
ADD_DEFINITIONS ( "-DHAVE_PTHREAD" )
ADD_DEFINITIONS ( "-DHAVE_PTHREAD" )
target_link_libraries ( n2n pthread )
endif ( N2N_OPTION_USE_PTHREAD )
endif ( N2N_OPTION_USE_PTHREAD )
if ( N2N_OPTION_USE_OPENSSL )
if ( N2N_OPTION_USE_OPENSSL )
@ -67,32 +66,31 @@ if(N2N_OPTION_USE_OPENSSL)
endif ( )
endif ( )
include_directories ( ${ OPENSSL_INCLUDE_DIR } )
include_directories ( ${ OPENSSL_INCLUDE_DIR } )
add_definitions ( -DHAVE_OPENSSL_1_1 )
add_definitions ( -DHAVE_OPENSSL_1_1 )
# target_link_libraries ( n2n crypto )
target_link_libraries ( n2n ${ OPENSSL_LIBRARIES } )
endif ( N2N_OPTION_USE_OPENSSL )
endif ( N2N_OPTION_USE_OPENSSL )
if ( N2N_OPTION_USE_ZSTD )
if ( N2N_OPTION_USE_ZSTD )
find_library ( LIBZSTD libztd )
# T O D O : t h e find_library ( ) c a l l w o r k s f o r s o m e o f t h e c o n f i g , b u t n o t o t h e r s
if ( NOT LIBZSTD )
# find_library ( LIBZSTD libzstd )
MESSAGE ( FATAL_ERROR "libzstd not found." )
# if ( NOT LIBZSTD )
endif ( NOT LIBZSTD )
# MESSAGE ( FATAL_ERROR "libzstd not found." )
# endif ( NOT LIBZSTD )
MESSAGE ( INFO "Using libztd." )
MESSAGE ( INFO "Using libztd." )
add_definitions ( -DN2N_HAVE_ZSTD )
add_definitions ( -DN2N_HAVE_ZSTD )
target_link_libraries ( n2n zstd )
endif ( N2N_OPTION_USE_ZSTD )
endif ( N2N_OPTION_USE_ZSTD )
if ( N2N_OPTION_USE_PCAPLIB )
if ( N2N_OPTION_USE_PCAPLIB )
find_library ( PCAP_LIB pcap )
# T O D O : t h e find_library ( ) c a l l w o r k s f o r s o m e o f t h e c o n f i g , b u t n o t o t h e r s
if ( NOT PCAP_LIB )
# find_library ( PCAP_LIB pcap )
MESSAGE ( FATAL_ERROR "libpcap not found." )
# if ( NOT PCAP_LIB )
endif ( NOT PCAP_LIB )
# MESSAGE ( FATAL_ERROR "libpcap not found." )
# endif ( NOT PCAP_LIB )
# T O D O
# T O D O
# - t h i s i s d i f f e r e n t t o t h e c o n f i g u r e . a c l o g i c
# - t h i s i s d i f f e r e n t t o t h e c o n f i g u r e . a c l o g i c
check_function_exists ( pcap_set_immediate_mode HAVE_PCAP_IMMEDIATE_MODE )
check_function_exists ( pcap_set_immediate_mode HAVE_PCAP_IMMEDIATE_MODE )
IF ( NOT HAVE_PCAP_IMMEDIATE_MODE )
IF ( NOT HAVE_PCAP_IMMEDIATE_MODE )
MESSAGE ( FATAL_ERROR "libpcap not support pcap_set_immediate_modei ()" )
MESSAGE ( FATAL_ERROR "libpcap not support pcap_set_immediate_mode()" )
ENDIF ( HAVE_PCAP_IMMEDIATE_MODE )
ENDIF ( NOT HAVE_PCAP_IMMEDIATE_MODE )
MESSAGE ( INFO "Using libpcap." )
MESSAGE ( INFO "Using libpcap." )
ADD_DEFINITIONS ( "-DHAVE_PCAP_IMMEDIATE_MODE" )
ADD_DEFINITIONS ( "-DHAVE_PCAP_IMMEDIATE_MODE" )
@ -107,14 +105,14 @@ endif(N2N_OPTION_USE_PCAPLIB)
if ( N2N_OPTION_USE_CAPLIB )
if ( N2N_OPTION_USE_CAPLIB )
# L i n u x C a p a b i l i t i e s
# L i n u x C a p a b i l i t i e s
find_library ( CAP_LIB cap )
# T O D O : t h e find_library ( ) c a l l w o r k s f o r s o m e o f t h e c o n f i g , b u t n o t o t h e r s
if ( NOT CAP_LIB )
# find_library ( CAP_LIB cap )
MESSAGE ( FATAL_ERROR "libcap not found." )
# if ( NOT CAP_LIB )
endif ( NOT CAP_LIB )
# MESSAGE ( FATAL_ERROR "libcap not found." )
# endif ( NOT CAP_LIB )
MESSAGE ( INFO "Using libpcap." )
MESSAGE ( INFO "Using libpcap." )
ADD_DEFINITIONS ( "-DHAVE_LIBCAP" )
ADD_DEFINITIONS ( "-DHAVE_LIBCAP" )
target_link_libraries ( edge cap.a )
# T O D O :
# T O D O :
# - T h i s v a r i a b l e i s a l s o s e t e l s e w h e r e , I d o n t t h i n k i t w o r k s t h i s w a y
# - T h i s v a r i a b l e i s a l s o s e t e l s e w h e r e , I d o n t t h i n k i t w o r k s t h i s w a y
@ -126,13 +124,11 @@ if(N2N_OPTION_USE_PORTMAPPING)
include_directories ( ${ THIRD_PARTY_DIR } /miniupnp/miniupnpc/include )
include_directories ( ${ THIRD_PARTY_DIR } /miniupnp/miniupnpc/include )
add_subdirectory ( ${ THIRD_PARTY_DIR } /miniupnp/miniupnpc lib_miniupnpc )
add_subdirectory ( ${ THIRD_PARTY_DIR } /miniupnp/miniupnpc lib_miniupnpc )
link_directories ( ${ PROJECT_BINARY_DIR } /lib_miniupnpc )
link_directories ( ${ PROJECT_BINARY_DIR } /lib_miniupnpc )
target_link_libraries ( n2n libminiupnpc-static )
ADD_DEFINITIONS ( "-DHAVE_NATPMP" )
ADD_DEFINITIONS ( "-DHAVE_NATPMP" )
include_directories ( ${ THIRD_PARTY_DIR } /libnatpmp )
include_directories ( ${ THIRD_PARTY_DIR } /libnatpmp )
add_subdirectory ( ${ THIRD_PARTY_DIR } /libnatpmp libnatpmp )
add_subdirectory ( ${ THIRD_PARTY_DIR } /libnatpmp libnatpmp )
link_directories ( ${ PROJECT_BINARY_DIR } /libnatpmp )
link_directories ( ${ PROJECT_BINARY_DIR } /libnatpmp )
target_link_libraries ( n2n natpmp )
# T O D O :
# T O D O :
# - t h i s i s t h e o d d o n e o u t , i s i t n e e d e d ?
# - t h i s i s t h e o d d o n e o u t , i s i t n e e d e d ?
@ -229,6 +225,29 @@ target_link_libraries(example_edge_embed n2n)
add_executable ( example_sn_embed src/example_sn_embed.c )
add_executable ( example_sn_embed src/example_sn_embed.c )
target_link_libraries ( example_sn_embed n2n )
target_link_libraries ( example_sn_embed n2n )
if ( N2N_OPTION_USE_PTHREAD )
target_link_libraries ( n2n pthread )
endif ( N2N_OPTION_USE_PTHREAD )
if ( N2N_OPTION_USE_OPENSSL )
# target_link_libraries ( n2n crypto )
target_link_libraries ( n2n ${ OPENSSL_LIBRARIES } )
endif ( N2N_OPTION_USE_OPENSSL )
if ( N2N_OPTION_USE_ZSTD )
target_link_libraries ( n2n zstd )
endif ( N2N_OPTION_USE_ZSTD )
if ( N2N_OPTION_USE_CAPLIB )
# T O D O : t h i s i s a s t a t i c l i b r a r y , s h o u l d n t w e h a v e a g e n e r i c o n e ?
target_link_libraries ( edge cap.a )
endif ( N2N_OPTION_USE_CAPLIB )
if ( N2N_OPTION_USE_PORTMAPPING )
target_link_libraries ( n2n libminiupnpc-static )
target_link_libraries ( n2n natpmp )
endif ( N2N_OPTION_USE_PORTMAPPING )
install ( TARGETS edge supernode
install ( TARGETS edge supernode
R U N T I M E D E S T I N A T I O N s b i n
R U N T I M E D E S T I N A T I O N s b i n
L I B R A R Y D E S T I N A T I O N l i b
L I B R A R Y D E S T I N A T I O N l i b