diff --git a/CMakeLists.txt b/CMakeLists.txt index 54daf4951a..f4e04dc84b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,9 @@ project(tritonserver LANGUAGES C CXX) include(CMakeDependentOption) +# Use C++17 standard as Triton's minimum required. +set(TRITON_MIN_CXX_STANDARD 17 CACHE STRING "The minimum C++ standard which features are requested to build this target.") + set(TRITON_VERSION "0.0.0" CACHE STRING "The version of the Triton shared library" ) option(TRITON_ENABLE_LOGGING "Include logging support in server" ON) @@ -260,6 +263,7 @@ ExternalProject_Add(triton-server -DTRITON_ENABLE_S3:BOOL=${TRITON_ENABLE_S3} -DTRITON_ENABLE_TENSORRT:BOOL=${TRITON_ENABLE_TENSORRT} -DTRITON_ENABLE_ENSEMBLE:BOOL=${TRITON_ENABLE_ENSEMBLE} + -DTRITON_MIN_CXX_STANDARD:STRING=${TRITON_MIN_CXX_STANDARD} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${TRITON_INSTALL_PREFIX} -DTRITON_VERSION:STRING=${TRITON_VERSION} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fe9be17cbb..85cd1434fc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -117,7 +117,7 @@ if (NOT WIN32) set_property(TARGET main PROPERTY OUTPUT_NAME tritonserver) endif() -target_compile_features(main PRIVATE cxx_std_11) +target_compile_features(main PRIVATE cxx_std_${TRITON_MIN_CXX_STANDARD}) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") message("Using MSVC as compiler, default target on Windows 10. " "If the target system is not Windows 10, please update _WIN32_WINNT " @@ -353,7 +353,7 @@ if(${TRITON_ENABLE_HTTP} ${HTTP_ENDPOINT_SRCS} ${HTTP_ENDPOINT_HDRS} ) - target_compile_features(http-endpoint-library PRIVATE cxx_std_11) + target_compile_features(http-endpoint-library PRIVATE cxx_std_${TRITON_MIN_CXX_STANDARD}) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") target_compile_options( http-endpoint-library @@ -508,7 +508,7 @@ if(${TRITON_ENABLE_TRACING}) ) if (NOT WIN32) - target_compile_features(tracing-library PRIVATE cxx_std_17) + target_compile_features(tracing-library PRIVATE cxx_std_${TRITON_MIN_CXX_STANDARD}) target_include_directories( tracing-library @@ -592,7 +592,7 @@ if (NOT WIN32) simple.cc ) - target_compile_features(simple PRIVATE cxx_std_11) + target_compile_features(simple PRIVATE cxx_std_${TRITON_MIN_CXX_STANDARD}) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") message("Using MSVC as compiler, default target on Windows 10. " "If the target system is not Windows 10, please update _WIN32_WINNT " @@ -656,7 +656,7 @@ if (NOT WIN32) multi_server.cc ) - target_compile_features(multi_server PRIVATE cxx_std_11) + target_compile_features(multi_server PRIVATE cxx_std_${TRITON_MIN_CXX_STANDARD}) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") message("Using MSVC as compiler, default target on Windows 10. " "If the target system is not Windows 10, please update _WIN32_WINNT " @@ -721,7 +721,7 @@ if (NOT WIN32) memory_alloc.cc ) - target_compile_features(memory_alloc PRIVATE cxx_std_11) + target_compile_features(memory_alloc PRIVATE cxx_std_${TRITON_MIN_CXX_STANDARD}) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") message("Using MSVC as compiler, default target on Windows 10. " "If the target system is not Windows 10, please update _WIN32_WINNT " diff --git a/src/grpc/CMakeLists.txt b/src/grpc/CMakeLists.txt index 1308b6e1b2..8b200a591e 100644 --- a/src/grpc/CMakeLists.txt +++ b/src/grpc/CMakeLists.txt @@ -37,7 +37,7 @@ add_library( stream_infer_handler.cc ) -target_compile_features(grpc-endpoint-library PRIVATE cxx_std_11) +target_compile_features(grpc-endpoint-library PRIVATE cxx_std_${TRITON_MIN_CXX_STANDARD}) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") target_compile_options( grpc-endpoint-library