|
12 | 12 | # See the License for the specific language governing permissions and
|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
15 |
| -cmake_minimum_required (VERSION 3.5.0) |
| 15 | +cmake_minimum_required(VERSION 3.15) |
16 | 16 |
|
17 | 17 | # Silent cmake/build output (internal option)
|
18 | 18 | # Extra command line options
|
@@ -62,45 +62,36 @@ project(agones VERSION ${AGONES_VERSION} HOMEPAGE_URL https://github.com/googlef
|
62 | 62 |
|
63 | 63 | # Options
|
64 | 64 | option(AGONES_FORCE_GRPC_VERSION "Build Agones C++ SDK only with supported gRPC version" ON)
|
65 |
| -option(AGONES_BUILD_ONLY_PREREQUISITIES "Build only prerequisites of Agones" OFF) |
66 |
| -option(AGONES_ZLIB_STATIC "Use static version of ZLIB" ON) |
67 |
| -option(AGONES_BUILD_THIRDPARTY_DEBUG "Build debug version of thirdparty libraries (MSVC only)" OFF) |
68 | 65 | option(AGONES_CLANG_FORMAT "Apply clang-format (if found) as a pre-build step" OFF)
|
69 |
| -set(AGONES_THIRDPARTY_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}" CACHE STRING "Path for installing third-party OpenSSL and gRPC, if they are not found with find_package") |
70 |
| -set(AGONES_OPENSSL_CONFIG_STRING "VC-WIN64A" CACHE STRING "See https://github.com/openssl/openssl/blob/OpenSSL_1_1_1-stable/INSTALL for details") |
71 | 66 |
|
72 | 67 | # Prerequisities
|
73 | 68 | # [markmandel] - not 100% sure what include(CMakeFindDependencyMacro) does, but it solves the building issue.
|
74 | 69 | # https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#creating-a-package-configuration-file
|
75 | 70 | include(CMakeFindDependencyMacro)
|
76 |
| -include(./cmake/prerequisites.cmake) |
77 |
| -find_package(Threads REQUIRED) |
78 |
| -find_package(ZLIB REQUIRED) |
79 |
| -find_package(Protobuf REQUIRED CONFIG) |
80 |
| -find_package(gRPC ${AGONES_GRPC_VERSION} ${AGONES_GRPC_VERSION_MATCH} REQUIRED CONFIG) |
| 71 | +include(ProcessorCount) |
81 | 72 |
|
82 |
| -if (AGONES_BUILD_ONLY_PREREQUISITIES) |
83 |
| - return() |
| 73 | +ProcessorCount(CPU_COUNT) |
| 74 | +if (CPU_COUNT GREATER 0 AND NOT DEFINED CMAKE_BUILD_PARALLEL_LEVEL) |
| 75 | + set(ENV{CMAKE_BUILD_PARALLEL_LEVEL} "${CPU_COUNT}") |
| 76 | + message(STATUS "Setting CMAKE_BUILD_PARALLEL_LEVEL to $ENV{CMAKE_BUILD_PARALLEL_LEVEL}") |
84 | 77 | endif()
|
85 | 78 |
|
86 |
| -# Currently we doesn't support build time generation of proto/gRPC files, |
87 |
| -# so gRPC version should be strict |
88 |
| -set(AGONES_FORCE_GRPC_VERSION ON) |
89 |
| -set(AGONES_GRPC_VERSION_MATCH "") |
90 |
| -if (AGONES_FORCE_GRPC_VERSION) |
91 |
| - set(AGONES_GRPC_VERSION_MATCH EXACT) |
92 |
| -endif() |
| 79 | +# gRPC |
| 80 | +find_package(Protobuf REQUIRED) |
| 81 | +find_package(gRPC CONFIG REQUIRED) |
| 82 | +find_package(Threads REQUIRED) |
| 83 | + |
| 84 | +message(STATUS "gRPC version found: ${gRPC_VERSION}") |
93 | 85 |
|
94 | 86 | # Settings
|
95 | 87 | set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
96 | 88 |
|
97 |
| -set(CMAKE_CXX_STANDARD 14) |
| 89 | +set(CMAKE_CXX_STANDARD 17) |
98 | 90 | set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
99 | 91 | set(CMAKE_CXX_EXTENSIONS OFF)
|
100 | 92 | set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
101 | 93 | set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
|
102 | 94 | set(CMAKE_DEBUG_POSTFIX "d")
|
103 |
| -set(AGONES_GRPC_VERSION "1.57.0") |
104 | 95 |
|
105 | 96 | # Platform specific stuff
|
106 | 97 | if (WIN32)
|
|
0 commit comments