Skip to content

Commit

Permalink
支持安装
Browse files Browse the repository at this point in the history
  • Loading branch information
xukeawsl committed May 29, 2023
1 parent 267bd0d commit 3667e52
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
25 changes: 24 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,27 @@ else()
message(STATUS "This operating system is not supported")
endif()

target_link_libraries(${PROJECT_NAME} PUBLIC ${SOCKS_LIB_NAME})
target_link_libraries(${PROJECT_NAME} PUBLIC ${SOCKS_LIB_NAME})


# ---------------------------------------------------------------------------------------
# Install
# ---------------------------------------------------------------------------------------
include(GNUInstallDirs)

set(INSTALL_BINDIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/${CMAKE_BUILD_TYPE}/${CMAKE_INSTALL_BINDIR})
set(INSTALL_SYSCONF ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/${CMAKE_BUILD_TYPE})

install(TARGETS ${PROJECT_NAME} ${SOCKS_LIB_NAME}
ARCHIVE
DESTINATION ${INSTALL_BINDIR}
LIBRARY
DESTINATION ${INSTALL_BINDIR}
RUNTIME
DESTINATION ${INSTALL_BINDIR}
)

install(
FILES ${CMAKE_SOURCE_DIR}/config.json
DESTINATION ${INSTALL_SYSCONF}
)
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ cmake --build .
cmake -DLOG_LEVEL=Info ..
```

## 设置安装目录
```bash
# Linux
cmake -DCMAKE_PREFIX=/usr/local ..

# Windows
cmake -G "MinGW Makefiles" -DCMAKE_PREFIX=D:/ ..
```

## 安装
```bash
cmake --build . --target install
```

## 配置服务器参数
* 通过修改 `config.json` 文件内容进行服务器参数配置
```json
Expand Down Expand Up @@ -237,7 +251,6 @@ perf script > out.perf

## TODO
### 1. 功能扩展
* 支持安装
* 配置文件优化
* 支持 `BIND` 命令
* 支持配置数据库,添加多对用户名和密码

0 comments on commit 3667e52

Please sign in to comment.