Skip to content

Commit

Permalink
Build proto files in cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
lalinsky committed Feb 25, 2024
1 parent 17fa756 commit feb0535
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 12 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
- run: |
sudo apt-get update
sudo apt-get install -y qt6-base-dev libgtest-dev libgrpc++-dev protobuf-compiler-grpc protobuf-compiler libsqlite3-dev
- run: ./update_proto.sh
- run: cmake -DCMAKE_BUILD_TYPE=Release .
- run: make
- run: make check
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ jobs:
sudo apt-get update
sudo apt-get install -y qt6-base-dev libgtest-dev libgrpc++-dev protobuf-compiler-grpc protobuf-compiler libsqlite3-dev
- name: Build proto files
run: |
./update_proto.sh
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
Expand Down
34 changes: 34 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,40 @@ set(fpserver_SOURCES
add_library(fpserverlib ${fpserver_SOURCES})
target_link_libraries(fpserverlib fpindexlib qhttp PkgConfig::GRPCPP PkgConfig::PROTOBUF)

add_custom_command(
COMMAND
protoc
-Isrc/server/grpc/proto
--cpp_out=src/server/grpc/proto
--grpc_out=src/server/grpc/proto
--plugin=protoc-gen-grpc=/usr/bin/grpc_cpp_plugin
src/server/grpc/proto/index.proto
OUTPUT
src/server/grpc/proto/index.pb.h
src/server/grpc/proto/index.pb.cc
src/server/grpc/proto/index.grpc.pb.h
src/server/grpc/proto/index.grpc.pb.cc
DEPENDS
src/server/grpc/proto/index.proto
)

add_custom_command(
COMMAND
protoc
-Isrc/server/grpc/proto
--cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/src/server/grpc/proto
src/server/grpc/proto/google/api/annotations.proto
src/server/grpc/proto/google/api/http.proto
OUTPUT
src/server/grpc/proto/google/api/annotations.pb.h
src/server/grpc/proto/google/api/annotations.pb.cc
src/server/grpc/proto/google/api/http.pb.h
src/server/grpc/proto/google/api/http.pb.cc
DEPENDS
src/server/grpc/proto/google/api/annotations.proto
src/server/grpc/proto/google/api/http.proto
)

include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/server/grpc/proto
Expand Down
7 changes: 0 additions & 7 deletions update_proto.sh

This file was deleted.

0 comments on commit feb0535

Please sign in to comment.