Skip to content

Commit

Permalink
style: First commit for github
Browse files Browse the repository at this point in the history
  • Loading branch information
keenbo committed Nov 13, 2019
0 parents commit 268f052
Show file tree
Hide file tree
Showing 1,644 changed files with 706,658 additions and 0 deletions.
5 changes: 5 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Names should be added to this file like so:
# Name or Organization <email address>

xibaocao <xibaocao@tencent.com>
datonli <datonli@tencent.com>
64 changes: 64 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
cmake_minimum_required(VERSION 2.8.12)
project(wwsearch)

option(WITH_ROCKSDB "build with rocksdb" ON)
option(WITH_SNAPPY "build with snappy" ON)
option(WITH_TESTS "build with ut" OFF)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules/")

set(CMAKE_COMMON_FLAGS "-DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -DOS_LINUX -fno-builtin-memcmp -DZLIB -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_PTHREAD_ADAPTIVE_MUTEX -DROCKSDB_BACKTRACE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -march=native -DHAVE_SSE42 -DHAVE_PCLMUL -DROCKSDB_SUPPORT_THREAD_LOCAL -DWITH_TESTS=OFF")
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_COMMON_FLAGS} -lpthread -lrt -lz -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_COMMON_FLAGS} -lpthread -std=c++11 -lrt -lz -g")
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -ldl -lrt")
#set(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++ -static-libgcc")
set(WWSEARCH_DIR ${CMAKE_CURRENT_SOURCE_DIR})

# add search path for build rocksdb
set(CMAKE_INCLUDE_PATH "${WWSEARCH_DIR}/deps/snappy/include")
set(CMAKE_LIBRARY_PATH "${WWSEARCH_DIR}/deps/snappy/lib")


add_subdirectory(${WWSEARCH_DIR}/deps/rocksdb)
add_subdirectory(${WWSEARCH_DIR}/deps/tokenizer)

link_libraries(rocksdb)
link_libraries(tokenizer)
link_libraries(gtest)

include_directories(
${WWSEARCH_DIR}
${WWSEARCH_DIR}/include
${WWSEARCH_DIR}/deps/rocksdb/
${WWSEARCH_DIR}/deps/rocksdb/include
${WWSEARCH_DIR}/deps/rocksdb/third-party/gtest-1.7.0/fused-src
${WWSEARCH_DIR}/deps/tokenizer/include
${WWSEARCH_DIR}/unittest
)

file(GLOB WWSEARCH_SRC_DIR ./src/*.cpp ./include/*.cc)
ADD_LIBRARY(wwsearch ${WWSEARCH_SRC_DIR})

include_directories(${WWSEARCH_DIR}/deps/protobuf/include/)
FIND_LIBRARY(PROTOBUF_LIB NAMES libprotobuf.a HINTS ${WWSEARCH_DIR}/deps/protobuf/lib NO_DEFAULT_PATH)
#link_libraries(protobuf)

include_directories(${WWSEARCH_DIR}/deps/snappy/include)
FIND_LIBRARY(SNAPPY_LIB NAMES libsnappy.a HINTS ${WWSEARCH_DIR}/deps/snappy/lib NO_DEFAULT_PATH)

target_link_libraries(wwsearch rocksdb tokenizer -Lprotobuf ${PROTOBUF_LIB} -Lsnappy ${SNAPPY_LIB})

file(GLOB WWSEARCH_UT_DIR ./unittest/*.cpp)

add_executable(wwsearch_example example/example.cpp)
target_link_libraries(wwsearch_example wwsearch)

include_directories(${WWSEARCH_DIR}/benchmark)
file(GLOB WWSEARCH_BEN_DIR ./benchmark/*.cpp)
add_executable(wwsearch_ben ${WWSEARCH_BEN_DIR})
target_link_libraries(wwsearch_ben wwsearch)

set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_COMMON_FLAGS} -lpthread -lrt -lz -g -Dprivate=public")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_COMMON_FLAGS} -lpthread -std=c++11 -lrt -lz -g -Dprivate=public")
add_executable(wwsearch_ut ${WWSEARCH_UT_DIR})
target_link_libraries(wwsearch_ut wwsearch gtest)
72 changes: 72 additions & 0 deletions Contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Contributing

我们提倡您通过提 issue 和 pull request 方式来促进 wwsearch 的发展。

## Acknowledgements

wwsearch 持续招募贡献者,即使是在 issue 中回答问题,或者做一些简单的 bugfix ,也会给 wwsearch 带来很大的帮助。

## Issue 提交

#### 对于贡献者

在提 issue 前请确保满足一下条件:

- 必须是一个 bug 或者功能新增。
- 已经在 issue 中搜索过,并且没有找到相似的 issue 或者解决方案。

## Pull request

我们除了希望听到您的反馈和建议外,我们也希望您接受代码形式的直接帮助,对我们的 GitHub 发出 pull request 请求。

以下是具体步骤:

#### Fork仓库

点击 `Fork` 按钮,将需要参与的项目仓库 fork 到自己的 Github 中。

#### Clone 已 fork 项目

在自己的 github 中,找到 fork 下来的项目,git clone 到本地。

```bash
$ git clone git@github.com:<yourname>/wwsearch.git
```

#### 添加 wwsearch 仓库

将 fork 源仓库连接到本地仓库:

```bash
$ git remote add <name> <url>
# 例如:
$ git remote add wwsearch git@github.com:Tencent/wwsearch.git
```

#### 保持与 wwsearch 仓库的同步

更新上游仓库:

```bash
$ git pull --rebase <name> <branch>
# 等同于以下两条命令
$ git fetch <name> <branch>
$ git rebase <name>/<branch>
```

#### 开发调试代码

您需要在Linux平台编译执行。
```bash
mkdir build
cd build
cmake ..
make -j32
cp ../deps/tokenizer/etc/wwsearch_* .
```

编译完成将可以看到:

wwsearch_ut : 单元测试;
wwsearch_example : 简单示例,包括index和query。
接下来可以愉快使用啦,enjoy it!
Loading

0 comments on commit 268f052

Please sign in to comment.