Skip to content

Commit

Permalink
Quick Start first
Browse files Browse the repository at this point in the history
  • Loading branch information
yedongfu committed Apr 18, 2019
1 parent fc3aea3 commit 482dd46
Showing 1 changed file with 37 additions and 29 deletions.
66 changes: 37 additions & 29 deletions README-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,10 @@ can use valgrind to check memory leak
only 10 lines can finish a complete server

## Usage
### Build handy shared library and examples:
```
$ git clone https://github.com/yedf/handy
$ cd handy && mkdir build && cd build
$ cmake -DBUILD_HANDY_SHARED_LIBRARY=ON -DBUILD_HANDY_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=/tmp/handy ..
$ make -j4
$ make install
$ ls /tmp/handy
bin include lib64
$ ls /tmp/handy/bin/
10m-cli 10m-svr codec-cli codec-svr daemon echo hsha http-hello idle-close reconnect safe-close stat timer udp-cli udp-hsha udp-svr write-on-empty
$ ls /tmp/handy/lib64/
libhandy_s.a libhandy.so
```

### As a static library in your own programs:
* add handy as a git submodule to say a folder called vendor
* in your CMakeLists.txt

### Quick start
```
add_subdirectory("vendor/handy" EXCLUDE_FROM_ALL)
add_executable(${PROJECT_NAME} main.cpp)
target_include_directories(${PROJECT_NAME} PUBLIC
"vendor/handy"
)
target_link_libraries(${PROJECT_NAME} PUBLIC
handy_s
)
make && make install
```

### sample --echo-server
Expand Down Expand Up @@ -103,6 +76,41 @@ examples can be found in directory protobuf
###[hand book](https://github.com/yedf/handy/blob/master/doc-cn.md)
## Advanced build option
### Build handy shared library and examples:
```
$ git clone https://github.com/yedf/handy
$ cd handy && mkdir build && cd build
$ cmake -DBUILD_HANDY_SHARED_LIBRARY=ON -DBUILD_HANDY_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=/tmp/handy ..
$ make -j4
$ make install
$ ls /tmp/handy
bin include lib64
$ ls /tmp/handy/bin/
10m-cli 10m-svr codec-cli codec-svr daemon echo hsha http-hello idle-close reconnect safe-close stat timer udp-cli udp-hsha udp-svr write-on-empty
$ ls /tmp/handy/lib64/
libhandy_s.a libhandy.so
```
### As a static library in your own programs:
* add handy as a git submodule to say a folder called vendor
* in your CMakeLists.txt
```
add_subdirectory("vendor/handy" EXCLUDE_FROM_ALL)

add_executable(${PROJECT_NAME} main.cpp)

target_include_directories(${PROJECT_NAME} PUBLIC
"vendor/handy"
)

target_link_libraries(${PROJECT_NAME} PUBLIC
handy_s
)
```

license
====
Use of this source code is governed by a BSD-style
Expand Down

0 comments on commit 482dd46

Please sign in to comment.