Skip to content

Commit

Permalink
Merge pull request OpenAtomFoundation#1 from AlexStocks/lihao-clang
Browse files Browse the repository at this point in the history
modify clang
  • Loading branch information
ForestLH committed May 25, 2023
2 parents 8827ff5 + 569c68a commit 93b7a0d
Show file tree
Hide file tree
Showing 651 changed files with 28,961 additions and 1,857 deletions.
62 changes: 57 additions & 5 deletions .github/workflows/pika.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: install Deps
if: ${{ steps.cache.output.cache-hit != 'true' }}
run: |
sudo apt install autoconf libprotobuf-dev protobuf-compiler clang-tidy -y
sudo apt install autoconf libprotobuf-dev protobuf-compiler -y
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
Expand All @@ -41,12 +41,64 @@ jobs:
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Clang-tidy Check
- name: Test
working-directory: ${{github.workspace}}/build
run: make clang-tidy
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}

build_on_centos:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
container:
image: centos:7

steps:
- name: Install deps
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
yum install -y wget git autoconf centos-release-scl
yum install -y devtoolset-10-gcc devtoolset-10-gcc-c++ devtoolset-10-make devtoolset-10-bin-util
source /opt/rh/devtoolset-10/enable
gcc --version
make --version
- name: Install cmake
run: |
wget https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4-linux-x86_64.sh
bash ./cmake-3.26.4-linux-x86_64.sh --skip-license --prefix=/usr
cmake --version
- name: checkout
working-directory: ${{github.workspace}}
run: |
echo Fetching $GITHUB_REPOSITORY@$GITHUB_SHA
git init
git fetch --depth 1 https://github.com/$GITHUB_REPOSITORY $GITHUB_SHA
git checkout $GITHUB_SHA
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
source /opt/rh/devtoolset-10/enable
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUSE_PIKA_TOOLS=ON
- name: Build
# Build your program with the given configuration
run: |
cd ${{github.workspace}}
source /opt/rh/devtoolset-10/enable
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}
run: |
cd ${{github.workspace}}/build
source /opt/rh/devtoolset-10/enable
ctest -C ${{env.BUILD_TYPE}}
28 changes: 0 additions & 28 deletions .github/workflows/pika_exporter.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/tools_go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Tools_go_build

on:
push:
branches: [ "unstable" ]
paths:
- 'tools/**'
pull_request:
branches: [ "unstable" ]
paths:
- 'tools/**'

jobs:

build_pika_exporter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Build
run: |
cd tools/pika_exporter && make -j
- name: Test
run: |
cd tools/pika_exporter && make -j
build_codis2pika:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Build
run: |
cd tools/codis2pika && sh build.sh
- name: Test
run: |
cd tools/codis2pika && sh build.sh
26 changes: 6 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ if (${AUTOCONF} MATCHES AUTOCONF-NOTFOUND)
message(FATAL_ERROR "not find autoconf on localhost")
endif()

set(CLANG_SEARCH_PATH "/usr/local/bin" "/usr/bin" "/usr/local/opt/llvm/bin" "/usr/local/opt/llvm@12/bin"
"/usr/local/Cellar/llvm/12.0.1/bin" "/opt/homebrew/opt/llvm@12/bin/")

find_program(CLANG_TIDY_BIN
NAMES clang-tidy clang-tidy-12
HINTS ${CLANG_SEARCH_PATH})
Expand Down Expand Up @@ -263,7 +260,11 @@ else()
set(LIB_GLOG libglog.a)
endif()

set(GLOG_LIBRARY ${INSTALL_LIBDIR}/${LIB_GLOG})
if(${OS_VERSION} MATCHES "CentOS")
set(GLOG_LIBRARY ${INSTALL_LIBDIR_64}/${LIB_GLOG})
else()
set(GLOG_LIBRARY ${INSTALL_LIBDIR}/${LIB_GLOG})
endif()
set(GLOG_INCLUDE_DIR ${INSTALL_INCLUDEDIR})

ExternalProject_Add(snappy
Expand Down Expand Up @@ -756,7 +757,7 @@ target_link_libraries(${PROJECT_NAME}
storage
net
pstd
${LIB_GLOG}
${GLOG_LIBRARY}
librocksdb.a
${LIB_PROTOBUF}
${LIB_GFLAGS}
Expand All @@ -768,21 +769,6 @@ target_link_libraries(${PROJECT_NAME}
${LIBUNWIND_LIBRARY}
${JEMALLOC_LIBRARY})

option(ENABLE_IPO "enable interprocedural optimization" ON)
if (ENABLE_IPO)
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_result OUTPUT ipo_output LANGUAGES CXX)

if (ipo_result)
set_property(TARGET ${PROJECT_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_libraries(${PROJECT_NAME} PUBLIC "-fuse-ld=lld")
endif ()
else ()
message(WARNING "IPO is not supported: ${ipo_output}")
endif ()
endif ()

option(USE_SSL "Enable SSL support" OFF)
add_custom_target(
clang-tidy
Expand Down
2 changes: 1 addition & 1 deletion format_code.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

find include src pika-tools -regex '.*\.\(cpp\|hpp\|c\|h\|cc\)' | xargs clang-format -i
find include src tools -regex '.*\.\(cpp\|hpp\|c\|h\|cc\)' | xargs clang-format -i


# If you want to automatically format your code before git commit
Expand Down
Loading

0 comments on commit 93b7a0d

Please sign in to comment.