File tree Expand file tree Collapse file tree 4 files changed +28
-17
lines changed Expand file tree Collapse file tree 4 files changed +28
-17
lines changed Original file line number Diff line number Diff line change @@ -131,9 +131,7 @@ for detailed advice.
131
131
132
132
#### C++ language version
133
133
134
- ** C++11.**
135
-
136
- NOTE: The code does not yet fully conform to this, and some files require C++17.
134
+ ** C++17.**
137
135
138
136
Rationale: This is a compromise between being compatible with older, proprietary
139
137
toolchains, 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.
59
59
- We recommend ` conda ` as it provides cross-language
60
60
support and integrates smoothly with ` pip ` (Python's built-in package manager)
61
61
- 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.
66
64
67
65
Note 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
69
67
portability details.
70
68
71
69
## 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.
96
96
97
97
#### C++ Language Considerations
98
98
99
- * The code is C++11 -compatible to work with older toolchains.
99
+ * The code is C++17 -compatible to work with older toolchains.
100
100
* The runtime does not use exceptions or RTTI, although it is not antagonistic
101
101
to them.
102
102
* The code is compatible with GCC and Clang, and has also been built with
Original file line number Diff line number Diff line change 13
13
14
14
#pragma once
15
15
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
17
33
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"
20
37
#endif
21
38
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"
27
42
#endif
28
43
29
44
/*
You can’t perform that action at this time.
0 commit comments