add cmake support and fix compile errors

This commit is contained in:
broncotc 2017-08-11 10:45:40 +08:00
parent eb8567b693
commit ed6416a30d
5 changed files with 28 additions and 7 deletions

17
CMakeLists.txt Normal file

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.7)
project(udp2raw_tunnel)
set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILES
lib/aes.c
lib/md5.c
common.cpp
encrypt.cpp
log.cpp
main.cpp
network.cpp
)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused-variable -Wno-unused-parameter -static")
set(CMAKE_LINK_LIBRARY_FLAG "-lrt")
add_executable(udp2raw_tunnel ${SOURCE_FILES})

@ -1,11 +1,13 @@
#include <lib/aes.h>
#include <lib/md5.h>
extern "C"{
#include "lib/aes.h"
#include "lib/md5.h"
}
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <encrypt.h>
#include <common.h>
#include "encrypt.h"
#include "common.h"
#include "log.h"
//static uint64_t seq=1;

@ -1,4 +1,4 @@
#include <log.h>
#include "log.h"
int log_level=log_info;

2
log.h

@ -44,7 +44,7 @@
#include <sys/timerfd.h>
#include <set>
#include <encrypt.h>
#include "encrypt.h"
#include <inttypes.h>
#include <sys/ioctl.h>

@ -1,7 +1,9 @@
#include "common.h"
#include "network.h"
#include "log.h"
#include "lib/md5.h"
extern "C" {
#include "lib/md5.h"
}
char local_address[100]="0.0.0.0", remote_address[100]="255.255.255.255",source_address[100]="0.0.0.0";
u32_t local_address_uint32,remote_address_uint32,source_address_uint32;