Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build/
.idea
cmake-build-debug
Lib
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/cids-server.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
cmake_minimum_required(VERSION 3.00)
project(cids_server_new)

#Global Setting
SET(CMAKE_CXX_FLAGS -pthread)

SET(CMAKE_CXX_STANDARD 14)

#Thir Lib

#find- nanodbc
if(NOT TARGET nanodbc)
find_package(nanodbc CONFIG REQUIRED)
endif()

#find- rapidjson
find_package(RapidJSON REQUIRED)

#already put muduo in the project

#add include
include_directories(Include)
include_directories(Include/Third_Lib)

include_directories(${RapidJSON_INCLUDE_DIR})
#muduo in Include/Third_lib
#nanodbc in Include/Third_lib

#add lib
link_directories(Lib)

#My src
aux_source_directory(Src/Center CENTER_SRC)
aux_source_directory(Src/Mirror MIRROR_SRC)
aux_source_directory(Src/Common COMMON_SRC)

#生成可执行文件

add_executable(center ${CENTER_SRC} ${COMMON_SRC})
add_executable(mirror ${MIRROR_SRC} ${COMMON_SRC})

#Center绑定包
target_link_libraries(center libmuduo_base.a libmuduo_net.a) #绑定muduo包


#Center修改输出属性
set_target_properties(center PROPERTIES OUTPUT_NAME cids_Center)
set_target_properties(center PROPERTIES PREFIX "")
set_target_properties(center PROPERTIES SUFFIX "")


#Mirror绑定包
target_link_libraries(mirror libmuduo_base.a libmuduo_net.a) #绑定muduo包
target_link_libraries(mirror ${RapidJSON_LIBS}) #绑定rapidjson包
target_link_libraries(mirror nanodbc) #绑定nanodbc包

#Mirror修改输出树形
set_target_properties(mirror PROPERTIES OUTPUT_NAME cids_Mirror)
set_target_properties(mirror PROPERTIES PREFIX "")
set_target_properties(mirror PROPERTIES SUFFIX "")
174 changes: 174 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,176 @@
# cids-servers

center server ,mirror server and driver



your project path and other library project path should be like this:



- dir

- cids-server

- rapidjson
- nanodbc

- muduo



after clone this project



## Imporve projectPath

```bash
-- mkdir lib #to find libraries

-- mkdir include #to find headers
```

------



## Compile rapidJson

```bash
git clone <https://github.com/Tencent/rapidjson.git> #download rapidjson

cd rapidjson #change to rapidjson dir

mkdir build #Put compiler output in build file

cd build #change to build dir

cmake .. #generate Makefile

make #generate other things you can add '-j4' after 'make' to make it faster

sudo make install #generate lib files and put them in /usr/lib(maybe)
```

------



## Compile nanodbc

Before you compile nanodbc, you should download UnixOdbc:

### download mariadb and configure

### download unixodbc

` sudo apt install unixodbc `

### download unixODBC-2.3.0.tar.gz -> to download odbc_config

Download unixODBC-2.3.0.tar.gz ,you can also use `sudo apt install unixodbc ` to download but it's unuseful to my system

```bash
tar -xzvf unixODBC-2.3.0.tar.gz

cd unixODBC-2.3.0.tar.gz

./configure --enable-gui=no

make

sudo make install

odbc_config --version #check odbc_config is installed

```

### download odbc-mariadb
{
`sudo apt install odbc-mariadb`

}

### configure odbc-mariadb

see complete info on "https://mariadb.com/kb/en/creating-a-data-source-with-mariadb-connectorodbc/"

[MariaDB ODBC 3.0 Driver]
Description = MariaDB Connector/ODBC v.3.0
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so



```bash
git clone <https://github.com/nanodbc/nanodbc.git> #download nanodbc

cd nanodbc #change to nanodbc dir

mkdir build #Put compiler output in build file

cd build #change to build dir

cmake .. #generate Makefile

make #generate other things you can add '-j4' after 'make' to make it faster

sudo make install #add lib to your env

```
add these statements to your CMakeLists.txt

```cmake
if (NOT TARGET nanodbc)
find_package(nanodbc CONFIG REQUIRED)
endif()

#add exe here

target_link_libraries(SRC nanodbc)



------



## Compiler muduo

```bash
git clone <https://github.com/chenshuo/muduo.git> #download muduo

cd muduo #change to muduo dir

cp -r muduo ../cids-servser/include #copy include file to projectPath/include

mkdir build #Put compiler output in build file

cd build #change to build dir

cmake .. #generate Makefile

make #generate other things you can add '-j4' after 'make' to make it faster

cd lib #change to lib dir

cp * ../../../cids-servsers/lib #put lib file to projectPath/lib

```

------



## now your project will like this:

- cids-servsers
- include
- muduo
- net
- base
- nanodbc
- lib
- libxxx.a #7/10 lib files


Loading