Skip to content

Commit 518549f

Browse files
authored
Remove handwritten makefiles to keep only one build system (apache#576)
1 parent 6ab3ff4 commit 518549f

17 files changed

+46
-486
lines changed

.github/workflows/daily-ci.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ jobs:
6161

6262
- name: Build
6363
run: |
64-
git submodule init && git submodule update
6564
mkdir _build && cd _build
6665
cmake -DDISABLE_JEMALLOC=true -DCMAKE_BUILD_TYPE=Release ..
6766
make -j4 kvrocks kvrocks2redis
@@ -82,12 +81,13 @@ jobs:
8281

8382
- name: Install Dependencies
8483
run: |
85-
brew install snappy googletest gcc autoconf automake libtool
84+
brew install cmake gcc autoconf automake libtool
8685
mkdir build
8786
- name: Build
8887
run: |
88+
cd build
89+
cmake ..
8990
make -j4
90-
cp src/kvrocks build/kvrocks
9191
- name: Unit Test
9292
run: make test
9393

.github/workflows/kvrocks.yaml

+12-33
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,24 @@ jobs:
4848
sudo apt-get update
4949
sudo apt-get install -y cppcheck
5050
sudo pip install cpplint==1.5.0
51-
sudo apt-get install -y tar libsnappy-dev
51+
sudo apt-get install -y tar cmake
5252
mkdir build
5353
5454
- name: Lint
5555
run: |
56-
make lint
56+
./cpplint.sh
57+
./cppcheck.sh
5758
5859
- name: Build
5960
run: |
61+
cd build
62+
cmake ..
6063
make -j4
61-
cp src/kvrocks build/kvrocks
64+
cd ..
6265
6366
- name: Unit Test
6467
run: |
65-
wget https://github.com/google/googletest/archive/release-1.8.1.tar.gz
66-
tar -zxvf release-1.8.1.tar.gz
67-
cd googletest-release-1.8.1/
68-
cmake CMakeLists.txt
69-
make && sudo make install && cd -
70-
make test
68+
./build/unittest
7169
7270
- name: Redis Tcl Test
7371
run: |
@@ -79,28 +77,6 @@ jobs:
7977
cd tests/tcl && sh runtest
8078
sh runtest --single integration/redis-cli && cd -
8179
82-
build-on-ubuntu-with-cmake:
83-
strategy:
84-
matrix:
85-
os: [ubuntu-18.04]
86-
runs-on: ${{ matrix.os }}
87-
needs: [license]
88-
steps:
89-
- name: Checkout Code Base
90-
uses: actions/[email protected]
91-
with:
92-
fetch-depth: 64
93-
94-
- name: Install Dependencies
95-
run: |
96-
sudo apt update
97-
sudo apt-get install -y gcc g++ cmake
98-
mkdir _build
99-
100-
- name: Build
101-
run: |
102-
sh build.sh _build
103-
10480
build-on-macos-latest:
10581
runs-on: macos-11
10682
needs: [license]
@@ -112,8 +88,11 @@ jobs:
11288

11389
- name: Install Dependencies
11490
run: |
115-
brew install snappy googletest gcc autoconf automake libtool
91+
brew install gcc autoconf automake libtool cmake
11692
mkdir build
11793
11894
- name: Build
119-
run: make -j4
95+
run: |
96+
cd build
97+
cmake ..
98+
make -j4

.github/workflows/release.yaml

+15-10
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,19 @@ jobs:
4141

4242
- name: Install Dependencies
4343
run: |
44-
sudo apt-get install -y tar libsnappy-dev
44+
sudo apt-get install -y tar cmake
4545
mkdir -p build/bin
4646
mkdir -p build/conf
4747
4848
- name: Build
4949
run: |
50+
cd build
51+
cmake -DCMAKE_BUILD_TYPE=Release ..
5052
make -j4
51-
cp src/kvrocks build/bin/
52-
cp src/kvrocks2redis build/bin/
53-
cp kvrocks.conf build/conf/
53+
cp kvrocks bin/
54+
cp kvrocks2redis bin/
55+
cp ../kvrocks.conf conf/
56+
cd ..
5457
5558
- name: Set ENV
5659
run: |
@@ -101,7 +104,7 @@ jobs:
101104
run: |
102105
yum install -y epel-release
103106
yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
104-
yum install -y git gcc gcc-c++ make snappy snappy-devel autoconf automake libtool which gtest gtest-devel
107+
yum install -y git gcc gcc-c++ make cmake autoconf automake libtool which
105108
106109
- name: Checkout Code Base
107110
uses: actions/[email protected]
@@ -110,12 +113,14 @@ jobs:
110113

111114
- name: Build
112115
run: |
116+
cd build
117+
cmake -DCMAKE_BUILD_TYPE=Release
113118
make -j4
114-
mkdir -p build/bin
115-
mkdir -p build/conf
116-
cp src/kvrocks build/bin/
117-
cp src/kvrocks2redis build/bin/
118-
cp kvrocks.conf build/conf/
119+
mkdir -p bin
120+
mkdir -p conf
121+
cp kvrocks bin/
122+
cp kvrocks2redis bin/
123+
cp ../kvrocks.conf conf/
119124
120125
- name: Set ENV
121126
run: |

.gitmodules

-24
This file was deleted.

Dockerfile

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,18 @@
1717

1818
FROM ubuntu:22.04 as build
1919

20-
RUN apt update && apt install -y make git autoconf libtool g++ libsnappy-dev
20+
RUN apt update && apt install -y cmake make git autoconf libtool g++
2121
WORKDIR /kvrocks
2222

2323
COPY . .
24-
RUN make -j4
24+
RUN mkdir docker-build && ./build.sh docker-build
2525

2626

2727
FROM ubuntu:22.04
2828

29-
RUN apt update && apt install -y libsnappy-dev
3029
WORKDIR /kvrocks
3130

32-
COPY --from=build /kvrocks/src/kvrocks ./bin/
31+
COPY --from=build /kvrocks/docker-build/kvrocks ./bin/
3332

3433
COPY ./kvrocks.conf ./conf/
3534
RUN sed -i -e 's|dir /tmp/kvrocks|dir /var/lib/kvrocks|g' ./conf/kvrocks.conf

Makefile

-29
This file was deleted.

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -43,44 +43,44 @@ Kvrocks has the following key features:
4343

4444
#### requirements
4545
* g++ (required by c++11, version >= 4.8)
46-
* autoconf automake libtool snappy
46+
* autoconf automake libtool cmake
4747

4848
#### Build
4949

50-
***NOTE: You should install the snappy first:***
51-
5250
```shell
5351
# Centos/Redhat
54-
sudo yum install -y epel-release && sudo yum install -y git gcc gcc-c++ make snappy snappy-devel autoconf automake libtool which gtest gtest-devel
52+
sudo yum install -y epel-release && sudo yum install -y git gcc gcc-c++ make cmake autoconf automake libtool which
5553

5654
# Ubuntu/Debian
5755
sudo apt update
58-
sudo apt-get install gcc g++ make libsnappy-dev autoconf automake libtool googletest libgtest-dev
56+
sudo apt-get install gcc g++ make cmake autoconf automake libtool
5957

6058
# MACOSX
61-
brew install autoconf automake libtool snappy googletest
59+
brew install autoconf automake libtool cmake
6260
```
6361

6462
It is as simple as:
6563

6664
```shell
67-
$ git clone --recursive https://github.com/apache/incubator-kvrocks.git
65+
$ git clone https://github.com/apache/incubator-kvrocks.git
6866
$ cd kvrocks
69-
$ make -j4
67+
$ mkdir build
68+
$ ./build.sh build # manually run CMake if you want to build Debug version or add some build options
7069
```
7170

7271
### Running kvrocks
7372

7473
```shell
75-
$ ./src/kvrocks -c kvrocks.conf
74+
$ ./build/kvrocks -c kvrocks.conf
7675
```
7776

7877
### Running test cases
7978

80-
***NOTE: You should install the googletest first***
81-
8279
```shell
83-
make test
80+
$ # make sure CMake was executed in ./build
81+
$ cd build
82+
$ make unittest
83+
$ ./unittest
8484
```
8585

8686
### Supported platforms

0 commit comments

Comments
 (0)