File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -131,9 +131,7 @@ for detailed advice.
131131
132132#### C++ language version
133133
134- ** C++11.**
135-
136- NOTE: The code does not yet fully conform to this, and some files require C++17.
134+ ** C++17.**
137135
138136Rationale: This is a compromise between being compatible with older, proprietary
139137toolchains, and having access to relatively modern C++ features.
Original file line number Diff line number Diff line change @@ -59,13 +59,11 @@ also work in similar environments.
5959 - We recommend ` conda ` as it provides cross-language
6060 support and integrates smoothly with ` pip ` (Python's built-in package manager)
6161 - Otherwise, Python's built-in virtual environment manager ` python venv ` is a good alternative.
62- * ` g++ ` version 8 or higher, ` clang++ ` version 8 or higher, or another
63- C++17-compatible toolchain that supports GNU C-style [ statement
64- expressions] ( https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html ) (`({ ...
65- })` syntax).
62+ * ` g++ ` version 7 or higher, ` clang++ ` version 5 or higher, or another
63+ C++17-compatible toolchain.
6664
6765Note that the cross-compilable core runtime code supports a wider range of
68- toolchains, down to C++11 . See the [ Runtime Overview] ( ./runtime-overview.md ) for
66+ toolchains, down to C++17 . See the [ Runtime Overview] ( ./runtime-overview.md ) for
6967portability details.
7068
7169## Quick Setup: Colab/Jupyter Notebook Prototype
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ can build it for a wide variety of target systems.
9696
9797#### C++ Language Considerations
9898
99- * The code is C++11 -compatible to work with older toolchains.
99+ * The code is C++17 -compatible to work with older toolchains.
100100* The runtime does not use exceptions or RTTI, although it is not antagonistic
101101 to them.
102102* The code is compatible with GCC and Clang, and has also been built with
Original file line number Diff line number Diff line change 1313
1414#pragma once
1515
16- // Compiler support checks.
16+ /*
17+ * Compiler support checks. Follows the logic used by pytorch/c10/util/C++17.h
18+ * but may support older versions.
19+ */
20+
21+ // https://gcc.gnu.org/projects/cxx-status.html#cxx17
22+ #if !defined(__clang__ ) && !defined(_MSC_VER ) && defined(__GNUC__ ) && \
23+ __GNUC__ < 7
24+ #error \
25+ "You're trying to build ExecuTorch with a too old version of GCC. We need GCC 7 or later."
26+ #endif
27+
28+ // https://clang.llvm.org/cxx_status.html#cxx17
29+ #if defined(__clang__ ) && __clang_major__ < 5
30+ #error \
31+ "You're trying to build ExecuTorch with a too old version of Clang. We need Clang 5 or later."
32+ #endif
1733
18- #if !defined(__cplusplus )
19- #error ExecuTorch must be compiled using a C++ compiler.
34+ #if (defined(_MSC_VER ) && (!defined(_MSVC_LANG ) || _MSVC_LANG < 201703L )) || \
35+ (!defined(_MSC_VER ) && __cplusplus < 201703L )
36+ #error "You need C++17 to compile ExecuTorch"
2037#endif
2138
22- #if __cplusplus < 201103L && (!defined(_MSC_VER ) || _MSC_VER < 1600 ) && \
23- (!defined(__GNUC__ ) || \
24- (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ < 40400 ))
25- #error ExecuTorch must use a compiler supporting at least the C++11 standard.
26- #error __cplusplus _MSC_VER __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__
39+ #if defined(_WIN32 ) && (defined(min ) || defined(max ))
40+ #error \
41+ "Macro clash with min and max -- define NOMINMAX when compiling your program on Windows"
2742#endif
2843
2944/*
You can’t perform that action at this time.
0 commit comments