Skip to content

Commit 036f369

Browse files
committed
Change /O2 handling on Windows to better approach
The conflict is with /RCT1, which seems to be a debugging flag, so the thing to do is to avoid adding /O2 when the configuration is debug.
1 parent ff19378 commit 036f369

File tree

8 files changed

+16
-17
lines changed

8 files changed

+16
-17
lines changed

pybind_interface/avx2/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ project(qsim)
1717

1818
if(WIN32)
1919
add_compile_options(/arch:AVX2 /openmp)
20-
# Only apply /O2 if the configuration is RELEASE.
20+
# Add /O2 to any configuration that is NOT Debug.
2121
# This prevents a conflict with /RTC1 in DEBUG builds.
22-
add_compile_options($<$<CONFIG:RELEASE>:/O2>)
22+
add_compile_options($<$<NOT:$<CONFIG:Debug>>:/O2>)
2323
else()
2424
add_compile_options(-mavx2 -mfma -O3 -flto=auto)
2525
endif()

pybind_interface/avx512/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ project(qsim)
1717

1818
if(WIN32)
1919
add_compile_options(/arch:AVX512 /openmp)
20-
# Only apply /O2 if the configuration is RELEASE.
20+
# Add /O2 to any configuration that is NOT Debug.
2121
# This prevents a conflict with /RTC1 in DEBUG builds.
22-
add_compile_options($<$<CONFIG:RELEASE>:/O2>)
22+
add_compile_options($<$<NOT:$<CONFIG:Debug>>:/O2>)
2323
else()
2424
add_compile_options(-mavx512f -mbmi2 -O3 -flto=auto)
2525
endif()

pybind_interface/basic/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ project(qsim)
1717

1818
if(WIN32)
1919
add_compile_options(/openmp)
20-
# Only apply /O2 if the configuration is RELEASE.
20+
# Add /O2 to any configuration that is NOT Debug.
2121
# This prevents a conflict with /RTC1 in DEBUG builds.
22-
add_compile_options($<$<CONFIG:RELEASE>:/O2>)
22+
add_compile_options($<$<NOT:$<CONFIG:Debug>>:/O2>)
2323
else()
2424
add_compile_options(-O3 -flto=auto)
2525
endif()

pybind_interface/cuda/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ project(qsim LANGUAGES CXX CUDA)
1818
if(WIN32)
1919
# Always apply AVX2 and openmp on Windows
2020
add_compile_options(/openmp)
21-
22-
# Only apply /O2 if the configuration is RELEASE.
21+
# Add /O2 to any configuration that is NOT Debug.
2322
# This prevents a conflict with /RTC1 in DEBUG builds.
24-
add_compile_options($<$<CONFIG:RELEASE>:/O2>)
23+
add_compile_options($<$<NOT:$<CONFIG:Debug>>:/O2>)
2524
else()
2625
add_compile_options(-O3 -flto=auto)
2726
endif()

pybind_interface/custatevec/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ project(qsim LANGUAGES CXX CUDA)
1717

1818
if(WIN32)
1919
add_compile_options(/openmp)
20-
# Only apply /O2 if the configuration is RELEASE.
20+
# Add /O2 to any configuration that is NOT Debug.
2121
# This prevents a conflict with /RTC1 in DEBUG builds.
22-
add_compile_options($<$<CONFIG:RELEASE>:/O2>)
22+
add_compile_options($<$<NOT:$<CONFIG:Debug>>:/O2>)
2323
else()
2424
add_compile_options(-O3 -flto=auto)
2525
endif()

pybind_interface/decide/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ check_language(CUDA)
2020

2121
if(WIN32)
2222
add_compile_options(/openmp)
23-
# Only apply /O2 if the configuration is RELEASE.
23+
# Add /O2 to any configuration that is NOT Debug.
2424
# This prevents a conflict with /RTC1 in DEBUG builds.
25-
add_compile_options($<$<CONFIG:RELEASE>:/O2>)
25+
add_compile_options($<$<NOT:$<CONFIG:Debug>>:/O2>)
2626
else()
2727
add_compile_options(-O3 -flto=auto)
2828
endif()

pybind_interface/hip/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ project(qsim LANGUAGES CXX HIP)
1717

1818
if(WIN32)
1919
add_compile_options(/openmp)
20-
# Only apply /O2 if the configuration is RELEASE.
20+
# Add /O2 to any configuration that is NOT Debug.
2121
# This prevents a conflict with /RTC1 in DEBUG builds.
22-
add_compile_options($<$<CONFIG:RELEASE>:/O2>)
22+
add_compile_options($<$<NOT:$<CONFIG:Debug>>:/O2>)
2323
else()
2424
add_compile_options(-O3 -flto=auto)
2525
endif()

pybind_interface/sse/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ project(qsim)
1717

1818
if(WIN32)
1919
add_compile_options(/openmp)
20-
# Only apply /O2 if the configuration is RELEASE.
20+
# Add /O2 to any configuration that is NOT Debug.
2121
# This prevents a conflict with /RTC1 in DEBUG builds.
22-
add_compile_options($<$<CONFIG:RELEASE>:/O2>)
22+
add_compile_options($<$<NOT:$<CONFIG:Debug>>:/O2>)
2323
else()
2424
add_compile_options(-msse4.1 -O3 -flto=auto)
2525
endif()

0 commit comments

Comments
 (0)