mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Make language std configurable. (#75519)
RocksDB 7 starts to use C++17 in header. We should make this configurable, in case user needs higher std version. List of files to changed is found by `git grep 'CMAKE_[^_]*_STANDARD'`. Doc string is from CMake code. Pull Request resolved: https://github.com/pytorch/pytorch/pull/75519 Approved by: https://github.com/malfet
This commit is contained in:
committed by
PyTorch MergeBot
parent
3c7044728b
commit
dff70a5e1a
@ -37,8 +37,8 @@ if(env_cxx_standard GREATER -1)
|
||||
WARNING "C++ standard version definition detected in environment variable."
|
||||
"PyTorch requires -std=c++14. Please remove -std=c++ settings in your environment.")
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard whose features are requested to build this target.")
|
||||
set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard whose features are requested to build this target.")
|
||||
|
||||
if(DEFINED GLIBCXX_USE_CXX11_ABI)
|
||||
if(${GLIBCXX_USE_CXX11_ABI} EQUAL 1)
|
||||
|
@ -14,7 +14,7 @@ endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard whose features are requested to build this target.")
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
message(STATUS "ANDROID_STL:${ANDROID_STL}")
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.4.1)
|
||||
project(pytorch_vision_jni CXX)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard whose features are requested to build this target.")
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
|
||||
set(pytorch_vision_cpp_DIR ${CMAKE_CURRENT_LIST_DIR}/src/main/cpp)
|
||||
|
@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.4.1)
|
||||
set(PROJECT_NAME pytorch_testapp_jni)
|
||||
project(${PROJECT_NAME} CXX)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard whose features are requested to build this target.")
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
|
||||
set(build_DIR ${CMAKE_SOURCE_DIR}/build)
|
||||
|
@ -3,7 +3,7 @@ if(PYTORCH_NNAPI_STANDALONE)
|
||||
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
|
||||
project(pytorch_nnapi)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard whose features are requested to build this target.")
|
||||
find_package(Torch REQUIRED)
|
||||
|
||||
set(NNAPI_SRCS
|
||||
|
@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
|
||||
project(c10 CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard whose features are requested to build this target.")
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Main build file for the C10 library.
|
||||
|
@ -1654,14 +1654,14 @@ if(NOT INTERN_BUILD_MOBILE)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.1")
|
||||
set(CMAKE_C_FLAGS "-std=c11 ${CMAKE_C_FLAGS}")
|
||||
else()
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard whose features are requested to build this target.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(APPEND CMAKE_CUDA_FLAGS " -Wno-deprecated-gpu-targets --expt-extended-lambda")
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard whose features are requested to build this target.")
|
||||
endif()
|
||||
|
||||
# use cub in a safe manner, see:
|
||||
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
project(custom_build_project)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard whose features are requested to build this target.")
|
||||
|
||||
# Find torch library
|
||||
find_package(Torch REQUIRED)
|
||||
|
@ -19,7 +19,7 @@ endif(MSVC)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.1")
|
||||
set(CMAKE_CXX_FLAGS "-std=c++14 ${CMAKE_CXX_FLAGS}")
|
||||
else()
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard whose features are requested to build this target.")
|
||||
endif()
|
||||
|
||||
add_library(shm SHARED core.cpp)
|
||||
|
Reference in New Issue
Block a user