Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Struct pb new #273

Merged
merged 25 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Clang Format Diff

on:
push:
branches: [ master]
branches: [ master, struct_pb ]
pull_request:
branches: [ master]
branches: [ master, struct_pb ]

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linux-clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Ubuntu (clang)

on:
push:
branches: [ master]
branches: [ master, struct_pb ]
pull_request:
branches: [ master]
branches: [ master, struct_pb ]

jobs:
build:
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/linux-gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Ubuntu (gcc)

on:
push:
branches: [ master]
branches: [ master, struct_pb ]
pull_request:
branches: [ master]
branches: [ master, struct_pb ]

jobs:
ubuntu_gcc:
Expand All @@ -21,8 +21,11 @@ jobs:
- name: checkout gcc version
run: gcc --version

- name: Install Protobuf and Dev Package
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libprotobuf-dev

- name: configure cmake
run: CXX=g++ CC=gcc cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ matrix.mode }} -DCMAKE_CXX_STANDARD=${{ matrix.cpp_version }}
run: CXX=g++ CC=gcc cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ matrix.mode }} -DHAS_PROTOBUF=ON -DCMAKE_CXX_STANDARD=${{ matrix.cpp_version }}

- name: build project
run: cmake --build ${{ github.workspace }}/build --config ${{ matrix.mode }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: macOS Monterey 12

on:
push:
branches: [ master]
branches: [ master, struct_pb ]
pull_request:
branches: [ master]
branches: [ master, struct_pb ]

jobs:
build:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Windows Server 2022

on:
on:
push:
branches: [ master]
branches: [ master, struct_pb ]
pull_request:
branches: [ master]
branches: [ master, struct_pb ]

jobs:
build:
Expand Down
33 changes: 32 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 2.15)
project(iguana)

message(STATUS "C++ Compiler Version: ${CMAKE_CXX_COMPILER_VERSION}")

if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++20")
add_compile_options(/utf-8)
Expand Down Expand Up @@ -82,6 +84,9 @@ set(YAMLBENCH benchmark/yaml_benchmark.cpp)
set(TEST_NOTHROW test/test_yaml_nothrow.cpp)
set(TEST_UTIL test/test_util.cpp)
set(TEST_XMLNOTHROW test/test_xml_nothrow.cpp)
set(TEST_PB test/test_pb.cpp)
set(TEST_PROTO test/test_proto3.cpp)
set(PB_BENCHMARK benchmark/pb_benchmark.cpp)

add_executable(json_example ${JSON_EXAMPLE})
add_executable(json_benchmark ${JSONBENCHMARK})
Expand All @@ -97,6 +102,31 @@ add_executable(test_yaml ${TEST_YAML})
add_executable(yaml_benchmark ${YAMLBENCH})
add_executable(test_nothrow ${TEST_NOTHROW})
add_executable(test_util ${TEST_UTIL})
add_executable(test_pb ${TEST_PB})

option(HAS_PROTOBUF "import protobuf" OFF)
if(HAS_PROTOBUF)
find_package(Protobuf REQUIRED)
if(Protobuf_FOUND)
message(STATUS "Found Protobuf: ${Protobuf_VERSION}")
else()
message(STATUS "Protobuf not found")
endif()

include_directories(${Protobuf_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(PROTO_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test/proto)
file(GLOB PROTO_FILES ${PROTO_SRC_DIR}/*.proto)

protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${PROTO_FILES})
message(STATUS "Proto source files: ${PROTO_SRCS}")
message(STATUS "Proto header files: ${PROTO_HDRS}")

add_executable(pb_benchmark ${PB_BENCHMARK} ${PROTO_SRCS})
target_link_libraries(pb_benchmark ${Protobuf_LIBRARIES})
add_executable(test_proto ${PROTO_SRCS} ${TEST_PROTO})
target_link_libraries(test_proto ${Protobuf_LIBRARIES})
endif()

# unit test
option(BUILD_UNIT_TESTS "Build unit tests" ON)
Expand All @@ -121,4 +151,5 @@ add_test(NAME test_xml COMMAND test_xml)
add_test(NAME test_yaml COMMAND test_yaml)
add_test(NAME test_nothrow COMMAND test_nothrow)
add_test(NAME test_util COMMAND test_util)
add_test(NAME test_xml_nothrow COMMAND test_xml_nothrow)
add_test(NAME test_xml_nothrow COMMAND test_xml_nothrow)
add_test(NAME test_pb COMMAND test_pb)
Loading
Loading