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

Bugs and Improvements for CPP SDK and Example #3318

Merged
merged 4 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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 build/build-sdk-images/cpp/build-sdk-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ has already built - using cached version. \
Use make clean-sdk-conformance-tests if you want to start from scratch"
fi
cd $DIR/sdk/.build
cmake --build . --target install
cmake --build . --target install -j$(nproc)
cd $DIR && mkdir -p .build && cd .build
cmake .. -G "Unix Makefiles" \
-DCMAKE_PREFIX_PATH=$DIR/sdk/.build \
-Dagones_DIR=$DIR/sdk/.build/agones/cmake \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.bin
cmake --build . --target install
cmake --build . --target install -j$(nproc)
32 changes: 18 additions & 14 deletions examples/cpp-simple/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,31 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcc:9 as builder
FROM debian:bullseye as builder

WORKDIR /project
RUN apt-get update && apt-get install -y \
build-essential autoconf libtool git pkg-config \
automake libtool curl make g++ unzip moreutils cmake \
&& apt-get clean

RUN wget -q https://cmake.org/files/v3.14/cmake-3.14.1-Linux-x86_64.sh -O /cmake-3.14.1-Linux-x86_64.sh
RUN mkdir /opt/cmake
RUN sh /cmake-3.14.1-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
RUN cmake --version
WORKDIR /project

COPY ./sdks/cpp sdk
RUN cd sdk && mkdir -p .build && \
RUN cd sdk && \
mkdir -p .build && \
cd .build && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DAGONES_SILENT_OUTPUT=ON -G "Unix Makefiles" -Wno-dev && \
cmake --build . --target install
cmake .. -DCMAKE_BUILD_TYPE=Release -DAGONES_SILENT_OUTPUT=OFF -DCMAKE_INSTALL_PREFIX=/project/sdk/.build \
-DAGONES_THIRDPARTY_INSTALL_PATH=/project/sdk/.build -G "Unix Makefiles" -Wno-dev && \
cmake --build . --target install -j$(nproc)

COPY ./examples/cpp-simple cpp-simple
RUN cd cpp-simple && mkdir -p .build && \
cd .build && \
cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.bin && \
cmake --build . --target install
RUN cd cpp-simple && mkdir -p .build && cd .build && \
cmake .. -G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=/project/sdk/.build \
-Dagones_DIR=/project/sdk/.build/agones/cmake \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.bin && \
cmake --build . --target install -j$(nproc)

FROM debian:bullseye
RUN useradd -u 1000 -m server
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp-simple/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ REPOSITORY = us-docker.pkg.dev/agones-images/examples
# Directory that this Makefile is in.
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
project_path := $(dir $(mkfile_path))
server_tag = $(REPOSITORY)/cpp-simple-server:0.15
server_tag = $(REPOSITORY)/cpp-simple-server:0.16
root_path = $(realpath $(project_path)/../..)

# _____ _
Expand Down
2 changes: 1 addition & 1 deletion sdks/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
set(CMAKE_DEBUG_POSTFIX "d")
set(AGONES_GRPC_VERSION "1.50.1")
set(AGONES_GRPC_VERSION "1.53.0")

# Platform specific stuff
if (WIN32)
Expand Down
2 changes: 1 addition & 1 deletion sdks/cpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ build:
-mkdir $(build_path)
-mkdir $(archive_path)
cd $(build_path) && cmake .. -DCMAKE_BUILD_TYPE=Release -DAGONES_SILENT_OUTPUT=ON -G "Unix Makefiles" -Wno-dev -DCMAKE_INSTALL_PREFIX=.install
cd $(build_path) && cmake --build . --target install -- -s
cd $(build_path) && cmake --build . --target install -j$(nproc) -- -s

verify:
cd $(build_path)/clang-format && cmake . -DAGONES_SILENT_OUTPUT=ON
Expand Down
2 changes: 1 addition & 1 deletion sdks/cpp/build_scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ cd ..
mkdir -p .build
cd .build
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -Wno-dev -DCMAKE_INSTALL_PREFIX=./install
cmake --build . --target install
cmake --build . --target install -j$(nproc)
6 changes: 5 additions & 1 deletion sdks/cpp/cmake/prerequisites.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ endif()

# gRPC repo and version
set(gRPC_GIT_REPO "https://github.com/gRPC/gRPC.git")
set(gRPC_GIT_TAG "v1.50.1")
set(gRPC_GIT_TAG "v1.53.0")

# OpenSSL required only for successful build gRPC
set(OPENSSL_GIT_REPO "https://github.com/openssl/openssl.git")
Expand Down Expand Up @@ -177,6 +177,9 @@ if (NOT ${gRPC_FOUND})
"-Dprotobuf_MSVC_STATIC_RUNTIME=OFF"
"-Dprotobuf_BUILD_TESTS=OFF"
)
invoke_cmake_build(absl ${gRPC_SOURCE_DIR}/third_party/abseil-cpp
"-DABSL_BUILD_TESTING=OFF"
)

# Build gRPC as cmake package
set(OPENSSL_PARAM "")
Expand Down Expand Up @@ -205,6 +208,7 @@ if (NOT ${gRPC_FOUND})
"-DgRPC_ZLIB_PROVIDER=package"
"-DgRPC_CARES_PROVIDER=package"
"-DgRPC_SSL_PROVIDER=package"
"-DgRPC_ABSL_PROVIDER=package"
${GRPC_EXTRA_FLAGS}
)
set(AGONES_OWN_GRPC TRUE CACHE BOOL "Third party is built by Agones" FORCE)
Expand Down
Loading