Skip to content

Commit

Permalink
Option for CMake silent output
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Sazonov authored and markmandel committed Apr 19, 2019
1 parent d69fe68 commit f87ef94
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build/build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ RUN echo "export PATH=/usr/local/go/bin:/go/bin/:\$PATH" >> /root/.bashrc
RUN echo "export EDITOR=nano" >> /root/.bashrc

# update CMake
RUN wget https://github.com/Kitware/CMake/releases/download/v3.14.0/cmake-3.14.0-Linux-x86_64.sh && mkdir /opt/cmake && \
RUN wget -nv https://github.com/Kitware/CMake/releases/download/v3.14.0/cmake-3.14.0-Linux-x86_64.sh && mkdir /opt/cmake && \
sh ./cmake-3.14.0-Linux-x86_64.sh --skip-license --prefix=/opt/cmake && export PATH=$PATH:/opt/cmake/bin

# install terraform
Expand Down
24 changes: 24 additions & 0 deletions sdks/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,30 @@

cmake_minimum_required (VERSION 3.13.0)

# Silent cmake/build output (internal option)
# Extra command line options
# For windows: cmake --build . --config Release --target install -- /v:quiet /nologo
# For *nix: cmake --build . --target install -- -s
option(AGONES_SILENT_OUTPUT "Show only warnings/error messages" OFF)
if (AGONES_SILENT_OUTPUT)
function(message)
list(GET ARGV 0 MessageType)
if(MessageType STREQUAL FATAL_ERROR OR
MessageType STREQUAL SEND_ERROR OR
MessageType STREQUAL WARNING OR
MessageType STREQUAL AUTHOR_WARNING)
list(REMOVE_AT ARGV 0)
_message(${MessageType} "${ARGV}")
endif()
endfunction()

set(CMAKE_INSTALL_MESSAGE NEVER)
set(CMAKE_VERBOSE_MAKEFILE OFF)
set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
set_property(GLOBAL PROPERTY TARGET_MESSAGES OFF)
endif(AGONES_SILENT_OUTPUT)

# Project AGONES
project(agones VERSION 0.9.0 HOMEPAGE_URL https://github.com/GoogleCloudPlatform/agones LANGUAGES C CXX)

# Build options
Expand Down
6 changes: 3 additions & 3 deletions sdks/cpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ install_path := /opt/local

build:
-mkdir $(build_path)
cd $(build_path) && cmake .. -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -Wno-dev -DCMAKE_INSTALL_PREFIX=.install
cd $(build_path) && cmake --build . --target install
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

install:
cp -r $(build_path)/.install $(install_path)

archive: VERSION = "dev"
archive:
cd $(package_path) && tar cvf $(build_path)/agonessdk-$(VERSION)-linux-arch_64.tar.gz *
cd $(package_path) && tar cf $(build_path)/agonessdk-$(VERSION)-linux-arch_64.tar.gz *

clean:
-rm -rf $(build_path)

0 comments on commit f87ef94

Please sign in to comment.