Skip to content

Commit

Permalink
可以编译
Browse files Browse the repository at this point in the history
  • Loading branch information
huo_hongbin committed Nov 23, 2016
1 parent 3336ca7 commit 3e42016
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 5 deletions.
16 changes: 16 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
cmake_minimum_required(VERSION 3.6)
project(share_me)

IF(UNIX)
ADD_DEFINITIONS(-D__unix__)
ELSEIF(WIN32)
ADD_DEFINITIONS(-D_WIN32)
ENDIF(UNIX)

SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)

# ADD_SUBDIRECTORY(common)
ADD_SUBDIRECTORY(FileTransfer)

# INCLUDE_DIRECTORIES(./common/ftplib)

add_executable(main main.cpp)

# TARGET_LINK_LIBRARIES(main ftp)
4 changes: 4 additions & 0 deletions src/FileTransfer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

AUX_SOURCE_DIRECTORY(. SRC_LIST)

ADD_LIBRARY(FileTransfer STATIC ${SRC_LIST})
15 changes: 15 additions & 0 deletions src/FileTransfer/FileTransfer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "FileTransfer.h"

#include <iostream>

FileTransferServer* FileTransferServer::Instanse() {
static FileTransferServer* f = NULL;
if ( f == NULL ) {
f = new FileTransferServer();
}
return f;
}

bool FileTransferServer::Config() {
return true;
}
16 changes: 16 additions & 0 deletions src/FileTransfer/FileTransfer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef SHARE_ME_FILE_TRANSFER
#define SHARE_ME_FILE_TRANSFER

class FileTransferServer {
private:
FileTransferServer(){};
~FileTransferServer(){};

public:
static FileTransferServer* Instanse();

bool Config();

};

#endif
3 changes: 3 additions & 0 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

ADD_SUBDIRECTORY(ftplib)
6 changes: 1 addition & 5 deletions src/common/ftplib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ SET(SSRC ftplib.c)

MESSAGE(STATUS "plate ${CMAKE_SYSTEM} ${CMAKE_SYSTEM_PROCESSOR}")

IF(UNIX)
ADD_DEFINITIONS(-D__unix__)
ELSEIF(WIN32)
ADD_DEFINITIONS(-D_WIN32)
ENDIF(UNIX)


ADD_LIBRARY(ftp STATIC ${SSRC})
Empty file added src/ftp/CMakeLists.txt
Empty file.
4 changes: 4 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

// #include "ftplib.h"

int main (int argc, char *argv[])
{
// FtpInit();
if (argc < 2)
{
fprintf(stdout,"Usage: %s number\n",argv[0]);
Expand Down

0 comments on commit 3e42016

Please sign in to comment.