Skip to content

Commit f96f149

Browse files
leofangclaude
andcommitted
cuda.core: add C++17 standard flag and use -O2 optimization
Pass -std=c++17 (Linux) / /std:c++17 (Windows) for all builds, and use -O2 instead of -O3 for non-debug Linux builds. Partially addresses #1882. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7a9a248 commit f96f149

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

cuda_core/build_hooks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,17 @@ def get_sources(mod_name):
167167
extra_link_args = []
168168
extra_cythonize_kwargs = {}
169169
if sys.platform == "win32":
170+
extra_compile_args += ["/std:c++17"]
170171
if debug:
171172
raise RuntimeError("Debuggable builds are not supported on Windows.")
172173
else:
174+
extra_compile_args += ["-std=c++17"]
173175
if debug:
174176
extra_cythonize_kwargs["gdb_debug"] = True
175177
extra_compile_args += ["-g", "-O0"]
176178
extra_compile_args += ["-D _GLIBCXX_ASSERTIONS"]
177179
else:
178-
extra_compile_args += ["-O3"]
180+
extra_compile_args += ["-O2"]
179181
extra_link_args += ["-Wl,--strip-all"]
180182
if COMPILE_FOR_COVERAGE:
181183
# CYTHON_TRACE_NOGIL indicates to trace nogil functions. It is not

0 commit comments

Comments
 (0)