From ed6416a30dd0ffdeb3e6ccaab1d54bbe4a35cb78 Mon Sep 17 00:00:00 2001 From: broncotc Date: Fri, 11 Aug 2017 10:45:40 +0800 Subject: [PATCH] add cmake support and fix compile errors --- CMakeLists.txt | 17 +++++++++++++++++ encrypt.cpp | 10 ++++++---- log.cpp | 2 +- log.h | 2 +- main.cpp | 4 +++- 5 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7eed1d4 --- /dev/null +++ b/CMakeLists.txt @@ -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}) \ No newline at end of file diff --git a/encrypt.cpp b/encrypt.cpp index ab5edf2..4038147 100755 --- a/encrypt.cpp +++ b/encrypt.cpp @@ -1,11 +1,13 @@ -#include -#include +extern "C"{ + #include "lib/aes.h" + #include "lib/md5.h" +} #include #include #include #include -#include -#include +#include "encrypt.h" +#include "common.h" #include "log.h" //static uint64_t seq=1; diff --git a/log.cpp b/log.cpp index 31255e1..9e9365d 100755 --- a/log.cpp +++ b/log.cpp @@ -1,4 +1,4 @@ -#include +#include "log.h" int log_level=log_info; diff --git a/log.h b/log.h index 07efc13..30e3b36 100755 --- a/log.h +++ b/log.h @@ -44,7 +44,7 @@ #include #include -#include +#include "encrypt.h" #include #include diff --git a/main.cpp b/main.cpp index a44d5be..7526efd 100755 --- a/main.cpp +++ b/main.cpp @@ -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;