Skip to content

Commit

Permalink
Merge pull request clapdb#19 from longqimin/dev
Browse files Browse the repository at this point in the history
rebase on pganalyze/libpg_query/15-4.2.2
  • Loading branch information
longqimin authored Jul 25, 2023
2 parents cb3aa9e + 89cca9e commit c5ddda4
Show file tree
Hide file tree
Showing 10 changed files with 50,100 additions and 45,185 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ jobs:
id: cache-protobuf
uses: actions/cache@v1
with:
path: protobuf-3.14.0
key: ${{ runner.os }}-protobuf-cpp-3.14.0
path: protobuf-3.19.6
key: ${{ runner.os }}-protobuf-cpp-3.19.6
- name: Build protobuf library
if: matrix.protobuf_lib == 'protobuf-cpp' && steps.cache-protobuf.outputs.cache-hit != 'true'
run: |
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protobuf-cpp-3.14.0.tar.gz
tar -xf protobuf-cpp-3.14.0.tar.gz
cd protobuf-3.14.0
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.6/protobuf-cpp-3.19.6.tar.gz
tar -xf protobuf-cpp-3.19.6.tar.gz
cd protobuf-3.19.6
./configure
make
- name: Install protobuf library
if: matrix.protobuf_lib == 'protobuf-cpp'
run: |
cd protobuf-3.14.0
cd protobuf-3.19.6
sudo make install
sudo ldconfig
- name: Install Valgrind
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ test/*.dSYM

tmp/*
!tmp/.gitkeep
cmake-build-*
Empty file added .gitmodules
Empty file.
45 changes: 45 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
cmake_minimum_required(VERSION 3.19.0)

project(libpg_query)

set(CMAKE_C_FLAGS "-g -Wno-unused-function -Wno-unused-value -Wno-unused-variable -fno-strict-aliasing -fwrapv -fPIC")

set(CMAKE_C_FLAGS_DEBUG "-O0 -DUSE_ASSERT_CHECKING")
set(CMAKE_C_FLAGS_RELEASE "-O3")

include_directories(SYSTEM ${PROJECT_SOURCE_DIR})
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/vendor)
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/src/postgres/include)

# fmt
find_package(fmt REQUIRED)

# sanitizer
set(SANITIZE_PARAM "-fsanitize=address -fsanitize=undefined -fno-sanitize=vptr -fno-omit-frame-pointer") # param from seastar.pc
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${SANITIZE_PARAM}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${SANITIZE_PARAM}")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${SANITIZE_PARAM}")
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} ${SANITIZE_PARAM}")

FILE(GLOB_RECURSE SRC
${PROJECT_SOURCE_DIR}/src/*.c)

LIST(REMOVE_ITEM SRC
${PROJECT_SOURCE_DIR}/src/pg_query_enum_defs.c
${PROJECT_SOURCE_DIR}/src/pg_query_fingerprint_defs.c
${PROJECT_SOURCE_DIR}/src/pg_query_fingerprint_conds.c
${PROJECT_SOURCE_DIR}/src/pg_query_outfuncs_defs.c
${PROJECT_SOURCE_DIR}/src/pg_query_outfuncs_conds.c
${PROJECT_SOURCE_DIR}/src/pg_query_readfuncs_defs.c
${PROJECT_SOURCE_DIR}/src/pg_query_readfuncs_conds.c
${PROJECT_SOURCE_DIR}/src/pg_query_json_helper.c
${PROJECT_SOURCE_DIR}/src/postgres/guc-file.c
${PROJECT_SOURCE_DIR}/src/postgres/scan.c)

LIST(APPEND SRC
${PROJECT_SOURCE_DIR}/vendor/protobuf-c/protobuf-c.c
${PROJECT_SOURCE_DIR}/vendor/xxhash/xxhash.c
${PROJECT_SOURCE_DIR}/protobuf/pg_query.pb-c.c
)

add_library(pg_query ${SRC})
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PGDIRBZ2 = $(root_dir)/tmp/postgres.tar.bz2

PG_VERSION = 15.1
PG_VERSION_MAJOR = $(call word-dot,$(PG_VERSION),1)
PROTOC_VERSION = 3.14.0
PROTOC_VERSION = 3.19.6

VERSION = 4.2.2
VERSION_MAJOR = $(call word-dot,$(VERSION),1)
Expand Down
Loading

0 comments on commit c5ddda4

Please sign in to comment.