Compare commits
No commits in common. "master" and "main" have entirely different histories.
|
@ -0,0 +1,90 @@
|
|||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: Google
|
||||
AccessModifierOffset: -1
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: true
|
||||
AlignConsecutiveMacros: true
|
||||
AlignEscapedNewlinesLeft: true
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
ColumnLimit: 120
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: true
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||
IncludeCategories:
|
||||
- Regex: '^<.*\.h>'
|
||||
Priority: 1
|
||||
- Regex: '^<.*'
|
||||
Priority: 2
|
||||
- Regex: '.*'
|
||||
Priority: 3
|
||||
IndentCaseLabels: true
|
||||
IndentWidth: 2
|
||||
IndentWrappedFunctionNames: false
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: false
|
||||
PenaltyBreakBeforeFirstCallParameter: 1
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 200
|
||||
PointerAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Auto
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
...
|
|
@ -0,0 +1,12 @@
|
|||
coverage:
|
||||
precision: 2
|
||||
notify:
|
||||
email:
|
||||
default:
|
||||
to:
|
||||
- sdsang@taosdata.com
|
||||
- &author
|
||||
only_pulls: false
|
||||
layout: reach, diff, flags, files
|
||||
flags: null
|
||||
paths: null
|
|
@ -0,0 +1,10 @@
|
|||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.209.3/containers/cpp/.devcontainer/base.Dockerfile
|
||||
|
||||
# [Choice] Debian / Ubuntu version (use Debian 11/9, Ubuntu 18.04/21.04 on local arm64/Apple Silicon): debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04
|
||||
ARG VARIANT="bullseye"
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT}
|
||||
|
||||
# [Optional] Uncomment this section to install additional packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||
RUN apt-get update && apt-get -y install tree vim tmux python3-pip
|
|
@ -0,0 +1,38 @@
|
|||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.3/containers/cpp
|
||||
{
|
||||
"name": "C++",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
// Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04
|
||||
// Use Debian 11, Debian 9, Ubuntu 18.04 or Ubuntu 21.04 on local arm64/Apple Silicon
|
||||
"args": {
|
||||
"VARIANT": "ubuntu-21.04"
|
||||
}
|
||||
},
|
||||
"runArgs": [
|
||||
"--cap-add=SYS_PTRACE",
|
||||
"--security-opt",
|
||||
"seccomp=unconfined"
|
||||
],
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"settings": {},
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"ms-vscode.cpptools",
|
||||
"ms-vscode.cmake-tools",
|
||||
"austin.code-gnu-global",
|
||||
"visualstudioexptteam.vscodeintel",
|
||||
"eamodio.gitlens",
|
||||
"matepek.vscode-catch2-test-adapter",
|
||||
"spmeesseman.vscode-taskexplorer",
|
||||
"cschlosser.doxdocgen",
|
||||
"urosvujosevic.explorer-manager"
|
||||
],
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "wget https://raw.githubusercontent.com/hzcheng/config/master/.tmux.conf -P /root",
|
||||
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "root"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
*.py linguist-detectable=false
|
|
@ -0,0 +1,26 @@
|
|||
# reference
|
||||
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
|
||||
|
||||
# merge team
|
||||
# @guanshengliang Shengliang Guan
|
||||
# @zitsen Linhe Huo
|
||||
# @wingwing2005 Ya Qiang Li
|
||||
# @feici02 WANG Xu
|
||||
# @hzcheng Hongze Cheng
|
||||
# @dapan1121 Pan Wei
|
||||
# @sheyanjie-qq She Yanjie
|
||||
# @pigzhou ZacharyZhou
|
||||
|
||||
* @taosdata/merge
|
||||
/.github/ @feici02
|
||||
/cmake/ @guanshengliang
|
||||
/contrib/ @guanshengliang
|
||||
/deps/ @guanshengliang
|
||||
/docs/ @guanshengliang @zitsen
|
||||
/examples/ @guanshengliang @zitsen
|
||||
/include/ @guanshengliang @hzcheng @dapan1121
|
||||
/packaging/ @feici02
|
||||
/source/ @guanshengliang @hzcheng @dapan1121
|
||||
/tests/ @guanshengliang @zitsen
|
||||
/tools/ @guanshengliang @zitsen
|
||||
/utils/ @guanshengliang
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
name: Bug Report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Bug Description**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Type in '....'
|
||||
3. See error
|
||||
|
||||
**Expected Behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Environment (please complete the following information):**
|
||||
- OS: [e.g. CentOS 7.0]
|
||||
- Memory, CPU, current Disk Space
|
||||
- TDengine Version [e.g. 1.6.1.7]
|
||||
|
||||
**Additional Context**
|
||||
Add any other context about the problem here.
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
name: Feature Request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the circumstance is and what the associated problem is. Ex. I'm using TDengine for this use case: [...]. But I'm always frustrated when [...]
|
||||
|
||||
**Describe your desired behavior**
|
||||
A clear and concise description of what you want to happen. Ex. I want TDengine to be able to do [...] when I try to do [...] with it.
|
||||
|
||||
**Describe your solutions/suggestions if you've any**
|
||||
A clear and concise description of any solutions/suggestions to this problem or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
name: General Questions
|
||||
about: General questions about TDengine's usage, user experiences, milestones etc.
|
||||
title: ''
|
||||
labels: help wanted, question
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**General Questions**
|
||||
A general question should be related to TDengine's user's manual, user experience, milestones, business cooperations etc.
|
||||
Before you ask a question, please:
|
||||
1. Try searching for answers in the official documentation
|
||||
2. Try searching in the existing issues on GitHub
|
||||
3. Try searching on tech forums such as Stack Overflow, Quora, CSDN, v2ex etc.
|
||||
4. Try using online searching engines such as Google, Bing, Baidu
|
||||
|
||||
If all the ways above couldn't help, please clearly and concisely describe what the question is.
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
name: Performance-related Questions
|
||||
about: Any questions related to TDengine's performance.
|
||||
title: ''
|
||||
labels: performance
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Performance Issue**
|
||||
Any questions related to TDengine's performance can be discussed here.
|
||||
|
||||
**Problem Description**
|
||||
A clear and concise description of what the problem is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Database parameters used:
|
||||
```show databases```
|
||||
2. Verbs used: Insert/Import/Select?
|
||||
3. Describe the total amount of data
|
||||
4. Observed performance vs. expected performance
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Environment (please complete the following information):**
|
||||
|
||||
* OS: [e.g. CentOS 7.0]
|
||||
* Memory, CPU, current Disk Space
|
||||
* TDengine Version [e.g. 1.6.1.7]
|
||||
|
||||
**Additional Context**
|
||||
Add any other context about the problem here.
|
|
@ -0,0 +1,11 @@
|
|||
# Description
|
||||
|
||||
Please briefly describe the code changes in this pull request.
|
||||
|
||||
# Checklist
|
||||
|
||||
Please check the items in the checklist if applicable.
|
||||
|
||||
- [ ] Is the user manual updated?
|
||||
- [ ] Are the test cases passed and automated?
|
||||
- [ ] Is there no significant decrease in test coverage?
|
|
@ -0,0 +1,25 @@
|
|||
name: Cancel Workflow on Merge
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [closed]
|
||||
|
||||
jobs:
|
||||
cancel-workflow:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Cancel Workflow if Merged or Closed
|
||||
if: ${{ github.event.pull_request.merged || github.event.pull_request.state == 'closed' }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
echo "PR has been merged or closed, cancelling workflow..."
|
||||
gh auth status
|
||||
gh run list \
|
||||
--repo ${{ github.repository }} \
|
||||
--branch ${{ github.event.pull_request.head.ref }} \
|
||||
--workflow "TDengine Test" \
|
||||
--status in_progress \
|
||||
--status queued \
|
||||
--json databaseId --jq '.[].databaseId' | \
|
||||
xargs -I {} gh run cancel --repo ${{ github.repository }} {}
|
|
@ -0,0 +1,61 @@
|
|||
name: taosKeeper Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
- '3.0'
|
||||
paths:
|
||||
- 'tools/keeper/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
name: Build and test on ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.18
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt update -y
|
||||
sudo apt install -y build-essential cmake libgeos-dev
|
||||
|
||||
- name: Install TDengine
|
||||
run: |
|
||||
mkdir debug
|
||||
cd debug
|
||||
cmake .. -DBUILD_HTTP=false -DBUILD_JDBC=false -DBUILD_TOOLS=false -DBUILD_TEST=off -DBUILD_KEEPER=true -DBUILD_DEPENDENCY_TESTS=false
|
||||
make -j 4
|
||||
sudo make install
|
||||
which taosd
|
||||
which taosadapter
|
||||
which taoskeeper
|
||||
|
||||
- name: Start taosd
|
||||
run: |
|
||||
cp /etc/taos/taos.cfg ./
|
||||
sudo echo "supportVnodes 256" >> taos.cfg
|
||||
nohup sudo taosd -c taos.cfg &
|
||||
|
||||
- name: Start taosadapter
|
||||
run: nohup sudo taosadapter &
|
||||
|
||||
- name: Run tests with coverage
|
||||
working-directory: tools/keeper
|
||||
run: |
|
||||
go mod tidy
|
||||
sudo go test -v -ldflags="-X 'github.com/taosdata/taoskeeper/version.IsEnterprise=true'" -coverpkg=./... -coverprofile=coverage.out ./...
|
||||
go tool cover -func=coverage.out
|
||||
|
||||
- name: Clean up
|
||||
if: always()
|
||||
run: |
|
||||
if pgrep taosd; then sudo pkill taosd; fi
|
||||
if pgrep taosadapter; then sudo pkill taosadapter; fi
|
|
@ -0,0 +1,126 @@
|
|||
name: TDengine Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
- '3.0'
|
||||
- '3.1'
|
||||
- '3.3.6'
|
||||
- 'enh/cmake-TD-33848'
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- 'packaging/**'
|
||||
- 'tests/**'
|
||||
- '**/*.md'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Run on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-20.04
|
||||
- ubuntu-22.04
|
||||
- ubuntu-24.04
|
||||
- macos-13
|
||||
- macos-14
|
||||
- macos-15
|
||||
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.18
|
||||
|
||||
- name: Install dependencies on Linux
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt update -y
|
||||
sudo apt install -y \
|
||||
build-essential \
|
||||
cmake \
|
||||
gawk \
|
||||
libgeos-dev \
|
||||
libjansson-dev \
|
||||
liblzma-dev \
|
||||
libsnappy-dev \
|
||||
libssl-dev \
|
||||
libz-dev \
|
||||
pkg-config \
|
||||
zlib1g
|
||||
|
||||
- name: Install dependencies on macOS
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
brew update
|
||||
brew install \
|
||||
argp-standalone \
|
||||
gawk \
|
||||
gflags \
|
||||
geos \
|
||||
jansson \
|
||||
openssl \
|
||||
pkg-config \
|
||||
snappy \
|
||||
zlib
|
||||
|
||||
- name: prepare install path
|
||||
run: |
|
||||
sudo mkdir -p /usr/local/lib
|
||||
sudo mkdir -p /usr/local/include
|
||||
|
||||
- name: Build and install TDengine
|
||||
run: |
|
||||
mkdir debug && cd debug
|
||||
cmake .. -DBUILD_TOOLS=true \
|
||||
-DBUILD_KEEPER=true \
|
||||
-DBUILD_HTTP=false \
|
||||
-DBUILD_TEST=true \
|
||||
-DWEBSOCKET=true \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_DEPENDENCY_TESTS=false
|
||||
make -j 4
|
||||
sudo make install
|
||||
which taosd
|
||||
which taosadapter
|
||||
which taoskeeper
|
||||
|
||||
- name: Statistics ldd
|
||||
run: |
|
||||
find ${{ github.workspace }}/debug/build/lib -type f -name "*.so" -print0 | xargs -0 ldd || true
|
||||
find ${{ github.workspace }}/debug/build/bin -type f -print0 | xargs -0 ldd || true
|
||||
|
||||
- name: Statistics size
|
||||
run: |
|
||||
find ${{ github.workspace }}/debug/build/lib -type f -print0 | xargs -0 ls -lhrS
|
||||
find ${{ github.workspace }}/debug/build/bin -type f -print0 | xargs -0 ls -lhrS
|
||||
|
||||
- name: Start taosd
|
||||
run: |
|
||||
cp /etc/taos/taos.cfg ./
|
||||
sudo echo "supportVnodes 256" >> taos.cfg
|
||||
nohup sudo taosd -c taos.cfg &
|
||||
|
||||
- name: Start taosadapter
|
||||
run: nohup sudo taosadapter &
|
||||
|
||||
- name: Run tests with taosBenchmark
|
||||
run: |
|
||||
taosBenchmark -t 10 -n 10 -y
|
||||
taos -s "select count(*) from test.meters"
|
||||
|
||||
- name: Clean up
|
||||
if: always()
|
||||
run: |
|
||||
if pgrep taosd; then sudo pkill taosd; fi
|
||||
if pgrep taosadapter; then sudo pkill taosadapter; fi
|
|
@ -0,0 +1,47 @@
|
|||
name: TDengine Doc Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
- '3.0'
|
||||
paths:
|
||||
- 'docs/**'
|
||||
|
||||
env:
|
||||
DOC_WKC: '/root/doc_ci_work'
|
||||
ZH_DOC_REPO: 'docs.taosdata.com'
|
||||
EN_DOC_REPO: 'docs.tdengine.com'
|
||||
TD_REPO: 'TDengine'
|
||||
TOOLS_REPO: 'taos-tools'
|
||||
|
||||
jobs:
|
||||
build-doc:
|
||||
runs-on:
|
||||
group: CI
|
||||
labels: [self-hosted, doc-build]
|
||||
steps:
|
||||
- name: Get the latest document contents
|
||||
run: |
|
||||
set -e
|
||||
cd ${{ env.DOC_WKC }}/${{ env.TD_REPO }}
|
||||
git reset --hard
|
||||
git clean -f
|
||||
git remote prune origin
|
||||
git fetch
|
||||
git checkout ${{ github.event.pull_request.base.ref }}
|
||||
git pull >/dev/null
|
||||
git fetch origin +refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
git checkout -qf FETCH_HEAD
|
||||
|
||||
- name: Build the chinese document
|
||||
run: |
|
||||
cd ${{ env.DOC_WKC }}/${{ env.ZH_DOC_REPO }}
|
||||
yarn ass local
|
||||
yarn build
|
||||
|
||||
- name: Build the english document
|
||||
run: |
|
||||
cd ${{ env.DOC_WKC }}/${{ env.EN_DOC_REPO }}
|
||||
yarn ass local
|
||||
yarn build
|
|
@ -0,0 +1,122 @@
|
|||
name: TDengine Release Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 */2 * * *'
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- '3.*'
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- 'packaging/**'
|
||||
- 'tests/**'
|
||||
- '**/*.md'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Run on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-22.04
|
||||
- macos-14
|
||||
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.18
|
||||
|
||||
- name: Install dependencies on Linux
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt update -y
|
||||
sudo apt install -y \
|
||||
build-essential \
|
||||
cmake \
|
||||
gawk \
|
||||
libgeos-dev \
|
||||
libjansson-dev \
|
||||
liblzma-dev \
|
||||
libsnappy-dev \
|
||||
libssl-dev \
|
||||
libz-dev \
|
||||
pkg-config \
|
||||
zlib1g
|
||||
|
||||
- name: Install dependencies on macOS
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
brew update
|
||||
brew install \
|
||||
argp-standalone \
|
||||
gawk \
|
||||
gflags \
|
||||
geos \
|
||||
jansson \
|
||||
openssl \
|
||||
pkg-config \
|
||||
snappy \
|
||||
zlib
|
||||
|
||||
- name: Prepare install path
|
||||
run: |
|
||||
sudo mkdir -p /usr/local/lib
|
||||
sudo mkdir -p /usr/local/include
|
||||
|
||||
- name: Build and install TDengine
|
||||
run: |
|
||||
mkdir debug && cd debug
|
||||
cmake .. -DBUILD_TOOLS=true \
|
||||
-DBUILD_KEEPER=true \
|
||||
-DBUILD_HTTP=false \
|
||||
-DBUILD_TEST=true \
|
||||
-DWEBSOCKET=true \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_DEPENDENCY_TESTS=false
|
||||
make -j 4
|
||||
sudo make install
|
||||
which taosd
|
||||
which taosadapter
|
||||
which taoskeeper
|
||||
|
||||
- name: Statistics ldd
|
||||
run: |
|
||||
find ${{ github.workspace }}/debug/build/lib -type f -name "*.so" -print0 | xargs -0 ldd || true
|
||||
find ${{ github.workspace }}/debug/build/bin -type f -print0 | xargs -0 ldd || true
|
||||
|
||||
- name: Statistics size
|
||||
run: |
|
||||
find ${{ github.workspace }}/debug/build/lib -type f -print0 | xargs -0 ls -lhrS
|
||||
find ${{ github.workspace }}/debug/build/bin -type f -print0 | xargs -0 ls -lhrS
|
||||
|
||||
- name: Start taosd
|
||||
run: |
|
||||
cp /etc/taos/taos.cfg ./
|
||||
sudo echo "supportVnodes 256" >> taos.cfg
|
||||
nohup sudo taosd -c taos.cfg &
|
||||
|
||||
- name: Start taosadapter
|
||||
run: nohup sudo taosadapter &
|
||||
|
||||
- name: Run tests with taosBenchmark
|
||||
run: |
|
||||
taosBenchmark -t 10 -n 10 -y
|
||||
taos -s "select count(*) from test.meters"
|
||||
|
||||
- name: Clean up
|
||||
if: always()
|
||||
run: |
|
||||
if pgrep taosd; then sudo pkill taosd; fi
|
||||
if pgrep taosadapter; then sudo pkill taosadapter; fi
|
|
@ -0,0 +1,28 @@
|
|||
# Coverage test for taosd & taosc
|
||||
|
||||
name: TDengine Coverage
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
specified_test_branch:
|
||||
description: 'Enter the test branch name of TDengine'
|
||||
required: true
|
||||
type: string
|
||||
schedule:
|
||||
- cron: '30 00 * * *'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.inputs.specified_test_branch || '3.0' }}-TDengine
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
WKC: '/var/lib/jenkins/workspace/TDinternal/community'
|
||||
|
||||
jobs:
|
||||
run-tests-on-linux:
|
||||
uses: taosdata/.github/.github/workflows/run-coverage-tests-on-linux.yml@main
|
||||
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'}}
|
||||
with:
|
||||
tdinternal: false
|
||||
specified_test_branch: ${{ github.event_name == 'schedule' && 'unavailable' || github.event.inputs.specified_test_branch || '3.0' }}
|
|
@ -0,0 +1,69 @@
|
|||
name: TDengine Test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
- '3.0'
|
||||
- '3.1'
|
||||
- '3.3.6'
|
||||
paths-ignore:
|
||||
- 'packaging/**'
|
||||
- 'docs/**'
|
||||
- 'tools/tdgpt/**'
|
||||
- 'source/libs/executor/src/forecastoperator.c'
|
||||
- 'source/libs/executor/src/anomalywindowoperator.c'
|
||||
- 'source/dnode/mnode/impl/src/mndAnode.c'
|
||||
- 'include/common/tanalytics.h'
|
||||
- 'source/common/src/tanalytics.c'
|
||||
- 'tests/parallel/tdgpt_cases.task'
|
||||
- 'tests/script/tsim/analytics'
|
||||
- '**/*.md'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
specified_source_branch:
|
||||
description: 'Enter the source branch name of TDengine'
|
||||
required: true
|
||||
type: string
|
||||
specified_target_branch:
|
||||
description: 'Enter the target branch name of TDengine'
|
||||
required: true
|
||||
type: string
|
||||
specified_pr_number:
|
||||
description: 'Enter the PR number of TDengine'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-
|
||||
${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || inputs.specified_target_branch }}-
|
||||
${{ github.event_name == 'pull_request' && github.event.pull_request.number || inputs.specified_pr_number }}-TDengine
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
WKC: '/var/lib/jenkins/workspace/TDinternal/community'
|
||||
|
||||
jobs:
|
||||
run-tests-on-linux:
|
||||
uses: taosdata/.github/.github/workflows/run-tests-on-linux.yml@main
|
||||
with:
|
||||
tdinternal: false
|
||||
specified_source_branch: ${{ github.event_name == 'pull_request' && 'unavailable' || inputs.specified_source_branch }}
|
||||
specified_target_branch: ${{ github.event_name == 'pull_request' && 'unavailable' || inputs.specified_target_branch }}
|
||||
specified_pr_number: ${{ github.event_name == 'pull_request' && 'unavailable' || inputs.specified_pr_number }}
|
||||
|
||||
run-tests-on-mac:
|
||||
uses: taosdata/.github/.github/workflows/run-tests-on-macos.yml@main
|
||||
with:
|
||||
tdinternal: false
|
||||
specified_source_branch: ${{ github.event_name == 'pull_request' && 'unavailable' || inputs.specified_source_branch }}
|
||||
specified_target_branch: ${{ github.event_name == 'pull_request' && 'unavailable' || inputs.specified_target_branch }}
|
||||
specified_pr_number: ${{ github.event_name == 'pull_request' && 'unavailable' || inputs.specified_pr_number }}
|
||||
|
||||
run-tests-on-windows:
|
||||
uses: taosdata/.github/.github/workflows/run-tests-on-windows.yml@main
|
||||
with:
|
||||
tdinternal: false
|
||||
specified_source_branch: ${{ github.event_name == 'pull_request' && 'unavailable' || inputs.specified_source_branch }}
|
||||
specified_target_branch: ${{ github.event_name == 'pull_request' && 'unavailable' || inputs.specified_target_branch }}
|
||||
specified_pr_number: ${{ github.event_name == 'pull_request' && 'unavailable' || inputs.specified_pr_number }}
|
|
@ -0,0 +1,203 @@
|
|||
# Run unit-test and system-test cases for TDgpt when TDgpt code is changed.
|
||||
|
||||
name: TDgpt Test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
- '3.0'
|
||||
- '3.3.6'
|
||||
paths:
|
||||
- 'tools/tdgpt/**'
|
||||
- 'source/libs/executor/src/forecastoperator.c'
|
||||
- 'source/libs/executor/src/anomalywindowoperator.c'
|
||||
- 'source/dnode/mnode/impl/src/mndAnode.c'
|
||||
- 'include/common/tanalytics.h'
|
||||
- 'source/common/src/tanalytics.c'
|
||||
- 'tests/parallel/tdgpt_cases.task'
|
||||
- 'tests/script/tsim/analytics'
|
||||
|
||||
jobs:
|
||||
unit-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.10"]
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ github.workspace }}/tools/tdgpt
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install flake8 pytest pylint
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
|
||||
- name: Checking the code with pylint
|
||||
run: |
|
||||
pylint $(git ls-files '*.py') --exit-zero
|
||||
|
||||
- name: Checking the code with flake8
|
||||
run: |
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
|
||||
- name: Run test cases with pytest
|
||||
run: |
|
||||
pytest
|
||||
|
||||
function-test:
|
||||
runs-on:
|
||||
group: CI
|
||||
labels: [self-hosted, Linux, X64, testing]
|
||||
|
||||
env:
|
||||
CONTAINER_NAME: 'taosd-test'
|
||||
WKDIR: '/var/lib/jenkins/workspace'
|
||||
WK: '/var/lib/jenkins/workspace/TDinternal'
|
||||
WKC: '/var/lib/jenkins/workspace/TDinternal/community'
|
||||
SOURCE_BRANCH: ${{ github.event.pull_request.head.ref }}
|
||||
TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
|
||||
steps:
|
||||
- name: Output the environment information
|
||||
run: |
|
||||
echo "::group::Environment Info"
|
||||
date
|
||||
hostname
|
||||
env
|
||||
echo "Runner: ${{ runner.name }}"
|
||||
echo "Workspace: ${{ env.WKDIR }}"
|
||||
git --version
|
||||
echo "${{ env.WKDIR }}/restore.sh -p PR-${{ env.PR_NUMBER }} -n ${{ github.run_number }} -c ${{ env.CONTAINER_NAME }}"
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Prepare repositories
|
||||
run: |
|
||||
set -euo pipefail
|
||||
prepare_environment() {
|
||||
cd "$1"
|
||||
git reset --hard
|
||||
git clean -f
|
||||
git remote prune origin
|
||||
git fetch
|
||||
git checkout "$2"
|
||||
}
|
||||
prepare_environment "${{ env.WK }}" "${{ env.TARGET_BRANCH }}"
|
||||
prepare_environment "${{ env.WKC }}" "${{ env.TARGET_BRANCH }}"
|
||||
|
||||
- name: Get latest codes and logs
|
||||
run: |
|
||||
cd ${{ env.WKC }}
|
||||
git remote prune origin
|
||||
git pull >/dev/null
|
||||
git log -5
|
||||
echo "`date "+%Y%m%d-%H%M%S"` TDengineTest/${{ env.PR_NUMBER }}:${{ github.run_number }}:${{ env.TARGET_BRANCH }}" >>${{ env.WKDIR }}/jenkins.log
|
||||
echo "CHANGE_BRANCH:${{ env.SOURCE_BRANCH }}" >>${{ env.WKDIR }}/jenkins.log
|
||||
echo "community log: `git log -5`" >>${{ env.WKDIR }}/jenkins.log
|
||||
git fetch origin +refs/pull/${{ env.PR_NUMBER }}/merge
|
||||
git checkout -qf FETCH_HEAD
|
||||
git log -5
|
||||
echo "community log merged: `git log -5`" >>${{ env.WKDIR }}/jenkins.log
|
||||
cd ${{ env.WK }}
|
||||
git pull >/dev/null
|
||||
git log -5
|
||||
echo "TDinternal log: `git log -5`" >>${{ env.WKDIR }}/jenkins.log
|
||||
|
||||
- name: Update submodule
|
||||
run: |
|
||||
cd ${{ env.WKC }}
|
||||
git submodule update --init --recursive
|
||||
|
||||
- name: Detect non-doc files changed
|
||||
run: |
|
||||
mkdir -p ${{ env.WKDIR }}/tmp/${{ env.PR_NUMBER }}_${{ github.run_number }}
|
||||
cd ${{ env.WKC }}
|
||||
changed_files_non_doc=$(git --no-pager diff --name-only \
|
||||
FETCH_HEAD \
|
||||
$(git merge-base FETCH_HEAD ${{ env.TARGET_BRANCH }}) | \
|
||||
grep -v "^docs/en/" | \
|
||||
grep -v "^docs/zh/" | \
|
||||
grep -v ".md$" | \
|
||||
tr '\n' ' ' || : \
|
||||
)
|
||||
echo $changed_files_non_doc > \
|
||||
${{ env.WKDIR }}/tmp/${{ env.PR_NUMBER }}_${{ github.run_number }}/docs_changed.txt
|
||||
|
||||
- name: Check assert testing
|
||||
run: |
|
||||
cd ${{ env.WKC }}/tests/parallel_test
|
||||
./run_check_assert_container.sh -d ${{ env.WKDIR }}
|
||||
|
||||
- name: Check void function testing
|
||||
run: |
|
||||
cd ${{ env.WKC }}/tests/parallel_test
|
||||
./run_check_void_container.sh -d ${{ env.WKDIR }}
|
||||
|
||||
- name: Build docker container
|
||||
run: |
|
||||
date
|
||||
rm -rf ${{ env.WKC }}/debug
|
||||
cd ${{ env.WKC }}/tests/parallel_test
|
||||
time ./container_build.sh -w ${{ env.WKDIR }} -e
|
||||
|
||||
- name: Get parameters for testing
|
||||
id: get_param
|
||||
run: |
|
||||
log_server_file="/home/log_server.json"
|
||||
timeout_cmd=""
|
||||
extra_param=""
|
||||
|
||||
if [ -f "$log_server_file" ]; then
|
||||
log_server_enabled=$(jq '.enabled' "$log_server_file")
|
||||
timeout_param=$(jq '.timeout' "$log_server_file")
|
||||
if [ "$timeout_param" != "null" ] && [ "$timeout_param" != "0" ]; then
|
||||
timeout_cmd="timeout $timeout_param"
|
||||
fi
|
||||
|
||||
if [ "$log_server_enabled" == "1" ]; then
|
||||
log_server=$(jq '.server' "$log_server_file" | sed 's/\\\"//g')
|
||||
if [ "$log_server" != "null" ] && [ "$log_server" != "" ]; then
|
||||
extra_param="-w $log_server"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo "timeout_cmd=$timeout_cmd" >> $GITHUB_OUTPUT
|
||||
echo "extra_param=$extra_param" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Run function returns with a null pointer scan testing
|
||||
run: |
|
||||
cd ${{ env.WKC }}/tests/parallel_test
|
||||
./run_scan_container.sh \
|
||||
-d ${{ env.WKDIR }} \
|
||||
-b ${{ env.PR_NUMBER }}_${{ github.run_number }} \
|
||||
-f ${{ env.WKDIR }}/tmp/${{ env.PR_NUMBER }}_${{ github.run_number }}/docs_changed.txt \
|
||||
${{ steps.get_param.outputs.extra_param }}
|
||||
|
||||
- name: Run tdgpt test cases
|
||||
run: |
|
||||
cd ${{ env.WKC }}/tests/parallel_test
|
||||
export DEFAULT_RETRY_TIME=2
|
||||
date
|
||||
timeout 600 time ./run.sh -e \
|
||||
-m /home/m.json \
|
||||
-t tdgpt_cases.task \
|
||||
-b "${{ env.PR_NUMBER }}_${{ github.run_number }}" \
|
||||
-l ${{ env.WKDIR }}/log \
|
||||
-o 300 ${{ steps.get_param.outputs.extra_param }}
|
|
@ -0,0 +1,43 @@
|
|||
# Scheduled updates for the TDgpt service.
|
||||
|
||||
name: TDgpt Update Service
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 00 * * *'
|
||||
|
||||
env:
|
||||
WKC: "/root/TDengine"
|
||||
|
||||
jobs:
|
||||
update-service:
|
||||
runs-on:
|
||||
group: CI
|
||||
labels: [self-hosted, Linux, X64, tdgpt-anode-service]
|
||||
steps:
|
||||
- name: Update TDengine codes
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd ${{ env.WKC }}
|
||||
git checkout 3.0
|
||||
|
||||
- name: Package the TDGpt Anode Service
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd ${{ env.WKC }}/tools/tdgpt/script && ./release.sh
|
||||
|
||||
- name: Reinstall and restart the TDGpt Anode Service
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd ${{ env.WKC }}/tools/tdgpt/release
|
||||
if [[ -f "TDengine-enterprise-anode-1.0.1.tar.gz" ]]; then
|
||||
tar -xzf TDengine-enterprise-anode-1.0.1.tar.gz
|
||||
cd TDengine-enterprise-anode-1.0.1
|
||||
./install.sh
|
||||
fi
|
||||
systemctl restart taosanoded
|
||||
|
||||
- name: Clean up
|
||||
if: always()
|
||||
run: |
|
||||
if [[ -f ${{ env.WKC }}/tools/tdgpt/release/TDengine-enterprise-anode-1.0.1 ]] then rm -rf ${{ env.WKC }}/tools/tdgpt/release/TDengine-enterprise-anode-1.0.1; fi
|
|
@ -0,0 +1,173 @@
|
|||
*build/
|
||||
compile_commands.json
|
||||
CMakeSettings.json
|
||||
.cache
|
||||
.ycm_extra_conf.py
|
||||
.tasks
|
||||
.vimspector.json
|
||||
.vscode/
|
||||
.vscode
|
||||
.idea/
|
||||
cmake-build-debug/
|
||||
cmake-build-release/
|
||||
cscope.out
|
||||
cscope.files
|
||||
.DS_Store
|
||||
debug/
|
||||
release/
|
||||
target/
|
||||
debs/
|
||||
rpms/
|
||||
mac/
|
||||
*.pyc
|
||||
.mypy_cache
|
||||
*.tmp
|
||||
*.swp
|
||||
*.swo
|
||||
*.orig
|
||||
src/connector/nodejs/node_modules/
|
||||
src/connector/nodejs/out/
|
||||
tests/taoshebei/
|
||||
tests/taoscsv/
|
||||
tests/taosdalipu/
|
||||
tests/jenkins/
|
||||
tests/hdfs/
|
||||
*.iml
|
||||
*.class
|
||||
nmake/
|
||||
sln/
|
||||
hdfs/
|
||||
taoshebei/
|
||||
taosdalipu/
|
||||
Target/
|
||||
*.failed
|
||||
*.sql
|
||||
sim
|
||||
sim/
|
||||
psim/
|
||||
pysim/
|
||||
*.out
|
||||
*DS_Store
|
||||
tests/script/api/batchprepare
|
||||
taosadapter
|
||||
taosadapter-debug
|
||||
tools/taosws-rs/*
|
||||
tools/taosadapter/*
|
||||
tools/upx*
|
||||
|
||||
# Doxygen Generated files
|
||||
html/
|
||||
/.vs
|
||||
/CMakeFiles/3.10.2
|
||||
/Makefile
|
||||
/*.cmake
|
||||
/src/cq/test/CMakeFiles/cqtest.dir/*.cmake
|
||||
*.cmake
|
||||
/src/cq/test/CMakeFiles/cqtest.dir/*.make
|
||||
*.make
|
||||
link.txt
|
||||
*.internal
|
||||
*.includecache
|
||||
*.marks
|
||||
Makefile
|
||||
CMakeError.log
|
||||
*.log
|
||||
/CMakeFiles/CMakeRuleHashes.txt
|
||||
/CMakeFiles/Makefile2
|
||||
/CMakeFiles/TargetDirectories.txt
|
||||
/CMakeFiles/cmake.check_cache
|
||||
/out/isenseconfig/WSL-Clang-Debug
|
||||
/out/isenseconfig/WSL-GCC-Debug
|
||||
/test/cfg
|
||||
/src/.vs
|
||||
*.o
|
||||
version.c
|
||||
taos.rc
|
||||
src/connector/jdbc/.classpath
|
||||
src/connector/jdbc/.project
|
||||
src/connector/jdbc/.settings/
|
||||
tests/comparisonTest/cassandra/cassandratest/.classpath
|
||||
tests/comparisonTest/cassandra/cassandratest/.project
|
||||
tests/comparisonTest/cassandra/cassandratest/.settings/
|
||||
tests/comparisonTest/opentsdb/opentsdbtest/.classpath
|
||||
tests/comparisonTest/opentsdb/opentsdbtest/.factorypath
|
||||
tests/comparisonTest/opentsdb/opentsdbtest/.project
|
||||
tests/comparisonTest/opentsdb/opentsdbtest/.settings/
|
||||
tests/examples/JDBC/JDBCDemo/.classpath
|
||||
tests/examples/JDBC/JDBCDemo/.project
|
||||
tests/examples/JDBC/JDBCDemo/.settings/
|
||||
source/libs/parser/inc/sql.*
|
||||
source/os/src/timezone/
|
||||
tests/script/tmqResult.txt
|
||||
tests/system-test/case_to_run.txt
|
||||
tests/develop-test/case_to_run.txt
|
||||
tests/scripts/case_to_run.txt
|
||||
tests/tmqResult.txt
|
||||
tests/script/jenkins/basic.txt
|
||||
|
||||
# Emacs
|
||||
# -*- mode: gitignore; -*-
|
||||
*~
|
||||
\#*\#
|
||||
/.emacs.desktop
|
||||
/.emacs.desktop.lock
|
||||
*.elc
|
||||
auto-save-list
|
||||
tramp
|
||||
.\#*
|
||||
TAGS
|
||||
|
||||
contrib/*
|
||||
!contrib/CMakeLists.txt
|
||||
!contrib/test
|
||||
!contrib/azure-cmake
|
||||
sql
|
||||
debug*/
|
||||
.env
|
||||
tools/README
|
||||
tools/LICENSE
|
||||
tools/README.1ST
|
||||
tools/THANKS
|
||||
tools/NEWS
|
||||
tools/COPYING
|
||||
tools/BUGS
|
||||
tools/taosws-rs
|
||||
tags
|
||||
.clangd
|
||||
*CMakeCache*
|
||||
*CMakeFiles*
|
||||
.history/
|
||||
*.tcl
|
||||
*.pc
|
||||
contrib/geos
|
||||
contrib/libuv
|
||||
contrib/pcre2
|
||||
contrib/zlib
|
||||
deps_tmp_CMakeLists.txt.in
|
||||
*.a
|
||||
*.ctest
|
||||
pcre2-config
|
||||
pcre2_test.sh
|
||||
pcre2_grep_test.sh
|
||||
pcre2_chartables.c
|
||||
geos-config
|
||||
config.h
|
||||
!contrib/xml2-cmake
|
||||
!contrib/xml2-cmake/linux_x86_64/include/config.h
|
||||
!contrib/xml2-cmake/CMakeLists.txt
|
||||
pcre2.h
|
||||
zconf.h
|
||||
version.h
|
||||
geos_c.h
|
||||
source/libs/parser/src/sql.c
|
||||
include/common/ttokenauto.h
|
||||
!packaging/smokeTest/pytest_require.txt
|
||||
tdengine-test-dir/
|
||||
localtime.c
|
||||
private.h
|
||||
strftime.c
|
||||
tzdir.h
|
||||
tzfile.h
|
||||
coverage.info
|
||||
taos
|
||||
taosd
|
|
@ -0,0 +1,28 @@
|
|||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v2.3.0
|
||||
hooks:
|
||||
- id: check-yaml
|
||||
- id: check-json
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: stable
|
||||
hooks:
|
||||
- id: black
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/pocc/pre-commit-hooks
|
||||
rev: master
|
||||
hooks:
|
||||
- id: cppcheck
|
||||
args: ["--error-exitcode=0"]
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/crate-ci/typos
|
||||
rev: v1.15.7
|
||||
hooks:
|
||||
- id: typos
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(
|
||||
TDengine
|
||||
VERSION 3.0
|
||||
DESCRIPTION "An open-source big data platform designed and optimized for the Internet of Things(IOT)"
|
||||
)
|
||||
|
||||
if(NOT DEFINED TD_SOURCE_DIR)
|
||||
set(TD_SOURCE_DIR ${PROJECT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
SET(TD_COMMUNITY_DIR ${PROJECT_SOURCE_DIR})
|
||||
set(TD_SUPPORT_DIR "${TD_SOURCE_DIR}/cmake")
|
||||
set(TD_CONTRIB_DIR "${TD_SOURCE_DIR}/contrib")
|
||||
|
||||
include(${TD_SUPPORT_DIR}/cmake.platform)
|
||||
include(${TD_SUPPORT_DIR}/cmake.options)
|
||||
include(${TD_SUPPORT_DIR}/cmake.define)
|
||||
include(${TD_SUPPORT_DIR}/cmake.version)
|
||||
include(${TD_SUPPORT_DIR}/cmake.install)
|
||||
enable_testing()
|
||||
|
||||
set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_NO_CYCLES OFF)
|
||||
add_subdirectory(contrib)
|
||||
|
||||
if(${BUILD_TEST})
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
add_subdirectory(examples/c)
|
||||
endif(${BUILD_TEST})
|
||||
|
||||
add_library(api INTERFACE)
|
||||
target_include_directories(api INTERFACE "include/client")
|
||||
add_subdirectory(source)
|
||||
add_subdirectory(tools)
|
||||
add_subdirectory(utils)
|
||||
add_subdirectory(tests)
|
||||
add_subdirectory(docs/doxgen)
|
|
@ -0,0 +1,47 @@
|
|||
# 贡献者契约行为准则
|
||||
|
||||
[](code_of_conduct.md)
|
||||
|
||||
## 我们的承诺
|
||||
|
||||
为了营造一个开放和热情的环境,作为贡献者和维护者,我们承诺让每个人参与我们的项目和社区成为一种无骚扰的体验,无论年龄、体型、残疾、种族、性别特征、性别认同和表达、经验水平、教育、社会经济地位、国籍、个人外表、种族、宗教或性认同和取向如何。
|
||||
|
||||
## 我们的标准
|
||||
|
||||
有助于创造积极环境的行为示例包括:
|
||||
|
||||
- 使用热情和包容的语言
|
||||
- 尊重不同的观点和经历
|
||||
- 优雅地接受建设性的批评
|
||||
- 专注于对社区最有利的事情
|
||||
- 对其他社区成员表示同情
|
||||
|
||||
参与者不可接受的行为示例包括:
|
||||
|
||||
- 使用性感的语言或图像以及不受欢迎的性关注或进步
|
||||
- 拖钓、侮辱/贬损评论以及人身或政治攻击
|
||||
- 公共或私人骚扰
|
||||
- 未经明确许可发布他人的私人信息,例如物理地址或电子地址
|
||||
- 在专业环境中可能被合理认为不适当的其他行为
|
||||
|
||||
## 我们的责任
|
||||
|
||||
项目维护人员负责阐明可接受行为的标准,并期望针对任何不可接受行为的情况采取适当和公平的纠正措施。
|
||||
|
||||
项目维护者有权利和责任删除、编辑或拒绝评论、提交、代码、wiki 编辑、问题和其他不符合本行为准则的贡献,或暂时或永久禁止任何贡献者从事他们认为不适当、威胁、冒犯或有害的其他行为。
|
||||
|
||||
## 范围
|
||||
|
||||
本行为准则适用于所有项目空间,也适用于个人在公共场所代表项目或其社区时。 代表项目或社区的示例包括使用官方项目电子邮件地址、通过官方社交媒体帐户发布信息或在在线或离线活动中担任指定代表。 项目的表示可以由项目维护者进一步定义和澄清。
|
||||
|
||||
## 执法
|
||||
|
||||
可以通过 support@taosdata.com 联系项目团队来报告辱骂、骚扰或其他不可接受的行为。 所有投诉都将被审查和调查,并将产生被认为必要且适合具体情况的回应。 项目团队有义务对事件的报告者保密。 具体执行政策的更多细节可能会单独发布。
|
||||
|
||||
不善意遵守或执行行为准则的项目维护者可能会面临由项目领导的其他成员确定的临时或永久影响。
|
||||
|
||||
## 来源
|
||||
|
||||
本行为准则改编自贡献者公约 1.4 版,可在 https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 获取
|
||||
|
||||
有关此行为准则的常见问题的答案,请参阅 https://www.contributor-covenant.org/faq
|
|
@ -0,0 +1,78 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
[](code_of_conduct.md)
|
||||
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all project spaces, and it also applies when
|
||||
an individual is representing the project or its community in public spaces.
|
||||
Examples of representing a project or community include using an official
|
||||
project e-mail address, posting via an official social media account, or acting
|
||||
as an appointed representative at an online or offline event. Representation of
|
||||
a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at support@taosdata.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
|
@ -0,0 +1,51 @@
|
|||
# 贡献指南
|
||||
|
||||
我们感谢所有开发者提交贡献。随时关注我们,Fork 存储库,报告错误,以及在 GitHub 上提交您的代码。但是,我们希望开发者遵循我们的指南,才能更好的做出贡献。
|
||||
|
||||
## 报告错误
|
||||
|
||||
- 任何用户都可以通过 **[GitHub issue tracker](https://github.com/taosdata/TDengine/issues)** 向我们报告错误。请您对所遇到的问题进行**详细描述**,最好提供重现错误的详细步骤。
|
||||
- 欢迎提供包含由 Bug 生成的日志文件的附录。
|
||||
|
||||
## 代码提交规则
|
||||
|
||||
1. 在提交代码之前,需要**同意贡献者许可协议(CLA)**。点击 [TaosData CLA](https://cla-assistant.io/taosdata/TDengine) 阅读并签署协议。如果您不接受该协议,请停止提交。
|
||||
2. 请在 [GitHub issue tracker](https://github.com/taosdata/TDengine/issues) 中解决问题或添加注册功能。
|
||||
如果在 [GitHub issue tracker](https://github.com/taosdata/TDengine/issues) 中没有找到相应的问题或功能,请**创建一个新的 issue**。
|
||||
将代码提交到我们的存储库时,请创建**包含问题编号的 PR**。
|
||||
3. 将TDengine仓库库fork到自己的账户中并创建分支(branch)。
|
||||
注意:默认分支`main`不能直接接受PR,请基于开发分支`3.0`创建自己的分支。
|
||||
注意:修改文档的分支要以`docs/`为开头,以免进行不必要的测试。
|
||||
4. 创建pull request,将自己的分支合并到开发分支`3.0`,我们开发团队将尽快审核。
|
||||
|
||||
如遇任何问题,请添加官方微信 tdengine1。我们的团队会帮忙解决。
|
||||
|
||||
## 给贡献者的礼品
|
||||
|
||||
只要您是为 TDengine 做贡献的开发者,不管是代码贡献、修复 bug 或功能请求,还是文档更改,您都将会获得一份**特别的贡献者纪念品礼物**!
|
||||
|
||||
<p align="left">
|
||||
<img
|
||||
src="docs/assets/contributing-cup.jpg"
|
||||
alt=""
|
||||
width="200"
|
||||
/>
|
||||
<img
|
||||
src="docs/assets/contributing-notebook.jpg"
|
||||
alt=""
|
||||
width="200"
|
||||
/>
|
||||
<img
|
||||
src="docs/assets/contributing-shirt.jpg"
|
||||
alt=""
|
||||
width="200"
|
||||
/>
|
||||
|
||||
TDengine 社区致力于让更多的开发者理解和使用它。
|
||||
请填写**贡献者提交表**以选择您想收到的礼物。
|
||||
|
||||
- [贡献者提交表](https://page.ma.scrmtech.com/form/index?pf_uid=27715_2095&id=12100)
|
||||
|
||||
## 联系我们
|
||||
|
||||
如果您有什么问题需要解决,或者有什么问题需要解答,可以添加微信:tdengine1。
|
|
@ -0,0 +1,58 @@
|
|||
# Contributing to TDengine
|
||||
|
||||
TDengine Community Edition is free, open-source software. Its development is led by the TDengine Team, but we welcome contributions from all community members and open-source developers. This document describes how you can contribute, no matter whether you're a user or a developer yourself.
|
||||
|
||||
## Bug reports
|
||||
|
||||
All users can report bugs to us through the **[GitHub issue tracker](https://github.com/taosdata/TDengine/issues)**. To ensure that the development team can locate and resolve the issue that you experienced, please include the following in your bug report:
|
||||
|
||||
- A detailed description of the issue, including the steps to reproduce it.
|
||||
- Any log files that may be relevant to the issue.
|
||||
|
||||
## Code contributions
|
||||
|
||||
Developers are encouraged to submit patches to the project, and all contributions, from minor documentation changes to bug fixes, are appreciated by our team. To ensure that your code can be merged successfully and improve the experience for other community members, we ask that you go through the following procedure before submitting a pull request:
|
||||
|
||||
1. Read and accept the terms of the TAOS Data Contributor License Agreement (CLA) located at [https://cla-assistant.io/taosdata/TDengine](https://cla-assistant.io/taosdata/TDengine).
|
||||
|
||||
2. For bug fixes, search the [GitHub issue tracker](https://github.com/taosdata/TDengine/issues) to check whether the bug has already been filed.
|
||||
- If the bug that you want to fix already exists in the issue tracker, review the previous discussion before submitting your patch.
|
||||
- If the bug that you want to fix does not exist in the issue tracker, click **New issue** and file a report.
|
||||
- Ensure that you note the issue number in your pull request when you submit your patch.
|
||||
|
||||
3. Fork our repository to your GitHub account and create a branch for your patch.
|
||||
**Important:** The `main` branch is for stable versions and cannot accept patches directly. For all code and documentation changes, create your own branch from the development branch `3.0` and not from `main`.
|
||||
Note: For a documentation change, ensure that the branch name starts with `docs/` so that the change can be merged without running tests.
|
||||
|
||||
4. Create a pull request to merge your changes into the development branch `3.0`, and our team members will review the request as soon as possible.
|
||||
|
||||
If you encounter any difficulties or problems in contributing your code, you can join our [Discord server](https://discord.com/invite/VZdSuUg4pS) and receive assistance from members of the TDengine Team.
|
||||
|
||||
## Expressing our thanks
|
||||
|
||||
To thank community members for your support, we are offering a free gift to any developer who submits at least one contribution. You can choose one of the following items:
|
||||
|
||||
<p align="left">
|
||||
<img
|
||||
src="docs/assets/contributing-cup.jpg"
|
||||
alt=""
|
||||
width="200"
|
||||
/>
|
||||
<img
|
||||
src="docs/assets/contributing-notebook.jpg"
|
||||
alt=""
|
||||
width="200"
|
||||
/>
|
||||
<img
|
||||
src="docs/assets/contributing-shirt.jpg"
|
||||
alt=""
|
||||
width="200"
|
||||
/>
|
||||
|
||||
If you would like to claim your gift, send an email to [developer@tdengine.com](mailto:developer@tdengine.com?subject=Claiming&20my%20developer%20gift) including the following information:
|
||||
|
||||
- Your GitHub account name
|
||||
- Your name and mailing address
|
||||
- Your preferred gift
|
||||
|
||||
Note: Limit one per person.
|
|
@ -0,0 +1,200 @@
|
|||
import hudson.model.Result
|
||||
import hudson.model.*;
|
||||
import jenkins.model.CauseOfInterruption
|
||||
node {
|
||||
}
|
||||
|
||||
def skipbuild=0
|
||||
def win_stop=0
|
||||
|
||||
def abortPreviousBuilds() {
|
||||
def currentJobName = env.JOB_NAME
|
||||
def currentBuildNumber = env.BUILD_NUMBER.toInteger()
|
||||
def jobs = Jenkins.instance.getItemByFullName(currentJobName)
|
||||
def builds = jobs.getBuilds()
|
||||
|
||||
for (build in builds) {
|
||||
if (!build.isBuilding()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (currentBuildNumber == build.getNumber().toInteger()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
build.doKill() //doTerm(),doKill(),doTerm()
|
||||
}
|
||||
}
|
||||
// abort previous build
|
||||
abortPreviousBuilds()
|
||||
def abort_previous(){
|
||||
def buildNumber = env.BUILD_NUMBER as int
|
||||
if (buildNumber > 1) milestone(buildNumber - 1)
|
||||
milestone(buildNumber)
|
||||
}
|
||||
def pre_test(){
|
||||
sh'hostname'
|
||||
sh '''
|
||||
sudo rmtaos || echo "taosd has not installed"
|
||||
'''
|
||||
sh '''
|
||||
killall -9 taosd ||echo "no taosd running"
|
||||
killall -9 gdb || echo "no gdb running"
|
||||
killall -9 python3.8 || echo "no python program running"
|
||||
cd ${WKC}
|
||||
'''
|
||||
script {
|
||||
if (env.CHANGE_TARGET == 'master') {
|
||||
sh '''
|
||||
cd ${WKC}
|
||||
git checkout master
|
||||
'''
|
||||
}
|
||||
else if(env.CHANGE_TARGET == '2.0'){
|
||||
sh '''
|
||||
cd ${WKC}
|
||||
git checkout 2.0
|
||||
'''
|
||||
}
|
||||
else if(env.CHANGE_TARGET == '3.0'){
|
||||
sh '''
|
||||
cd ${WKC}
|
||||
git checkout 3.0
|
||||
'''
|
||||
}
|
||||
else{
|
||||
sh '''
|
||||
cd ${WKC}
|
||||
git checkout develop
|
||||
'''
|
||||
}
|
||||
}
|
||||
sh'''
|
||||
cd ${WKC}
|
||||
git pull >/dev/null
|
||||
git fetch origin +refs/pull/${CHANGE_ID}/merge
|
||||
git checkout -qf FETCH_HEAD
|
||||
export TZ=Asia/Harbin
|
||||
date
|
||||
rm -rf debug
|
||||
mkdir debug
|
||||
cd debug
|
||||
cmake .. -DBUILD_TEST=true > /dev/null
|
||||
make -j4> /dev/null
|
||||
|
||||
'''
|
||||
return 1
|
||||
}
|
||||
|
||||
pipeline {
|
||||
agent none
|
||||
options { skipDefaultCheckout() }
|
||||
environment{
|
||||
WK = '/var/lib/jenkins/workspace/TDinternal'
|
||||
WKC= '/var/lib/jenkins/workspace/TDengine'
|
||||
}
|
||||
stages {
|
||||
stage('pre_build'){
|
||||
agent{label 'slave3_0'}
|
||||
options { skipDefaultCheckout() }
|
||||
when {
|
||||
changeRequest()
|
||||
}
|
||||
steps {
|
||||
script{
|
||||
abort_previous()
|
||||
abortPreviousBuilds()
|
||||
}
|
||||
timeout(time: 45, unit: 'MINUTES'){
|
||||
pre_test()
|
||||
sh'''
|
||||
cd ${WKC}/tests
|
||||
./test-all.sh b1fq
|
||||
'''
|
||||
sh'''
|
||||
cd ${WKC}/debug
|
||||
ctest -VV
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
success {
|
||||
emailext (
|
||||
subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' SUCCESS",
|
||||
body: """<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body leftmargin="8" marginwidth="0" topmargin="8" marginheight="4" offset="0">
|
||||
<table width="95%" cellpadding="0" cellspacing="0" style="font-size: 16pt; font-family: Tahoma, Arial, Helvetica, sans-serif">
|
||||
<tr>
|
||||
<td><br />
|
||||
<b><font color="#0B610B"><font size="6">构建信息</font></font></b>
|
||||
<hr size="2" width="100%" align="center" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<ul>
|
||||
<div style="font-size:18px">
|
||||
<li>构建名称>>分支:${env.BRANCH_NAME}</li>
|
||||
<li>构建结果:<span style="color:green"> Successful </span></li>
|
||||
<li>构建编号:${BUILD_NUMBER}</li>
|
||||
<li>触发用户:${env.CHANGE_AUTHOR}</li>
|
||||
<li>提交信息:${env.CHANGE_TITLE}</li>
|
||||
<li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
|
||||
<li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
|
||||
|
||||
</div>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table></font>
|
||||
</body>
|
||||
</html>""",
|
||||
to: "${env.CHANGE_AUTHOR_EMAIL}",
|
||||
from: "support@taosdata.com"
|
||||
)
|
||||
}
|
||||
failure {
|
||||
emailext (
|
||||
subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' FAIL",
|
||||
body: """<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body leftmargin="8" marginwidth="0" topmargin="8" marginheight="4" offset="0">
|
||||
<table width="95%" cellpadding="0" cellspacing="0" style="font-size: 16pt; font-family: Tahoma, Arial, Helvetica, sans-serif">
|
||||
<tr>
|
||||
<td><br />
|
||||
<b><font color="#0B610B"><font size="6">构建信息</font></font></b>
|
||||
<hr size="2" width="100%" align="center" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<ul>
|
||||
<div style="font-size:18px">
|
||||
<li>构建名称>>分支:${env.BRANCH_NAME}</li>
|
||||
<li>构建结果:<span style="color:red"> Failure </span></li>
|
||||
<li>构建编号:${BUILD_NUMBER}</li>
|
||||
<li>触发用户:${env.CHANGE_AUTHOR}</li>
|
||||
<li>提交信息:${env.CHANGE_TITLE}</li>
|
||||
<li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
|
||||
<li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
|
||||
|
||||
</div>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table></font>
|
||||
</body>
|
||||
</html>""",
|
||||
to: "${env.CHANGE_AUTHOR_EMAIL}",
|
||||
from: "support@taosdata.com"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,671 @@
|
|||
import hudson.model.Result
|
||||
import hudson.model.*;
|
||||
import jenkins.model.CauseOfInterruption
|
||||
node {
|
||||
}
|
||||
file_zh_changed = ''
|
||||
file_en_changed = ''
|
||||
file_no_doc_changed = '1'
|
||||
file_only_tdgpt_change_except = '1'
|
||||
tdgpt_file = "forecastoperator.c|anomalywindowoperator.c|tanalytics.h|tanalytics.c|tdgpt_cases.task|analytics"
|
||||
|
||||
|
||||
def abortPreviousBuilds() {
|
||||
def currentJobName = env.JOB_NAME
|
||||
def currentBuildNumber = env.BUILD_NUMBER.toInteger()
|
||||
def jobs = Jenkins.instance.getItemByFullName(currentJobName)
|
||||
def builds = jobs.getBuilds()
|
||||
|
||||
for (build in builds) {
|
||||
if (!build.isBuilding()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (currentBuildNumber == build.getNumber().toInteger()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
build.doKill() //doTerm(),doKill(),doTerm()
|
||||
}
|
||||
}
|
||||
// abort previous build
|
||||
abortPreviousBuilds()
|
||||
def abort_previous(){
|
||||
def buildNumber = env.BUILD_NUMBER as int
|
||||
if (buildNumber > 1) milestone(buildNumber - 1)
|
||||
milestone(buildNumber)
|
||||
}
|
||||
def check_docs(){
|
||||
if (env.CHANGE_URL =~ /\/TDengine\//) {
|
||||
sh '''
|
||||
hostname
|
||||
date
|
||||
env
|
||||
'''
|
||||
sh '''
|
||||
cd ${WKC}
|
||||
git reset --hard
|
||||
git clean -f
|
||||
git remote prune origin
|
||||
git fetch
|
||||
git checkout ''' + env.CHANGE_TARGET + '''
|
||||
git pull >/dev/null
|
||||
git fetch origin +refs/pull/${CHANGE_ID}/merge
|
||||
git checkout -qf FETCH_HEAD
|
||||
'''
|
||||
|
||||
file_zh_changed = sh (
|
||||
script: '''
|
||||
cd ${WKC}
|
||||
git --no-pager diff --name-only FETCH_HEAD `git merge-base FETCH_HEAD ${CHANGE_TARGET}`|grep "^docs/zh/" || :
|
||||
''',
|
||||
returnStdout: true
|
||||
)
|
||||
|
||||
file_en_changed = sh (
|
||||
script: '''
|
||||
cd ${WKC}
|
||||
git --no-pager diff --name-only FETCH_HEAD `git merge-base FETCH_HEAD ${CHANGE_TARGET}`|grep "^docs/en/" || :
|
||||
''',
|
||||
returnStdout: true
|
||||
)
|
||||
|
||||
file_no_doc_changed = sh (
|
||||
script: '''
|
||||
cd ${WKC}
|
||||
git --no-pager diff --name-only FETCH_HEAD `git merge-base FETCH_HEAD ${CHANGE_TARGET}`|grep -v "^docs/en/"|grep -v "^docs/zh/"|grep -v ".md$" || :
|
||||
''',
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
file_only_tdgpt_change_except = sh (
|
||||
script: '''
|
||||
cd ${WKC}
|
||||
git --no-pager diff --name-only FETCH_HEAD `git merge-base FETCH_HEAD ${CHANGE_TARGET}`|grep -v "^docs/en/"|grep -v "^docs/zh/"|grep -v ".md$" | grep -Ev "forecastoperator.c|anomalywindowoperator.c|tanalytics.h|tanalytics.c|tdgpt_cases.task|analytics" ||:
|
||||
''',
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
echo "file_zh_changed: ${file_zh_changed}"
|
||||
echo "file_en_changed: ${file_en_changed}"
|
||||
echo "file_no_doc_changed: ${file_no_doc_changed}"
|
||||
echo "file_only_tdgpt_change_except: ${file_only_tdgpt_change_except}"
|
||||
}
|
||||
}
|
||||
|
||||
def build_pre_docs(){
|
||||
if (env.CHANGE_URL =~ /\/TDengine\//) {
|
||||
sh '''
|
||||
hostname
|
||||
date
|
||||
env
|
||||
'''
|
||||
|
||||
sh '''
|
||||
cd ${DOC_WKC}/${td_repo}
|
||||
git reset --hard
|
||||
git clean -f
|
||||
git remote prune origin
|
||||
git fetch
|
||||
git checkout ''' + env.CHANGE_TARGET + '''
|
||||
git pull >/dev/null
|
||||
git fetch origin +refs/pull/${CHANGE_ID}/merge
|
||||
git checkout -qf FETCH_HEAD
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
def build_zh_docs(){
|
||||
sh '''
|
||||
cd ${DOC_WKC}/${zh_doc_repo}
|
||||
# git pull
|
||||
yarn ass local
|
||||
yarn build
|
||||
'''
|
||||
}
|
||||
|
||||
def build_en_docs(){
|
||||
sh '''
|
||||
cd ${DOC_WKC}/${en_doc_repo}
|
||||
# git pull
|
||||
yarn ass local
|
||||
yarn build
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
def pre_test(){
|
||||
sh '''
|
||||
hostname
|
||||
date
|
||||
env
|
||||
'''
|
||||
sh '''
|
||||
cd ${WK}
|
||||
git reset --hard
|
||||
git remote prune origin
|
||||
git fetch
|
||||
cd ${WKC}
|
||||
git reset --hard
|
||||
git clean -f
|
||||
rm -rf examples/rust/
|
||||
git remote prune origin
|
||||
git fetch
|
||||
'''
|
||||
script {
|
||||
sh '''
|
||||
cd ${WK}
|
||||
git checkout ''' + env.CHANGE_TARGET + '''
|
||||
cd ${WKC}
|
||||
git checkout ''' + env.CHANGE_TARGET + '''
|
||||
'''
|
||||
}
|
||||
if (env.CHANGE_URL =~ /\/TDengine\//) {
|
||||
sh '''
|
||||
cd ${WKC}
|
||||
git remote prune origin
|
||||
git pull >/dev/null
|
||||
git log -5
|
||||
echo "`date "+%Y%m%d-%H%M%S"` ${JOB_NAME}:${BRANCH_NAME}:${BUILD_ID}:${CHANGE_TARGET}" >>${WKDIR}/jenkins.log
|
||||
echo "CHANGE_BRANCH:${CHANGE_BRANCH}" >>${WKDIR}/jenkins.log
|
||||
echo "community log: `git log -5`" >>${WKDIR}/jenkins.log
|
||||
git fetch origin +refs/pull/${CHANGE_ID}/merge
|
||||
git checkout -qf FETCH_HEAD
|
||||
git log -5
|
||||
echo "community log merged: `git log -5`" >>${WKDIR}/jenkins.log
|
||||
cd ${WK}
|
||||
git pull >/dev/null
|
||||
git log -5
|
||||
echo "tdinternal log: `git log -5`" >>${WKDIR}/jenkins.log
|
||||
'''
|
||||
} else if (env.CHANGE_URL =~ /\/TDinternal\//) {
|
||||
sh '''
|
||||
cd ${WK}
|
||||
git pull >/dev/null
|
||||
git log -5
|
||||
echo "`date "+%Y%m%d-%H%M%S"` ${JOB_NAME}:${BRANCH_NAME}:${BUILD_ID}:${CHANGE_TARGET}" >>${WKDIR}/jenkins.log
|
||||
echo "CHANGE_BRANCH:${CHANGE_BRANCH}" >>${WKDIR}/jenkins.log
|
||||
echo "tdinternal log: `git log -5`" >>${WKDIR}/jenkins.log
|
||||
git fetch origin +refs/pull/${CHANGE_ID}/merge
|
||||
git checkout -qf FETCH_HEAD
|
||||
git log -5
|
||||
echo "tdinternal log merged: `git log -5`" >>${WKDIR}/jenkins.log
|
||||
cd ${WKC}
|
||||
git remote prune origin
|
||||
git pull >/dev/null
|
||||
git log -5
|
||||
echo "community log: `git log -5`" >>${WKDIR}/jenkins.log
|
||||
'''
|
||||
} else {
|
||||
sh '''
|
||||
echo "unmatched repository ${CHANGE_URL}"
|
||||
'''
|
||||
}
|
||||
sh '''
|
||||
cd ${WKC}
|
||||
git rm --cached tools/taos-tools 2>/dev/null || :
|
||||
git rm --cached tools/taosadapter 2>/dev/null || :
|
||||
git rm --cached tools/taosws-rs 2>/dev/null || :
|
||||
git rm --cached examples/rust 2>/dev/null || :
|
||||
'''
|
||||
sh '''
|
||||
cd ${WKC}
|
||||
git submodule update --init --recursive
|
||||
'''
|
||||
return 1
|
||||
}
|
||||
|
||||
def pre_test_build_mac() {
|
||||
sh '''
|
||||
hostname
|
||||
date
|
||||
'''
|
||||
sh '''
|
||||
cd ${WK}
|
||||
rm -rf debug
|
||||
mkdir debug
|
||||
'''
|
||||
sh '''
|
||||
cd ${WK}/debug
|
||||
cmake .. -DBUILD_TEST=true -DBUILD_HTTPS=false -DCMAKE_BUILD_TYPE=Release
|
||||
make -j10
|
||||
ctest -j10 || exit 7
|
||||
'''
|
||||
sh '''
|
||||
date
|
||||
'''
|
||||
}
|
||||
|
||||
def pre_test_win(){
|
||||
bat '''
|
||||
hostname
|
||||
taskkill /f /t /im python.exe
|
||||
taskkill /f /t /im bash.exe
|
||||
taskkill /f /t /im taosd.exe
|
||||
ipconfig
|
||||
set
|
||||
date /t
|
||||
time /t
|
||||
rd /s /Q %WIN_INTERNAL_ROOT%\\debug || exit 0
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_INTERNAL_ROOT%
|
||||
git reset --hard
|
||||
git remote prune origin
|
||||
git fetch
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_COMMUNITY_ROOT%
|
||||
git clean -f
|
||||
git reset --hard
|
||||
git remote prune origin
|
||||
git fetch
|
||||
'''
|
||||
script {
|
||||
bat '''
|
||||
cd %WIN_INTERNAL_ROOT%
|
||||
git checkout ''' + env.CHANGE_TARGET + '''
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_COMMUNITY_ROOT%
|
||||
git checkout ''' + env.CHANGE_TARGET + '''
|
||||
'''
|
||||
}
|
||||
script {
|
||||
if (env.CHANGE_URL =~ /\/TDengine\//) {
|
||||
bat '''
|
||||
cd %WIN_INTERNAL_ROOT%
|
||||
git pull origin ''' + env.CHANGE_TARGET + '''
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_COMMUNITY_ROOT%
|
||||
git remote prune origin
|
||||
git pull origin ''' + env.CHANGE_TARGET + '''
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_COMMUNITY_ROOT%
|
||||
git fetch origin +refs/pull/%CHANGE_ID%/merge
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_COMMUNITY_ROOT%
|
||||
git checkout -qf FETCH_HEAD
|
||||
'''
|
||||
} else if (env.CHANGE_URL =~ /\/TDinternal\//) {
|
||||
bat '''
|
||||
cd %WIN_INTERNAL_ROOT%
|
||||
git pull origin ''' + env.CHANGE_TARGET + '''
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_INTERNAL_ROOT%
|
||||
git fetch origin +refs/pull/%CHANGE_ID%/merge
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_INTERNAL_ROOT%
|
||||
git checkout -qf FETCH_HEAD
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_COMMUNITY_ROOT%
|
||||
git remote prune origin
|
||||
git pull
|
||||
'''
|
||||
} else {
|
||||
bat '''
|
||||
echo "unmatched repository %CHANGE_URL%"
|
||||
'''
|
||||
}
|
||||
}
|
||||
bat '''
|
||||
cd %WIN_INTERNAL_ROOT%
|
||||
git branch
|
||||
git log -5
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_COMMUNITY_ROOT%
|
||||
git branch
|
||||
git log -5
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_COMMUNITY_ROOT%
|
||||
git rm --cached tools/taos-tools 2>nul
|
||||
git rm --cached tools/taosadapter 2>nul
|
||||
git rm --cached tools/taosws-rs 2>nul
|
||||
git rm --cached examples/rust 2>nul
|
||||
exit 0
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_COMMUNITY_ROOT%
|
||||
git submodule update --init --recursive
|
||||
'''
|
||||
}
|
||||
|
||||
def pre_test_build_win() {
|
||||
bat '''
|
||||
echo "building ..."
|
||||
time /t
|
||||
cd %WIN_INTERNAL_ROOT%
|
||||
mkdir debug
|
||||
cd debug
|
||||
time /t
|
||||
call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat" x64
|
||||
set CL=/MP8
|
||||
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> cmake"
|
||||
time /t
|
||||
cmake .. -G "NMake Makefiles JOM" -DBUILD_TEST=true -DBUILD_TOOLS=true || exit 7
|
||||
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> jom -j 6"
|
||||
time /t
|
||||
jom -j 6 || exit 8
|
||||
time /t
|
||||
'''
|
||||
bat '''
|
||||
cd %WIN_COMMUNITY_ROOT%/tests/ci
|
||||
pip3 install taospy==2.7.21
|
||||
pip3 install taos-ws-py==0.3.8
|
||||
xcopy /e/y/i/f %WIN_INTERNAL_ROOT%\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
|
||||
xcopy /e/y/i/f %WIN_INTERNAL_ROOT%\\debug\\build\\lib\\taosnative.dll C:\\Windows\\System32
|
||||
'''
|
||||
return 1
|
||||
}
|
||||
|
||||
def run_win_ctest() {
|
||||
bat '''
|
||||
echo "windows ctest ..."
|
||||
time /t
|
||||
cd %WIN_INTERNAL_ROOT%\\debug
|
||||
ctest -j 1 || exit 7
|
||||
time /t
|
||||
'''
|
||||
}
|
||||
|
||||
def run_win_test() {
|
||||
bat '''
|
||||
echo "windows test ..."
|
||||
xcopy /e/y/i/f %WIN_INTERNAL_ROOT%\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
|
||||
xcopy /e/y/i/f %WIN_INTERNAL_ROOT%\\debug\\build\\lib\\taosnative.dll C:\\Windows\\System32
|
||||
ls -l C:\\Windows\\System32\\taos.dll
|
||||
ls -l C:\\Windows\\System32\\taosnative.dll
|
||||
time /t
|
||||
cd %WIN_SYSTEM_TEST_ROOT%
|
||||
echo "testing ..."
|
||||
test-all.bat ci
|
||||
time /t
|
||||
'''
|
||||
}
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
options { skipDefaultCheckout() }
|
||||
environment{
|
||||
WKDIR = '/var/lib/jenkins/workspace'
|
||||
WK = '/var/lib/jenkins/workspace/TDinternal'
|
||||
WKC = '/var/lib/jenkins/workspace/TDinternal/community'
|
||||
WKPY = '/var/lib/jenkins/workspace/taos-connector-python'
|
||||
DOC_WKC = '/root/doc_ci_work'
|
||||
td_repo = 'TDengine'
|
||||
zh_doc_repo = 'docs.taosdata.com'
|
||||
en_doc_repo = 'docs.tdengine.com'
|
||||
tools_repo = 'taos-tools'
|
||||
}
|
||||
stages {
|
||||
stage ('check doc file changed') {
|
||||
agent{label " slave1_47 || slave1_48 || slave1_49 || slave1_50 || slave1_52 || slave1_59 || slave1_63 || worker03 || slave215 || slave217 || slave219 || Mac_catalina "}
|
||||
steps {
|
||||
check_docs()
|
||||
}
|
||||
}
|
||||
|
||||
stage ('pre for build docs') {
|
||||
when {
|
||||
beforeAgent true
|
||||
expression { env.CHANGE_BRANCH =~ /(?i)doc.*/ || file_zh_changed != '' || file_en_changed != '' }
|
||||
}
|
||||
agent{label "doc_build_0_30"}
|
||||
steps {
|
||||
build_pre_docs()
|
||||
}
|
||||
}
|
||||
|
||||
stage('build Docs') {
|
||||
when {
|
||||
beforeAgent true
|
||||
expression { env.CHANGE_BRANCH =~ /(?i)doc.*/ || file_zh_changed != '' || file_en_changed != '' }
|
||||
}
|
||||
parallel {
|
||||
stage('build zh docs') {
|
||||
agent{label "doc_build_0_30"}
|
||||
when {
|
||||
expression { file_zh_changed != '' }
|
||||
}
|
||||
steps {
|
||||
build_zh_docs()
|
||||
}
|
||||
}
|
||||
stage('build en docs') {
|
||||
agent{label "doc_build_0_30"}
|
||||
when {
|
||||
expression { file_en_changed != '' }
|
||||
}
|
||||
steps {
|
||||
build_en_docs()
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
unsuccessful {
|
||||
error('build docs stage failed, terminating pipeline.')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('run test') {
|
||||
when {
|
||||
expression {
|
||||
file_no_doc_changed != '' && env.CHANGE_TARGET != 'docs-cloud'
|
||||
}
|
||||
}
|
||||
parallel {
|
||||
stage('windows test') {
|
||||
agent{label " windows10_01 || windows10_02 || windows10_03 || windows10_04 "}
|
||||
environment{
|
||||
WIN_INTERNAL_ROOT="C:\\workspace\\${env.EXECUTOR_NUMBER}\\TDinternal"
|
||||
WIN_COMMUNITY_ROOT="C:\\workspace\\${env.EXECUTOR_NUMBER}\\TDinternal\\community"
|
||||
WIN_SYSTEM_TEST_ROOT="C:\\workspace\\${env.EXECUTOR_NUMBER}\\TDinternal\\community\\tests\\system-test"
|
||||
}
|
||||
when {
|
||||
beforeAgent true
|
||||
expression { file_only_tdgpt_change_except != '' }
|
||||
}
|
||||
steps {
|
||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||
timeout(time: 126, unit: 'MINUTES'){
|
||||
pre_test_win()
|
||||
pre_test_build_win()
|
||||
run_win_ctest()
|
||||
run_win_test()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('mac test') {
|
||||
agent{label " Mac_catalina "}
|
||||
when {
|
||||
beforeAgent true
|
||||
expression { file_only_tdgpt_change_except != '' }
|
||||
}
|
||||
steps {
|
||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||
timeout(time: 60, unit: 'MINUTES'){
|
||||
pre_test()
|
||||
pre_test_build_mac()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('linux test') {
|
||||
agent{label "slave1_47 || slave1_48 || slave1_49 || slave1_50 || slave1_52 || slave1_59 || slave1_63 || worker03 || slave215 || slave217 || slave219 "}
|
||||
options { skipDefaultCheckout() }
|
||||
when {
|
||||
changeRequest()
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
def linux_node_ip = sh (
|
||||
script: 'ip addr|grep 192|grep -v virbr|awk "{print \\\$2}"|sed "s/\\/.*//"',
|
||||
returnStdout: true
|
||||
).trim()
|
||||
echo "${linux_node_ip}"
|
||||
echo "${WKDIR}/restore.sh -p ${BRANCH_NAME} -n ${BUILD_ID} -c {container name}"
|
||||
}
|
||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||
timeout(time: 200, unit: 'MINUTES'){
|
||||
pre_test()
|
||||
script {
|
||||
sh '''
|
||||
mkdir -p ${WKDIR}/tmp/${BRANCH_NAME}_${BUILD_ID}
|
||||
echo "''' + file_no_doc_changed + '''" > ${WKDIR}/tmp/${BRANCH_NAME}_${BUILD_ID}/docs_changed.txt
|
||||
'''
|
||||
sh '''
|
||||
cd ${WKC}/tests/parallel_test
|
||||
./run_check_assert_container.sh -d ${WKDIR}
|
||||
'''
|
||||
sh '''
|
||||
cd ${WKC}/tests/parallel_test
|
||||
./run_check_void_container.sh -d ${WKDIR}
|
||||
'''
|
||||
sh '''
|
||||
date
|
||||
rm -rf ${WKC}/debug
|
||||
cd ${WKC}/tests/parallel_test
|
||||
time ./container_build.sh -w ${WKDIR} -e
|
||||
'''
|
||||
def extra_param = ""
|
||||
def log_server_file = "/home/log_server.json"
|
||||
def timeout_cmd = ""
|
||||
if (fileExists(log_server_file)) {
|
||||
def log_server_enabled = sh (
|
||||
script: 'jq .enabled ' + log_server_file,
|
||||
returnStdout: true
|
||||
).trim()
|
||||
def timeout_param = sh (
|
||||
script: 'jq .timeout ' + log_server_file,
|
||||
returnStdout: true
|
||||
).trim()
|
||||
if (timeout_param != "null" && timeout_param != "0") {
|
||||
timeout_cmd = "timeout " + timeout_param
|
||||
}
|
||||
if (log_server_enabled == "1") {
|
||||
def log_server = sh (
|
||||
script: 'jq .server ' + log_server_file + ' | sed "s/\\\"//g"',
|
||||
returnStdout: true
|
||||
).trim()
|
||||
if (log_server != "null" && log_server != "") {
|
||||
extra_param = "-w " + log_server
|
||||
}
|
||||
}
|
||||
}
|
||||
sh '''
|
||||
cd ${WKC}/tests/parallel_test
|
||||
./run_scan_container.sh -d ${WKDIR} -b ${BRANCH_NAME}_${BUILD_ID} -f ${WKDIR}/tmp/${BRANCH_NAME}_${BUILD_ID}/docs_changed.txt ''' + extra_param + '''
|
||||
'''
|
||||
if ( file_no_doc_changed =~ /forecastoperator.c|anomalywindowoperator.c|tanalytics.h|tanalytics.c|tdgpt_cases.task|analytics/ ) {
|
||||
sh '''
|
||||
cd ${WKC}/tests/parallel_test
|
||||
export DEFAULT_RETRY_TIME=2
|
||||
date
|
||||
timeout 600 time ./run.sh -e -m /home/m.json -t tdgpt_cases.task -b ${BRANCH_NAME}_${BUILD_ID} -l ${WKDIR}/log -o 300 ''' + extra_param + '''
|
||||
'''
|
||||
}
|
||||
if ( file_only_tdgpt_change_except != '' ) {
|
||||
sh '''
|
||||
cd ${WKC}/tests/parallel_test
|
||||
export DEFAULT_RETRY_TIME=2
|
||||
date
|
||||
''' + timeout_cmd + ''' time ./run.sh -e -m /home/m.json -t cases.task -b ${BRANCH_NAME}_${BUILD_ID} -l ${WKDIR}/log -o 1200 ''' + extra_param + '''
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
success {
|
||||
emailext (
|
||||
subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' SUCCESS",
|
||||
body: """<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body leftmargin="8" marginwidth="0" topmargin="8" marginheight="4" offset="0">
|
||||
<table width="95%" cellpadding="0" cellspacing="0" style="font-size: 16pt; font-family: Tahoma, Arial, Helvetica, sans-serif">
|
||||
<tr>
|
||||
<td><br />
|
||||
<b><font color="#0B610B"><font size="6">构建信息</font></font></b>
|
||||
<hr size="2" width="100%" align="center" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<ul>
|
||||
<div style="font-size:18px">
|
||||
<li>构建名称>>分支:${env.BRANCH_NAME}</li>
|
||||
<li>构建结果:<span style="color:green"> Successful </span></li>
|
||||
<li>构建编号:${BUILD_NUMBER}</li>
|
||||
<li>触发用户:${env.CHANGE_AUTHOR}</li>
|
||||
<li>提交信息:${env.CHANGE_TITLE}</li>
|
||||
<li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
|
||||
<li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
|
||||
|
||||
</div>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table></font>
|
||||
</body>
|
||||
</html>""",
|
||||
to: "${env.CHANGE_AUTHOR_EMAIL}",
|
||||
from: "support@taosdata.com"
|
||||
)
|
||||
}
|
||||
failure {
|
||||
emailext (
|
||||
subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' FAIL",
|
||||
body: """<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body leftmargin="8" marginwidth="0" topmargin="8" marginheight="4" offset="0">
|
||||
<table width="95%" cellpadding="0" cellspacing="0" style="font-size: 16pt; font-family: Tahoma, Arial, Helvetica, sans-serif">
|
||||
<tr>
|
||||
<td><br />
|
||||
<b><font color="#0B610B"><font size="6">构建信息</font></font></b>
|
||||
<hr size="2" width="100%" align="center" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<ul>
|
||||
<div style="font-size:18px">
|
||||
<li>构建名称>>分支:${env.BRANCH_NAME}</li>
|
||||
<li>构建结果:<span style="color:red"> Failure </span></li>
|
||||
<li>构建编号:${BUILD_NUMBER}</li>
|
||||
<li>触发用户:${env.CHANGE_AUTHOR}</li>
|
||||
<li>提交信息:${env.CHANGE_TITLE}</li>
|
||||
<li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
|
||||
<li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
|
||||
|
||||
</div>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table></font>
|
||||
</body>
|
||||
</html>""",
|
||||
to: "${env.CHANGE_AUTHOR_EMAIL}",
|
||||
from: "support@taosdata.com"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,661 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
|
@ -0,0 +1,401 @@
|
|||
<p align="center">
|
||||
<a href="https://www.taosdata.com" target="_blank">
|
||||
<img
|
||||
src="docs/assets/tdengine.svg"
|
||||
alt="TDengine"
|
||||
width="500"
|
||||
/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
简体中文 | [English](README.md) | [TDengine 云服务](https://cloud.taosdata.com/?utm_medium=cn&utm_source=github) | 很多职位正在热招中,请看 [这里](https://www.taosdata.com/careers/)
|
||||
|
||||
# 目录
|
||||
|
||||
1. [TDengine 简介](#1-tdengine-简介)
|
||||
1. [文档](#2-文档)
|
||||
1. [必备工具](#3-必备工具)
|
||||
- [3.1 Linux 预备](#31-Linux系统)
|
||||
- [3.2 macOS 预备](#32-macOS系统)
|
||||
- [3.3 Windows 预备](#3.3-Windows系统)
|
||||
- [3.4 克隆仓库](#34-克隆仓库)
|
||||
1. [构建](#4-构建)
|
||||
- [4.1 Linux 系统上构建](#41-Linux系统上构建)
|
||||
- [4.2 macOS 系统上构建](#42-macOS系统上构建)
|
||||
- [4.3 Windows 系统上构建](#43-Windows系统上构建)
|
||||
1. [打包](#5-打包)
|
||||
1. [安装](#6-安装)
|
||||
- [6.1 Linux 系统上安装](#61-Linux系统上安装)
|
||||
- [6.2 macOS 系统上安装](#62-macOS系统上安装)
|
||||
- [6.3 Windows 系统上安装](#63-Windows系统上安装)
|
||||
1. [快速运行](#7-快速运行)
|
||||
- [7.1 Linux 系统上运行](#71-Linux系统上运行)
|
||||
- [7.2 macOS 系统上运行](#72-macOS系统上运行)
|
||||
- [7.3 Windows 系统上运行](#73-Windows系统上运行)
|
||||
1. [测试](#8-测试)
|
||||
1. [版本发布](#9-版本发布)
|
||||
1. [工作流](#10-工作流)
|
||||
1. [覆盖率](#11-覆盖率)
|
||||
1. [成为社区贡献者](#12-成为社区贡献者)
|
||||
|
||||
|
||||
# 1. 简介
|
||||
|
||||
TDengine 是一款开源、高性能、云原生、AI 驱动的时序数据库 (Time-Series Database, TSDB)。TDengine 能被广泛运用于物联网、工业互联网、车联网、IT 运维、金融等领域。除核心的时序数据库功能外,TDengine 还提供缓存、数据订阅、流式计算、AI 智能体等功能,是一极简的时序数据处理平台,最大程度的减小系统设计的复杂度,降低研发和运营成本。与其他时序数据库相比,TDengine 的主要优势如下:
|
||||
|
||||
- **高性能**:通过创新的存储引擎设计,无论是数据写入还是查询,TDengine 的性能比通用数据库快 10 倍以上,也远超其他时序数据库,存储空间不及通用数据库的 1/10。
|
||||
|
||||
- **云原生**:通过原生分布式的设计,充分利用云平台的优势,TDengine 提供了水平扩展能力,具备弹性、韧性和可观测性,支持 k8s 部署,可运行在公有云、私有云和混合云上。
|
||||
|
||||
- **极简时序数据平台**:TDengine 内建消息队列、缓存、流式计算、AI 智能体等功能,应用无需再集成 Kafka/Redis/HBase/Spark 等软件,大幅降低系统的复杂度,降低应用开发和运营成本。
|
||||
|
||||
- **分析能力**:支持 SQL,同时为时序数据特有的分析提供 SQL 扩展。通过超级表、存储计算分离、分区分片、预计算、自定义函数以及 AI Agent 等技术,TDengine 具备强大的分析能力。
|
||||
|
||||
- **AI智能体**:内置时序数据智能体 TDgpt, 无缝连接时序数据基础模型、大语言模型、机器学习、传统统计算法等,提供时序数据预测、异常检测、数据补全和数据分类的功能。
|
||||
|
||||
- **简单易用**:无任何依赖,安装、集群几秒搞定;提供 REST 以及各种语言连接器,与众多第三方工具无缝集成;提供命令行程序,便于管理和即席查询;提供各种运维工具。
|
||||
|
||||
- **核心开源**:TDengine 的核心代码包括集群功能全部开源,截止到 2022 年 8 月 1 日,全球超过 135.9k 个运行实例,GitHub Star 18.7k,Fork 4.4k,社区活跃。
|
||||
|
||||
了解TDengine高级功能的完整列表,请 [点击](https://tdengine.com/tdengine/)。体验 TDengine 最简单的方式是通过 [TDengine云平台](https://cloud.tdengine.com)。对最新发布的 TDengine 组件 TDgpt,请访问 [TDgpt README](./tools/tdgpt/README.md) 了解细节。
|
||||
|
||||
# 2. 文档
|
||||
|
||||
关于完整的使用手册,系统架构和更多细节,请参考 [TDengine](https://www.taosdata.com/) 或者 [TDengine 官方文档](https://docs.taosdata.com)。
|
||||
|
||||
用户可根据需求选择通过 [容器](https://docs.taosdata.com/get-started/docker/)、[安装包](https://docs.taosdata.com/get-started/package/)、[Kubernetes](https://docs.taosdata.com/deployment/k8s/) 来安装或直接使用无需安装部署的 [云服务](https://cloud.taosdata.com/)。本快速指南是面向想自己编译、打包、测试的开发者的。
|
||||
|
||||
如果想编译或测试 TDengine 连接器,请访问以下仓库:[JDBC连接器](https://github.com/taosdata/taos-connector-jdbc)、[Go连接器](https://github.com/taosdata/driver-go)、[Python连接器](https://github.com/taosdata/taos-connector-python)、[Node.js连接器](https://github.com/taosdata/taos-connector-node)、[C#连接器](https://github.com/taosdata/taos-connector-dotnet)、[Rust连接器](https://github.com/taosdata/taos-connector-rust)。
|
||||
|
||||
# 3. 前置条件
|
||||
|
||||
TDengine 目前可以在 Linux 和 macOS 平台上安装和运行 (企业版支持 Windows)。任何 OS 的应用也可以选择 taosAdapter 的 RESTful 接口连接服务端 taosd。CPU 支持 X64、ARM64,后续会支持 MIPS64、Alpha64、ARM32、RISC-V 等 CPU 架构。目前不支持使用交叉编译器构建。
|
||||
|
||||
如果你想要编译 taosAdapter 或者 taosKeeper,需要安装 Go 1.18 及以上版本。
|
||||
|
||||
## 3.1 Linux 系统
|
||||
|
||||
<details>
|
||||
|
||||
<summary>安装 Linux 必备工具</summary>
|
||||
|
||||
### Ubuntu 18.04、20.04、22.04
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc cmake build-essential git libjansson-dev \
|
||||
libsnappy-dev liblzma-dev zlib1g-dev pkg-config
|
||||
```
|
||||
|
||||
### CentOS 8
|
||||
|
||||
```bash
|
||||
sudo yum update
|
||||
yum install -y epel-release gcc gcc-c++ make cmake git perl dnf-plugins-core
|
||||
yum config-manager --set-enabled powertools
|
||||
yum install -y zlib-static xz-devel snappy-devel jansson-devel pkgconfig libatomic-static libstdc++-static
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## 3.2 macOS 系统
|
||||
|
||||
<details>
|
||||
|
||||
<summary>安装 macOS 必备工具</summary>
|
||||
|
||||
根据提示安装依赖工具 [brew](https://brew.sh/)
|
||||
|
||||
```bash
|
||||
brew install argp-standalone gflags pkgconfig
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## 3.3 Windows 系统
|
||||
|
||||
<details>
|
||||
|
||||
<summary>安装 Windows 必备工具</summary>
|
||||
|
||||
进行中。
|
||||
|
||||
</details>
|
||||
|
||||
## 3.4 克隆仓库
|
||||
|
||||
通过如下命令将 TDengine 仓库克隆到指定计算机:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/taosdata/TDengine.git
|
||||
cd TDengine
|
||||
```
|
||||
|
||||
# 4. 构建
|
||||
|
||||
TDengine 还提供一组辅助工具软件 taosTools,目前它包含 taosBenchmark(曾命名为 taosdemo)和 taosdump 两个软件。默认 TDengine 编译不包含 taosTools,您可以在编译 TDengine 时使用 `cmake .. -DBUILD_TOOLS=true` 来同时编译 taosTools。
|
||||
|
||||
为了构建 TDengine,请使用 [CMake](https://cmake.org/) 3.13.0 或者更高版本。
|
||||
|
||||
## 4.1 Linux 系统上构建
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Linux 系统上构建步骤</summary>
|
||||
|
||||
可以通过以下命令使用脚本 `build.sh` 编译 TDengine 和 taosTools,包括 taosBenchmark 和 taosdump。
|
||||
|
||||
```bash
|
||||
./build.sh
|
||||
```
|
||||
|
||||
也可以通过以下命令进行构建:
|
||||
|
||||
```bash
|
||||
mkdir debug && cd debug
|
||||
cmake .. -DBUILD_TOOLS=true -DBUILD_CONTRIB=true
|
||||
make
|
||||
```
|
||||
|
||||
如果你想要编译 taosAdapter,需要添加 `-DBUILD_HTTP=false` 选项。
|
||||
|
||||
如果你想要编译 taosKeeper,需要添加 `-DBUILD_KEEPER=true` 选项。
|
||||
|
||||
可以使用 Jemalloc 作为内存分配器,而不是使用 glibc:
|
||||
|
||||
```bash
|
||||
cmake .. -DJEMALLOC_ENABLED=ON
|
||||
```
|
||||
TDengine 构建脚本可以自动检测 x86、x86-64、arm64 平台上主机的体系结构。
|
||||
您也可以通过 CPUTYPE 选项手动指定架构:
|
||||
|
||||
```bash
|
||||
cmake .. -DCPUTYPE=aarch64 && cmake --build .
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## 4.2 macOS 系统上构建
|
||||
|
||||
<details>
|
||||
|
||||
<summary>macOS 系统上构建步骤</summary>
|
||||
|
||||
请安装 XCode 命令行工具和 cmake。使用 XCode 11.4+ 在 Catalina 和 Big Sur 上完成验证。
|
||||
|
||||
```shell
|
||||
mkdir debug && cd debug
|
||||
cmake .. && cmake --build .
|
||||
```
|
||||
|
||||
如果你想要编译 taosAdapter,需要添加 `-DBUILD_HTTP=false` 选项。
|
||||
|
||||
如果你想要编译 taosKeeper,需要添加 `-DBUILD_KEEPER=true` 选项。
|
||||
|
||||
</details>
|
||||
|
||||
## 4.3 Windows 系统上构建
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Windows 系统上构建步骤</summary>
|
||||
|
||||
如果您使用的是 Visual Studio 2013,请执行 “cmd.exe” 打开命令窗口执行如下命令。
|
||||
执行 vcvarsall.bat 时,64 位的 Windows 请指定 “amd64”,32 位的 Windows 请指定 “x86”。
|
||||
|
||||
```cmd
|
||||
mkdir debug && cd debug
|
||||
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" < amd64 | x86 >
|
||||
cmake .. -G "NMake Makefiles"
|
||||
nmake
|
||||
```
|
||||
|
||||
如果您使用 Visual Studio 2019 或 2017:
|
||||
|
||||
请执行 “cmd.exe” 打开命令窗口执行如下命令。
|
||||
执行 vcvarsall.bat 时,64 位的 Windows 请指定 “x64”,32 位的 Windows 请指定 “x86”。
|
||||
|
||||
```cmd
|
||||
mkdir debug && cd debug
|
||||
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" < x64 | x86 >
|
||||
cmake .. -G "NMake Makefiles"
|
||||
nmake
|
||||
```
|
||||
|
||||
或者,您可以通过点击 Windows 开始菜单打开命令窗口 -> `Visual Studio < 2019 | 2017 >` 文件夹 -> `x64 原生工具命令提示符 VS < 2019 | 2017 >` 或 `x86 原生工具命令提示符 < 2019 | 2017 >` 取决于你的 Windows 是什么架构,然后执行命令如下:
|
||||
|
||||
```cmd
|
||||
mkdir debug && cd debug
|
||||
cmake .. -G "NMake Makefiles"
|
||||
nmake
|
||||
```
|
||||
</details>
|
||||
|
||||
# 5. 打包
|
||||
|
||||
由于一些组件依赖关系,TDengine 社区安装程序不能仅由该存储库创建。我们仍在努力改进。
|
||||
|
||||
# 6. 安装
|
||||
|
||||
|
||||
## 6.1 Linux 系统上安装
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Linux 系统上安装详细步骤</summary>
|
||||
|
||||
构建成功后,TDengine 可以通过以下命令进行安装:
|
||||
|
||||
```bash
|
||||
sudo make install
|
||||
```
|
||||
从源代码安装还将为 TDengine 配置服务管理。用户也可以使用 [TDengine安装包](https://docs.taosdata.com/get-started/package/)进行安装。
|
||||
|
||||
</details>
|
||||
|
||||
## 6.2 macOS 系统上安装
|
||||
|
||||
<details>
|
||||
|
||||
<summary>macOS 系统上安装详细步骤</summary>
|
||||
|
||||
构建成功后,TDengine可以通过以下命令进行安装:
|
||||
|
||||
```bash
|
||||
sudo make install
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## 6.3 Windows 系统上安装
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Windows 系统上安装详细步骤</summary>
|
||||
|
||||
构建成功后,TDengine 可以通过以下命令进行安装:
|
||||
|
||||
```cmd
|
||||
nmake install
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
# 7. 快速运行
|
||||
|
||||
## 7.1 Linux 系统上运行
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Linux 系统上运行详细步骤</summary>
|
||||
|
||||
在Linux 系统上安装 TDengine 完成后,在终端运行如下命令启动服务:
|
||||
|
||||
```bash
|
||||
sudo systemctl start taosd
|
||||
```
|
||||
然后用户可以通过如下命令使用 TDengine 命令行连接 TDengine 服务:
|
||||
|
||||
```bash
|
||||
taos
|
||||
```
|
||||
|
||||
如果 TDengine 命令行连接服务器成功,系统将打印欢迎信息和版本信息。否则,将显示连接错误信息。
|
||||
|
||||
如果您不想将 TDengine 作为服务运行,您可以在当前终端中运行它。例如,要在构建完成后快速启动 TDengine 服务器,在终端中运行以下命令:(以 Linux 为例,Windows 上的命令为 `taosd.exe`)
|
||||
|
||||
```bash
|
||||
./build/bin/taosd -c test/cfg
|
||||
```
|
||||
|
||||
在另一个终端上,使用 TDengine 命令行连接服务器:
|
||||
|
||||
```bash
|
||||
./build/bin/taos -c test/cfg
|
||||
```
|
||||
|
||||
选项 `-c test/cfg` 指定系统配置文件的目录。
|
||||
|
||||
</details>
|
||||
|
||||
## 7.2 macOS 系统上运行
|
||||
|
||||
<details>
|
||||
|
||||
<summary>macOS 系统上运行详细步骤</summary>
|
||||
|
||||
在 macOS 上安装完成后启动服务,双击 `/applications/TDengine` 启动程序,或者在终端中执行如下命令:
|
||||
|
||||
```bash
|
||||
sudo launchctl start com.tdengine.taosd
|
||||
```
|
||||
|
||||
然后在终端中使用如下命令通过 TDengine 命令行连接 TDengine 服务器:
|
||||
|
||||
```bash
|
||||
taos
|
||||
```
|
||||
|
||||
如果 TDengine 命令行连接服务器成功,系统将打印欢迎信息和版本信息。否则,将显示错误信息。
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
## 7.3 Windows 系统上运行
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Windows 系统上运行详细步骤</summary>
|
||||
|
||||
您可以使用以下命令在 Windows 平台上启动 TDengine 服务器:
|
||||
|
||||
```cmd
|
||||
.\build\bin\taosd.exe -c test\cfg
|
||||
```
|
||||
|
||||
在另一个终端上,使用 TDengine 命令行连接服务器:
|
||||
|
||||
```cmd
|
||||
.\build\bin\taos.exe -c test\cfg
|
||||
```
|
||||
|
||||
选项 `-c test/cfg` 指定系统配置文件的目录。
|
||||
|
||||
</details>
|
||||
|
||||
# 8. 测试
|
||||
|
||||
有关如何在 TDengine 上运行不同类型的测试,请参考 [TDengine测试](./tests/README-CN.md)
|
||||
|
||||
# 9. 版本发布
|
||||
|
||||
TDengine 发布版本的完整列表,请参考 [版本列表](https://github.com/taosdata/TDengine/releases)
|
||||
|
||||
# 10. 工作流
|
||||
|
||||
TDengine 构建检查工作流可以在参考 [Github Action](https://github.com/taosdata/TDengine/actions/workflows/taosd-ci-build.yml),更多的工作流正在创建中,将很快可用。
|
||||
|
||||
# 11. 覆盖率
|
||||
|
||||
最新的 TDengine 测试覆盖率报告可参考 [coveralls.io](https://coveralls.io/github/taosdata/TDengine)
|
||||
|
||||
<details>
|
||||
|
||||
<summary>如何在本地运行测试覆盖率报告?</summary>
|
||||
|
||||
在本地创建测试覆盖率报告(HTML 格式),请运行以下命令:
|
||||
|
||||
```bash
|
||||
cd tests
|
||||
bash setup-lcov.sh -v 1.16 && ./run_local_coverage.sh -b main -c task
|
||||
# on main branch and run cases in longtimeruning_cases.task
|
||||
# for more infomation about options please refer to ./run_local_coverage.sh -h
|
||||
```
|
||||
> **注意**:
|
||||
> 请注意,-b 和 -i 选项将使用 -DCOVER=true 选项重新编译 TDengine,这可能需要花费一些时间。
|
||||
|
||||
</details>
|
||||
|
||||
# 12. 成为社区贡献者
|
||||
|
||||
点击 [这里](https://www.taosdata.com/contributor),了解如何成为 TDengine 的贡献者。
|
352
README.md
352
README.md
|
@ -1,2 +1,352 @@
|
|||
# homework-jianmu
|
||||
<p align="center">
|
||||
<a href="https://tdengine.com" target="_blank">
|
||||
<img
|
||||
src="docs/assets/tdengine.svg"
|
||||
alt="TDengine"
|
||||
width="500"
|
||||
/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
[](https://github.com/taosdata/TDengine/actions/workflows/tdengine-release-build.yml)
|
||||
[](https://coveralls.io/github/taosdata/TDengine?branch=3.0)
|
||||
[](https://github.com/feici02/TDengine/commits/main/)
|
||||
<br />
|
||||
[](https://github.com/taosdata/TDengine/releases)
|
||||
[](https://github.com/taosdata/TDengine/blob/main/LICENSE)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/4201)
|
||||
<br />
|
||||
[](https://twitter.com/tdenginedb)
|
||||
[](https://www.youtube.com/@tdengine)
|
||||
[](https://discord.com/invite/VZdSuUg4pS)
|
||||
[](https://www.linkedin.com/company/tdengine)
|
||||
[](https://stackoverflow.com/questions/tagged/tdengine)
|
||||
|
||||
English | [简体中文](README-CN.md) | [TDengine Cloud](https://cloud.tdengine.com) | [Learn more about TSDB](https://tdengine.com/time-series-database/)
|
||||
|
||||
# Table of Contents
|
||||
|
||||
1. [Introduction](#1-introduction)
|
||||
1. [Documentation](#2-documentation)
|
||||
1. [Prerequisites](#3-prerequisites)
|
||||
- [3.1 Prerequisites On Linux](#31-prerequisites-on-linux)
|
||||
- [3.2 Prerequisites On macOS](#32-prerequisites-on-macos)
|
||||
- [3.3 Prerequisites On Windows](#33-prerequisites-on-windows)
|
||||
- [3.4 Clone the repo](#34-clone-the-repo)
|
||||
1. [Building](#4-building)
|
||||
- [4.1 Build on Linux](#41-build-on-linux)
|
||||
- [4.2 Build on macOS](#42-build-on-macos)
|
||||
- [4.3 Build On Windows](#43-build-on-windows)
|
||||
1. [Packaging](#5-packaging)
|
||||
1. [Installation](#6-installation)
|
||||
- [6.1 Install on Linux](#61-install-on-linux)
|
||||
- [6.2 Install on macOS](#62-install-on-macos)
|
||||
- [6.3 Install on Windows](#63-install-on-windows)
|
||||
1. [Running](#7-running)
|
||||
- [7.1 Run TDengine on Linux](#71-run-tdengine-on-linux)
|
||||
- [7.2 Run TDengine on macOS](#72-run-tdengine-on-macos)
|
||||
- [7.3 Run TDengine on Windows](#73-run-tdengine-on-windows)
|
||||
1. [Testing](#8-testing)
|
||||
1. [Releasing](#9-releasing)
|
||||
1. [Workflow](#10-workflow)
|
||||
1. [Coverage](#11-coverage)
|
||||
1. [Contributing](#12-contributing)
|
||||
|
||||
# 1. Introduction
|
||||
|
||||
TDengine is an open source, high-performance, cloud native and AI powered [time-series database](https://tdengine.com/tsdb/) designed for Internet of Things (IoT), Connected Cars, and Industrial IoT. It enables efficient, real-time data ingestion, processing, and analysis of TB and even PB scale data per day, generated by billions of sensors and data collectors. TDengine differentiates itself from other time-series databases with the following advantages:
|
||||
|
||||
- **[High Performance](https://tdengine.com/tdengine/high-performance-time-series-database/)**: TDengine is the only time-series database to solve the high cardinality issue to support billions of data collection points while out performing other time-series databases for data ingestion, querying and data compression.
|
||||
|
||||
- **[Simplified Solution](https://tdengine.com/tdengine/simplified-time-series-data-solution/)**: Through built-in caching, stream processing, data subscription and AI agent features, TDengine provides a simplified solution for time-series data processing. It reduces system design complexity and operation costs significantly.
|
||||
|
||||
- **[Cloud Native](https://tdengine.com/tdengine/cloud-native-time-series-database/)**: Through native distributed design, sharding and partitioning, separation of compute and storage, RAFT, support for kubernetes deployment and full observability, TDengine is a cloud native Time-Series Database and can be deployed on public, private or hybrid clouds.
|
||||
|
||||
- **[AI Powered](https://tdengine.com/tdengine/tdgpt/)**: Through the built in AI agent TDgpt, TDengine can connect to a variety of time series foundation model, large language model, machine learning and traditional algorithms to provide time series data forecasting, anomly detection, imputation and classification.
|
||||
|
||||
- **[Ease of Use](https://tdengine.com/tdengine/easy-time-series-data-platform/)**: For administrators, TDengine significantly reduces the effort to deploy and maintain. For developers, it provides a simple interface, simplified solution and seamless integrations for third party tools. For data users, it gives easy data access.
|
||||
|
||||
- **[Easy Data Analytics](https://tdengine.com/tdengine/time-series-data-analytics-made-easy/)**: Through super tables, storage and compute separation, data partitioning by time interval, pre-computation and AI agent, TDengine makes it easy to explore, format, and get access to data in a highly efficient way.
|
||||
|
||||
- **[Open Source](https://tdengine.com/tdengine/open-source-time-series-database/)**: TDengine’s core modules, including cluster feature and AI agent, are all available under open source licenses. It has gathered 23.7k stars on GitHub. There is an active developer community, and over 730k running instances worldwide.
|
||||
|
||||
For a full list of TDengine competitive advantages, please [check here](https://tdengine.com/tdengine/). The easiest way to experience TDengine is through [TDengine Cloud](https://cloud.tdengine.com). For the latest TDengine component TDgpt, please refer to [TDgpt README](./tools/tdgpt/README.md) for details.
|
||||
|
||||
# 2. Documentation
|
||||
|
||||
For user manual, system design and architecture, please refer to [TDengine Documentation](https://docs.tdengine.com) ([TDengine 文档](https://docs.taosdata.com))
|
||||
|
||||
You can choose to install TDengine via [container](https://docs.tdengine.com/get-started/deploy-in-docker/), [installation package](https://docs.tdengine.com/get-started/deploy-from-package/), [Kubernetes](https://docs.tdengine.com/operations-and-maintenance/deploy-your-cluster/#kubernetes-deployment) or try [fully managed service](https://cloud.tdengine.com/) without installation. This quick guide is for developers who want to contribute, build, release and test TDengine by themselves.
|
||||
|
||||
For contributing/building/testing TDengine Connectors, please check the following repositories: [JDBC Connector](https://github.com/taosdata/taos-connector-jdbc), [Go Connector](https://github.com/taosdata/driver-go), [Python Connector](https://github.com/taosdata/taos-connector-python), [Node.js Connector](https://github.com/taosdata/taos-connector-node), [C# Connector](https://github.com/taosdata/taos-connector-dotnet), [Rust Connector](https://github.com/taosdata/taos-connector-rust).
|
||||
|
||||
# 3. Prerequisites
|
||||
|
||||
At the moment, TDengine server supports running on Linux/MacOS systems. Any application can also choose the RESTful interface provided by taosAdapter to connect the taosd service. TDengine supports X64/ARM64 CPU, and it will support MIPS64, Alpha64, ARM32, RISC-V and other CPU architectures in the future. Right now we don't support build with cross-compiling environment.
|
||||
|
||||
Starting from version 3.1.0.0, TDengine supports the Windows system exclusively in its Enterprise edition.
|
||||
|
||||
If you want to compile taosAdapter or taosKeeper, you need to install Go 1.18 or above.
|
||||
|
||||
## 3.1 Prerequisites on Linux
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Install required tools on Linux</summary>
|
||||
|
||||
### For Ubuntu 18.04、20.04、22.04
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc cmake build-essential git libjansson-dev \
|
||||
libsnappy-dev liblzma-dev zlib1g-dev pkg-config
|
||||
```
|
||||
|
||||
### For CentOS 8
|
||||
|
||||
```bash
|
||||
sudo yum update
|
||||
yum install -y epel-release gcc gcc-c++ make cmake git perl dnf-plugins-core
|
||||
yum config-manager --set-enabled powertools
|
||||
yum install -y zlib-static xz-devel snappy-devel jansson-devel pkgconfig libatomic-static libstdc++-static
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## 3.2 Prerequisites on macOS
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Install required tools on macOS</summary>
|
||||
|
||||
Please intall the dependencies with [brew](https://brew.sh/).
|
||||
|
||||
```bash
|
||||
brew install argp-standalone gflags pkgconfig
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## 3.3 Prerequisites on Windows
|
||||
|
||||
Not available for community edition.
|
||||
|
||||
## 3.4 Clone the repo
|
||||
|
||||
Clone the repository to the target machine:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/taosdata/TDengine.git
|
||||
cd TDengine
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
# 4. Building
|
||||
|
||||
TDengine provide a few useful tools such as taosBenchmark (was named taosdemo) and taosdump. They were part of TDengine. By default, TDengine compiling does not include taosTools. You can use `cmake .. -DBUILD_TOOLS=true` to make them be compiled with TDengine.
|
||||
|
||||
TDengine requires [GCC](https://gcc.gnu.org/) 9.3.1 or higher and [CMake](https://cmake.org/) 3.13.0 or higher for building.
|
||||
|
||||
## 4.1 Build on Linux
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Detailed steps to build on Linux</summary>
|
||||
|
||||
You can run the bash script `build.sh` to build both TDengine and taosTools including taosBenchmark and taosdump as below:
|
||||
|
||||
```bash
|
||||
./build.sh
|
||||
```
|
||||
|
||||
It equals to execute following commands:
|
||||
|
||||
```bash
|
||||
mkdir debug && cd debug
|
||||
cmake .. -DBUILD_TOOLS=true -DBUILD_CONTRIB=true
|
||||
make
|
||||
```
|
||||
|
||||
If you want to compile taosAdapter, you need to add the `-DBUILD_HTTP=false` option.
|
||||
|
||||
If you want to compile taosKeeper, you need to add the `-DBUILD_KEEPER=true` option.
|
||||
|
||||
You can use Jemalloc as memory allocator instead of glibc:
|
||||
|
||||
```bash
|
||||
cmake .. -DJEMALLOC_ENABLED=ON
|
||||
```
|
||||
|
||||
TDengine build script can auto-detect the host machine's architecture on x86, x86-64, arm64 platform.
|
||||
You can also specify architecture manually by CPUTYPE option:
|
||||
|
||||
```bash
|
||||
cmake .. -DCPUTYPE=aarch64 && cmake --build .
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## 4.2 Build on macOS
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Detailed steps to build on macOS</summary>
|
||||
|
||||
Please install XCode command line tools and cmake. Verified with XCode 11.4+ on Catalina and Big Sur.
|
||||
|
||||
```shell
|
||||
mkdir debug && cd debug
|
||||
cmake .. && cmake --build .
|
||||
```
|
||||
|
||||
If you want to compile taosAdapter, you need to add the `-DBUILD_HTTP=false` option.
|
||||
|
||||
If you want to compile taosKeeper, you need to add the `-DBUILD_KEEPER=true` option.
|
||||
|
||||
</details>
|
||||
|
||||
## 4.3 Build on Windows
|
||||
|
||||
Not available for community edition.
|
||||
|
||||
# 5. Packaging
|
||||
|
||||
The TDengine community installer can NOT be created by this repository only, due to some component dependencies. We are still working on this improvement.
|
||||
|
||||
# 6. Installation
|
||||
|
||||
## 6.1 Install on Linux
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Detailed steps to install on Linux</summary>
|
||||
|
||||
After building successfully, TDengine can be installed by:
|
||||
|
||||
```bash
|
||||
sudo make install
|
||||
```
|
||||
|
||||
Installing from source code will also configure service management for TDengine. Users can also choose to [install from packages](https://docs.tdengine.com/get-started/deploy-from-package/) for it.
|
||||
|
||||
</details>
|
||||
|
||||
## 6.2 Install on macOS
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Detailed steps to install on macOS</summary>
|
||||
|
||||
After building successfully, TDengine can be installed by:
|
||||
|
||||
```bash
|
||||
sudo make install
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## 6.3 Install on Windows
|
||||
|
||||
Not available for community edition.
|
||||
|
||||
# 7. Running
|
||||
|
||||
## 7.1 Run TDengine on Linux
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Detailed steps to run on Linux</summary>
|
||||
|
||||
To start the service after installation on linux, in a terminal, use:
|
||||
|
||||
```bash
|
||||
sudo systemctl start taosd
|
||||
```
|
||||
|
||||
Then users can use the TDengine CLI to connect the TDengine server. In a terminal, use:
|
||||
|
||||
```bash
|
||||
taos
|
||||
```
|
||||
|
||||
If TDengine CLI connects the server successfully, welcome messages and version info are printed. Otherwise, an error message is shown.
|
||||
|
||||
If you don't want to run TDengine as a service, you can run it in current shell. For example, to quickly start a TDengine server after building, run the command below in terminal: (We take Linux as an example, command on Windows will be `taosd.exe`)
|
||||
|
||||
```bash
|
||||
./build/bin/taosd -c test/cfg
|
||||
```
|
||||
|
||||
In another terminal, use the TDengine CLI to connect the server:
|
||||
|
||||
```bash
|
||||
./build/bin/taos -c test/cfg
|
||||
```
|
||||
|
||||
Option `-c test/cfg` specifies the system configuration file directory.
|
||||
|
||||
</details>
|
||||
|
||||
## 7.2 Run TDengine on macOS
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Detailed steps to run on macOS</summary>
|
||||
|
||||
To start the service after installation on macOS, double-click the /applications/TDengine to start the program, or in a terminal, use:
|
||||
|
||||
```bash
|
||||
sudo launchctl start com.tdengine.taosd
|
||||
```
|
||||
|
||||
Then users can use the TDengine CLI to connect the TDengine server. In a terminal, use:
|
||||
|
||||
```bash
|
||||
taos
|
||||
```
|
||||
|
||||
If TDengine CLI connects the server successfully, welcome messages and version info are printed. Otherwise, an error message is shown.
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
## 7.3 Run TDengine on Windows
|
||||
|
||||
Not available for community edition.
|
||||
|
||||
# 8. Testing
|
||||
|
||||
For how to run different types of tests on TDengine, please see [Testing TDengine](./tests/README.md).
|
||||
|
||||
# 9. Releasing
|
||||
|
||||
For the complete list of TDengine Releases, please see [Releases](https://github.com/taosdata/TDengine/releases).
|
||||
|
||||
# 10. Workflow
|
||||
|
||||
TDengine build check workflow can be found in this [Github Action](https://github.com/taosdata/TDengine/actions/workflows/taosd-ci-build.yml). More workflows will be available soon.
|
||||
|
||||
# 11. Coverage
|
||||
|
||||
Latest TDengine test coverage report can be found on [coveralls.io](https://coveralls.io/github/taosdata/TDengine)
|
||||
|
||||
<details>
|
||||
|
||||
<summary>How to run the coverage report locally?</summary>
|
||||
To create the test coverage report (in HTML format) locally, please run following commands:
|
||||
|
||||
```bash
|
||||
cd tests
|
||||
bash setup-lcov.sh -v 1.16 && ./run_local_coverage.sh -b main -c task
|
||||
# on main branch and run cases in longtimeruning_cases.task
|
||||
# for more infomation about options please refer to ./run_local_coverage.sh -h
|
||||
```
|
||||
> **NOTE:**
|
||||
> Please note that the -b and -i options will recompile TDengine with the -DCOVER=true option, which may take a amount of time.
|
||||
|
||||
</details>
|
||||
|
||||
# 12. Contributing
|
||||
|
||||
Please follow the [contribution guidelines](CONTRIBUTING.md) to contribute to TDengine.
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# Security Policy
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please submit CVE to https://github.com/taosdata/TDengine/security/advisories.
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! -d debug ]; then
|
||||
mkdir debug || echo -e "failed to make directory for build"
|
||||
fi
|
||||
|
||||
cd debug && cmake .. -DBUILD_TOOLS=true -DBUILD_CONTRIB=true && make
|
||||
|
|
@ -0,0 +1 @@
|
|||
cmake_policy(SET CMP0048 NEW)
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
# addr2line
|
||||
ExternalProject_Add(addr2line
|
||||
GIT_REPOSITORY https://github.com/davea42/libdwarf-addr2line.git
|
||||
GIT_TAG main
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/addr2line"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/addr2line"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,20 @@
|
|||
# apr-util
|
||||
ExternalProject_Add(aprutil-1
|
||||
URL https://dlcdn.apache.org//apr/apr-util-1.6.3.tar.gz
|
||||
URL_HASH SHA256=2b74d8932703826862ca305b094eef2983c27b39d5c9414442e9976a9acf1983
|
||||
DOWNLOAD_NO_PROGRESS 1
|
||||
DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
|
||||
#GIT_REPOSITORY https://github.com/apache/apr-util.git
|
||||
#GIT_TAG 1.5.4
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/apr-util"
|
||||
#BINARY_DIR ""
|
||||
BUILD_IN_SOURCE TRUE
|
||||
BUILD_ALWAYS 1
|
||||
#UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND ./configure --prefix=$ENV{HOME}/.cos-local.1/ --with-apr=$ENV{HOME}/.cos-local.1
|
||||
#CONFIGURE_COMMAND ./configure --with-apr=/usr/local/apr
|
||||
BUILD_COMMAND make
|
||||
INSTALL_COMMAND make install
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,20 @@
|
|||
# apr
|
||||
ExternalProject_Add(apr-1
|
||||
URL https://dlcdn.apache.org//apr/apr-1.7.4.tar.gz
|
||||
URL_HASH SHA256=a4137dd82a185076fa50ba54232d920a17c6469c30b0876569e1c2a05ff311d9
|
||||
DOWNLOAD_NO_PROGRESS 1
|
||||
DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
|
||||
#GIT_REPOSITORY https://github.com/apache/apr.git
|
||||
#GIT_TAG 1.5.2
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/apr"
|
||||
BUILD_IN_SOURCE TRUE
|
||||
UPDATE_DISCONNECTED TRUE
|
||||
BUILD_ALWAYS 1
|
||||
#UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND ./configure --prefix=$ENV{HOME}/.cos-local.1/ --enable-shared=no
|
||||
#CONFIGURE_COMMAND ./configure
|
||||
BUILD_COMMAND make
|
||||
INSTALL_COMMAND make install
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,16 @@
|
|||
# azure
|
||||
ExternalProject_Add(azure
|
||||
URL https://github.com/Azure/azure-sdk-for-cpp/archive/refs/tags/azure-storage-blobs_12.13.0-beta.1.tar.gz
|
||||
URL_HASH SHA256=3eca486fd60e3522d0a633025ecd652a71515b1e944799b2e8ee31fd590305a9
|
||||
DEPENDS xml2
|
||||
DOWNLOAD_NO_PROGRESS 1
|
||||
DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/azure-sdk-for-cpp-azure-storage-blobs_12.13.0-beta.1"
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
#BUILD_ALWAYS 1
|
||||
#UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
# cjson
|
||||
ExternalProject_Add(cjson
|
||||
GIT_REPOSITORY https://github.com/taosdata-contrib/cJSON.git
|
||||
GIT_TAG v1.7.15
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/cJson"
|
||||
BINARY_DIR ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,267 @@
|
|||
cmake_minimum_required(VERSION 3.0)
|
||||
set(CMAKE_VERBOSE_MAKEFILE FALSE)
|
||||
set(TD_BUILD_TAOSA_INTERNAL FALSE)
|
||||
set(TD_BUILD_KEEPER_INTERNAL FALSE)
|
||||
|
||||
# set output directory
|
||||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/lib)
|
||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/bin)
|
||||
SET(TD_TESTS_OUTPUT_DIR ${PROJECT_BINARY_DIR}/test)
|
||||
|
||||
MESSAGE(STATUS "Project source directory: " ${PROJECT_SOURCE_DIR})
|
||||
MESSAGE(STATUS "Project binary files output path: " ${PROJECT_BINARY_DIR})
|
||||
MESSAGE(STATUS "Project executable files output path: " ${EXECUTABLE_OUTPUT_PATH})
|
||||
MESSAGE(STATUS "Project library files output path: " ${LIBRARY_OUTPUT_PATH})
|
||||
|
||||
IF(NOT DEFINED TD_GRANT)
|
||||
SET(TD_GRANT FALSE)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT DEFINED BUILD_WITH_RAND_ERR)
|
||||
SET(BUILD_WITH_RAND_ERR FALSE)
|
||||
ELSE()
|
||||
SET(BUILD_WITH_RAND_ERR TRUE)
|
||||
ENDIF()
|
||||
|
||||
IF("${WEBSOCKET}" MATCHES "true")
|
||||
SET(TD_WEBSOCKET TRUE)
|
||||
MESSAGE("Enable websocket")
|
||||
ADD_DEFINITIONS(-DWEBSOCKET)
|
||||
ELSE()
|
||||
SET(TD_WEBSOCKET FALSE)
|
||||
ENDIF()
|
||||
|
||||
IF("${BUILD_HTTP}" STREQUAL "")
|
||||
IF(TD_LINUX)
|
||||
IF(TD_ARM_32)
|
||||
SET(TD_BUILD_HTTP TRUE)
|
||||
ELSE()
|
||||
SET(TD_BUILD_HTTP TRUE)
|
||||
ENDIF()
|
||||
ELSEIF(TD_DARWIN)
|
||||
SET(TD_BUILD_HTTP TRUE)
|
||||
ELSE()
|
||||
SET(TD_BUILD_HTTP TRUE)
|
||||
ENDIF()
|
||||
ELSEIF(${BUILD_HTTP} MATCHES "false")
|
||||
SET(TD_BUILD_HTTP FALSE)
|
||||
ELSEIF(${BUILD_HTTP} MATCHES "true")
|
||||
SET(TD_BUILD_HTTP TRUE)
|
||||
ELSEIF(${BUILD_HTTP} MATCHES "internal")
|
||||
SET(TD_BUILD_HTTP FALSE)
|
||||
SET(TD_BUILD_TAOSA_INTERNAL TRUE)
|
||||
ELSE()
|
||||
SET(TD_BUILD_HTTP TRUE)
|
||||
ENDIF()
|
||||
|
||||
IF(TD_BUILD_HTTP)
|
||||
ADD_DEFINITIONS(-DHTTP_EMBEDDED)
|
||||
ENDIF()
|
||||
|
||||
IF("${BUILD_KEEPER}" STREQUAL "")
|
||||
SET(TD_BUILD_KEEPER FALSE)
|
||||
ELSEIF(${BUILD_KEEPER} MATCHES "false")
|
||||
SET(TD_BUILD_KEEPER FALSE)
|
||||
ELSEIF(${BUILD_KEEPER} MATCHES "true")
|
||||
SET(TD_BUILD_KEEPER TRUE)
|
||||
ELSEIF(${BUILD_KEEPER} MATCHES "internal")
|
||||
SET(TD_BUILD_KEEPER FALSE)
|
||||
SET(TD_BUILD_KEEPER_INTERNAL TRUE)
|
||||
ELSE()
|
||||
SET(TD_BUILD_KEEPER FALSE)
|
||||
ENDIF()
|
||||
|
||||
IF("${BUILD_TOOLS}" STREQUAL "")
|
||||
IF(TD_LINUX)
|
||||
IF(TD_ARM_32)
|
||||
SET(BUILD_TOOLS "false")
|
||||
ELSEIF(TD_ARM_64)
|
||||
SET(BUILD_TOOLS "false")
|
||||
ELSE()
|
||||
SET(BUILD_TOOLS "false")
|
||||
ENDIF()
|
||||
ELSEIF(TD_DARWIN)
|
||||
SET(BUILD_TOOLS "false")
|
||||
ELSE()
|
||||
SET(BUILD_TOOLS "false")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF("${BUILD_TOOLS}" MATCHES "false")
|
||||
MESSAGE("${Yellow} Will _not_ build taos_tools! ${ColourReset}")
|
||||
SET(TD_TAOS_TOOLS FALSE)
|
||||
ELSE()
|
||||
MESSAGE("")
|
||||
MESSAGE("${Green} Will build taos_tools! ${ColourReset}")
|
||||
MESSAGE("")
|
||||
SET(TD_TAOS_TOOLS TRUE)
|
||||
ENDIF()
|
||||
|
||||
SET(TAOS_LIB taos)
|
||||
SET(TAOS_LIB_STATIC taos_static)
|
||||
SET(TAOS_NATIVE_LIB taosnative)
|
||||
SET(TAOS_NATIVE_LIB_STATIC taosnative_static)
|
||||
|
||||
# build TSZ by default
|
||||
IF("${TSZ_ENABLED}" MATCHES "false")
|
||||
set(VAR_TSZ "" CACHE INTERNAL "global variant empty")
|
||||
ELSE()
|
||||
# define add
|
||||
MESSAGE(STATUS "build with TSZ enabled")
|
||||
ADD_DEFINITIONS(-DTD_TSZ)
|
||||
set(VAR_TSZ "TSZ" CACHE INTERNAL "global variant tsz")
|
||||
ENDIF()
|
||||
|
||||
IF(TD_WINDOWS)
|
||||
MESSAGE("${Yellow} set compiler flag for Windows! ${ColourReset}")
|
||||
|
||||
IF(${CMAKE_BUILD_TYPE} MATCHES "Release")
|
||||
MESSAGE("${Green} will build Release version! ${ColourReset}")
|
||||
SET(COMMON_FLAGS "/W3 /D_WIN32 /DWIN32 /Zi- /O2 /GL /MD")
|
||||
|
||||
ELSE()
|
||||
MESSAGE("${Green} will build Debug version! ${ColourReset}")
|
||||
SET(COMMON_FLAGS "/w /D_WIN32 /DWIN32 /Zi /MTd")
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO /FORCE:MULTIPLE")
|
||||
|
||||
# IF (MSVC AND (MSVC_VERSION GREATER_EQUAL 1900))
|
||||
# SET(COMMON_FLAGS "${COMMON_FLAGS} /Wv:18")
|
||||
# ENDIF ()
|
||||
IF(CMAKE_DEPFILE_FLAGS_C)
|
||||
SET(CMAKE_DEPFILE_FLAGS_C "")
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_DEPFILE_FLAGS_CXX)
|
||||
SET(CMAKE_DEPFILE_FLAGS_CXX "")
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_C_FLAGS_DEBUG)
|
||||
SET(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "" FORCE)
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_CXX_FLAGS_DEBUG)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "" FORCE)
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS}")
|
||||
|
||||
ELSE()
|
||||
IF(${TD_DARWIN})
|
||||
set(CMAKE_MACOSX_RPATH 0)
|
||||
ENDIF()
|
||||
|
||||
IF(${COVER} MATCHES "true")
|
||||
MESSAGE(STATUS "Test coverage mode, add extra flags")
|
||||
SET(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
|
||||
SET(GCC_COVERAGE_LINK_FLAGS "-lgcov --coverage")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
|
||||
ENDIF()
|
||||
|
||||
# disable all assert
|
||||
IF((${DISABLE_ASSERT} MATCHES "true") OR(${DISABLE_ASSERTS} MATCHES "true"))
|
||||
ADD_DEFINITIONS(-DDISABLE_ASSERT)
|
||||
MESSAGE(STATUS "Disable all asserts")
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(CheckCCompilerFlag)
|
||||
|
||||
IF(TD_ARM_64 OR TD_ARM_32)
|
||||
SET(COMPILER_SUPPORT_SSE42 false)
|
||||
ELSEIF(("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") OR("${CMAKE_C_COMPILER_ID}" MATCHES "AppleClang"))
|
||||
SET(COMPILER_SUPPORT_SSE42 true)
|
||||
MESSAGE(STATUS "Always enable sse4.2 for Clang/AppleClang")
|
||||
ELSE()
|
||||
CHECK_C_COMPILER_FLAG("-msse4.2" COMPILER_SUPPORT_SSE42)
|
||||
ENDIF()
|
||||
|
||||
IF(TD_ARM_64 OR TD_ARM_32)
|
||||
SET(COMPILER_SUPPORT_FMA false)
|
||||
SET(COMPILER_SUPPORT_AVX false)
|
||||
SET(COMPILER_SUPPORT_AVX2 false)
|
||||
SET(COMPILER_SUPPORT_AVX512F false)
|
||||
SET(COMPILER_SUPPORT_AVX512BMI false)
|
||||
SET(COMPILER_SUPPORT_AVX512VL false)
|
||||
ELSE()
|
||||
CHECK_C_COMPILER_FLAG("-mfma" COMPILER_SUPPORT_FMA)
|
||||
CHECK_C_COMPILER_FLAG("-mavx" COMPILER_SUPPORT_AVX)
|
||||
CHECK_C_COMPILER_FLAG("-mavx2" COMPILER_SUPPORT_AVX2)
|
||||
CHECK_C_COMPILER_FLAG("-mavx512f" COMPILER_SUPPORT_AVX512F)
|
||||
CHECK_C_COMPILER_FLAG("-mavx512vbmi" COMPILER_SUPPORT_AVX512BMI)
|
||||
CHECK_C_COMPILER_FLAG("-mavx512vl" COMPILER_SUPPORT_AVX512VL)
|
||||
ENDIF()
|
||||
|
||||
IF(COMPILER_SUPPORT_SSE42)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2")
|
||||
ENDIF()
|
||||
|
||||
IF("${SIMD_SUPPORT}" MATCHES "true")
|
||||
IF(COMPILER_SUPPORT_FMA)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfma")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfma")
|
||||
MESSAGE(STATUS "FMA instructions is ACTIVATED")
|
||||
ENDIF()
|
||||
|
||||
IF(COMPILER_SUPPORT_AVX)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
|
||||
MESSAGE(STATUS "AVX instructions is ACTIVATED")
|
||||
ENDIF()
|
||||
|
||||
IF(COMPILER_SUPPORT_AVX2)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")
|
||||
MESSAGE(STATUS "AVX2 instructions is ACTIVATED")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF("${SIMD_AVX512_SUPPORT}" MATCHES "true")
|
||||
IF(COMPILER_SUPPORT_AVX512F AND COMPILER_SUPPORT_AVX512BMI)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512f -mavx512vbmi")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -mavx512vbmi")
|
||||
MESSAGE(STATUS "avx512f/avx512bmi enabled by compiler")
|
||||
ENDIF()
|
||||
|
||||
IF(COMPILER_SUPPORT_AVX512VL)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512vl")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512vl")
|
||||
MESSAGE(STATUS "avx512vl enabled by compiler")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# build mode
|
||||
SET(CMAKE_C_FLAGS_REL "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -O3 -Wformat=2 -Wno-format-nonliteral -Wno-format-truncation -Wno-format-y2k")
|
||||
SET(CMAKE_CXX_FLAGS_REL "${CMAKE_CXX_FLAGS} -Werror -Wno-reserved-user-defined-literal -Wno-literal-suffix -Werror=return-type -fPIC -O3 -Wformat=2 -Wno-format-nonliteral -Wno-format-truncation -Wno-format-y2k")
|
||||
|
||||
IF(${BUILD_SANITIZER})
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fsanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=shift-base -fno-sanitize=alignment -g3 -Wformat=0")
|
||||
|
||||
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-literal-suffix -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fsanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=shift-base -fno-sanitize=alignment -g3 -Wformat=0")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-literal-suffix -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=shift-base -fno-sanitize=alignment -g3 -Wformat=0")
|
||||
MESSAGE(STATUS "Compile with Address Sanitizer!")
|
||||
ELSEIF(${BUILD_RELEASE})
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_REL}")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_REL}")
|
||||
ELSE()
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -g3 -gdwarf-2 -Wformat=2 -Wno-format-nonliteral -Wno-format-truncation -Wno-format-y2k")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reserved-user-defined-literal -g3 -Wno-literal-suffix -Werror=return-type -fPIC -gdwarf-2 -Wformat=2 -Wno-format-nonliteral -Wno-format-truncation -Wno-format-y2k")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
||||
IF(TD_LINUX_64)
|
||||
IF(${JEMALLOC_ENABLED})
|
||||
MESSAGE(STATUS "JEMALLOC Enabled")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=attributes")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=attributes")
|
||||
SET(LINK_JEMALLOC "-L${CMAKE_BINARY_DIR}/build/lib -ljemalloc")
|
||||
ADD_DEFINITIONS(-DTD_JEMALLOC_ENABLED -I${CMAKE_BINARY_DIR}/build/include -L${CMAKE_BINARY_DIR}/build/lib -Wl,-rpath,${CMAKE_BINARY_DIR}/build/lib)
|
||||
ELSE()
|
||||
MESSAGE(STATUS "JEMALLOC Disabled")
|
||||
SET(LINK_JEMALLOC "")
|
||||
ENDIF()
|
||||
ENDIF()
|
|
@ -0,0 +1,39 @@
|
|||
SET(PREPARE_ENV_CMD "prepare_env_cmd")
|
||||
SET(PREPARE_ENV_TARGET "prepare_env_target")
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${PREPARE_ENV_CMD}
|
||||
POST_BUILD
|
||||
COMMAND echo "make test directory"
|
||||
DEPENDS taosd
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${TD_TESTS_OUTPUT_DIR}/cfg/
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${TD_TESTS_OUTPUT_DIR}/log/
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${TD_TESTS_OUTPUT_DIR}/data/
|
||||
COMMAND ${CMAKE_COMMAND} -E echo firstEp localhost:6030 > ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||
COMMAND ${CMAKE_COMMAND} -E echo fqdn localhost >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||
COMMAND ${CMAKE_COMMAND} -E echo serverPort 6030 >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||
COMMAND ${CMAKE_COMMAND} -E echo debugFlag 135 >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||
COMMAND ${CMAKE_COMMAND} -E echo asyncLog 0 >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||
COMMAND ${CMAKE_COMMAND} -E echo supportVnodes 1024 >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||
COMMAND ${CMAKE_COMMAND} -E echo numOfLogLines 300000000 >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||
COMMAND ${CMAKE_COMMAND} -E echo logKeepDays -1 >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||
COMMAND ${CMAKE_COMMAND} -E echo checkpointInterval 60 >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||
COMMAND ${CMAKE_COMMAND} -E echo snodeAddress 127.0.0.1:873 >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||
COMMAND ${CMAKE_COMMAND} -E echo dataDir ${TD_TESTS_OUTPUT_DIR}/data >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||
COMMAND ${CMAKE_COMMAND} -E echo logDir ${TD_TESTS_OUTPUT_DIR}/log >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||
COMMAND ${CMAKE_COMMAND} -E echo charset UTF-8 >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||
COMMAND ${CMAKE_COMMAND} -E echo monitor 0 >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||
COMMENT "prepare taosd environment")
|
||||
ADD_CUSTOM_TARGET(${PREPARE_ENV_TARGET} ALL WORKING_DIRECTORY ${TD_EXECUTABLE_OUTPUT_PATH} DEPENDS ${PREPARE_ENV_CMD})
|
||||
|
||||
IF (TD_LINUX)
|
||||
SET(TD_MAKE_INSTALL_SH "${TD_SOURCE_DIR}/packaging/tools/make_install.sh")
|
||||
INSTALL(CODE "MESSAGE(\"make install script: ${TD_MAKE_INSTALL_SH}\")")
|
||||
INSTALL(CODE "execute_process(COMMAND bash ${TD_MAKE_INSTALL_SH} ${TD_SOURCE_DIR} ${PROJECT_BINARY_DIR} Linux ${TD_VER_NUMBER})")
|
||||
ELSEIF (TD_WINDOWS)
|
||||
SET(TD_MAKE_INSTALL_SH "${TD_SOURCE_DIR}/packaging/tools/make_install.bat")
|
||||
INSTALL(CODE "MESSAGE(\"make install script: ${TD_MAKE_INSTALL_SH}\")")
|
||||
INSTALL(CODE "execute_process(COMMAND ${TD_MAKE_INSTALL_SH} :needAdmin ${TD_SOURCE_DIR} ${PROJECT_BINARY_DIR} Windows ${TD_VER_NUMBER} ${TD_BUILD_TAOSA_INTERNAL})")
|
||||
ELSEIF (TD_DARWIN)
|
||||
SET(TD_MAKE_INSTALL_SH "${TD_SOURCE_DIR}/packaging/tools/make_install.sh")
|
||||
INSTALL(CODE "MESSAGE(\"make install script: ${TD_MAKE_INSTALL_SH}\")")
|
||||
INSTALL(CODE "execute_process(COMMAND bash ${TD_MAKE_INSTALL_SH} ${TD_SOURCE_DIR} ${PROJECT_BINARY_DIR} Darwin ${TD_VER_NUMBER})")
|
||||
ENDIF ()
|
|
@ -0,0 +1,323 @@
|
|||
# =========================================================
|
||||
# Deps options
|
||||
# =========================================================
|
||||
|
||||
option(
|
||||
BUILD_TEST
|
||||
"If build unit tests using googletest"
|
||||
OFF
|
||||
)
|
||||
|
||||
IF(${TD_WINDOWS})
|
||||
IF(NOT TD_ASTRA)
|
||||
MESSAGE("build pthread Win32")
|
||||
option(
|
||||
BUILD_PTHREAD
|
||||
"If build pthread on Windows"
|
||||
ON
|
||||
)
|
||||
|
||||
MESSAGE("build gnu regex for Windows")
|
||||
option(
|
||||
BUILD_GNUREGEX
|
||||
"If build gnu regex on Windows"
|
||||
ON
|
||||
)
|
||||
|
||||
MESSAGE("build iconv Win32")
|
||||
option(
|
||||
BUILD_WITH_ICONV
|
||||
"If build iconv on Windows"
|
||||
ON
|
||||
)
|
||||
|
||||
MESSAGE("build msvcregex Win32")
|
||||
option(
|
||||
BUILD_MSVCREGEX
|
||||
"If build msvcregex on Windows"
|
||||
ON
|
||||
)
|
||||
|
||||
MESSAGE("build wcwidth Win32")
|
||||
option(
|
||||
BUILD_WCWIDTH
|
||||
"If build wcwidth on Windows"
|
||||
ON
|
||||
)
|
||||
|
||||
MESSAGE("build wingetopt Win32")
|
||||
option(
|
||||
BUILD_WINGETOPT
|
||||
"If build wingetopt on Windows"
|
||||
ON
|
||||
)
|
||||
|
||||
option(
|
||||
TDENGINE_3
|
||||
"TDengine 3.x for taos-tools"
|
||||
ON
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_CRASHDUMP
|
||||
"If build crashdump on Windows"
|
||||
ON
|
||||
)
|
||||
ENDIF ()
|
||||
ELSEIF (TD_DARWIN_64)
|
||||
IF(${BUILD_TEST})
|
||||
add_definitions(-DCOMPILER_SUPPORTS_CXX13)
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
|
||||
option(
|
||||
BUILD_WITH_LEMON
|
||||
"If build with lemon"
|
||||
ON
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_WITH_UDF
|
||||
"If build with UDF"
|
||||
ON
|
||||
)
|
||||
|
||||
IF(NOT TD_ASTRA)
|
||||
option(
|
||||
BUILD_GEOS
|
||||
"If build with geos"
|
||||
ON
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_SHARED_LIBS
|
||||
""
|
||||
OFF
|
||||
)
|
||||
|
||||
option(
|
||||
RUST_BINDINGS
|
||||
"If build with rust-bindings"
|
||||
ON
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_PCRE2
|
||||
"If build with pcre2"
|
||||
ON
|
||||
)
|
||||
|
||||
option(
|
||||
JEMALLOC_ENABLED
|
||||
"If build with jemalloc"
|
||||
OFF
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_SANITIZER
|
||||
"If build sanitizer"
|
||||
OFF
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_ADDR2LINE
|
||||
"If build addr2line"
|
||||
OFF
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_WITH_LEVELDB
|
||||
"If build with leveldb"
|
||||
OFF
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_WITH_ROCKSDB
|
||||
"If build with rocksdb"
|
||||
ON
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_WITH_LZ4
|
||||
"If build with lz4"
|
||||
ON
|
||||
)
|
||||
ELSE ()
|
||||
|
||||
option(
|
||||
BUILD_WITH_LZMA2
|
||||
"If build with lzma2"
|
||||
ON
|
||||
)
|
||||
|
||||
ENDIF ()
|
||||
|
||||
ADD_DEFINITIONS(-DUSE_AUDIT)
|
||||
ADD_DEFINITIONS(-DUSE_GEOS)
|
||||
ADD_DEFINITIONS(-DUSE_UDF)
|
||||
ADD_DEFINITIONS(-DUSE_STREAM)
|
||||
ADD_DEFINITIONS(-DUSE_PRCE2)
|
||||
ADD_DEFINITIONS(-DUSE_RSMA)
|
||||
ADD_DEFINITIONS(-DUSE_TSMA)
|
||||
ADD_DEFINITIONS(-DUSE_TQ)
|
||||
ADD_DEFINITIONS(-DUSE_TOPIC)
|
||||
ADD_DEFINITIONS(-DUSE_MONITOR)
|
||||
ADD_DEFINITIONS(-DUSE_REPORT)
|
||||
|
||||
IF(${TD_ASTRA_RPC})
|
||||
ADD_DEFINITIONS(-DTD_ASTRA_RPC)
|
||||
ENDIF()
|
||||
|
||||
IF(${TD_LINUX})
|
||||
|
||||
option(
|
||||
BUILD_S3
|
||||
"If build with s3"
|
||||
ON
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_WITH_S3
|
||||
"If build with s3"
|
||||
ON
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_WITH_COS
|
||||
"If build with cos"
|
||||
OFF
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_WITH_ANALYSIS
|
||||
"If build with analysis"
|
||||
ON
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_WITH_LZMA2
|
||||
"If build with lzma2"
|
||||
ON
|
||||
)
|
||||
|
||||
ENDIF ()
|
||||
|
||||
IF(NOT TD_ENTERPRISE)
|
||||
MESSAGE("switch s3 off with community version")
|
||||
set(BUILD_S3 OFF)
|
||||
set(BUILD_WITH_S3 OFF)
|
||||
set(BUILD_WITH_COS OFF)
|
||||
set(BUILD_WITH_ANALYSIS OFF)
|
||||
ENDIF ()
|
||||
|
||||
IF(${BUILD_WITH_ANALYSIS})
|
||||
message("build with analysis")
|
||||
set(BUILD_S3 ON)
|
||||
set(BUILD_WITH_S3 ON)
|
||||
ENDIF()
|
||||
|
||||
IF(${TD_LINUX})
|
||||
set(BUILD_WITH_ANALYSIS ON)
|
||||
ENDIF()
|
||||
|
||||
IF(${BUILD_S3})
|
||||
|
||||
IF(${BUILD_WITH_S3})
|
||||
|
||||
add_definitions(-DUSE_S3)
|
||||
option(BUILD_WITH_COS "If build with cos" OFF)
|
||||
|
||||
ELSE ()
|
||||
|
||||
option(BUILD_WITH_COS "If build with cos" ON)
|
||||
|
||||
ENDIF ()
|
||||
|
||||
ELSE ()
|
||||
|
||||
option(BUILD_WITH_S3 "If build with s3" OFF)
|
||||
|
||||
option(BUILD_WITH_COS "If build with cos" OFF)
|
||||
|
||||
ENDIF ()
|
||||
|
||||
IF(${TAOSD_INTEGRATED})
|
||||
add_definitions(-DTAOSD_INTEGRATED)
|
||||
ENDIF()
|
||||
|
||||
IF(${TD_AS_LIB})
|
||||
add_definitions(-DTD_AS_LIB)
|
||||
ENDIF()
|
||||
|
||||
option(
|
||||
BUILD_WITH_SQLITE
|
||||
"If build with sqlite"
|
||||
OFF
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_WITH_BDB
|
||||
"If build with BDB"
|
||||
OFF
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_WITH_LUCENE
|
||||
"If build with lucene"
|
||||
off
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_WITH_NURAFT
|
||||
"If build with NuRaft"
|
||||
OFF
|
||||
)
|
||||
|
||||
IF(NOT TD_ASTRA)
|
||||
|
||||
option(
|
||||
BUILD_WITH_UV
|
||||
"If build with libuv"
|
||||
ON
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_WITH_UV_TRANS
|
||||
"If build with libuv_trans "
|
||||
ON
|
||||
)
|
||||
|
||||
IF(${TD_LINUX} MATCHES TRUE)
|
||||
|
||||
option(
|
||||
BUILD_DEPENDENCY_TESTS
|
||||
"If build dependency tests"
|
||||
ON
|
||||
)
|
||||
|
||||
ENDIF ()
|
||||
|
||||
option(
|
||||
BUILD_DOCS
|
||||
"If use doxygen build documents"
|
||||
OFF
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_WITH_INVERTEDINDEX
|
||||
"If use invertedIndex"
|
||||
ON
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
option(
|
||||
BUILD_RELEASE
|
||||
"If build release version"
|
||||
OFF
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_CONTRIB
|
||||
"If build thirdpart from source"
|
||||
OFF
|
||||
)
|
|
@ -0,0 +1,222 @@
|
|||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
# init
|
||||
SET(TD_LINUX FALSE)
|
||||
SET(TD_WINDOWS FALSE)
|
||||
SET(TD_DARWIN FALSE)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX MATCHES 1)
|
||||
set(CXX_COMPILER_IS_GNU TRUE)
|
||||
else()
|
||||
set(CXX_COMPILER_IS_GNU FALSE)
|
||||
endif()
|
||||
|
||||
MESSAGE("Current system: ${CMAKE_SYSTEM_NAME}")
|
||||
|
||||
IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
|
||||
IF (${CXX_COMPILER_IS_GNU})
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
|
||||
ELSE ()
|
||||
ADD_DEFINITIONS("-Wno-tautological-constant-out-of-range-compare -Wno-pointer-sign -Wno-unknown-warning-option")
|
||||
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -undefined dynamic_lookup")
|
||||
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup")
|
||||
ENDIF ()
|
||||
|
||||
MESSAGE("Current system processor: ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
|
||||
IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
SET(TD_LINUX TRUE)
|
||||
SET(OSTYPE "Linux")
|
||||
ADD_DEFINITIONS("-DLINUX")
|
||||
|
||||
IF (${CMAKE_SIZEOF_VOID_P} MATCHES 8)
|
||||
SET(TD_LINUX_64 TRUE)
|
||||
ELSE ()
|
||||
SET(TD_LINUX_32 TRUE)
|
||||
ENDIF ()
|
||||
|
||||
EXECUTE_PROCESS(COMMAND chmod 777 ${CMAKE_CURRENT_LIST_DIR}/../packaging/tools/get_os.sh)
|
||||
EXECUTE_PROCESS(COMMAND readlink /bin/sh OUTPUT_VARIABLE SHELL_LINK)
|
||||
MESSAGE(STATUS "The shell is: " ${SHELL_LINK})
|
||||
|
||||
IF (${SHELL_LINK} MATCHES "dash")
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_CURRENT_LIST_DIR}/../packaging/tools/get_os.sh "" OUTPUT_VARIABLE TD_OS_INFO)
|
||||
ELSE ()
|
||||
EXECUTE_PROCESS(COMMAND sh ${CMAKE_CURRENT_LIST_DIR}/../packaging/tools/get_os.sh "" OUTPUT_VARIABLE TD_OS_INFO)
|
||||
ENDIF ()
|
||||
MESSAGE(STATUS "The current OS is " ${TD_OS_INFO})
|
||||
IF (${TD_OS_INFO} MATCHES "Alpine")
|
||||
SET(TD_ALPINE TRUE)
|
||||
ADD_DEFINITIONS("-D_ALPINE")
|
||||
ENDIF ()
|
||||
|
||||
ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
|
||||
SET(TD_DARWIN TRUE)
|
||||
SET(OSTYPE "macOS")
|
||||
ADD_DEFINITIONS("-DDARWIN -Wno-tautological-pointer-compare")
|
||||
|
||||
IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64")
|
||||
MESSAGE("Current system arch is arm64")
|
||||
SET(TD_DARWIN_64 TRUE)
|
||||
SET(TD_DARWIN_ARM64 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_DARWIN_64")
|
||||
ADD_DEFINITIONS("-D_TD_DARWIN_ARM64")
|
||||
ENDIF ()
|
||||
IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
|
||||
MESSAGE("Current system arch is x86_64")
|
||||
SET(TD_DARWIN_64 TRUE)
|
||||
SET(TD_DARWIN_X64 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_DARWIN_64")
|
||||
ADD_DEFINITIONS("-D_TD_DARWIN_X64")
|
||||
ENDIF ()
|
||||
|
||||
ADD_DEFINITIONS("-DHAVE_UNISTD_H")
|
||||
ENDIF ()
|
||||
|
||||
ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
|
||||
SET(TD_WINDOWS TRUE)
|
||||
SET(OSTYPE "Windows")
|
||||
ADD_DEFINITIONS("-DWINDOWS")
|
||||
|
||||
IF (${CMAKE_SIZEOF_VOID_P} MATCHES 8)
|
||||
SET(TD_WINDOWS_64 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_WINDOWS_64")
|
||||
ELSE ()
|
||||
SET(TD_WINDOWS_32 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_WINDOWS_32")
|
||||
ENDIF ()
|
||||
|
||||
ENDIF()
|
||||
|
||||
IF ("${CPUTYPE}" STREQUAL "")
|
||||
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "(amd64)|(AMD64)|(x86_64)|(X86_64)")
|
||||
MESSAGE(STATUS "Current platform is amd64")
|
||||
SET(PLATFORM_ARCH_STR "amd64")
|
||||
SET(CPUTYPE "x64")
|
||||
SET(TD_INTEL_64 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_X86_")
|
||||
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)")
|
||||
MESSAGE(STATUS "Current platform is x86")
|
||||
SET(PLATFORM_ARCH_STR "i386")
|
||||
SET(CPUTYPE "x86")
|
||||
SET(TD_INTEL_32 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_X86_")
|
||||
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "armv7l")
|
||||
MESSAGE(STATUS "Current platform is aarch32")
|
||||
SET(PLATFORM_ARCH_STR "arm")
|
||||
SET(CPUTYPE "arm32")
|
||||
SET(TD_ARM_32 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_ARM_")
|
||||
ADD_DEFINITIONS("-D_TD_ARM_32")
|
||||
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "(aarch64)|(arm64)")
|
||||
MESSAGE(STATUS "Current platform is aarch64")
|
||||
SET(PLATFORM_ARCH_STR "arm64")
|
||||
SET(CPUTYPE "arm64")
|
||||
SET(TD_ARM_64 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_ARM_")
|
||||
ADD_DEFINITIONS("-D_TD_ARM_64")
|
||||
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
|
||||
MESSAGE(STATUS "The current platform is loongarch64")
|
||||
SET(PLATFORM_ARCH_STR "loongarch64")
|
||||
SET(CPUTYPE "loongarch64")
|
||||
SET(TD_LOONGARCH_64 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_LOONGARCH_")
|
||||
ADD_DEFINITIONS("-D_TD_LOONGARCH_64")
|
||||
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "mips64")
|
||||
SET(PLATFORM_ARCH_STR "mips")
|
||||
SET(CPUTYPE "mips64")
|
||||
MESSAGE(STATUS "input cpuType: mips64")
|
||||
SET(TD_MIPS_64 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_MIPS_")
|
||||
ADD_DEFINITIONS("-D_TD_MIPS_64")
|
||||
ENDIF ()
|
||||
ELSE ()
|
||||
# if generate ARM version:
|
||||
# cmake -DCPUTYPE=aarch32 .. or cmake -DCPUTYPE=aarch64
|
||||
IF (${CPUTYPE} MATCHES "aarch32" OR ${CPUTYPE} MATCHES "arm32")
|
||||
SET(PLATFORM_ARCH_STR "arm")
|
||||
MESSAGE(STATUS "input cpuType: aarch32")
|
||||
ADD_DEFINITIONS("-D_TD_ARM_")
|
||||
ADD_DEFINITIONS("-D_TD_ARM_32")
|
||||
SET(TD_ARM_32 TRUE)
|
||||
ELSEIF (${CPUTYPE} MATCHES "aarch64" OR ${CPUTYPE} MATCHES "arm64")
|
||||
SET(PLATFORM_ARCH_STR "arm64")
|
||||
MESSAGE(STATUS "input cpuType: aarch64")
|
||||
ADD_DEFINITIONS("-D_TD_ARM_")
|
||||
ADD_DEFINITIONS("-D_TD_ARM_64")
|
||||
SET(TD_ARM_64 TRUE)
|
||||
ELSEIF (${CPUTYPE} MATCHES "loongarch64")
|
||||
SET(PLATFORM_ARCH_STR "loongarch64")
|
||||
MESSAGE(STATUS "input cpuType: loongarch64")
|
||||
SET(TD_LOONGARCH_64 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_LOONGARCH_")
|
||||
ADD_DEFINITIONS("-D_TD_LOONGARCH_64")
|
||||
ELSEIF (${CPUTYPE} MATCHES "mips64")
|
||||
SET(PLATFORM_ARCH_STR "mips")
|
||||
MESSAGE(STATUS "input cpuType: mips64")
|
||||
SET(TD_MIPS_64 TRUE)
|
||||
ADD_DEFINITIONS("-D_TD_MIPS_")
|
||||
ADD_DEFINITIONS("-D_TD_MIPS_64")
|
||||
ELSEIF (${CPUTYPE} MATCHES "x64")
|
||||
SET(PLATFORM_ARCH_STR "amd64")
|
||||
MESSAGE(STATUS "input cpuType: x64")
|
||||
SET(TD_INTEL_64 TRUE)
|
||||
ELSEIF (${CPUTYPE} MATCHES "x86")
|
||||
SET(PLATFORM_ARCH_STR "i386")
|
||||
MESSAGE(STATUS "input cpuType: x86")
|
||||
SET(TD_INTEL_32 TRUE)
|
||||
ELSE ()
|
||||
MESSAGE(STATUS "input cpuType unknown " ${CPUTYPE})
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
|
||||
IF(APPLE)
|
||||
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
|
||||
set(CMAKE_HAVE_THREADS_LIBRARY 1)
|
||||
set(CMAKE_USE_WIN32_THREADS_INIT 0)
|
||||
set(CMAKE_USE_PTHREADS 1)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
ENDIF()
|
||||
|
||||
IF(TD_WINDOWS)
|
||||
IF(MSVC)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:8388608")
|
||||
ELSEIF(MINGW)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,8388608")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
MESSAGE(STATUS "Platform arch:" ${PLATFORM_ARCH_STR})
|
||||
|
||||
set(TD_DEPS_DIR "x86")
|
||||
if (TD_LINUX)
|
||||
IF (TD_ARM_64 OR TD_ARM_32)
|
||||
set(TD_DEPS_DIR "arm")
|
||||
ELSEIF (TD_MIPS_64)
|
||||
set(TD_DEPS_DIR "mips")
|
||||
ELSE()
|
||||
set(TD_DEPS_DIR "x86")
|
||||
ENDIF()
|
||||
elseif (TD_DARWIN)
|
||||
IF (TD_ARM_64 OR TD_ARM_32)
|
||||
set(TD_DEPS_DIR "darwin/arm")
|
||||
ELSE ()
|
||||
set(TD_DEPS_DIR "darwin/x64")
|
||||
ENDIF ()
|
||||
elseif (TD_WINDOWS)
|
||||
IF (TD_WINDOWS_64)
|
||||
set(TD_DEPS_DIR "win/x64")
|
||||
ELSEIF (TD_WINDOWS_32)
|
||||
set(TD_DEPS_DIR "win/i386")
|
||||
ENDIF ()
|
||||
else ()
|
||||
MESSAGE(FATAL_ERROR "unsupported platform")
|
||||
endif()
|
||||
MESSAGE(STATUS "DEPS_DIR: " ${TD_DEPS_DIR})
|
||||
|
||||
MESSAGE("C Compiler: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID}, ${CMAKE_C_COMPILER_VERSION})")
|
||||
MESSAGE("CXX Compiler: ${CMAKE_CXX_COMPILER} (${CMAKE_C_COMPILER_ID}, ${CMAKE_CXX_COMPILER_VERSION})")
|
|
@ -0,0 +1,123 @@
|
|||
|
||||
IF (DEFINED VERNUMBER)
|
||||
SET(TD_VER_NUMBER ${VERNUMBER})
|
||||
ELSE ()
|
||||
SET(TD_VER_NUMBER "3.3.6.0.alpha")
|
||||
ENDIF ()
|
||||
|
||||
IF (DEFINED VERCOMPATIBLE)
|
||||
SET(TD_VER_COMPATIBLE ${VERCOMPATIBLE})
|
||||
ELSE ()
|
||||
SET(TD_VER_COMPATIBLE "3.0.0.0")
|
||||
ENDIF ()
|
||||
|
||||
IF (TD_PRODUCT_NAME)
|
||||
ADD_DEFINITIONS(-DTD_PRODUCT_NAME="${TD_PRODUCT_NAME}")
|
||||
ENDIF ()
|
||||
|
||||
IF (CUS_NAME)
|
||||
ADD_DEFINITIONS(-DCUS_NAME="${CUS_NAME}")
|
||||
ENDIF ()
|
||||
|
||||
IF (CUS_PROMPT)
|
||||
ADD_DEFINITIONS(-DCUS_PROMPT="${CUS_PROMPT}")
|
||||
ENDIF ()
|
||||
|
||||
IF (CUS_EMAIL)
|
||||
ADD_DEFINITIONS(-DCUS_EMAIL="${CUS_EMAIL}")
|
||||
ENDIF ()
|
||||
|
||||
find_program(HAVE_GIT NAMES git)
|
||||
|
||||
IF (DEFINED GITINFO)
|
||||
SET(TD_VER_GIT ${GITINFO})
|
||||
ELSEIF (HAVE_GIT)
|
||||
execute_process(COMMAND git log -1 --format=%H WORKING_DIRECTORY ${TD_COMMUNITY_DIR} OUTPUT_VARIABLE GIT_COMMITID)
|
||||
#message(STATUS "git log result:${GIT_COMMITID}")
|
||||
IF (GIT_COMMITID)
|
||||
string (REGEX REPLACE "[\n\t\r]" "" GIT_COMMITID ${GIT_COMMITID})
|
||||
SET(TD_VER_GIT ${GIT_COMMITID})
|
||||
ELSE ()
|
||||
message(STATUS "not a git repository")
|
||||
SET(TD_VER_GIT "no git commit id")
|
||||
ENDIF ()
|
||||
ELSE ()
|
||||
message(STATUS "no git found")
|
||||
SET(TD_VER_GIT "no git commit id")
|
||||
ENDIF ()
|
||||
|
||||
IF (DEFINED GITINFOI)
|
||||
SET(TD_VER_GIT_INTERNAL ${GITINFOI})
|
||||
ELSEIF (HAVE_GIT)
|
||||
execute_process(COMMAND git log -1 --format=%H WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMITID)
|
||||
message(STATUS "git log result:${GIT_COMMITID}")
|
||||
IF (GIT_COMMITID)
|
||||
string (REGEX REPLACE "[\n\t\r]" "" GIT_COMMITID ${GIT_COMMITID})
|
||||
SET(TD_VER_GIT_INTERNAL ${GIT_COMMITID})
|
||||
ELSE ()
|
||||
message(STATUS "not a git repository")
|
||||
SET(TD_VER_GIT "no git commit id")
|
||||
ENDIF ()
|
||||
ELSE ()
|
||||
message(STATUS "no git cmd")
|
||||
SET(TD_VER_GIT_INTERNAL "no git commit id")
|
||||
ENDIF ()
|
||||
|
||||
IF (DEFINED VERDATE)
|
||||
SET(TD_VER_DATE ${VERDATE})
|
||||
ELSE ()
|
||||
STRING(COMPARE GREATER_EQUAL "${CMAKE_VERSION}" "3.26" TD_CMAKE_SUPPORT_TZ)
|
||||
|
||||
IF (TD_CMAKE_SUPPORT_TZ)
|
||||
STRING(TIMESTAMP TD_VER_DATE "%Y-%m-%d %H:%M:%S %z")
|
||||
ELSE ()
|
||||
IF (TD_WINDOWS)
|
||||
STRING(TIMESTAMP TD_VER_DATE "%Y-%m-%d %H:%M:%S")
|
||||
ELSE ()
|
||||
EXECUTE_PROCESS(COMMAND date +"%F %T %z" OUTPUT_VARIABLE TD_VER_DATE)
|
||||
STRING(REPLACE "\"" "" TD_VER_DATE ${TD_VER_DATE})
|
||||
STRING(STRIP ${TD_VER_DATE} TD_VER_DATE)
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
|
||||
IF (DEFINED VERTYPE)
|
||||
SET(TD_VER_VERTYPE ${VERTYPE})
|
||||
ELSE ()
|
||||
SET(TD_VER_VERTYPE "stable")
|
||||
ENDIF ()
|
||||
|
||||
IF (DEFINED CPUTYPE)
|
||||
SET(TD_VER_CPUTYPE ${CPUTYPE})
|
||||
ELSE ()
|
||||
IF (TD_WINDOWS_32)
|
||||
SET(TD_VER_CPUTYPE "x86")
|
||||
ELSEIF (TD_LINUX_32)
|
||||
SET(TD_VER_CPUTYPE "x86")
|
||||
ELSEIF (TD_ARM_32)
|
||||
SET(TD_VER_CPUTYPE "arm32")
|
||||
ELSEIF (TD_MIPS_32)
|
||||
SET(TD_VER_CPUTYPE "mips32")
|
||||
ELSE ()
|
||||
SET(TD_VER_CPUTYPE "x64")
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
|
||||
IF (DEFINED OSTYPE)
|
||||
SET(TD_VER_OSTYPE ${OSTYPE})
|
||||
ELSE ()
|
||||
SET(TD_VER_OSTYPE "Linux")
|
||||
ENDIF ()
|
||||
|
||||
MESSAGE(STATUS "============= compile version parameter information start ============= ")
|
||||
MESSAGE(STATUS "version: " ${TD_VER_NUMBER})
|
||||
MESSAGE(STATUS "compatible: " ${TD_VER_COMPATIBLE})
|
||||
MESSAGE(STATUS "commit id: " ${TD_VER_GIT})
|
||||
MESSAGE(STATUS "build date: " ${TD_VER_DATE})
|
||||
MESSAGE(STATUS "build type: " ${CMAKE_BUILD_TYPE})
|
||||
MESSAGE(STATUS "type: " ${TD_VER_VERTYPE})
|
||||
MESSAGE(STATUS "cpu: " ${TD_VER_CPUTYPE})
|
||||
MESSAGE(STATUS "os: " ${TD_VER_OSTYPE})
|
||||
MESSAGE(STATUS "============= compile version parameter information end ============= ")
|
||||
|
||||
STRING(REPLACE "." "_" TD_LIB_VER_NUMBER ${TD_VER_NUMBER})
|
|
@ -0,0 +1,13 @@
|
|||
# cos
|
||||
ExternalProject_Add(cos
|
||||
GIT_REPOSITORY https://github.com/tencentyun/cos-c-sdk-v5.git
|
||||
GIT_TAG v5.0.16
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/cos-c-sdk-v5"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
# crashdump
|
||||
ExternalProject_Add(crashdump
|
||||
GIT_REPOSITORY https://github.com/Arnavion/crashdump.git
|
||||
GIT_TAG master
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/crashdump"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/crashdump"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,20 @@
|
|||
# curl
|
||||
ExternalProject_Add(curl2
|
||||
URL https://github.com/curl/curl/releases/download/curl-8_2_1/curl-8.2.1.tar.gz
|
||||
#URL https://curl.se/download/curl-8.2.1.tar.gz
|
||||
URL_HASH MD5=b25588a43556068be05e1624e0e74d41
|
||||
DOWNLOAD_NO_PROGRESS 1
|
||||
DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
|
||||
#GIT_REPOSITORY https://github.com/curl/curl.git
|
||||
#GIT_TAG curl-7_88_1
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/curl2"
|
||||
DEPENDS openssl
|
||||
BUILD_IN_SOURCE TRUE
|
||||
BUILD_ALWAYS 1
|
||||
UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND ${CONTRIB_CONFIG_ENV} ./configure --prefix=$ENV{HOME}/.cos-local.2 --with-ssl=$ENV{HOME}/.cos-local.2 --enable-websockets --enable-shared=no --disable-ldap --disable-ldaps --without-brotli --without-zstd --without-libidn2 --without-nghttp2 --without-libpsl --without-librtmp #--enable-debug
|
||||
BUILD_COMMAND make -j
|
||||
INSTALL_COMMAND make install
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
project(deps-download NONE)
|
||||
|
||||
include(ExternalProject)
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
# geos
|
||||
ExternalProject_Add(geos
|
||||
GIT_REPOSITORY https://github.com/libgeos/geos.git
|
||||
GIT_TAG 3.12.0
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/geos"
|
||||
BINARY_DIR ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
# gnuregex
|
||||
ExternalProject_Add(gnuregex
|
||||
URL https://launchpad.net/gnuregex/trunk/2.9/+download/libgnurx-src-2.9.zip
|
||||
DOWNLOAD_NAME libgnurx-src.zip
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/gnuregex"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
# googletest
|
||||
ExternalProject_Add(googletest
|
||||
GIT_REPOSITORY https://github.com/taosdata-contrib/googletest.git
|
||||
GIT_TAG release-1.11.0
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/googletest"
|
||||
BINARY_DIR ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
# iconv
|
||||
ExternalProject_Add(iconv
|
||||
GIT_REPOSITORY https://github.com/win-iconv/win-iconv.git
|
||||
GIT_TAG v0.0.8
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/iconv"
|
||||
BINARY_DIR ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
# jemalloc
|
||||
ExternalProject_Add(jemalloc
|
||||
GIT_REPOSITORY https://github.com/jemalloc/jemalloc.git
|
||||
GIT_TAG 5.3.0
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/jemalloc"
|
||||
BINARY_DIR ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
GIT_PROGRESS true
|
||||
)
|
|
@ -0,0 +1,11 @@
|
|||
# lemon
|
||||
|
||||
ExternalProject_Add(
|
||||
lemon
|
||||
SOURCE_DIR ${TD_CONTRIB_DIR}/lemon
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND "${C_COMPILER_LEMON}" -o ${TD_CONTRIB_DIR}/lemon/lemon ${TD_CONTRIB_DIR}/lemon/lemon.c
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_IN_SOURCE 1
|
||||
BUILD_ALWAYS 1
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
# libdwarf
|
||||
ExternalProject_Add(libdwarf
|
||||
GIT_REPOSITORY https://github.com/davea42/libdwarf-code.git
|
||||
GIT_TAG libdwarf-0.3.1
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/libdwarf"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/libdwarf"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,430 @@
|
|||
# GNUmakefile
|
||||
#
|
||||
# Copyright 2008 Bryan Ischo <bryan@ischo.com>
|
||||
#
|
||||
# This file is part of libs3.
|
||||
#
|
||||
# libs3 is free software: you can redistribute it and/or modify it under the
|
||||
# terms of the GNU Lesser General Public License as published by the Free
|
||||
# Software Foundation, version 3 or above of the License. You can also
|
||||
# redistribute and/or modify it under the terms of the GNU General Public
|
||||
# License, version 2 or above of the License.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of this library and its programs with the
|
||||
# OpenSSL library, and distribute linked combinations including the two.
|
||||
#
|
||||
# libs3 is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# version 3 along with libs3, in a file named COPYING. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# You should also have received a copy of the GNU General Public License
|
||||
# version 2 along with libs3, in a file named COPYING-GPLv2. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
# I tried to use the autoconf/automake/autolocal/etc (i.e. autohell) tools
|
||||
# but I just couldn't stomach them. Since this is a Makefile for POSIX
|
||||
# systems, I will simply do away with autohell completely and use a GNU
|
||||
# Makefile. GNU make ought to be available pretty much everywhere, so I
|
||||
# don't see this being a significant issue for portability.
|
||||
|
||||
# All commands assume a GNU compiler. For systems which do not use a GNU
|
||||
# compiler, write scripts with the same names as these commands, and taking
|
||||
# the same arguments, and translate the arguments and commands into the
|
||||
# appropriate non-POSIX ones as needed. libs3 assumes a GNU toolchain as
|
||||
# the most portable way to build software possible. Non-POSIX, non-GNU
|
||||
# systems can do the work of supporting this build infrastructure.
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Set libs3 version number, unless it is already set.
|
||||
|
||||
LIBS3_VER_MAJOR ?= 4
|
||||
LIBS3_VER_MINOR ?= 1
|
||||
LIBS3_VER := $(LIBS3_VER_MAJOR).$(LIBS3_VER_MINOR)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Determine verbosity. VERBOSE_SHOW should be prepended to every command which
|
||||
# should only be displayed if VERBOSE is set. QUIET_ECHO may be used to
|
||||
# echo text only if VERBOSE is not set. Typically, a VERBOSE_SHOW command will
|
||||
# be paired with a QUIET_ECHO command, to provide a command which is displayed
|
||||
# in VERBOSE mode, along with text which is displayed in non-VERBOSE mode to
|
||||
# describe the command.
|
||||
#
|
||||
# No matter what VERBOSE is defined to, it ends up as true if it's defined.
|
||||
# This will be weird if you defined VERBOSE=false in the environment, and we
|
||||
# switch it to true here; but the meaning of VERBOSE is, "if it's defined to
|
||||
# any value, then verbosity is turned on". So don't define VERBOSE if you
|
||||
# don't want verbosity in the build process.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
ifdef VERBOSE
|
||||
VERBOSE = true
|
||||
VERBOSE_ECHO = @ echo
|
||||
VERBOSE_SHOW =
|
||||
QUIET_ECHO = @ echo > /dev/null
|
||||
else
|
||||
VERBOSE = false
|
||||
VERBOSE_ECHO = @ echo > /dev/null
|
||||
VERBOSE_SHOW = @
|
||||
QUIET_ECHO = @ echo
|
||||
endif
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# BUILD directory
|
||||
ifndef BUILD
|
||||
ifdef DEBUG
|
||||
BUILD := build-debug
|
||||
else
|
||||
BUILD := build
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# DESTDIR directory
|
||||
ifndef DESTDIR
|
||||
DESTDIR := ${HOME}/.cos-local.2
|
||||
endif
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# LIBDIR directory
|
||||
ifndef LIBDIR
|
||||
LIBDIR := ${DESTDIR}/lib
|
||||
endif
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Compiler CC handling
|
||||
ifndef CC
|
||||
CC := gcc
|
||||
endif
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Acquire configuration information for libraries that libs3 depends upon
|
||||
|
||||
ifndef CURL_LIBS
|
||||
CURL_LIBS := $(shell curl-config --libs)
|
||||
endif
|
||||
|
||||
ifndef CURL_CFLAGS
|
||||
CURL_CFLAGS := $(shell curl-config --cflags)
|
||||
endif
|
||||
|
||||
ifndef LIBXML2_LIBS
|
||||
LIBXML2_LIBS := $(shell xml2-config --libs)
|
||||
endif
|
||||
|
||||
ifndef LIBXML2_CFLAGS
|
||||
LIBXML2_CFLAGS := $(shell xml2-config --cflags)
|
||||
endif
|
||||
|
||||
ifndef OPENSSL_LIBS
|
||||
OPENSSL_LIBS := -lssl -lcrypto
|
||||
endif
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# These CFLAGS assume a GNU compiler. For other compilers, write a script
|
||||
# which converts these arguments into their equivalent for that particular
|
||||
# compiler.
|
||||
|
||||
ifndef CFLAGS
|
||||
ifdef DEBUG
|
||||
CFLAGS := -g
|
||||
else
|
||||
CFLAGS := -O3
|
||||
endif
|
||||
endif
|
||||
|
||||
CFLAGS += -Wall -Werror -Wshadow -Wextra -Iinc \
|
||||
$(CURL_CFLAGS) $(LIBXML2_CFLAGS) \
|
||||
-DLIBS3_VER_MAJOR=\"$(LIBS3_VER_MAJOR)\" \
|
||||
-DLIBS3_VER_MINOR=\"$(LIBS3_VER_MINOR)\" \
|
||||
-DLIBS3_VER=\"$(LIBS3_VER)\" \
|
||||
-D__STRICT_ANSI__ \
|
||||
-D_ISOC99_SOURCE \
|
||||
-D_POSIX_C_SOURCE=200112L
|
||||
|
||||
LDFLAGS = $(CURL_LIBS) $(LIBXML2_LIBS) $(OPENSSL_LIBS) -lpthread
|
||||
|
||||
STRIP ?= strip
|
||||
INSTALL := install --strip-program=$(STRIP)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Default targets are everything
|
||||
|
||||
.PHONY: all
|
||||
all: exported test
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Exported targets are the library and driver program
|
||||
|
||||
.PHONY: exported
|
||||
exported: libs3 s3 headers
|
||||
exported_static: $(LIBS3_STATIC)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Install target
|
||||
|
||||
.PHONY: install install_static
|
||||
install_static: exported_static
|
||||
$(QUIET_ECHO) $(LIBDIR)/libs3.a: Installing static library
|
||||
$(VERBOSE_SHOW) $(INSTALL) -Dp -m u+rw,go+r $(BUILD)/lib/libs3.a \
|
||||
$(LIBDIR)/libs3.a
|
||||
$(QUIET_ECHO) $(DESTDIR)/include/libs3.h: Installing header
|
||||
$(VERBOSE_SHOW) $(INSTALL) -Dp -m u+rw,go+r inc/libs3.h \
|
||||
$(DESTDIR)/include/libs3.h
|
||||
|
||||
install: exported
|
||||
$(QUIET_ECHO) $(DESTDIR)/bin/s3: Installing executable
|
||||
$(VERBOSE_SHOW) $(INSTALL) -Dps -m u+rwx,go+rx $(BUILD)/bin/s3 \
|
||||
$(DESTDIR)/bin/s3
|
||||
$(QUIET_ECHO) \
|
||||
$(LIBDIR)/libs3.so.$(LIBS3_VER): Installing shared library
|
||||
$(VERBOSE_SHOW) $(INSTALL) -Dps -m u+rw,go+r \
|
||||
$(BUILD)/lib/libs3.so.$(LIBS3_VER_MAJOR) \
|
||||
$(LIBDIR)/libs3.so.$(LIBS3_VER)
|
||||
$(QUIET_ECHO) \
|
||||
$(LIBDIR)/libs3.so.$(LIBS3_VER_MAJOR): Linking shared library
|
||||
$(VERBOSE_SHOW) ln -sf libs3.so.$(LIBS3_VER) \
|
||||
$(LIBDIR)/libs3.so.$(LIBS3_VER_MAJOR)
|
||||
$(QUIET_ECHO) $(LIBDIR)/libs3.so: Linking shared library
|
||||
$(VERBOSE_SHOW) ln -sf libs3.so.$(LIBS3_VER_MAJOR) $(LIBDIR)/libs3.so
|
||||
$(QUIET_ECHO) $(LIBDIR)/libs3.a: Installing static library
|
||||
$(VERBOSE_SHOW) $(INSTALL) -Dp -m u+rw,go+r $(BUILD)/lib/libs3.a \
|
||||
$(LIBDIR)/libs3.a
|
||||
$(QUIET_ECHO) $(DESTDIR)/include/libs3.h: Installing header
|
||||
$(VERBOSE_SHOW) $(INSTALL) -Dp -m u+rw,go+r $(BUILD)/include/libs3.h \
|
||||
$(DESTDIR)/include/libs3.h
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Uninstall target
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
$(QUIET_ECHO) Installed files: Uninstalling
|
||||
$(VERBOSE_SHOW) \
|
||||
rm -f $(DESTDIR)/bin/s3 \
|
||||
$(DESTDIR)/include/libs3.h \
|
||||
$(DESTDIR)/lib/libs3.a \
|
||||
$(DESTDIR)/lib/libs3.so \
|
||||
$(DESTDIR)/lib/libs3.so.$(LIBS3_VER_MAJOR) \
|
||||
$(DESTDIR)/lib/libs3.so.$(LIBS3_VER)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Compile target patterns
|
||||
|
||||
$(BUILD)/obj/%.o: src/%.c
|
||||
$(QUIET_ECHO) $@: Compiling object
|
||||
@ mkdir -p $(dir $(BUILD)/dep/$<)
|
||||
@ $(CC) $(CFLAGS) -M -MG -MQ $@ -DCOMPILINGDEPENDENCIES \
|
||||
-o $(BUILD)/dep/$(<:%.c=%.d) -c $<
|
||||
@ mkdir -p $(dir $@)
|
||||
$(VERBOSE_SHOW) $(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(BUILD)/obj/%.do: src/%.c
|
||||
$(QUIET_ECHO) $@: Compiling dynamic object
|
||||
$(QUIET_ECHO) cflags:${CFLAGS}
|
||||
@ mkdir -p $(dir $(BUILD)/dep/$<)
|
||||
@ $(CC) $(CFLAGS) -M -MG -MQ $@ -DCOMPILINGDEPENDENCIES \
|
||||
-o $(BUILD)/dep/$(<:%.c=%.dd) -c $<
|
||||
@ mkdir -p $(dir $@)
|
||||
$(VERBOSE_SHOW) $(CC) $(CFLAGS) -fpic -fPIC -o $@ -c $<
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# libs3 library targets
|
||||
|
||||
LIBS3_SHARED = $(BUILD)/lib/libs3.so.$(LIBS3_VER_MAJOR)
|
||||
LIBS3_STATIC = $(BUILD)/lib/libs3.a
|
||||
|
||||
.PHONY: libs3
|
||||
libs3: $(LIBS3_SHARED) $(LIBS3_STATIC)
|
||||
|
||||
LIBS3_SOURCES := bucket.c bucket_metadata.c error_parser.c general.c \
|
||||
object.c request.c request_context.c \
|
||||
response_headers_handler.c service_access_logging.c \
|
||||
service.c simplexml.c util.c multipart.c
|
||||
|
||||
$(LIBS3_SHARED): $(LIBS3_SOURCES:%.c=$(BUILD)/obj/%.do)
|
||||
$(QUIET_ECHO) $@: Building shared library
|
||||
@ mkdir -p $(dir $@)
|
||||
$(VERBOSE_SHOW) $(CC) -shared -Wl,-soname,libs3.so.$(LIBS3_VER_MAJOR) \
|
||||
-o $@ $^ $(LDFLAGS)
|
||||
|
||||
$(LIBS3_STATIC): $(LIBS3_SOURCES:%.c=$(BUILD)/obj/%.o)
|
||||
$(QUIET_ECHO) $@: Building static library
|
||||
@ mkdir -p $(dir $@)
|
||||
$(VERBOSE_SHOW) $(AR) cr $@ $^
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Driver program targets
|
||||
|
||||
.PHONY: s3
|
||||
s3: $(BUILD)/bin/s3
|
||||
|
||||
$(BUILD)/bin/s3: $(BUILD)/obj/s3.o $(LIBS3_SHARED)
|
||||
$(QUIET_ECHO) $@: Building executable
|
||||
@ mkdir -p $(dir $@)
|
||||
$(VERBOSE_SHOW) $(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# libs3 header targets
|
||||
|
||||
.PHONY: headers
|
||||
headers: $(BUILD)/include/libs3.h
|
||||
|
||||
$(BUILD)/include/libs3.h: inc/libs3.h
|
||||
$(QUIET_ECHO) $@: Linking header
|
||||
@ mkdir -p $(dir $@)
|
||||
$(VERBOSE_SHOW) ln -sf $(abspath $<) $@
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Test targets
|
||||
|
||||
.PHONY: test
|
||||
test: $(BUILD)/bin/testsimplexml
|
||||
|
||||
$(BUILD)/bin/testsimplexml: $(BUILD)/obj/testsimplexml.o $(LIBS3_STATIC)
|
||||
$(QUIET_ECHO) $@: Building executable
|
||||
@ mkdir -p $(dir $@)
|
||||
$(VERBOSE_SHOW) $(CC) -o $@ $^ $(LIBXML2_LIBS)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Clean target
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(QUIET_ECHO) $(BUILD): Cleaning
|
||||
$(VERBOSE_SHOW) rm -rf $(BUILD)
|
||||
|
||||
.PHONY: distclean
|
||||
distclean:
|
||||
$(QUIET_ECHO) $(BUILD): Cleaning
|
||||
$(VERBOSE_SHOW) rm -rf $(BUILD)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Clean dependencies target
|
||||
|
||||
.PHONY: cleandeps
|
||||
cleandeps:
|
||||
$(QUIET_ECHO) $(BUILD)/dep: Cleaning dependencies
|
||||
$(VERBOSE_SHOW) rm -rf $(BUILD)/dep
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Dependencies
|
||||
|
||||
ALL_SOURCES := $(LIBS3_SOURCES) s3.c testsimplexml.c
|
||||
|
||||
$(foreach i, $(ALL_SOURCES), $(eval -include $(BUILD)/dep/src/$(i:%.c=%.d)))
|
||||
$(foreach i, $(ALL_SOURCES), $(eval -include $(BUILD)/dep/src/$(i:%.c=%.dd)))
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Debian package target
|
||||
|
||||
DEBPKG = $(BUILD)/pkg/libs3_$(LIBS3_VER).deb
|
||||
DEBDEVPKG = $(BUILD)/pkg/libs3-dev_$(LIBS3_VER).deb
|
||||
|
||||
.PHONY: deb
|
||||
deb: $(DEBPKG) $(DEBDEVPKG)
|
||||
|
||||
$(DEBPKG): DEBARCH = $(shell dpkg-architecture | grep ^DEB_BUILD_ARCH= | \
|
||||
cut -d '=' -f 2)
|
||||
$(DEBPKG): exported $(BUILD)/deb/DEBIAN/control $(BUILD)/deb/DEBIAN/shlibs \
|
||||
$(BUILD)/deb/DEBIAN/postinst \
|
||||
$(BUILD)/deb/usr/share/doc/libs3/changelog.gz \
|
||||
$(BUILD)/deb/usr/share/doc/libs3/changelog.Debian.gz \
|
||||
$(BUILD)/deb/usr/share/doc/libs3/copyright
|
||||
DESTDIR=$(BUILD)/deb/usr $(MAKE) install
|
||||
rm -rf $(BUILD)/deb/usr/include
|
||||
rm -f $(BUILD)/deb/usr/lib/libs3.a
|
||||
@mkdir -p $(dir $@)
|
||||
fakeroot dpkg-deb -b $(BUILD)/deb $@
|
||||
mv $@ $(BUILD)/pkg/libs3_$(LIBS3_VER)_$(DEBARCH).deb
|
||||
|
||||
$(DEBDEVPKG): DEBARCH = $(shell dpkg-architecture | grep ^DEB_BUILD_ARCH= | \
|
||||
cut -d '=' -f 2)
|
||||
$(DEBDEVPKG): exported $(BUILD)/deb-dev/DEBIAN/control \
|
||||
$(BUILD)/deb-dev/usr/share/doc/libs3-dev/changelog.gz \
|
||||
$(BUILD)/deb-dev/usr/share/doc/libs3-dev/changelog.Debian.gz \
|
||||
$(BUILD)/deb-dev/usr/share/doc/libs3-dev/copyright
|
||||
DESTDIR=$(BUILD)/deb-dev/usr $(MAKE) install
|
||||
rm -rf $(BUILD)/deb-dev/usr/bin
|
||||
rm -f $(BUILD)/deb-dev/usr/lib/libs3.so*
|
||||
@mkdir -p $(dir $@)
|
||||
fakeroot dpkg-deb -b $(BUILD)/deb-dev $@
|
||||
mv $@ $(BUILD)/pkg/libs3-dev_$(LIBS3_VER)_$(DEBARCH).deb
|
||||
|
||||
$(BUILD)/deb/DEBIAN/control: debian/control
|
||||
@mkdir -p $(dir $@)
|
||||
echo -n "Depends: " > $@
|
||||
dpkg-shlibdeps -Sbuild -O $(BUILD)/lib/libs3.so.$(LIBS3_VER_MAJOR) | \
|
||||
cut -d '=' -f 2- >> $@
|
||||
sed -e 's/LIBS3_VERSION/$(LIBS3_VER)/' \
|
||||
< $< | sed -e 's/DEBIAN_ARCHITECTURE/$(DEBARCH)/' | \
|
||||
grep -v ^Source: >> $@
|
||||
|
||||
$(BUILD)/deb-dev/DEBIAN/control: debian/control.dev
|
||||
@mkdir -p $(dir $@)
|
||||
sed -e 's/LIBS3_VERSION/$(LIBS3_VER)/' \
|
||||
< $< | sed -e 's/DEBIAN_ARCHITECTURE/$(DEBARCH)/' > $@
|
||||
|
||||
$(BUILD)/deb/DEBIAN/shlibs:
|
||||
echo -n "libs3 $(LIBS3_VER_MAJOR) libs3 " > $@
|
||||
echo "(>= $(LIBS3_VER))" >> $@
|
||||
|
||||
$(BUILD)/deb/DEBIAN/postinst: debian/postinst
|
||||
@mkdir -p $(dir $@)
|
||||
cp $< $@
|
||||
|
||||
$(BUILD)/deb/usr/share/doc/libs3/copyright: LICENSE
|
||||
@mkdir -p $(dir $@)
|
||||
cp $< $@
|
||||
@echo >> $@
|
||||
@echo -n "An alternate location for the GNU General Public " >> $@
|
||||
@echo "License version 3 on Debian" >> $@
|
||||
@echo "systems is /usr/share/common-licenses/GPL-3." >> $@
|
||||
|
||||
$(BUILD)/deb-dev/usr/share/doc/libs3-dev/copyright: LICENSE
|
||||
@mkdir -p $(dir $@)
|
||||
cp $< $@
|
||||
@echo >> $@
|
||||
@echo -n "An alternate location for the GNU General Public " >> $@
|
||||
@echo "License version 3 on Debian" >> $@
|
||||
@echo "systems is /usr/share/common-licenses/GPL-3." >> $@
|
||||
|
||||
$(BUILD)/deb/usr/share/doc/libs3/changelog.gz: debian/changelog
|
||||
@mkdir -p $(dir $@)
|
||||
gzip --best -c $< > $@
|
||||
|
||||
$(BUILD)/deb-dev/usr/share/doc/libs3-dev/changelog.gz: debian/changelog
|
||||
@mkdir -p $(dir $@)
|
||||
gzip --best -c $< > $@
|
||||
|
||||
$(BUILD)/deb/usr/share/doc/libs3/changelog.Debian.gz: debian/changelog.Debian
|
||||
@mkdir -p $(dir $@)
|
||||
gzip --best -c $< > $@
|
||||
|
||||
$(BUILD)/deb-dev/usr/share/doc/libs3-dev/changelog.Debian.gz: \
|
||||
debian/changelog.Debian
|
||||
@mkdir -p $(dir $@)
|
||||
gzip --best -c $< > $@
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# libs3
|
||||
|
||||
ExternalProject_Add(libs3
|
||||
GIT_REPOSITORY https://github.com/bji/libs3
|
||||
#GIT_TAG v5.0.16
|
||||
DEPENDS curl2 xml2
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/libs3"
|
||||
#BINARY_DIR ""
|
||||
BUILD_IN_SOURCE TRUE
|
||||
BUILD_ALWAYS 1
|
||||
UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND cp ${TD_SUPPORT_DIR}/libs3.GNUmakefile GNUmakefile && sed -i "s|CFLAGS += -Wall -Werror|CFLAGS += -I'$ENV{HOME}/.cos-local.2/include' -L'$ENV{HOME}/.cos-local.2/lib' |" ./GNUmakefile
|
||||
BUILD_COMMAND make build/lib/libs3.a
|
||||
INSTALL_COMMAND make install_static
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
# libuv
|
||||
ExternalProject_Add(libuv
|
||||
GIT_REPOSITORY https://github.com/libuv/libuv.git
|
||||
GIT_TAG v1.49.2
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/libuv"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/libuv"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
# lz4
|
||||
ExternalProject_Add(lz4
|
||||
GIT_REPOSITORY https://github.com/taosdata-contrib/lz4.git
|
||||
GIT_TAG v1.9.3
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/lz4"
|
||||
BINARY_DIR ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
# xz
|
||||
if (${BUILD_WITH_LZMA2})
|
||||
ExternalProject_Add(lzma2
|
||||
GIT_REPOSITORY https://github.com/conor42/fast-lzma2.git
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/lzma2"
|
||||
#BINARY_DIR ""
|
||||
BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND make
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
||||
endif()
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
# msvcregex
|
||||
ExternalProject_Add(msvcregex
|
||||
GIT_REPOSITORY https://gitee.com/l0km/libgnurx-msvc.git
|
||||
GIT_TAG master
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/msvcregex"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,15 @@
|
|||
# cos
|
||||
ExternalProject_Add(mxml
|
||||
GIT_REPOSITORY https://github.com/michaelrsweet/mxml.git
|
||||
GIT_TAG v2.12
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/mxml"
|
||||
#BINARY_DIR ""
|
||||
BUILD_IN_SOURCE TRUE
|
||||
#UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND ./configure --prefix=$ENV{HOME}/.cos-local.1 --enable-shared=no
|
||||
#CONFIGURE_COMMAND ./configure
|
||||
BUILD_COMMAND make
|
||||
INSTALL_COMMAND make install
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
# pcre2
|
||||
ExternalProject_Add(pcre2
|
||||
GIT_REPOSITORY https://github.com/PCRE2Project/pcre2.git
|
||||
GIT_TAG pcre2-10.43
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/pcre2"
|
||||
#BINARY_DIR "${TD_CONTRIB_DIR}/pcre2"
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
# pthread
|
||||
ExternalProject_Add(pthread
|
||||
GIT_REPOSITORY https://github.com/GerHobbelt/pthread-win32
|
||||
GIT_TAG v3.0.3.1
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/pthread"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
# rocksdb
|
||||
if (${BUILD_CONTRIB})
|
||||
ExternalProject_Add(rocksdb
|
||||
URL https://github.com/facebook/rocksdb/archive/refs/tags/v8.1.1.tar.gz
|
||||
URL_HASH MD5=3b4c97ee45df9c8a5517308d31ab008b
|
||||
DOWNLOAD_NO_PROGRESS 1
|
||||
DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/rocksdb"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
||||
else()
|
||||
if (NOT ${TD_LINUX})
|
||||
ExternalProject_Add(rocksdb
|
||||
URL https://github.com/facebook/rocksdb/archive/refs/tags/v8.1.1.tar.gz
|
||||
URL_HASH MD5=3b4c97ee45df9c8a5517308d31ab008b
|
||||
DOWNLOAD_NO_PROGRESS 1
|
||||
DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/rocksdb"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
||||
endif()
|
||||
endif()
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
# sqlite
|
||||
ExternalProject_Add(sqlite
|
||||
GIT_REPOSITORY https://github.com/sqlite/sqlite.git
|
||||
GIT_TAG version-3.36.0
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/sqlite"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/sqlite"
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND "./configure"
|
||||
BUILD_COMMAND "$(MAKE)"
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,16 @@
|
|||
# openssl
|
||||
ExternalProject_Add(openssl
|
||||
URL https://github.com/openssl/openssl/releases/download/openssl-3.1.3/openssl-3.1.3.tar.gz
|
||||
URL_HASH SHA256=f0316a2ebd89e7f2352976445458689f80302093788c466692fb2a188b2eacf6
|
||||
DOWNLOAD_NO_PROGRESS 1
|
||||
DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/openssl"
|
||||
BUILD_IN_SOURCE TRUE
|
||||
BUILD_ALWAYS 1
|
||||
UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND ${CONTRIB_CONFIG_ENV} ./Configure --prefix=$ENV{HOME}/.cos-local.2 no-shared
|
||||
BUILD_COMMAND make -j
|
||||
INSTALL_COMMAND make install_sw -j
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
# stub
|
||||
ExternalProject_Add(stub
|
||||
GIT_REPOSITORY https://github.com/coolxv/cpp-stub.git
|
||||
GIT_TAG 3137465194014d66a8402941e80d2bccc6346f51
|
||||
GIT_SUBMODULES "src"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/cpp-stub"
|
||||
BINARY_DIR "${TD_CONTRIB_DIR}/cpp-stub/src"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
# taosadapter
|
||||
ExternalProject_Add(taosadapter
|
||||
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
||||
GIT_TAG main
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
# taosws-rs
|
||||
ExternalProject_Add(taosws-rs
|
||||
GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git
|
||||
GIT_TAG main
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
|
@ -0,0 +1,15 @@
|
|||
# timezone
|
||||
ExternalProject_Add(tz
|
||||
GIT_REPOSITORY https://github.com/eggert/tz.git
|
||||
GIT_TAG main
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/tz"
|
||||
BINARY_DIR ""
|
||||
CONFIGURE_COMMAND ""
|
||||
#BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
GIT_PROGRESS true
|
||||
BUILD_COMMAND ""
|
||||
)
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
# wcwidth
|
||||
ExternalProject_Add(wcwidth
|
||||
GIT_REPOSITORY https://github.com/fumiyas/wcwidth-cjk.git
|
||||
GIT_TAG master
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/wcwidth"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
# wingetopt
|
||||
ExternalProject_Add(wingetopt
|
||||
GIT_REPOSITORY https://github.com/alex85k/wingetopt.git
|
||||
GIT_TAG master
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/wingetopt"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
# xml2
|
||||
ExternalProject_Add(xml2
|
||||
URL https://github.com/GNOME/libxml2/archive/refs/tags/v2.10.4.tar.gz
|
||||
URL_HASH SHA256=6f6fb27f91bb65f9d7196e3c616901b3e18a7dea31ccc2ae857940b125faa780
|
||||
DOWNLOAD_NO_PROGRESS 1
|
||||
DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/libxml2"
|
||||
#BINARY_DIR ""
|
||||
BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
# xz
|
||||
ExternalProject_Add(xz
|
||||
GIT_REPOSITORY https://github.com/xz-mirror/xz.git
|
||||
GIT_TAG v5.4.4
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/xz"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CMAKE_ARGS
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
# zlib
|
||||
|
||||
|
||||
ExternalProject_Add(zlib
|
||||
GIT_REPOSITORY https://github.com/taosdata-contrib/zlib.git
|
||||
GIT_TAG v1.2.11
|
||||
SOURCE_DIR "${TD_CONTRIB_DIR}/zlib"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
GIT_SHALLOW true
|
||||
)
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
# zstb
|
||||
|
||||
#ExternalProject_Add(zstd
|
||||
#GIT_REPOSITORY https://github.com/facebook/zstd.git
|
||||
#GIT_TAG v1.5.5
|
||||
#SOURCE_DIR "${TD_CONTRIB_DIR}/zstd"
|
||||
#DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
|
||||
#BINARY_DIR ""
|
||||
#CMAKE_COMMAND
|
||||
#CMAKE_ARGS ${TD_CONTRIB_DIR}/zstd/build/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}/build/lib
|
||||
#BUILD_COMMAND make -j4
|
||||
#INSTALL_COMMAND ""
|
||||
#TEST_COMMAND ""
|
||||
#GIT_SHALLOW true
|
||||
#)
|
|
@ -0,0 +1,9 @@
|
|||
-DLINUX
|
||||
-DWEBSOCKET
|
||||
-I/usr/include
|
||||
-Iinclude
|
||||
-Iinclude/os
|
||||
-Iinclude/common
|
||||
-Iinclude/util
|
||||
-Iinclude/libs/transport
|
||||
-Itools/shell/inc
|
|
@ -0,0 +1,721 @@
|
|||
# ================================================================================================
|
||||
# Download
|
||||
# ================================================================================================
|
||||
function(cat IN_FILE OUT_FILE)
|
||||
file(READ ${IN_FILE} CONTENTS)
|
||||
file(APPEND ${OUT_FILE} "${CONTENTS}")
|
||||
endfunction(cat IN_FILE OUT_FILE)
|
||||
|
||||
if(${BUILD_WITH_S3})
|
||||
file(MAKE_DIRECTORY $ENV{HOME}/.cos-local.2/)
|
||||
|
||||
elseif(${BUILD_WITH_COS})
|
||||
set(CONTRIB_TMP_FILE3 "${CMAKE_BINARY_DIR}/deps_tmp_CMakeLists.txt.in3")
|
||||
configure_file("${TD_SUPPORT_DIR}/deps_CMakeLists.txt.in" ${CONTRIB_TMP_FILE3})
|
||||
|
||||
if(${BUILD_WITH_COS})
|
||||
file(MAKE_DIRECTORY $ENV{HOME}/.cos-local.1/)
|
||||
cat("${TD_SUPPORT_DIR}/mxml_CMakeLists.txt.in" ${CONTRIB_TMP_FILE3})
|
||||
cat("${TD_SUPPORT_DIR}/apr_CMakeLists.txt.in" ${CONTRIB_TMP_FILE3})
|
||||
endif(${BUILD_WITH_COS})
|
||||
|
||||
configure_file(${CONTRIB_TMP_FILE3} "${TD_CONTRIB_DIR}/deps-download/CMakeLists.txt")
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
||||
WORKING_DIRECTORY "${TD_CONTRIB_DIR}/deps-download")
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
|
||||
WORKING_DIRECTORY "${TD_CONTRIB_DIR}/deps-download")
|
||||
|
||||
set(CONTRIB_TMP_FILE2 "${CMAKE_BINARY_DIR}/deps_tmp_CMakeLists.txt.in2")
|
||||
configure_file("${TD_SUPPORT_DIR}/deps_CMakeLists.txt.in" ${CONTRIB_TMP_FILE2})
|
||||
|
||||
if(${BUILD_WITH_COS})
|
||||
cat("${TD_SUPPORT_DIR}/apr-util_CMakeLists.txt.in" ${CONTRIB_TMP_FILE2})
|
||||
endif(${BUILD_WITH_COS})
|
||||
|
||||
configure_file(${CONTRIB_TMP_FILE2} "${TD_CONTRIB_DIR}/deps-download/CMakeLists.txt")
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
||||
WORKING_DIRECTORY "${TD_CONTRIB_DIR}/deps-download")
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
|
||||
WORKING_DIRECTORY "${TD_CONTRIB_DIR}/deps-download")
|
||||
endif()
|
||||
|
||||
set(CONTRIB_TMP_FILE "${CMAKE_BINARY_DIR}/deps_tmp_CMakeLists.txt.in")
|
||||
configure_file("${TD_SUPPORT_DIR}/deps_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
|
||||
# taosws-rs
|
||||
if(${WEBSOCKET})
|
||||
cat("${TD_SUPPORT_DIR}/taosws_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# taosadapter
|
||||
if(${BUILD_HTTP})
|
||||
MESSAGE("BUILD_HTTP is on")
|
||||
else()
|
||||
MESSAGE("BUILD_HTTP is off, use taosAdapter")
|
||||
cat("${TD_SUPPORT_DIR}/taosadapter_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# pthread
|
||||
if(${BUILD_PTHREAD})
|
||||
cat("${TD_SUPPORT_DIR}/pthread_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# iconv
|
||||
if(${BUILD_WITH_ICONV})
|
||||
cat("${TD_SUPPORT_DIR}/iconv_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# jemalloc
|
||||
if(${JEMALLOC_ENABLED})
|
||||
cat("${TD_SUPPORT_DIR}/jemalloc_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# msvc regex
|
||||
if(${BUILD_MSVCREGEX})
|
||||
cat("${TD_SUPPORT_DIR}/msvcregex_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# wcwidth
|
||||
if(${BUILD_WCWIDTH})
|
||||
cat("${TD_SUPPORT_DIR}/wcwidth_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# wingetopt
|
||||
if(${BUILD_WINGETOPT})
|
||||
cat("${TD_SUPPORT_DIR}/wingetopt_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# googletest
|
||||
if(${BUILD_TEST})
|
||||
cat("${TD_SUPPORT_DIR}/gtest_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/stub_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(${BUILD_TEST})
|
||||
|
||||
# lz4
|
||||
if(${BUILD_WITH_LZ4})
|
||||
cat("${TD_SUPPORT_DIR}/lz4_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(${BUILD_WITH_LZ4})
|
||||
|
||||
# zlib
|
||||
cat("${TD_SUPPORT_DIR}/zlib_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
|
||||
# cJson
|
||||
cat("${TD_SUPPORT_DIR}/cjson_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
|
||||
if(NOT ${TD_WINDOWS})
|
||||
cat("${TD_SUPPORT_DIR}/tz_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(NOT ${TD_WINDOWS})
|
||||
|
||||
# xz
|
||||
# cat("${TD_SUPPORT_DIR}/xz_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
|
||||
# lzma2
|
||||
cat("${TD_SUPPORT_DIR}/lzma_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
|
||||
if(${BUILD_CONTRIB})
|
||||
if(${BUILD_WITH_ROCKSDB})
|
||||
cat("${TD_SUPPORT_DIR}/rocksdb_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
add_definitions(-DUSE_ROCKSDB)
|
||||
endif()
|
||||
else()
|
||||
if(NOT ${TD_LINUX})
|
||||
if(${BUILD_WITH_ROCKSDB})
|
||||
cat("${TD_SUPPORT_DIR}/rocksdb_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
add_definitions(-DUSE_ROCKSDB)
|
||||
endif(${BUILD_WITH_ROCKSDB})
|
||||
else()
|
||||
if(${BUILD_WITH_ROCKSDB})
|
||||
add_definitions(-DUSE_ROCKSDB)
|
||||
endif(${BUILD_WITH_ROCKSDB})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# cat("${TD_SUPPORT_DIR}/zstd_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
|
||||
# libuv
|
||||
if(${BUILD_WITH_UV})
|
||||
cat("${TD_SUPPORT_DIR}/libuv_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(${BUILD_WITH_UV})
|
||||
|
||||
# sqlite
|
||||
if(${BUILD_WITH_SQLITE})
|
||||
cat("${TD_SUPPORT_DIR}/sqlite_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(${BUILD_WITH_SQLITE})
|
||||
|
||||
# libcurl
|
||||
if(NOT ${TD_WINDOWS})
|
||||
file(MAKE_DIRECTORY $ENV{HOME}/.cos-local.2/)
|
||||
cat("${TD_SUPPORT_DIR}/ssl_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/curl_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(NOT ${TD_WINDOWS})
|
||||
|
||||
# s3
|
||||
if(${BUILD_WITH_S3})
|
||||
cat("${TD_SUPPORT_DIR}/xml2_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/libs3_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/azure_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
add_definitions(-DUSE_S3)
|
||||
|
||||
# cos
|
||||
elseif(${BUILD_WITH_COS})
|
||||
# cat("${TD_SUPPORT_DIR}/mxml_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
# cat("${TD_SUPPORT_DIR}/apr_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
# cat("${TD_SUPPORT_DIR}/apr-util_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/cos_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
add_definitions(-DUSE_COS)
|
||||
endif()
|
||||
|
||||
# crashdump
|
||||
if(${BUILD_CRASHDUMP})
|
||||
cat("${TD_SUPPORT_DIR}/crashdump_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(${BUILD_CRASHDUMP})
|
||||
|
||||
# addr2line
|
||||
if(${BUILD_ADDR2LINE})
|
||||
if(NOT ${TD_WINDOWS})
|
||||
cat("${TD_SUPPORT_DIR}/libdwarf_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
cat("${TD_SUPPORT_DIR}/addr2line_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif(NOT ${TD_WINDOWS})
|
||||
endif(${BUILD_ADDR2LINE})
|
||||
|
||||
# geos
|
||||
if(${BUILD_GEOS})
|
||||
cat("${TD_SUPPORT_DIR}/geos_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
#
|
||||
if(${BUILD_PCRE2})
|
||||
cat("${TD_SUPPORT_DIR}/pcre2_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# lemon
|
||||
if(${BUILD_WITH_LEMON})
|
||||
if(${TD_ACORE})
|
||||
set(C_COMPILER_LEMON ${CMAKE_C_COMPILER})
|
||||
else()
|
||||
find_program(C_COMPILER_LEMON NAMES gcc)
|
||||
endif()
|
||||
if(C_COMPILER_LEMON)
|
||||
message(STATUS "LEMON C compiler: ${C_COMPILER_LEMON}")
|
||||
else()
|
||||
set(C_COMPILER_LEMON ${CMAKE_C_COMPILER})
|
||||
message(STATUS "LEMON C compiler: ${C_COMPILER_LEMON}")
|
||||
endif()
|
||||
|
||||
cat("${TD_SUPPORT_DIR}/lemon_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||
endif()
|
||||
|
||||
# Force specify CC=cc on MacOS. Because the default CC setting in the generated Makefile has issues finding standard library headers
|
||||
IF(${TD_DARWIN})
|
||||
SET(CONTRIB_CONFIG_ENV "CC=cc")
|
||||
ENDIF()
|
||||
|
||||
# download dependencies
|
||||
configure_file(${CONTRIB_TMP_FILE} "${TD_CONTRIB_DIR}/deps-download/CMakeLists.txt")
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
||||
WORKING_DIRECTORY "${TD_CONTRIB_DIR}/deps-download"
|
||||
RESULT_VARIABLE result)
|
||||
IF(NOT result EQUAL "0")
|
||||
message(FATAL_ERROR "CMake step for dowloading dependencies failed: ${result}")
|
||||
ENDIF()
|
||||
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
|
||||
WORKING_DIRECTORY "${TD_CONTRIB_DIR}/deps-download"
|
||||
RESULT_VARIABLE result)
|
||||
IF(NOT result EQUAL "0")
|
||||
message(FATAL_ERROR "CMake step for building dependencies failed: ${result}")
|
||||
ENDIF()
|
||||
|
||||
# ================================================================================================
|
||||
# Build
|
||||
# ================================================================================================
|
||||
# googletest
|
||||
if(${BUILD_TEST})
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory(googletest EXCLUDE_FROM_ALL)
|
||||
target_include_directories(
|
||||
gtest
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cpp-stub/src>
|
||||
)
|
||||
|
||||
if(${TD_WINDOWS})
|
||||
target_include_directories(
|
||||
gtest
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cpp-stub/src_win>
|
||||
)
|
||||
endif(${TD_WINDOWS})
|
||||
|
||||
if(${TD_LINUX})
|
||||
target_include_directories(
|
||||
gtest
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cpp-stub/src_linux>
|
||||
)
|
||||
endif(${TD_LINUX})
|
||||
|
||||
if(${TD_DARWIN})
|
||||
target_include_directories(
|
||||
gtest
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cpp-stub/src_darwin>
|
||||
)
|
||||
endif(${TD_DARWIN})
|
||||
endif(${BUILD_TEST})
|
||||
|
||||
# cJson
|
||||
# see https://stackoverflow.com/questions/37582508/silence-cmp0048-warnings-in-vendored-projects
|
||||
set(CMAKE_PROJECT_INCLUDE_BEFORE "${TD_SUPPORT_DIR}/EnableCMP0048.txt.in")
|
||||
option(ENABLE_CJSON_TEST "Enable building cJSON test" OFF)
|
||||
option(CJSON_OVERRIDE_BUILD_SHARED_LIBS "Override BUILD_SHARED_LIBS with CJSON_BUILD_SHARED_LIBS" ON)
|
||||
option(CJSON_BUILD_SHARED_LIBS "Overrides BUILD_SHARED_LIBS if CJSON_OVERRIDE_BUILD_SHARED_LIBS is enabled" OFF)
|
||||
add_subdirectory(cJson EXCLUDE_FROM_ALL)
|
||||
target_include_directories(
|
||||
cjson
|
||||
|
||||
# see https://stackoverflow.com/questions/25676277/cmake-target-include-directories-prints-an-error-when-i-try-to-add-the-source
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cJson>
|
||||
)
|
||||
unset(CMAKE_PROJECT_INCLUDE_BEFORE)
|
||||
|
||||
# xml2
|
||||
# if(${BUILD_WITH_S3})
|
||||
# add_subdirectory(xml2 EXCLUDE_FROM_ALL)
|
||||
# endif()
|
||||
|
||||
# lz4
|
||||
if(${BUILD_WITH_LZ4})
|
||||
add_subdirectory(lz4/build/cmake EXCLUDE_FROM_ALL)
|
||||
target_include_directories(
|
||||
lz4_static
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/lz4/lib
|
||||
)
|
||||
endif(${BUILD_WITH_LZ4})
|
||||
|
||||
# zlib
|
||||
set(CMAKE_PROJECT_INCLUDE_BEFORE "${TD_SUPPORT_DIR}/EnableCMP0048.txt.in")
|
||||
|
||||
if(${TD_DARWIN})
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=deprecated-non-prototype")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-non-prototype")
|
||||
endif(${TD_DARWIN})
|
||||
|
||||
add_subdirectory(zlib EXCLUDE_FROM_ALL)
|
||||
|
||||
if(${TD_DARWIN})
|
||||
target_compile_options(zlibstatic PRIVATE -Wno-error=deprecated-non-prototype)
|
||||
endif()
|
||||
target_include_directories(
|
||||
zlibstatic
|
||||
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/zlib
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/zlib
|
||||
)
|
||||
|
||||
if(${TD_DARWIN})
|
||||
target_compile_options(zlib PRIVATE -Wno-error=deprecated-non-prototype)
|
||||
endif()
|
||||
target_include_directories(
|
||||
zlib
|
||||
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/zlib
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/zlib
|
||||
)
|
||||
unset(CMAKE_PROJECT_INCLUDE_BEFORE)
|
||||
|
||||
# add_subdirectory(xz EXCLUDE_FROM_ALL)
|
||||
# target_include_directories(
|
||||
# xz
|
||||
# PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/xz
|
||||
# PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/xz
|
||||
# )
|
||||
|
||||
# leveldb
|
||||
if(${BUILD_WITH_LEVELDB})
|
||||
option(LEVELDB_BUILD_TESTS "" OFF)
|
||||
add_subdirectory(leveldb EXCLUDE_FROM_ALL)
|
||||
target_include_directories(
|
||||
leveldb
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/leveldb/include>
|
||||
)
|
||||
endif(${BUILD_WITH_LEVELDB})
|
||||
|
||||
# rocksdb
|
||||
# To support rocksdb build on ubuntu: sudo apt-get install libgflags-dev
|
||||
if(${BUILD_WITH_UV})
|
||||
if(${TD_LINUX})
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_REL}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_REL}")
|
||||
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
SET(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
endif(${TD_LINUX})
|
||||
endif(${BUILD_WITH_UV})
|
||||
|
||||
if(${BUILD_WITH_ROCKSDB})
|
||||
if(${BUILD_CONTRIB})
|
||||
if(${TD_LINUX})
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_REL} -Wno-error=maybe-uninitialized -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=unused-function -Wno-errno=unused-private-field -Wno-error=unused-result")
|
||||
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
SET(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
endif(${TD_LINUX})
|
||||
|
||||
MESSAGE(STATUS "ROCKSDB CXXXX STATUS CONFIG: " ${CMAKE_CXX_FLAGS})
|
||||
MESSAGE(STATUS "ROCKSDB C STATUS CONFIG: " ${CMAKE_C_FLAGS})
|
||||
|
||||
if(${TD_DARWIN})
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=maybe-uninitialized")
|
||||
endif(${TD_DARWIN})
|
||||
|
||||
if(${TD_DARWIN_ARM64})
|
||||
set(HAS_ARMV8_CRC true)
|
||||
endif(${TD_DARWIN_ARM64})
|
||||
|
||||
if(${TD_WINDOWS})
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819 /std:c++17")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4819")
|
||||
option(WITH_JNI "" OFF)
|
||||
|
||||
if(CMAKE_C_FLAGS MATCHES "/MT" OR CMAKE_C_FLAGS MATCHES "/MTd")
|
||||
message("Rocksdb build runtime lib use /MT or /MTd")
|
||||
option(WITH_MD_LIBRARY "build with MD" OFF)
|
||||
endif()
|
||||
|
||||
set(SYSTEM_LIBS ${SYSTEM_LIBS} shlwapi.lib rpcrt4.lib)
|
||||
endif(${TD_WINDOWS})
|
||||
|
||||
if(${TD_DARWIN})
|
||||
option(HAVE_THREAD_LOCAL "" OFF)
|
||||
option(WITH_IOSTATS_CONTEXT "" OFF)
|
||||
option(WITH_PERF_CONTEXT "" OFF)
|
||||
endif(${TD_DARWIN})
|
||||
|
||||
option(WITH_FALLOCATE "" OFF)
|
||||
option(WITH_JEMALLOC "" OFF)
|
||||
option(WITH_GFLAGS "" OFF)
|
||||
option(PORTABLE "" ON)
|
||||
option(WITH_LIBURING "" OFF)
|
||||
option(FAIL_ON_WARNINGS OFF)
|
||||
|
||||
option(WITH_TESTS "" OFF)
|
||||
option(WITH_BENCHMARK_TOOLS "" OFF)
|
||||
option(WITH_TOOLS "" OFF)
|
||||
option(WITH_LIBURING "" OFF)
|
||||
|
||||
option(ROCKSDB_BUILD_SHARED "Build shared versions of the RocksDB libraries" OFF)
|
||||
add_subdirectory(rocksdb EXCLUDE_FROM_ALL)
|
||||
target_include_directories(
|
||||
rocksdb
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/include>
|
||||
)
|
||||
else()
|
||||
if(NOT ${TD_LINUX})
|
||||
MESSAGE(STATUS "ROCKSDB CXX STATUS CONFIG: " ${CMAKE_CXX_FLAGS})
|
||||
MESSAGE(STATUS "ROCKSDB C STATUS CONFIG: " ${CMAKE_C_FLAGS})
|
||||
|
||||
if(${TD_DARWIN})
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=maybe-uninitialized")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=maybe-uninitialized")
|
||||
endif(${TD_DARWIN})
|
||||
|
||||
if(${TD_DARWIN_ARM64})
|
||||
set(HAS_ARMV8_CRC true)
|
||||
endif(${TD_DARWIN_ARM64})
|
||||
|
||||
if(${TD_WINDOWS})
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819 /std:c++17")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4819")
|
||||
option(WITH_JNI "" OFF)
|
||||
|
||||
if(CMAKE_C_FLAGS MATCHES "/MT" OR CMAKE_C_FLAGS MATCHES "/MTd")
|
||||
message("Rocksdb build runtime lib use /MT or /MTd")
|
||||
option(WITH_MD_LIBRARY "build with MD" OFF)
|
||||
endif()
|
||||
|
||||
set(SYSTEM_LIBS ${SYSTEM_LIBS} shlwapi.lib rpcrt4.lib)
|
||||
endif(${TD_WINDOWS})
|
||||
|
||||
if(${TD_DARWIN})
|
||||
option(HAVE_THREAD_LOCAL "" OFF)
|
||||
option(WITH_IOSTATS_CONTEXT "" OFF)
|
||||
option(WITH_PERF_CONTEXT "" OFF)
|
||||
endif(${TD_DARWIN})
|
||||
|
||||
option(WITH_FALLOCATE "" OFF)
|
||||
option(WITH_JEMALLOC "" OFF)
|
||||
option(WITH_GFLAGS "" OFF)
|
||||
option(PORTABLE "" ON)
|
||||
option(WITH_LIBURING "" OFF)
|
||||
option(FAIL_ON_WARNINGS OFF)
|
||||
|
||||
option(WITH_TESTS "" OFF)
|
||||
option(WITH_BENCHMARK_TOOLS "" OFF)
|
||||
option(WITH_TOOLS "" OFF)
|
||||
option(WITH_LIBURING "" OFF)
|
||||
|
||||
option(ROCKSDB_BUILD_SHARED "Build shared versions of the RocksDB libraries" OFF)
|
||||
add_subdirectory(rocksdb EXCLUDE_FROM_ALL)
|
||||
target_include_directories(
|
||||
rocksdb
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/include>
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${BUILD_WITH_S3})
|
||||
INCLUDE_DIRECTORIES($ENV{HOME}/.cos-local.2/include)
|
||||
MESSAGE("build with s3: ${BUILD_WITH_S3}")
|
||||
|
||||
# cos
|
||||
elseif(${BUILD_WITH_COS})
|
||||
if(${TD_LINUX})
|
||||
set(CMAKE_PREFIX_PATH $ENV{HOME}/.cos-local.1)
|
||||
|
||||
# ADD_DEFINITIONS(-DMINIXML_LIBRARY=${CMAKE_BINARY_DIR}/build/lib/libxml.a)
|
||||
option(ENABLE_TEST "Enable the tests" OFF)
|
||||
INCLUDE_DIRECTORIES($ENV{HOME}/.cos-local.1/include)
|
||||
|
||||
# MESSAGE("$ENV{HOME}/.cos-local.1/include")
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
set(ORIG_CMAKE_PROJECT_NAME ${CMAKE_PROJECT_NAME})
|
||||
set(CMAKE_PROJECT_NAME cos_c_sdk)
|
||||
|
||||
add_subdirectory(cos-c-sdk-v5 EXCLUDE_FROM_ALL)
|
||||
target_include_directories(
|
||||
cos_c_sdk
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cos-c-sdk-v5/cos_c_sdk>
|
||||
)
|
||||
|
||||
set(CMAKE_PROJECT_NAME ${ORIG_CMAKE_PROJECT_NAME})
|
||||
else()
|
||||
endif(${TD_LINUX})
|
||||
endif()
|
||||
|
||||
# pthread
|
||||
if(${BUILD_PTHREAD})
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
SET(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
add_definitions(-DPTW32_STATIC_LIB)
|
||||
add_subdirectory(pthread EXCLUDE_FROM_ALL)
|
||||
set_target_properties(libpthreadVC3 PROPERTIES OUTPUT_NAME pthread)
|
||||
add_library(pthread INTERFACE)
|
||||
target_link_libraries(pthread INTERFACE libpthreadVC3)
|
||||
endif()
|
||||
|
||||
# jemalloc
|
||||
if(${JEMALLOC_ENABLED})
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(jemalloc
|
||||
PREFIX "jemalloc"
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/jemalloc
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ./autogen.sh COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/build/ --disable-initial-exec-tls
|
||||
BUILD_COMMAND ${MAKE}
|
||||
)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/build/include)
|
||||
endif()
|
||||
|
||||
# crashdump
|
||||
if(${BUILD_CRASHDUMP})
|
||||
add_executable(dumper "crashdump/dumper/dumper.c")
|
||||
target_link_libraries(dumper User32.lib dbghelp.lib)
|
||||
file(READ "crashdump/crasher/crasher.c" CRASHDUMP_CONTENT)
|
||||
string(REPLACE "main(" "main_crashdump(" CRASHDUMP_CONTENT "${CRASHDUMP_CONTENT}")
|
||||
file(WRITE "crashdump/crasher/crasher.c" "${CRASHDUMP_CONTENT}")
|
||||
add_library(crashdump STATIC "crashdump/crasher/crasher.c")
|
||||
endif()
|
||||
|
||||
# iconv
|
||||
if(${BUILD_WITH_ICONV})
|
||||
add_library(iconv STATIC iconv/win_iconv.c)
|
||||
endif(${BUILD_WITH_ICONV})
|
||||
|
||||
# wingetopt
|
||||
if(${BUILD_WINGETOPT})
|
||||
add_subdirectory(wingetopt EXCLUDE_FROM_ALL)
|
||||
endif(${BUILD_WINGETOPT})
|
||||
|
||||
# msvcregex
|
||||
if(${BUILD_MSVCREGEX})
|
||||
add_library(msvcregex STATIC "")
|
||||
target_sources(msvcregex
|
||||
PRIVATE "msvcregex/regex.c"
|
||||
)
|
||||
target_include_directories(msvcregex
|
||||
PRIVATE "msvcregex"
|
||||
)
|
||||
target_link_libraries(msvcregex
|
||||
INTERFACE Shell32
|
||||
)
|
||||
SET_TARGET_PROPERTIES(msvcregex PROPERTIES OUTPUT_NAME msvcregex)
|
||||
endif(${BUILD_MSVCREGEX})
|
||||
|
||||
# wcwidth
|
||||
if(${BUILD_WCWIDTH})
|
||||
add_library(wcwidth STATIC "")
|
||||
target_sources(wcwidth
|
||||
PRIVATE "wcwidth/wcwidth.c"
|
||||
)
|
||||
target_include_directories(wcwidth
|
||||
PRIVATE "wcwidth"
|
||||
)
|
||||
SET_TARGET_PROPERTIES(wcwidth PROPERTIES OUTPUT_NAME wcwidth)
|
||||
endif(${BUILD_WCWIDTH})
|
||||
|
||||
# LIBUV
|
||||
if(${BUILD_WITH_UV})
|
||||
if(TD_WINDOWS)
|
||||
# There is no GetHostNameW function on win7.
|
||||
file(READ "libuv/src/win/util.c" LIBUV_WIN_UTIL_CONTENT)
|
||||
string(REPLACE "if (GetHostNameW(buf, UV_MAXHOSTNAMESIZE" "DWORD nSize = UV_MAXHOSTNAMESIZE;\n if (GetComputerNameW(buf, &nSize" LIBUV_WIN_UTIL_CONTENT "${LIBUV_WIN_UTIL_CONTENT}")
|
||||
file(WRITE "libuv/src/win/util.c" "${LIBUV_WIN_UTIL_CONTENT}")
|
||||
endif()
|
||||
|
||||
add_subdirectory(libuv EXCLUDE_FROM_ALL)
|
||||
endif(${BUILD_WITH_UV})
|
||||
|
||||
# SQLite
|
||||
# see https://stackoverflow.com/questions/8774593/cmake-link-to-external-library#comment58570736_10550334
|
||||
if(${BUILD_WITH_SQLITE})
|
||||
add_library(sqlite STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(sqlite PROPERTIES
|
||||
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/sqlite/.libs/libsqlite3.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/sqlite"
|
||||
)
|
||||
target_link_libraries(sqlite
|
||||
INTERFACE m
|
||||
INTERFACE pthread
|
||||
)
|
||||
|
||||
if(NOT TD_WINDOWS)
|
||||
target_link_libraries(sqlite
|
||||
INTERFACE dl
|
||||
)
|
||||
endif(NOT TD_WINDOWS)
|
||||
endif(${BUILD_WITH_SQLITE})
|
||||
|
||||
# addr2line
|
||||
if(${BUILD_ADDR2LINE})
|
||||
if(NOT ${TD_WINDOWS})
|
||||
check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
|
||||
check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
|
||||
check_include_file("inttypes.h" HAVE_INTTYPES_H)
|
||||
check_include_file("stddef.h" HAVE_STDDEF_H)
|
||||
check_include_file("stdlib.h" HAVE_STDLIB_H)
|
||||
check_include_file("string.h" HAVE_STRING_H)
|
||||
check_include_file("memory.h" HAVE_MEMORY_H)
|
||||
check_include_file("strings.h" HAVE_STRINGS_H)
|
||||
check_include_file("stdint.h" HAVE_STDINT_H)
|
||||
check_include_file("unistd.h" HAVE_UNISTD_H)
|
||||
check_include_file("sgidefs.h" HAVE_SGIDEFS_H)
|
||||
check_include_file("stdafx.h" HAVE_STDAFX_H)
|
||||
check_include_file("elf.h" HAVE_ELF_H)
|
||||
check_include_file("libelf.h" HAVE_LIBELF_H)
|
||||
check_include_file("libelf/libelf.h" HAVE_LIBELF_LIBELF_H)
|
||||
check_include_file("alloca.h" HAVE_ALLOCA_H)
|
||||
check_include_file("elfaccess.h" HAVE_ELFACCESS_H)
|
||||
check_include_file("sys/elf_386.h" HAVE_SYS_ELF_386_H)
|
||||
check_include_file("sys/elf_amd64.h" HAVE_SYS_ELF_AMD64_H)
|
||||
check_include_file("sys/elf_sparc.h" HAVE_SYS_ELF_SPARC_H)
|
||||
check_include_file("sys/ia64/elf.h" HAVE_SYS_IA64_ELF_H)
|
||||
set(VERSION 0.3.1)
|
||||
set(PACKAGE_VERSION "\"${VERSION}\"")
|
||||
configure_file(libdwarf/cmake/config.h.cmake config.h)
|
||||
file(GLOB_RECURSE LIBDWARF_SOURCES "libdwarf/src/lib/libdwarf/*.c")
|
||||
add_library(libdwarf STATIC ${LIBDWARF_SOURCES})
|
||||
set_target_properties(libdwarf PROPERTIES OUTPUT_NAME "libdwarf")
|
||||
|
||||
if(HAVE_LIBELF_H OR HAVE_LIBELF_LIBELF_H)
|
||||
target_link_libraries(libdwarf PUBLIC libelf)
|
||||
endif()
|
||||
|
||||
target_include_directories(libdwarf SYSTEM PUBLIC "libdwarf/src/lib/libdwarf" ${CMAKE_CURRENT_BINARY_DIR})
|
||||
file(READ "addr2line/addr2line.c" ADDR2LINE_CONTENT)
|
||||
string(REPLACE "static int" "int" ADDR2LINE_CONTENT "${ADDR2LINE_CONTENT}")
|
||||
string(REPLACE "static void" "void" ADDR2LINE_CONTENT "${ADDR2LINE_CONTENT}")
|
||||
string(REPLACE "main(" "main_addr2line(" ADDR2LINE_CONTENT "${ADDR2LINE_CONTENT}")
|
||||
file(WRITE "addr2line/addr2line.c" "${ADDR2LINE_CONTENT}")
|
||||
add_library(addr2line STATIC "addr2line/addr2line.c")
|
||||
target_link_libraries(addr2line PUBLIC libdwarf dl z)
|
||||
target_include_directories(addr2line PUBLIC "libdwarf/src/lib/libdwarf")
|
||||
endif(NOT ${TD_WINDOWS})
|
||||
endif(${BUILD_ADDR2LINE})
|
||||
|
||||
# geos
|
||||
if(${BUILD_GEOS})
|
||||
if(${TD_LINUX})
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_REL}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_REL}")
|
||||
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
SET(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
endif(${TD_LINUX})
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build GEOS with shared libraries" OFF)
|
||||
add_subdirectory(geos EXCLUDE_FROM_ALL)
|
||||
|
||||
if(${TD_WINDOWS})
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
else()
|
||||
unset(CMAKE_CXX_STANDARD CACHE) # undo libgeos's setting of global CMAKE_CXX_STANDARD
|
||||
endif(${TD_WINDOWS})
|
||||
|
||||
target_include_directories(
|
||||
geos_c
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/geos/include>
|
||||
)
|
||||
endif(${BUILD_GEOS})
|
||||
|
||||
if(${BUILD_PCRE2})
|
||||
add_subdirectory(pcre2 EXCLUDE_FROM_ALL)
|
||||
endif(${BUILD_PCRE2})
|
||||
|
||||
if(${TD_LINUX} AND ${BUILD_WITH_S3})
|
||||
set(ORIG_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||
string(REPLACE " -Werror " " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
add_subdirectory(xml2-cmake)
|
||||
set(CMAKE_C_FLAGS ${ORIG_CMAKE_C_FLAGS})
|
||||
|
||||
add_subdirectory(azure-cmake)
|
||||
endif()
|
||||
|
||||
IF(TD_LINUX)
|
||||
SET(TZ_OUTPUT_PATH /usr/share/zoneinfo)
|
||||
ELSEIF(TD_DARWIN)
|
||||
SET(TZ_OUTPUT_PATH /var/db/timezone/zoneinfo)
|
||||
ENDIF()
|
||||
|
||||
|
||||
if(NOT ${TD_WINDOWS})
|
||||
MESSAGE(STATUS "timezone file path: " ${TZ_OUTPUT_PATH})
|
||||
|
||||
execute_process(
|
||||
COMMAND make TZDIR=${TZ_OUTPUT_PATH}/ clean tzdir.h
|
||||
WORKING_DIRECTORY "${TD_CONTRIB_DIR}/tz"
|
||||
)
|
||||
|
||||
set(TZ_SRC_DIR "${TD_SOURCE_DIR}/source/os/src/timezone")
|
||||
file(REMOVE_RECURSE ${TZ_SRC_DIR})
|
||||
file(MAKE_DIRECTORY ${TZ_SRC_DIR})
|
||||
file(COPY ${TD_CONTRIB_DIR}/tz/private.h ${TD_CONTRIB_DIR}/tz/tzdir.h ${TD_CONTRIB_DIR}/tz/tzfile.h
|
||||
${TD_CONTRIB_DIR}/tz/localtime.c ${TD_CONTRIB_DIR}/tz/strftime.c
|
||||
DESTINATION ${TZ_SRC_DIR})
|
||||
endif(NOT ${TD_WINDOWS})
|
||||
|
||||
#if(NOT ${TD_WINDOWS})
|
||||
# execute_process(
|
||||
# COMMAND make CFLAGS+=-fPIC CFLAGS+=-g TZDIR=${TZ_OUTPUT_PATH} clean libtz.a
|
||||
# WORKING_DIRECTORY "${TD_CONTRIB_DIR}/tz"
|
||||
# )
|
||||
#endif(NOT ${TD_WINDOWS})
|
||||
# ================================================================================================
|
||||
# Build test
|
||||
# ================================================================================================
|
||||
MESSAGE("build with dependency tests: ${BUILD_DEPENDENCY_TESTS}")
|
||||
|
||||
if(${BUILD_DEPENDENCY_TESTS})
|
||||
add_subdirectory(test EXCLUDE_FROM_ALL)
|
||||
endif(${BUILD_DEPENDENCY_TESTS})
|
|
@ -0,0 +1,68 @@
|
|||
# lib_azure_sdk
|
||||
set(AZURE_DIR "${TD_CONTRIB_DIR}/azure-sdk-for-cpp-azure-storage-blobs_12.13.0-beta.1")
|
||||
set(AZURE_SDK_LIBRARY_DIR "${AZURE_DIR}/sdk")
|
||||
|
||||
file(GLOB AZURE_SDK_SRC
|
||||
"${AZURE_SDK_LIBRARY_DIR}/core/azure-core/src/*.cpp"
|
||||
"${AZURE_SDK_LIBRARY_DIR}/core/azure-core/src/credentials/*.cpp"
|
||||
"${AZURE_SDK_LIBRARY_DIR}/core/azure-core/src/cryptography/*.cpp"
|
||||
"${AZURE_SDK_LIBRARY_DIR}/core/azure-core/src/http/*.cpp"
|
||||
"${AZURE_SDK_LIBRARY_DIR}/core/azure-core/src/http/curl/*.cpp"
|
||||
"${AZURE_SDK_LIBRARY_DIR}/core/azure-core/src/io/*.cpp"
|
||||
"${AZURE_SDK_LIBRARY_DIR}/core/azure-core/src/tracing/*.cpp"
|
||||
"${AZURE_SDK_LIBRARY_DIR}/identity/azure-identity/src/*.cpp"
|
||||
"${AZURE_SDK_LIBRARY_DIR}/storage/azure-storage-blobs/src/*.cpp"
|
||||
"${AZURE_SDK_LIBRARY_DIR}/storage/azure-storage-blobs/src/private/*.cpp"
|
||||
"${AZURE_SDK_LIBRARY_DIR}/storage/azure-storage-common/src/*.cpp"
|
||||
)
|
||||
|
||||
file(GLOB AZURE_SDK_UNIFIED_SRC
|
||||
${AZURE_SDK_SRC}
|
||||
)
|
||||
|
||||
set(AZURE_SDK_INCLUDES
|
||||
"${AZURE_SDK_LIBRARY_DIR}/core/azure-core/inc/"
|
||||
"${AZURE_SDK_LIBRARY_DIR}/identity/azure-identity/inc/"
|
||||
"${AZURE_SDK_LIBRARY_DIR}/storage/azure-storage-common/inc/"
|
||||
"${AZURE_SDK_LIBRARY_DIR}/storage/azure-storage-blobs/inc/"
|
||||
)
|
||||
|
||||
add_library(_azure_sdk STATIC ${AZURE_SDK_UNIFIED_SRC})
|
||||
target_compile_definitions(_azure_sdk PRIVATE BUILD_CURL_HTTP_TRANSPORT_ADAPTER)
|
||||
|
||||
target_include_directories(
|
||||
_azure_sdk
|
||||
PUBLIC "$ENV{HOME}/.cos-local.2/include"
|
||||
)
|
||||
|
||||
find_library(CURL_LIBRARY curl $ENV{HOME}/.cos-local.2/lib NO_DEFAULT_PATH)
|
||||
find_library(SSL_LIBRARY ssl $ENV{HOME}/.cos-local.2/lib64 $ENV{HOME}/.cos-local.2/lib NO_DEFAULT_PATH)
|
||||
find_library(CRYPTO_LIBRARY crypto $ENV{HOME}/.cos-local.2/lib64 $ENV{HOME}/.cos-local.2/lib NO_DEFAULT_PATH)
|
||||
|
||||
# find_library(CoreFoundation_Library CoreFoundation)
|
||||
# find_library(SystemConfiguration_Library SystemConfiguration)
|
||||
target_link_libraries(
|
||||
_azure_sdk
|
||||
PRIVATE ${CURL_LIBRARY}
|
||||
PRIVATE ${SSL_LIBRARY}
|
||||
PRIVATE ${CRYPTO_LIBRARY}
|
||||
|
||||
PRIVATE _libxml2
|
||||
PRIVATE zlib
|
||||
|
||||
# PRIVATE ${CoreFoundation_Library}
|
||||
# PRIVATE ${SystemConfiguration_Library}
|
||||
)
|
||||
|
||||
# Originally, on Windows azure-core is built with bcrypt and crypt32 by default
|
||||
if(TARGET OpenSSL::SSL)
|
||||
target_link_libraries(_azure_sdk PRIVATE OpenSSL::Crypto OpenSSL::SSL)
|
||||
endif()
|
||||
|
||||
# Originally, on Windows azure-core is built with winhttp by default
|
||||
if(TARGET td_contrib::curl)
|
||||
target_link_libraries(_azure_sdk PRIVATE td_contrib::curl)
|
||||
endif()
|
||||
|
||||
target_include_directories(_azure_sdk SYSTEM BEFORE PUBLIC ${AZURE_SDK_INCLUDES})
|
||||
add_library(td_contrib::azure_sdk ALIAS _azure_sdk)
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,28 @@
|
|||
# rocksdb
|
||||
if(${BUILD_WITH_ROCKSDB})
|
||||
add_subdirectory(rocksdb)
|
||||
endif(${BUILD_WITH_ROCKSDB})
|
||||
|
||||
# cos
|
||||
if(${BUILD_WITH_COS})
|
||||
add_subdirectory(cos)
|
||||
endif(${BUILD_WITH_COS})
|
||||
|
||||
if(${BUILD_WITH_LUCENE})
|
||||
add_subdirectory(lucene)
|
||||
endif(${BUILD_WITH_LUCENE})
|
||||
|
||||
if(${BUILD_WITH_BDB})
|
||||
add_subdirectory(bdb)
|
||||
endif(${BUILD_WITH_BDB})
|
||||
|
||||
if(${BUILD_WITH_SQLITE})
|
||||
add_subdirectory(sqlite)
|
||||
endif(${BUILD_WITH_SQLITE})
|
||||
|
||||
# if(${BUILD_S3})
|
||||
# add_subdirectory(azure)
|
||||
# endif()
|
||||
|
||||
add_subdirectory(tdev)
|
||||
add_subdirectory(lz4)
|
|
@ -0,0 +1,27 @@
|
|||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
add_executable(
|
||||
azure-test
|
||||
main.cpp
|
||||
)
|
||||
|
||||
find_library(CURL_LIBRARY curl $ENV{HOME}/.cos-local.2/lib NO_DEFAULT_PATH)
|
||||
find_library(XML2_LIBRARY xml2 $ENV{HOME}/.cos-local.2/lib NO_DEFAULT_PATH)
|
||||
|
||||
# find_library(XML2_LIBRARY xml2)
|
||||
find_library(SSL_LIBRARY ssl $ENV{HOME}/.cos-local.2/lib64 $ENV{HOME}/.cos-local.2/lib NO_DEFAULT_PATH)
|
||||
find_library(CRYPTO_LIBRARY crypto $ENV{HOME}/.cos-local.2/lib64 $ENV{HOME}/.cos-local.2/lib NO_DEFAULT_PATH)
|
||||
|
||||
# find_library(CoreFoundation_Library CoreFoundation)
|
||||
# find_library(SystemConfiguration_Library SystemConfiguration)
|
||||
target_link_libraries(
|
||||
azure-test
|
||||
PRIVATE _azure_sdk
|
||||
PRIVATE ${CURL_LIBRARY}
|
||||
PRIVATE ${XML2_LIBRARY}
|
||||
PRIVATE ${SSL_LIBRARY}
|
||||
PRIVATE ${CRYPTO_LIBRARY}
|
||||
PRIVATE dl
|
||||
PRIVATE pthread
|
||||
)
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
// Include the necessary SDK headers
|
||||
#include <azure/core.hpp>
|
||||
#include <azure/storage/blobs.hpp>
|
||||
|
||||
// Add appropriate using namespace directives
|
||||
using namespace Azure::Storage;
|
||||
using namespace Azure::Storage::Blobs;
|
||||
|
||||
// Secrets should be stored & retrieved from secure locations such as Azure::KeyVault. For
|
||||
// convenience and brevity of samples, the secrets are retrieved from environment variables.
|
||||
|
||||
std::string GetEndpointUrl() {
|
||||
// return std::getenv("AZURE_STORAGE_ACCOUNT_URL");
|
||||
std::string accountId = getenv("ablob_account_id");
|
||||
if (accountId.empty()) {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
return accountId + ".blob.core.windows.net";
|
||||
}
|
||||
|
||||
std::string GetAccountName() {
|
||||
// return std::getenv("AZURE_STORAGE_ACCOUNT_NAME");
|
||||
return getenv("ablob_account_id");
|
||||
}
|
||||
|
||||
std::string GetAccountKey() {
|
||||
// return std::getenv("AZURE_STORAGE_ACCOUNT_KEY");
|
||||
|
||||
return getenv("ablob_account_secret");
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::string endpointUrl = GetEndpointUrl();
|
||||
std::string accountName = GetAccountName();
|
||||
std::string accountKey = GetAccountKey();
|
||||
|
||||
try {
|
||||
auto sharedKeyCredential = std::make_shared<StorageSharedKeyCredential>(accountName, accountKey);
|
||||
|
||||
std::string accountURL = "https://fd2d01cd892f844eeaa2273.blob.core.windows.net";
|
||||
BlobServiceClient blobServiceClient(accountURL, sharedKeyCredential);
|
||||
|
||||
std::string containerName = "myblobcontainer";
|
||||
// auto containerClient = blobServiceClient.GetBlobContainerClient("myblobcontainer");
|
||||
auto containerClient = blobServiceClient.GetBlobContainerClient("td-test");
|
||||
|
||||
// Create the container if it does not exist
|
||||
std::cout << "Creating container: " << containerName << std::endl;
|
||||
// containerClient.CreateIfNotExists();
|
||||
|
||||
std::string blobName = "blob.txt";
|
||||
uint8_t blobContent[] = "Hello Azure!";
|
||||
// Create the block blob client
|
||||
BlockBlobClient blobClient = containerClient.GetBlockBlobClient(blobName);
|
||||
|
||||
// Upload the blob
|
||||
std::cout << "Uploading blob: " << blobName << std::endl;
|
||||
blobClient.UploadFrom(blobContent, sizeof(blobContent));
|
||||
/*
|
||||
auto blockBlobClient = BlockBlobClient(endpointUrl, sharedKeyCredential);
|
||||
|
||||
// Create some data to upload into the blob.
|
||||
std::vector<uint8_t> data = {1, 2, 3, 4};
|
||||
Azure::Core::IO::MemoryBodyStream stream(data);
|
||||
|
||||
Azure::Response<Models::UploadBlockBlobResult> response = blockBlobClient.Upload(stream);
|
||||
|
||||
Models::UploadBlockBlobResult model = response.Value;
|
||||
std::cout << "Last modified date of uploaded blob: " << model.LastModified.ToString()
|
||||
<< std::endl;
|
||||
*/
|
||||
} catch (const Azure::Core::RequestFailedException& e) {
|
||||
std::cout << "Status Code: " << static_cast<int>(e.StatusCode) << ", Reason Phrase: " << e.ReasonPhrase
|
||||
<< std::endl;
|
||||
std::cout << e.what() << std::endl;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
add_executable(bdbTest "")
|
||||
target_sources(
|
||||
bdbTest PRIVATE
|
||||
"bdbTest.c"
|
||||
)
|
||||
|
||||
target_link_libraries(bdbTest bdb)
|
|
@ -0,0 +1,188 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "db.h"
|
||||
|
||||
// refer: https://docs.oracle.com/cd/E17076_05/html/gsg/C/BerkeleyDB-Core-C-GSG.pdf
|
||||
|
||||
// Access Methods:
|
||||
// 1. BTree
|
||||
// 2. Hash
|
||||
// 3. Queue
|
||||
// 4. Recno
|
||||
|
||||
// Use secondary database work as index.
|
||||
// Any attemp to write to a secondary database results in a non-zero status return.
|
||||
|
||||
static int idx_callback(DB *dbp, const DBT *keyp, const DBT *valuep, DBT *resvp);
|
||||
|
||||
#define USE_ENV 0
|
||||
|
||||
#define DESCRIPTION_SIZE 128
|
||||
float money = 122.45;
|
||||
char *description = "Grocery bill.";
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
char *family_name;
|
||||
char *surname;
|
||||
} SPersion;
|
||||
|
||||
static void put_value(DB *dbp) {
|
||||
DBT key = {0};
|
||||
DBT value = {0};
|
||||
int ret;
|
||||
|
||||
key.data = &money;
|
||||
key.size = sizeof(money);
|
||||
|
||||
value.data = description;
|
||||
value.size = strlen(description) + 1;
|
||||
|
||||
ret = dbp->put(dbp, NULL, &key, &value, DB_NOOVERWRITE);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Failed to put DB record: %s\n", db_strerror(ret));
|
||||
}
|
||||
}
|
||||
|
||||
static void get_value(DB *dbp) {
|
||||
char desp[DESCRIPTION_SIZE];
|
||||
DBT key = {0};
|
||||
DBT value = {0};
|
||||
|
||||
key.data = &money;
|
||||
key.size = sizeof(money);
|
||||
|
||||
value.data = desp;
|
||||
value.ulen = DESCRIPTION_SIZE;
|
||||
value.flags = DB_DBT_USERMEM;
|
||||
|
||||
dbp->get(dbp, NULL, &key, &value, 0);
|
||||
printf("The value is \"%s\"\n", desp);
|
||||
}
|
||||
|
||||
int main(int argc, char const *argv[]) {
|
||||
DB * dbp = NULL;
|
||||
DB * sdbp = NULL;
|
||||
u_int32_t db_flags;
|
||||
DB_ENV * envp = NULL;
|
||||
u_int32_t env_flags;
|
||||
int ret;
|
||||
DBT key = {0};
|
||||
DBT value = {0};
|
||||
|
||||
#if USE_ENV
|
||||
// Initialize an env object and open it for
|
||||
ret = db_env_create(&envp, 0);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Error creating env handle: %s\n", db_strerror(ret));
|
||||
return -1;
|
||||
}
|
||||
|
||||
env_flags = DB_CREATE | DB_INIT_MPOOL;
|
||||
|
||||
ret = envp->open(envp, "./meta", env_flags, 0);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Error opening env handle: %s\n", db_strerror(ret));
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initialize a DB handle and open the DB
|
||||
ret = db_create(&dbp, envp, 0);
|
||||
if (ret != 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = db_create(&sdbp, envp, 0);
|
||||
if (ret != 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = sdbp->set_flags(sdbp, DB_DUPSORT);
|
||||
if (ret != 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
db_flags = DB_CREATE | DB_TRUNCATE;
|
||||
ret = dbp->open(dbp, /* DB structure pointer */
|
||||
NULL, /* Transaction pointer */
|
||||
"meta.db", /* On-disk file that holds the database */
|
||||
NULL, /* Optional logical database name */
|
||||
DB_BTREE, /* Database access method */
|
||||
db_flags, /* Open flags */
|
||||
0); /* File mode */
|
||||
if (ret != 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = sdbp->open(sdbp, /* DB structure pointer */
|
||||
NULL, /* Transaction pointer */
|
||||
"index.db", /* On-disk file that holds the database */
|
||||
NULL, /* Optional logical database name */
|
||||
DB_BTREE, /* Database access method */
|
||||
db_flags, /* Open flags */
|
||||
0); /* File mode */
|
||||
if (ret != 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Associate the secondary database to the primary
|
||||
dbp->associate(dbp, /* Primary database */
|
||||
NULL, /* TXN id */
|
||||
sdbp, /* Secondary database */
|
||||
idx_callback, /* Callback used for key creation */
|
||||
0); /* Flags */
|
||||
|
||||
{
|
||||
// Insert a key-value record
|
||||
put_value(dbp);
|
||||
|
||||
// Read the key-value record
|
||||
get_value(dbp);
|
||||
}
|
||||
|
||||
// Close the database
|
||||
if (sdbp != NULL) {
|
||||
sdbp->close(sdbp, 0);
|
||||
}
|
||||
|
||||
if (dbp != NULL) {
|
||||
dbp->close(dbp, 0);
|
||||
}
|
||||
|
||||
if (envp != NULL) {
|
||||
envp->close(envp, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int idx_callback(DB * sdbp, /* secondary db handle */
|
||||
const DBT *keyp, /* primary db record's key */
|
||||
const DBT *valuep, /* primary db record's value */
|
||||
DBT * skeyp /* secondary db record's key*/
|
||||
) {
|
||||
DBT *tmpdbt;
|
||||
|
||||
tmpdbt = (DBT *)calloc(2, sizeof(DBT));
|
||||
|
||||
{ // TODO
|
||||
tmpdbt[0].data = NULL;
|
||||
tmpdbt[0].size = 0;
|
||||
|
||||
tmpdbt[1].data = NULL;
|
||||
tmpdbt[1].size = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* DB_DBT_MULTIPLE means DBT references an array
|
||||
* DB_DBT_APPMALLOC means we dynamically allocated memory for the DBT's data field.
|
||||
*/
|
||||
skeyp->flags = DB_DBT_MULTIPLE | DB_DBT_APPMALLOC;
|
||||
skeyp->size = 2;
|
||||
skeyp->data = tmpdbt;
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
add_executable(cosTest "")
|
||||
target_sources(cosTest
|
||||
PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/main.c"
|
||||
)
|
||||
|
||||
#find_path(APR_INCLUDE_DIR apr-1/apr_time.h)
|
||||
#find_path(APR_UTIL_INCLUDE_DIR apr/include/apr-1/apr_md5.h)
|
||||
#find_path(MINIXML_INCLUDE_DIR mxml.h)
|
||||
#find_path(CURL_INCLUDE_DIR curl/curl.h)
|
||||
|
||||
#include_directories (${MINIXML_INCLUDE_DIR})
|
||||
#include_directories (${CURL_INCLUDE_DIR})
|
||||
FIND_PROGRAM(APR_CONFIG_BIN NAMES apr-config apr-1-config PATHS /usr/bin /usr/local/bin /usr/local/apr/bin/)
|
||||
#FIND_PROGRAM(APU_CONFIG_BIN NAMES apu-config apu-1-config PATHS /usr/bin /usr/local/bin /usr/local/apr/bin/)
|
||||
|
||||
IF (APR_CONFIG_BIN)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${APR_CONFIG_BIN} --includedir
|
||||
OUTPUT_VARIABLE APR_INCLUDE_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
ENDIF()
|
||||
#IF (APU_CONFIG_BIN)
|
||||
# EXECUTE_PROCESS(
|
||||
# COMMAND ${APU_CONFIG_BIN} --includedir
|
||||
# OUTPUT_VARIABLE APR_UTIL_INCLUDE_DIR
|
||||
# OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
# )
|
||||
#ENDIF()
|
||||
|
||||
include_directories (${APR_INCLUDE_DIR})
|
||||
#include_directories (${APR_UTIL_INCLUDE_DIR})
|
||||
|
||||
target_include_directories(
|
||||
cosTest
|
||||
PUBLIC "${TD_SOURCE_DIR}/contrib/cos-c-sdk-v5/cos_c_sdk"
|
||||
)
|
||||
|
||||
#find_library(APR_LIBRARY apr-1 PATHS /usr/local/apr/lib/)
|
||||
#find_library(APR_UTIL_LIBRARY aprutil-1 PATHS /usr/local/apr/lib/)
|
||||
#find_library(MINIXML_LIBRARY mxml)
|
||||
#find_library(CURL_LIBRARY curl)
|
||||
|
||||
target_link_libraries(cosTest cos_c_sdk)
|
||||
target_link_libraries(cosTest apr-1})
|
||||
target_link_libraries(cosTest aprutil-1})
|
||||
target_link_libraries(cosTest mxml)
|
||||
target_link_libraries(cosTest curl)
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,9 @@
|
|||
add_executable(simulate_vnode "simulate_vnode.c")
|
||||
target_link_libraries(simulate_vnode PUBLIC craft lz4 uv_a)
|
||||
if(${BUILD_WINGETOPT})
|
||||
target_link_libraries(simulate_vnode PUBLIC wingetopt)
|
||||
target_include_directories(
|
||||
simulate_vnode
|
||||
PUBLIC "${TD_SOURCE_DIR}/contrib/wingetopt/src"
|
||||
)
|
||||
endif()
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
rm -rf 127.0.0.1*
|
||||
rm -rf ./data
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef TDENGINE_COMMON_H
|
||||
#define TDENGINE_COMMON_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define MAX_PEERS 10
|
||||
#define COMMAND_LEN 512
|
||||
#define TOKEN_LEN 128
|
||||
#define DIR_LEN 256
|
||||
#define HOST_LEN 64
|
||||
#define ADDRESS_LEN (HOST_LEN + 16)
|
||||
|
||||
typedef struct {
|
||||
char host[HOST_LEN];
|
||||
uint32_t port;
|
||||
} Addr;
|
||||
|
||||
typedef struct {
|
||||
int voter;
|
||||
Addr me;
|
||||
Addr peers[MAX_PEERS];
|
||||
int peersCount;
|
||||
char dir[DIR_LEN];
|
||||
char dataDir[DIR_LEN + HOST_LEN * 2];
|
||||
} SRaftServerConfig;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_COMMON_H
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
|
||||
make craft:
|
||||
|
||||
sudo apt-get install libuv1-dev liblz4-dev
|
||||
autoreconf -i
|
||||
./configure --enable-example
|
||||
make
|
||||
|
||||
|
||||
start:
|
||||
|
||||
./simulate_vnode 10000 10001 10002
|
||||
./simulate_vnode 10001 10000 10002
|
||||
./simulate_vnode 10002 10000 10001
|
|
@ -0,0 +1,417 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <getopt.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <raft.h>
|
||||
#include <raft/uv.h>
|
||||
#include "raftServer.h"
|
||||
#include "tcommon.h"
|
||||
|
||||
const char *exe_name;
|
||||
|
||||
void parseAddr(const char *addr, char *host, int len, uint32_t *port) {
|
||||
char* tmp = (char*)malloc(strlen(addr) + 1);
|
||||
strcpy(tmp, addr);
|
||||
|
||||
char* context;
|
||||
char* separator = ":";
|
||||
char* token = strtok_r(tmp, separator, &context);
|
||||
if (token) {
|
||||
snprintf(host, len, "%s", token);
|
||||
}
|
||||
|
||||
token = strtok_r(NULL, separator, &context);
|
||||
if (token) {
|
||||
sscanf(token, "%u", port);
|
||||
}
|
||||
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
// only parse 3 tokens
|
||||
int parseCommand(const char* str, char* token1, char* token2, char* token3, int len)
|
||||
{
|
||||
char* tmp = (char*)malloc(strlen(str) + 1);
|
||||
strcpy(tmp, str);
|
||||
|
||||
char* context;
|
||||
char* separator = " ";
|
||||
int n = 0;
|
||||
|
||||
char* token = strtok_r(tmp, separator, &context);
|
||||
if (!token) {
|
||||
goto ret;
|
||||
}
|
||||
if (strcmp(token, "") != 0) {
|
||||
strncpy(token1, token, len);
|
||||
n++;
|
||||
}
|
||||
|
||||
token = strtok_r(NULL, separator, &context);
|
||||
if (!token) {
|
||||
goto ret;
|
||||
}
|
||||
if (strcmp(token, "") != 0) {
|
||||
strncpy(token2, token, len);
|
||||
n++;
|
||||
}
|
||||
|
||||
token = strtok_r(NULL, separator, &context);
|
||||
if (!token) {
|
||||
goto ret;
|
||||
}
|
||||
if (strcmp(token, "") != 0) {
|
||||
strncpy(token3, token, len);
|
||||
n++;
|
||||
}
|
||||
|
||||
ret:
|
||||
return n;
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
void *startServerFunc(void *param) {
|
||||
SRaftServer *pServer = (SRaftServer*)param;
|
||||
int32_t r = raftServerStart(pServer);
|
||||
assert(r == 0);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Console ---------------------------------
|
||||
const char* state2String(unsigned short state) {
|
||||
if (state == RAFT_UNAVAILABLE) {
|
||||
return "RAFT_UNAVAILABLE";
|
||||
|
||||
} else if (state == RAFT_FOLLOWER) {
|
||||
return "RAFT_FOLLOWER";
|
||||
|
||||
} else if (state == RAFT_CANDIDATE) {
|
||||
return "RAFT_CANDIDATE";
|
||||
|
||||
} else if (state == RAFT_LEADER) {
|
||||
return "RAFT_LEADER";
|
||||
|
||||
}
|
||||
return "UNKNOWN_RAFT_STATE";
|
||||
}
|
||||
|
||||
void printRaftConfiguration(struct raft_configuration *c) {
|
||||
printf("configuration: \n");
|
||||
for (int i = 0; i < c->n; ++i) {
|
||||
printf("%llu -- %d -- %s\n", c->servers[i].id, c->servers[i].role, c->servers[i].address);
|
||||
}
|
||||
}
|
||||
|
||||
void printRaftState(struct raft *r) {
|
||||
printf("----Raft State: -----------\n");
|
||||
printf("my_id: %llu \n", r->id);
|
||||
printf("address: %s \n", r->address);
|
||||
printf("current_term: %llu \n", r->current_term);
|
||||
printf("voted_for: %llu \n", r->voted_for);
|
||||
printf("role: %s \n", state2String(r->state));
|
||||
printf("commit_index: %llu \n", r->commit_index);
|
||||
printf("last_applied: %llu \n", r->last_applied);
|
||||
printf("last_stored: %llu \n", r->last_stored);
|
||||
|
||||
printf("configuration_index: %llu \n", r->configuration_index);
|
||||
printf("configuration_uncommitted_index: %llu \n", r->configuration_uncommitted_index);
|
||||
printRaftConfiguration(&r->configuration);
|
||||
|
||||
printf("----------------------------\n");
|
||||
}
|
||||
|
||||
void putValueCb(struct raft_apply *req, int status, void *result) {
|
||||
raft_free(req);
|
||||
struct raft *r = req->data;
|
||||
if (status != 0) {
|
||||
printf("putValueCb: %s \n", raft_errmsg(r));
|
||||
} else {
|
||||
printf("putValueCb: %s \n", "ok");
|
||||
}
|
||||
}
|
||||
|
||||
void putValue(struct raft *r, const char *value) {
|
||||
struct raft_buffer buf;
|
||||
|
||||
buf.len = TOKEN_LEN;;
|
||||
buf.base = raft_malloc(buf.len);
|
||||
snprintf(buf.base, buf.len, "%s", value);
|
||||
|
||||
struct raft_apply *req = raft_malloc(sizeof(struct raft_apply));
|
||||
req->data = r;
|
||||
int ret = raft_apply(r, req, &buf, 1, putValueCb);
|
||||
if (ret == 0) {
|
||||
printf("put %s \n", (char*)buf.base);
|
||||
} else {
|
||||
printf("put error: %s \n", raft_errmsg(r));
|
||||
}
|
||||
}
|
||||
|
||||
void getValue(const char *key) {
|
||||
char *ptr = getKV(key);
|
||||
if (ptr) {
|
||||
printf("get value: [%s] \n", ptr);
|
||||
} else {
|
||||
printf("value not found for key: [%s] \n", key);
|
||||
}
|
||||
}
|
||||
|
||||
void raft_change_cb_add(struct raft_change *req, int status) {
|
||||
printf("raft_change_cb_add status:%d ... \n", status);
|
||||
}
|
||||
|
||||
void raft_change_cb_assign(struct raft_change *req, int status) {
|
||||
printf("raft_change_cb_assign status:%d ... \n", status);
|
||||
}
|
||||
|
||||
void raft_change_cb_remove(struct raft_change *req, int status) {
|
||||
printf("raft_change_cb_remove status:%d ... \n", status);
|
||||
}
|
||||
|
||||
void console(SRaftServer *pRaftServer) {
|
||||
while (1) {
|
||||
char cmd_buf[COMMAND_LEN];
|
||||
memset(cmd_buf, 0, sizeof(cmd_buf));
|
||||
char *ret = fgets(cmd_buf, COMMAND_LEN, stdin);
|
||||
if (!ret) {
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int pos = strlen(cmd_buf);
|
||||
if(cmd_buf[pos - 1] == '\n') {
|
||||
cmd_buf[pos - 1] = '\0';
|
||||
}
|
||||
|
||||
if (strncmp(cmd_buf, "", COMMAND_LEN) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
char cmd[TOKEN_LEN];
|
||||
memset(cmd, 0, sizeof(cmd));
|
||||
|
||||
char param1[TOKEN_LEN];
|
||||
memset(param1, 0, sizeof(param1));
|
||||
|
||||
char param2[TOKEN_LEN];
|
||||
memset(param2, 0, sizeof(param2));
|
||||
|
||||
parseCommand(cmd_buf, cmd, param1, param2, TOKEN_LEN);
|
||||
if (strcmp(cmd, "addnode") == 0) {
|
||||
//printf("not support \n");
|
||||
|
||||
char host[HOST_LEN];
|
||||
uint32_t port;
|
||||
parseAddr(param1, host, HOST_LEN, &port);
|
||||
uint64_t rid = raftId(host, port);
|
||||
|
||||
struct raft_change *req = raft_malloc(sizeof(*req));
|
||||
int r = raft_add(&pRaftServer->raft, req, rid, param1, raft_change_cb_add);
|
||||
if (r != 0) {
|
||||
printf("raft_add error: %s \n", raft_errmsg(&pRaftServer->raft));
|
||||
}
|
||||
printf("add node: %lu %s \n", rid, param1);
|
||||
|
||||
struct raft_change *req2 = raft_malloc(sizeof(*req2));
|
||||
r = raft_assign(&pRaftServer->raft, req2, rid, RAFT_VOTER, raft_change_cb_assign);
|
||||
if (r != 0) {
|
||||
printf("raft_assign error: %s \n", raft_errmsg(&pRaftServer->raft));
|
||||
}
|
||||
printf("raft_assign: %s %d \n", param1, RAFT_VOTER);
|
||||
|
||||
} else if (strcmp(cmd, "activate") == 0) {
|
||||
char host[HOST_LEN];
|
||||
uint32_t port;
|
||||
parseAddr(param1, host, HOST_LEN, &port);
|
||||
uint64_t rid = raftId(host, port);
|
||||
|
||||
|
||||
struct raft_change *req2 = raft_malloc(sizeof(*req2));
|
||||
int r = raft_assign(&pRaftServer->raft, req2, rid, RAFT_VOTER, raft_change_cb_assign);
|
||||
if (r != 0) {
|
||||
printf("raft_assign error: %s \n", raft_errmsg(&pRaftServer->raft));
|
||||
}
|
||||
printf("raft_assign: %s %d \n", param1, RAFT_VOTER);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} else if (strcmp(cmd, "dropnode") == 0) {
|
||||
char host[HOST_LEN] = {0};
|
||||
uint32_t port;
|
||||
parseAddr(param1, host, HOST_LEN, &port);
|
||||
uint64_t rid = raftId(host, port);
|
||||
|
||||
struct raft_change *req = raft_malloc(sizeof(*req));
|
||||
int r = raft_remove(&pRaftServer->raft, req, rid, raft_change_cb_remove);
|
||||
if (r != 0) {
|
||||
printf("raft_remove: %s \n", raft_errmsg(&pRaftServer->raft));
|
||||
}
|
||||
printf("drop node: %lu %s \n", rid, param1);
|
||||
|
||||
|
||||
|
||||
} else if (strcmp(cmd, "put") == 0) {
|
||||
char buf[256] = {0};
|
||||
snprintf(buf, sizeof(buf), "%s--%s", param1, param2);
|
||||
putValue(&pRaftServer->raft, buf);
|
||||
|
||||
} else if (strcmp(cmd, "get") == 0) {
|
||||
getValue(param1);
|
||||
|
||||
} else if (strcmp(cmd, "state") == 0) {
|
||||
printRaftState(&pRaftServer->raft);
|
||||
|
||||
} else if (strcmp(cmd, "snapshot") == 0) {
|
||||
printf("not support \n");
|
||||
|
||||
} else if (strcmp(cmd, "help") == 0) {
|
||||
printf("addnode \"127.0.0.1:8888\" \n");
|
||||
printf("activate \"127.0.0.1:8888\" \n");
|
||||
printf("dropnode \"127.0.0.1:8888\" \n");
|
||||
printf("put key value \n");
|
||||
printf("get key \n");
|
||||
printf("state \n");
|
||||
|
||||
} else {
|
||||
printf("unknown command: [%s], type \"help\" to see help \n", cmd);
|
||||
}
|
||||
|
||||
//printf("cmd_buf: [%s] \n", cmd_buf);
|
||||
}
|
||||
}
|
||||
|
||||
void *startConsoleFunc(void *param) {
|
||||
SRaftServer *pServer = (SRaftServer*)param;
|
||||
console(pServer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Config ---------------------------------
|
||||
void usage() {
|
||||
printf("\nusage: \n");
|
||||
printf("%s --me=127.0.0.1:10000 --dir=./data --voter \n", exe_name);
|
||||
printf("%s --me=127.0.0.1:10001 --dir=./data \n", exe_name);
|
||||
printf("%s --me=127.0.0.1:10002 --dir=./data \n", exe_name);
|
||||
printf("\n");
|
||||
printf("%s --me=127.0.0.1:10000 --peers=127.0.0.1:10001,127.0.0.1:10002 --dir=./data \n", exe_name);
|
||||
printf("%s --me=127.0.0.1:10001 --peers=127.0.0.1:10000,127.0.0.1:10002 --dir=./data \n", exe_name);
|
||||
printf("%s --me=127.0.0.1:10002 --peers=127.0.0.1:10000,127.0.0.1:10001 --dir=./data \n", exe_name);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void parseConf(int argc, char **argv, SRaftServerConfig *pConf) {
|
||||
memset(pConf, 0, sizeof(*pConf));
|
||||
|
||||
int option_index, option_value;
|
||||
option_index = 0;
|
||||
static struct option long_options[] = {
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"voter", no_argument, NULL, 'v'},
|
||||
{"peers", required_argument, NULL, 'p'},
|
||||
{"me", required_argument, NULL, 'm'},
|
||||
{"dir", required_argument, NULL, 'd'},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
pConf->voter = 0;
|
||||
while ((option_value = getopt_long(argc, argv, "hvp:m:d:", long_options, &option_index)) != -1) {
|
||||
switch (option_value) {
|
||||
case 'm': {
|
||||
parseAddr(optarg, pConf->me.host, sizeof(pConf->me.host), &pConf->me.port);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'p': {
|
||||
char tokens[MAX_PEERS][MAX_TOKEN_LEN];
|
||||
int peerCount = splitString(optarg, ",", tokens, MAX_PEERS);
|
||||
pConf->peersCount = peerCount;
|
||||
for (int i = 0; i < peerCount; ++i) {
|
||||
Addr *pAddr = &pConf->peers[i];
|
||||
parseAddr(tokens[i], pAddr->host, sizeof(pAddr->host), &pAddr->port);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'v': {
|
||||
pConf->voter = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'd': {
|
||||
snprintf(pConf->dir, sizeof(pConf->dir), "%s", optarg);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'h': {
|
||||
usage();
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
default: {
|
||||
usage();
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
snprintf(pConf->dataDir, sizeof(pConf->dataDir), "%s/%s:%u", pConf->dir, pConf->me.host, pConf->me.port);
|
||||
}
|
||||
|
||||
void printConf(SRaftServerConfig *pConf) {
|
||||
printf("\nconf: \n");
|
||||
printf("me: %s:%u \n", pConf->me.host, pConf->me.port);
|
||||
printf("peersCount: %d \n", pConf->peersCount);
|
||||
for (int i = 0; i < pConf->peersCount; ++i) {
|
||||
Addr *pAddr = &pConf->peers[i];
|
||||
printf("peer%d: %s:%u \n", i, pAddr->host, pAddr->port);
|
||||
}
|
||||
printf("dataDir: %s \n\n", pConf->dataDir);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
taosSeedRand(time(NULL));
|
||||
int32_t ret;
|
||||
|
||||
exe_name = argv[0];
|
||||
if (argc < 3) {
|
||||
usage();
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
SRaftServerConfig conf;
|
||||
parseConf(argc, argv, &conf);
|
||||
printConf(&conf);
|
||||
|
||||
char cmd_buf[COMMAND_LEN];
|
||||
snprintf(cmd_buf, sizeof(cmd_buf), "mkdir -p %s", conf.dataDir);
|
||||
system(cmd_buf);
|
||||
|
||||
struct raft_fsm fsm;
|
||||
initFsm(&fsm);
|
||||
|
||||
SRaftServer raftServer;
|
||||
ret = raftServerInit(&raftServer, &conf, &fsm);
|
||||
assert(ret == 0);
|
||||
|
||||
pthread_t tidRaftServer;
|
||||
pthread_create(&tidRaftServer, NULL, startServerFunc, &raftServer);
|
||||
|
||||
pthread_t tidConsole;
|
||||
pthread_create(&tidConsole, NULL, startConsoleFunc, &raftServer);
|
||||
|
||||
while (1) {
|
||||
sleep(10);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,172 @@
|
|||
#include <stdlib.h>
|
||||
#include "tcommon.h"
|
||||
#include "raftServer.h"
|
||||
|
||||
char *keys;
|
||||
char *values;
|
||||
|
||||
void initStore() {
|
||||
keys = malloc(MAX_RECORD_COUNT * MAX_KV_LEN);
|
||||
values = malloc(MAX_RECORD_COUNT * MAX_KV_LEN);
|
||||
writeIndex = 0;
|
||||
}
|
||||
|
||||
void destroyStore() {
|
||||
free(keys);
|
||||
free(values);
|
||||
}
|
||||
|
||||
void putKV(const char *key, const char *value) {
|
||||
if (writeIndex < MAX_RECORD_COUNT) {
|
||||
strncpy(&keys[writeIndex], key, MAX_KV_LEN);
|
||||
strncpy(&values[writeIndex], value, MAX_KV_LEN);
|
||||
writeIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
char *getKV(const char *key) {
|
||||
for (int i = 0; i < MAX_RECORD_COUNT; ++i) {
|
||||
if (strcmp(&keys[i], key) == 0) {
|
||||
return &values[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int splitString(const char* str, char* separator, char (*arr)[MAX_TOKEN_LEN], int n_arr)
|
||||
{
|
||||
if (n_arr <= 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
char* tmp = (char*)malloc(strlen(str) + 1);
|
||||
strcpy(tmp, str);
|
||||
char* context;
|
||||
int n = 0;
|
||||
|
||||
char* token = strtok_r(tmp, separator, &context);
|
||||
if (!token) {
|
||||
goto ret;
|
||||
}
|
||||
strncpy(arr[n], token, MAX_TOKEN_LEN);
|
||||
n++;
|
||||
|
||||
while (1) {
|
||||
token = strtok_r(NULL, separator, &context);
|
||||
if (!token || n >= n_arr) {
|
||||
goto ret;
|
||||
}
|
||||
strncpy(arr[n], token, MAX_TOKEN_LEN);
|
||||
n++;
|
||||
}
|
||||
|
||||
ret:
|
||||
free(tmp);
|
||||
return n;
|
||||
}
|
||||
|
||||
uint64_t raftId(const char *host, uint32_t port) {
|
||||
uint32_t host_uint32 = (uint32_t)inet_addr(host);
|
||||
assert(host_uint32 != (uint32_t)-1);
|
||||
uint64_t code = ((uint64_t)host_uint32) << 32 | port;
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t raftServerInit(SRaftServer *pRaftServer, const SRaftServerConfig *pConf, struct raft_fsm *pFsm) {
|
||||
int ret;
|
||||
|
||||
snprintf(pRaftServer->host, sizeof(pRaftServer->host), "%s", pConf->me.host);
|
||||
pRaftServer->port = pConf->me.port;
|
||||
snprintf(pRaftServer->address, sizeof(pRaftServer->address), "%s:%u", pRaftServer->host, pRaftServer->port);
|
||||
strncpy(pRaftServer->dir, pConf->dataDir, sizeof(pRaftServer->dir));
|
||||
|
||||
pRaftServer->raftId = raftId(pRaftServer->host, pRaftServer->port);
|
||||
pRaftServer->fsm = pFsm;
|
||||
|
||||
ret = uv_loop_init(&pRaftServer->loop);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "%s \n", raft_errmsg(&pRaftServer->raft));
|
||||
assert(0);
|
||||
}
|
||||
|
||||
ret = raft_uv_tcp_init(&pRaftServer->transport, &pRaftServer->loop);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "%s \n", raft_errmsg(&pRaftServer->raft));
|
||||
assert(0);
|
||||
}
|
||||
|
||||
ret = raft_uv_init(&pRaftServer->io, &pRaftServer->loop, pRaftServer->dir, &pRaftServer->transport);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "%s \n", raft_errmsg(&pRaftServer->raft));
|
||||
assert(0);
|
||||
}
|
||||
|
||||
ret = raft_init(&pRaftServer->raft, &pRaftServer->io, pRaftServer->fsm, pRaftServer->raftId, pRaftServer->address);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "%s \n", raft_errmsg(&pRaftServer->raft));
|
||||
assert(0);
|
||||
}
|
||||
|
||||
struct raft_configuration conf;
|
||||
raft_configuration_init(&conf);
|
||||
|
||||
if (pConf->voter == 0) {
|
||||
raft_configuration_add(&conf, pRaftServer->raftId, pRaftServer->address, RAFT_SPARE);
|
||||
|
||||
} else {
|
||||
raft_configuration_add(&conf, pRaftServer->raftId, pRaftServer->address, RAFT_VOTER);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
printf("add myself: %llu - %s \n", pRaftServer->raftId, pRaftServer->address);
|
||||
|
||||
|
||||
for (int i = 0; i < pConf->peersCount; ++i) {
|
||||
const Addr *pAddr = &pConf->peers[i];
|
||||
raft_id rid = raftId(pAddr->host, pAddr->port);
|
||||
char addrBuf[ADDRESS_LEN];
|
||||
snprintf(addrBuf, sizeof(addrBuf), "%s:%u", pAddr->host, pAddr->port);
|
||||
raft_configuration_add(&conf, rid, addrBuf, RAFT_VOTER);
|
||||
printf("add peers: %llu - %s \n", rid, addrBuf);
|
||||
}
|
||||
|
||||
raft_bootstrap(&pRaftServer->raft, &conf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t raftServerStart(SRaftServer *pRaftServer) {
|
||||
int ret;
|
||||
ret = raft_start(&pRaftServer->raft);
|
||||
if (!ret) {
|
||||
fprintf(stderr, "%s \n", raft_errmsg(&pRaftServer->raft));
|
||||
}
|
||||
|
||||
uv_run(&pRaftServer->loop, UV_RUN_DEFAULT);
|
||||
}
|
||||
|
||||
|
||||
void raftServerClose(SRaftServer *pRaftServer) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
int fsmApplyCb(struct raft_fsm *pFsm, const struct raft_buffer *buf, void **result) {
|
||||
char *msg = (char*)buf->base;
|
||||
printf("fsm apply: %s \n", msg);
|
||||
|
||||
char arr[2][MAX_TOKEN_LEN];
|
||||
splitString(msg, "--", arr, 2);
|
||||
putKV(arr[0], arr[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t initFsm(struct raft_fsm *fsm) {
|
||||
initStore();
|
||||
fsm->apply = fsmApplyCb;
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
#ifndef TDENGINE_RAFT_SERVER_H
|
||||
#define TDENGINE_RAFT_SERVER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "raft.h"
|
||||
#include "raft/uv.h"
|
||||
#include "tcommon.h"
|
||||
|
||||
|
||||
// simulate a db store, just for test
|
||||
#define MAX_KV_LEN 100
|
||||
#define MAX_RECORD_COUNT 500
|
||||
char *keys;
|
||||
char *values;
|
||||
int writeIndex;
|
||||
|
||||
void initStore();
|
||||
void destroyStore();
|
||||
void putKV(const char *key, const char *value);
|
||||
char *getKV(const char *key);
|
||||
|
||||
typedef struct {
|
||||
char dir[DIR_LEN + HOST_LEN * 2]; /* Data dir of UV I/O backend */
|
||||
char host[HOST_LEN];
|
||||
uint32_t port;
|
||||
char address[ADDRESS_LEN]; /* Raft instance address */
|
||||
raft_id raftId; /* For vote */
|
||||
struct raft_fsm *fsm; /* Sample application FSM */
|
||||
|
||||
struct raft raft; /* Raft instance */
|
||||
struct raft_io io; /* UV I/O backend */
|
||||
struct uv_loop_s loop; /* UV loop */
|
||||
struct raft_uv_transport transport; /* UV I/O backend transport */
|
||||
} SRaftServer;
|
||||
|
||||
#define MAX_TOKEN_LEN 32
|
||||
int splitString(const char* str, char* separator, char (*arr)[MAX_TOKEN_LEN], int n_arr);
|
||||
|
||||
uint64_t raftId(const char *host, uint32_t port);
|
||||
int32_t raftServerInit(SRaftServer *pRaftServer, const SRaftServerConfig *pConf, struct raft_fsm *pFsm);
|
||||
int32_t raftServerStart(SRaftServer *pRaftServer);
|
||||
void raftServerClose(SRaftServer *pRaftServer);
|
||||
|
||||
int initFsm(struct raft_fsm *fsm);
|
||||
|
||||
const char* state2String(unsigned short state);
|
||||
void printRaftConfiguration(struct raft_configuration *c);
|
||||
void printRaftState(struct raft *r);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TDENGINE_RAFT_SERVER_H
|
|
@ -0,0 +1,252 @@
|
|||
#include <stdio.h>
|
||||
#include <raft.h>
|
||||
#include <raft/uv.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
|
||||
const char* exe_name;
|
||||
|
||||
// simulate ------------------------
|
||||
typedef struct SVnode {
|
||||
int vid;
|
||||
} SVnode;
|
||||
|
||||
|
||||
#define VNODE_COUNT 10
|
||||
SVnode vnodes[VNODE_COUNT];
|
||||
|
||||
int vnodeApplyWMsg(SVnode *pVnode, char *pMsg, void **pRsp) {
|
||||
printf("put value to tsdb, vid:%d msg:%s \n", pVnode->vid, pMsg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int applyCB(struct raft_fsm *fsm,
|
||||
const struct raft_buffer *buf,
|
||||
void **result) {
|
||||
char *msg = (char*)buf->base;
|
||||
//printf("%s \n", msg);
|
||||
|
||||
// parse msg
|
||||
char* context;
|
||||
char* token = strtok_r(msg, ":", &context);
|
||||
int vid = atoi(token);
|
||||
|
||||
token = strtok_r(NULL, ":", &context);
|
||||
char *value = token;
|
||||
|
||||
SVnode* tmp_vnodes = (SVnode*)(fsm->data);
|
||||
vnodeApplyWMsg(&tmp_vnodes[vid], value, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Config ------------------------
|
||||
#define HOST_LEN 32
|
||||
#define MAX_PEERS 10
|
||||
typedef struct Address {
|
||||
char host[HOST_LEN];
|
||||
uint32_t port;
|
||||
} Address;
|
||||
|
||||
uint64_t raftId(Address *addr) {
|
||||
// test in a single machine, port is unique
|
||||
// if in multi machines, use host and port
|
||||
return addr->port;
|
||||
}
|
||||
|
||||
typedef struct Config {
|
||||
Address me;
|
||||
Address peers[MAX_PEERS];
|
||||
int peer_count;
|
||||
} Config;
|
||||
|
||||
Config gConf;
|
||||
|
||||
void printConf(Config *c) {
|
||||
printf("me: %s:%u \n", c->me.host, c->me.port);
|
||||
for (int i = 0; i < c->peer_count; ++i) {
|
||||
printf("peer%d: %s:%u \n", i, c->peers[i].host, c->peers[i].port);
|
||||
}
|
||||
}
|
||||
|
||||
// RaftServer ------------------------
|
||||
typedef struct RaftServer {
|
||||
struct uv_loop_s loop;
|
||||
struct raft_uv_transport transport;
|
||||
struct raft_io io;
|
||||
struct raft_fsm fsm;
|
||||
struct raft raft;
|
||||
struct raft_configuration conf;
|
||||
} RaftServer;
|
||||
|
||||
RaftServer gRaftServer;
|
||||
|
||||
static void* startRaftServer(void *param) {
|
||||
//RaftServer* rs = (RaftServer*)param;
|
||||
RaftServer* rs = &gRaftServer;
|
||||
raft_start(&rs->raft);
|
||||
uv_run(&rs->loop, UV_RUN_DEFAULT);
|
||||
}
|
||||
|
||||
static const char* state2String(unsigned short state) {
|
||||
if (state == RAFT_UNAVAILABLE) {
|
||||
return "RAFT_UNAVAILABLE";
|
||||
|
||||
} else if (state == RAFT_FOLLOWER) {
|
||||
return "RAFT_FOLLOWER";
|
||||
|
||||
} else if (state == RAFT_CANDIDATE) {
|
||||
return "RAFT_CANDIDATE";
|
||||
|
||||
} else if (state == RAFT_LEADER) {
|
||||
return "RAFT_LEADER";
|
||||
|
||||
}
|
||||
return "UNKNOWN_RAFT_STATE";
|
||||
}
|
||||
|
||||
static void printRaftState(struct raft *r) {
|
||||
printf("\n");
|
||||
printf("my_id: %llu \n", r->id);
|
||||
printf("address: %s \n", r->address);
|
||||
printf("current_term: %llu \n", r->current_term);
|
||||
printf("voted_for: %llu \n", r->voted_for);
|
||||
printf("role: %s \n", state2String(r->state));
|
||||
printf("commit_index: %llu \n", r->commit_index);
|
||||
printf("last_applied: %llu \n", r->last_applied);
|
||||
printf("last_stored: %llu \n", r->last_stored);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
// console -----------------------------------------
|
||||
#define PROPOSE_VALUE_LEN 128
|
||||
static void proposeValue(struct raft *r) {
|
||||
struct raft_buffer buf;
|
||||
|
||||
// need free
|
||||
buf.len = PROPOSE_VALUE_LEN;
|
||||
buf.base = raft_malloc(buf.len);
|
||||
|
||||
// mock ts value
|
||||
int vid = taosRand() % VNODE_COUNT;
|
||||
snprintf(buf.base, buf.len, "%d:value_%ld", vid, time(NULL));
|
||||
|
||||
printf("propose value: %s \n", (char*)buf.base);
|
||||
|
||||
// need free
|
||||
struct raft_apply *req = raft_malloc(sizeof(struct raft_apply));
|
||||
raft_apply(r, req, &buf, 1, NULL);
|
||||
}
|
||||
|
||||
static void* console(void *param) {
|
||||
while (1) {
|
||||
// notice! memory buffer overflow!
|
||||
char buf[128];
|
||||
memset(buf, 0, sizeof(buf));
|
||||
fgets(buf, 128, stdin);
|
||||
if (strlen(buf) == 1) {
|
||||
continue;
|
||||
}
|
||||
buf[strlen(buf)-1] = '\0';
|
||||
|
||||
// do not use strcmp
|
||||
if (strcmp(buf, "state") == 0) {
|
||||
printRaftState(&gRaftServer.raft);
|
||||
|
||||
} else if (strcmp(buf, "put") == 0) {
|
||||
proposeValue(&gRaftServer.raft);
|
||||
|
||||
} else {
|
||||
printf("unknown command: [%s], support command: state, put \n", buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
void usage() {
|
||||
printf("\n");
|
||||
printf("%s my_port peer1_port peer2_port ... \n", exe_name);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
taosSeedRand(time(NULL));
|
||||
|
||||
exe_name = argv[0];
|
||||
if (argc < 2) {
|
||||
usage();
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// read conf from argv
|
||||
strncpy(gConf.me.host, "127.0.0.1", HOST_LEN);
|
||||
sscanf(argv[1], "%u", &gConf.me.port);
|
||||
|
||||
gConf.peer_count = 0;
|
||||
for (int i = 2; i < argc; ++i) {
|
||||
strncpy(gConf.peers[gConf.peer_count].host, "127.0.0.1", HOST_LEN);
|
||||
sscanf(argv[i], "%u", &gConf.peers[gConf.peer_count].port);
|
||||
gConf.peer_count++;
|
||||
}
|
||||
printConf(&gConf);
|
||||
|
||||
// mkdir
|
||||
char dir[128];
|
||||
snprintf(dir, sizeof(dir), "./%s_%u", gConf.me.host, gConf.me.port);
|
||||
|
||||
char cmd[128];
|
||||
snprintf(cmd, sizeof(cmd), "rm -rf ./%s", dir);
|
||||
system(cmd);
|
||||
snprintf(cmd, sizeof(cmd), "mkdir -p ./%s", dir);
|
||||
system(cmd);
|
||||
|
||||
// init io
|
||||
uv_loop_init(&gRaftServer.loop);
|
||||
raft_uv_tcp_init(&gRaftServer.transport, &gRaftServer.loop);
|
||||
raft_uv_init(&gRaftServer.io, &gRaftServer.loop, dir, &gRaftServer.transport);
|
||||
|
||||
// init fsm
|
||||
gRaftServer.fsm.apply = applyCB;
|
||||
gRaftServer.fsm.data = vnodes;
|
||||
for (int i = 0; i < VNODE_COUNT; ++i) {
|
||||
vnodes[i].vid = i;
|
||||
}
|
||||
|
||||
// init raft instance with io and fsm
|
||||
char address_buf[128];
|
||||
snprintf(address_buf, sizeof(address_buf), "%s:%u", gConf.me.host, gConf.me.port);
|
||||
|
||||
// test in a single machine, port is unique
|
||||
uint64_t raft_id = raftId(&gConf.me);
|
||||
raft_init(&gRaftServer.raft, &gRaftServer.io, &gRaftServer.fsm, raft_id, address_buf);
|
||||
//raft_init(&gRaftServer.raft, &gRaftServer.io, &gRaftServer.fsm, 11, "127.0.0.1:9000");
|
||||
|
||||
// init cluster configuration
|
||||
struct raft_configuration conf;
|
||||
raft_configuration_init(&conf);
|
||||
raft_configuration_add(&conf, raftId(&gConf.me), address_buf, RAFT_VOTER);
|
||||
for (int i = 0; i < gConf.peer_count; ++i) {
|
||||
char address_buf[128];
|
||||
snprintf(address_buf, sizeof(address_buf), "%s:%u", gConf.peers[i].host, gConf.peers[i].port);
|
||||
raft_configuration_add(&conf, raftId(&gConf.peers[i]), address_buf, RAFT_VOTER);
|
||||
}
|
||||
raft_bootstrap(&gRaftServer.raft, &conf);
|
||||
|
||||
// start raft server and loop
|
||||
pthread_t tid;
|
||||
pthread_create(&tid, NULL, startRaftServer, &gRaftServer);
|
||||
|
||||
// simulate console
|
||||
pthread_t tid2;
|
||||
pthread_create(&tid2, NULL, console, NULL);
|
||||
|
||||
while (1) {
|
||||
sleep(10);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
add_executable(luceneTest "")
|
||||
target_sources(luceneTest
|
||||
PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/main.cpp"
|
||||
)
|
||||
target_link_libraries(luceneTest lucene++)
|
|
@ -0,0 +1,6 @@
|
|||
#include <iostream>
|
||||
|
||||
int main(int argc, char const *argv[]) {
|
||||
std::cout << "Hello, this is lucene test" << std::endl;
|
||||
return 0;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue