File tree Expand file tree Collapse file tree 9 files changed +28
-143
lines changed
Expand file tree Collapse file tree 9 files changed +28
-143
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,13 @@ endif()
7777set (CMAKE_CXX_STANDARD 17)
7878set (CMAKE_POSITION_INDEPENDENT_CODE ON )
7979
80+ # Options propagated to all sub-cmakefiles.
81+ if (WIN32 )
82+ add_compile_options (/O2 /std:c++17 /openmp)
83+ else ()
84+ add_compile_options (-O3 -std=c++17 -D_GLIBCXX_USE_CXX11_ABI=1 -flto=auto)
85+ endif ()
86+
8087# Always build the basic part.
8188add_subdirectory (pybind_interface/basic)
8289add_subdirectory (pybind_interface/decide)
@@ -105,6 +112,21 @@ if(NOT CMAKE_APPLE_SILICON_PROCESSOR)
105112 endif ()
106113endif ()
107114
115+ if (APPLE )
116+ include_directories (
117+ "/usr/local/include"
118+ "/usr/local/opt/llvm/include"
119+ "/opt/homebrew/include"
120+ "/opt/homebrew/opt/llvm@19/include"
121+ )
122+ link_directories (
123+ "/usr/local/lib"
124+ "/usr/local/opt/llvm/lib"
125+ "/opt/homebrew/lib"
126+ "/opt/homebrew/opt/llvm@19/lib"
127+ )
128+ endif ()
129+
108130
109131# ~~~~~ Print misc. info ~~~~~
110132
Original file line number Diff line number Diff line change @@ -16,26 +16,11 @@ cmake_minimum_required(VERSION 3.31)
1616project (qsim)
1717
1818IF (WIN32 )
19- set (CMAKE_CXX_FLAGS "/arch:AVX2 /O2 /openmp " )
19+ set (CMAKE_CXX_FLAGS "/arch:AVX2" )
2020ELSE ()
21- set (CMAKE_CXX_FLAGS "-mavx2 -mfma -O3 " )
21+ set (CMAKE_CXX_FLAGS "-mavx2 -mfma" )
2222ENDIF ()
2323
24- if (APPLE )
25- include_directories (
26- "/usr/local/include"
27- "/usr/local/opt/llvm/include"
28- "/opt/homebrew/include"
29- "/opt/homebrew/opt/llvm@19/include"
30- )
31- link_directories (
32- "/usr/local/lib"
33- "/usr/local/opt/llvm/lib"
34- "/opt/homebrew/lib"
35- "/opt/homebrew/opt/llvm@19/lib"
36- )
37- endif ()
38-
3924INCLUDE (../GetPybind11.cmake)
4025pybind11_add_module(qsim_avx2 pybind_main_avx2.cpp)
4126
Original file line number Diff line number Diff line change @@ -16,26 +16,11 @@ cmake_minimum_required(VERSION 3.31)
1616project (qsim)
1717
1818IF (WIN32 )
19- set (CMAKE_CXX_FLAGS "/arch:AVX512 /O2 /openmp " )
19+ set (CMAKE_CXX_FLAGS "/arch:AVX512" )
2020ELSE ()
21- set (CMAKE_CXX_FLAGS "-mavx512f -mbmi2 -O3 " )
21+ set (CMAKE_CXX_FLAGS "-mavx512f -mbmi2" )
2222ENDIF ()
2323
24- if (APPLE )
25- include_directories (
26- "/usr/local/include"
27- "/usr/local/opt/llvm/include"
28- "/opt/homebrew/include"
29- "/opt/homebrew/opt/llvm@19/include"
30- )
31- link_directories (
32- "/usr/local/lib"
33- "/usr/local/opt/llvm/lib"
34- "/opt/homebrew/lib"
35- "/opt/homebrew/opt/llvm@19/lib"
36- )
37- endif ()
38-
3924INCLUDE (../GetPybind11.cmake)
4025pybind11_add_module(qsim_avx512 pybind_main_avx512.cpp)
4126
Original file line number Diff line number Diff line change 1515cmake_minimum_required (VERSION 3.31)
1616project (qsim)
1717
18- if (WIN32 )
19- set (CMAKE_CXX_FLAGS "/O2 /openmp" )
20- else ()
21- set (CMAKE_CXX_FLAGS "-O3" )
22- endif ()
23-
24- if (APPLE )
25- include_directories (
26- "/usr/local/include"
27- "/usr/local/opt/llvm/include"
28- "/opt/homebrew/include"
29- "/opt/homebrew/opt/llvm@19/include"
30- )
31- link_directories (
32- "/usr/local/lib"
33- "/usr/local/opt/llvm/lib"
34- "/opt/homebrew/lib"
35- "/opt/homebrew/opt/llvm@19/lib"
36- )
37- endif ()
38-
3918INCLUDE (../GetPybind11.cmake)
4019pybind11_add_module(qsim_basic pybind_main_basic.cpp)
4120
Original file line number Diff line number Diff line change 1515cmake_minimum_required (VERSION 3.31)
1616project (qsim LANGUAGES CXX CUDA)
1717
18- if (WIN32 )
19- set (CMAKE_CXX_FLAGS "/O2 /openmp" )
20- else ()
21- set (CMAKE_CXX_FLAGS "-O3" )
22- endif ()
23-
24- if (APPLE )
25- include_directories (
26- "/usr/local/include"
27- "/usr/local/opt/llvm/include"
28- "/opt/homebrew/include"
29- "/opt/homebrew/opt/llvm@19/include"
30- )
31- link_directories (
32- "/usr/local/lib"
33- "/usr/local/opt/llvm/lib"
34- "/opt/homebrew/lib"
35- "/opt/homebrew/opt/llvm@19/lib"
36- )
37- endif ()
38-
3918include (../GetPybind11.cmake)
4019include (../GetCUDAARCHS.cmake)
4120
Original file line number Diff line number Diff line change 1515cmake_minimum_required (VERSION 3.31)
1616project (qsim LANGUAGES CXX CUDA)
1717
18- if (WIN32 )
19- set (CMAKE_CXX_FLAGS "/O2 /openmp" )
20- else ()
21- set (CMAKE_CXX_FLAGS "-O3" )
22- endif ()
23-
24- if (APPLE )
25- include_directories (
26- "/usr/local/include"
27- "/usr/local/opt/llvm/include"
28- "/opt/homebrew/include"
29- "/opt/homebrew/opt/llvm@19/include"
30- )
31- link_directories (
32- "/usr/local/lib"
33- "/usr/local/opt/llvm/lib"
34- "/opt/homebrew/lib"
35- "/opt/homebrew/opt/llvm@19/lib"
36- )
37- endif ()
38-
3918INCLUDE (../GetPybind11.cmake)
4019find_package (Python3 3.10 REQUIRED)
4120
Original file line number Diff line number Diff line change @@ -18,27 +18,6 @@ project(qsim LANGUAGES CXX)
1818include (CheckLanguage)
1919check_language(CUDA)
2020
21- if (WIN32 )
22- set (CMAKE_CXX_FLAGS "/O2 /openmp" )
23- else ()
24- set (CMAKE_CXX_FLAGS "-O3" )
25- endif ()
26-
27- if (APPLE )
28- include_directories (
29- "/usr/local/include"
30- "/usr/local/opt/llvm/include"
31- "/opt/homebrew/include"
32- "/opt/homebrew/opt/llvm@19/include"
33- )
34- link_directories (
35- "/usr/local/lib"
36- "/usr/local/opt/llvm/lib"
37- "/opt/homebrew/lib"
38- "/opt/homebrew/opt/llvm@19/lib"
39- )
40- endif ()
41-
4221include (../GetPybind11.cmake)
4322
4423# Configure based on the detected platform
Original file line number Diff line number Diff line change 1515cmake_minimum_required (VERSION 3.31)
1616project (qsim LANGUAGES CXX HIP)
1717
18- if (WIN32 )
19- set (CMAKE_CXX_FLAGS "/O2 /openmp" )
20- else ()
21- set (CMAKE_CXX_FLAGS "-O3" )
22- endif ()
23-
2418INCLUDE (../GetPybind11.cmake)
2519find_package (PythonLibs 3.10 REQUIRED)
2620
Original file line number Diff line number Diff line change 1515cmake_minimum_required (VERSION 3.31)
1616project (qsim)
1717
18- IF (WIN32 )
19- set (CMAKE_CXX_FLAGS "/O2 /openmp" )
20- ELSE ()
21- set (CMAKE_CXX_FLAGS "-msse4.1 -O3" )
22- ENDIF ()
23-
24- if (APPLE )
25- include_directories (
26- "/usr/local/include"
27- "/usr/local/opt/llvm/include"
28- "/opt/homebrew/include"
29- "/opt/homebrew/opt/llvm@19/include"
30- )
31- link_directories (
32- "/usr/local/lib"
33- "/usr/local/opt/llvm/lib"
34- "/opt/homebrew/lib"
35- "/opt/homebrew/opt/llvm@19/lib"
36- )
18+ if (NOT WIN32 )
19+ add_compile_options ("-msse4.1" )
3720endif ()
3821
3922INCLUDE (../GetPybind11.cmake)
You can’t perform that action at this time.
0 commit comments