File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- project (qsim)
2-
31set (CMAKE_CXX_STANDARD 11)
42cmake_minimum_required (VERSION 3.31 )
53
6- # Check if CMAKE_SYSTEM_NAME is Darwin (macOS) and CMAKE_SYSTEM_PROCESSOR is arm64
4+ # Set prelimary value so that other variables we need are defined
5+ project (qsim)
6+
7+ # Darwin + Arm64 => Apple Silicon, where we can't build Cuda, AVX or SSE features.
78if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" )
89 set (APPLE_ARM TRUE )
910else ()
1011 set (APPLE_ARM FALSE )
1112endif ()
1213
13- # Set the project name and language
14+ # Set the project name and language more precisely
1415if (APPLE )
1516 project (qsim LANGUAGES CXX )
1617else ()
Original file line number Diff line number Diff line change @@ -5,24 +5,6 @@ FetchContent_Declare(
55 pybind11
66 GIT_REPOSITORY https://github.com/pybind/pybind11
77 GIT_TAG "v${MIN_PYBIND_VERSION} "
8+ OVERRIDE_FIND_PACKAGE
89)
9- FetchContent_GetProperties (pybind11)
10- find_package (pybind11 "${MIN_PYBIND_VERSION} " CONFIG )
11-
12- if (pybind11_FOUND)
13- message (STATUS "Found pybind11 v${pybind11_VERSION} : ${pybind11_INCLUDE_DIRS} " )
14- # The pybind11_add_module doesn't correctly set the CXX_INCLUDES properly if a system pybind11 is found.
15- # Using `include_directories(${pybind11_INCLUDE_DIRS})` doesn't result in anything in
16- # CXX_INCLUDES. e.g., `pybind_interface/basic/CMakeFiles/qsim_basic.dir/flags.make` would only
17- # have `CXX_INCLUDES = -isystem $PREFIX/include/python3.11` and would miss `$PREFIX/include`.
18- # This problem would result in `fatal error: pybind11/complex.h: No such file or directory`
19- # This is a hack to get around that by passing `-I/path/to/include` to CXX_FLAGS
20- # Iterate over each include directory and add it as a compile option
21- foreach (INCLUDE_DIR ${pybind11_INCLUDE_DIRS} )
22- add_compile_options ("-I${INCLUDE_DIR} " )
23- endforeach ()
24- endif ()
25-
26- if ((NOT pybind11_FOUND) AND (NOT pybind11_POPULATED)) # check first on system path, then attempt git fetch
27- FetchContent_MakeAvailable (pybind11)
28- endif ()
10+ FetchContent_MakeAvailable (pybind11)
Original file line number Diff line number Diff line change 99
1010if (APPLE )
1111 set (CMAKE_CXX_STANDARD 14)
12- include_directories ("/usr/local/include" "/usr/local/opt/llvm/include" )
13- link_directories ("/usr/local/lib" "/usr/local/opt/llvm/lib" )
12+ include_directories (
13+ "/usr/local/include"
14+ "/usr/local/opt/llvm/include"
15+ "/opt/homebrew/include"
16+ "/opt/homebrew/opt/llvm@19/include"
17+ )
18+ link_directories (
19+ "/usr/local/lib"
20+ "/usr/local/opt/llvm/lib"
21+ "/opt/homebrew/lib"
22+ "/opt/homebrew/opt/llvm@19/lib"
23+ )
1424endif ()
25+
1526INCLUDE (../GetPybind11.cmake )
1627pybind11_add_module (qsim_avx2 pybind_main_avx2.cpp )
1728
Original file line number Diff line number Diff line change @@ -10,8 +10,18 @@ ENDIF()
1010
1111if (APPLE )
1212 set (CMAKE_CXX_STANDARD 14)
13- include_directories ("/usr/local/include" "/usr/local/opt/llvm/include" )
14- link_directories ("/usr/local/lib" "/usr/local/opt/llvm/lib" )
13+ include_directories (
14+ "/usr/local/include"
15+ "/usr/local/opt/llvm/include"
16+ "/opt/homebrew/include"
17+ "/opt/homebrew/opt/llvm@19/include"
18+ )
19+ link_directories (
20+ "/usr/local/lib"
21+ "/usr/local/opt/llvm/lib"
22+ "/opt/homebrew/lib"
23+ "/opt/homebrew/opt/llvm@19/lib"
24+ )
1525endif ()
1626
1727INCLUDE (../GetPybind11.cmake )
Original file line number Diff line number Diff line change @@ -10,8 +10,18 @@ endif()
1010
1111if (APPLE )
1212 set (CMAKE_CXX_STANDARD 14)
13- include_directories ("/usr/local/include" "/usr/local/opt/llvm/include" )
14- link_directories ("/usr/local/lib" "/usr/local/opt/llvm/lib" )
13+ include_directories (
14+ "/usr/local/include"
15+ "/usr/local/opt/llvm/include"
16+ "/opt/homebrew/include"
17+ "/opt/homebrew/opt/llvm@19/include"
18+ )
19+ link_directories (
20+ "/usr/local/lib"
21+ "/usr/local/opt/llvm/lib"
22+ "/opt/homebrew/lib"
23+ "/opt/homebrew/opt/llvm@19/lib"
24+ )
1525endif ()
1626
1727INCLUDE (../GetPybind11.cmake )
Original file line number Diff line number Diff line change 77 set (CMAKE_CXX_FLAGS "-O3" )
88endif ()
99
10-
1110if (APPLE )
1211 set (CMAKE_CXX_STANDARD 14)
13- include_directories ("/usr/local/include" "/usr/local/opt/llvm/include" )
14- link_directories ("/usr/local/lib" "/usr/local/opt/llvm/lib" )
12+ include_directories (
13+ "/usr/local/include"
14+ "/usr/local/opt/llvm/include"
15+ "/opt/homebrew/include"
16+ "/opt/homebrew/opt/llvm@19/include"
17+ )
18+ link_directories (
19+ "/usr/local/lib"
20+ "/usr/local/opt/llvm/lib"
21+ "/opt/homebrew/lib"
22+ "/opt/homebrew/opt/llvm@19/lib"
23+ )
1524endif ()
1625
1726INCLUDE (../GetPybind11.cmake )
Original file line number Diff line number Diff line change @@ -23,8 +23,18 @@ endif()
2323
2424if (APPLE )
2525 set (CMAKE_CXX_STANDARD 14)
26- include_directories ("/usr/local/include" "/usr/local/opt/llvm/include" )
27- link_directories ("/usr/local/lib" "/usr/local/opt/llvm/lib" )
26+ include_directories (
27+ "/usr/local/include"
28+ "/usr/local/opt/llvm/include"
29+ "/opt/homebrew/include"
30+ "/opt/homebrew/opt/llvm@19/include"
31+ )
32+ link_directories (
33+ "/usr/local/lib"
34+ "/usr/local/opt/llvm/lib"
35+ "/opt/homebrew/lib"
36+ "/opt/homebrew/opt/llvm@19/lib"
37+ )
2838endif ()
2939
3040INCLUDE (../GetPybind11.cmake )
Original file line number Diff line number Diff line change 66 set (CMAKE_CXX_FLAGS "-O3" )
77endif ()
88
9- if (APPLE AND NOT APPLE_ARM )
9+ if (APPLE )
1010 set (CMAKE_CXX_STANDARD 14)
11- include_directories ("/usr/local/include" "/usr/local/opt/llvm/include" )
12- link_directories ("/usr/local/lib" "/usr/local/opt/llvm/lib" )
11+ include_directories (
12+ "/usr/local/include"
13+ "/usr/local/opt/llvm/include"
14+ "/opt/homebrew/include"
15+ "/opt/homebrew/opt/llvm@19/include"
16+ )
17+ link_directories (
18+ "/usr/local/lib"
19+ "/usr/local/opt/llvm/lib"
20+ "/opt/homebrew/lib"
21+ "/opt/homebrew/opt/llvm@19/lib"
22+ )
1323endif ()
1424
1525include (../GetPybind11.cmake )
Original file line number Diff line number Diff line change 77 set (CMAKE_CXX_FLAGS "-msse4.1 -O3" )
88ENDIF ()
99
10-
1110if (APPLE )
1211 set (CMAKE_CXX_STANDARD 14)
13- include_directories ("/usr/local/include" "/usr/local/opt/llvm/include" )
14- link_directories ("/usr/local/lib" "/usr/local/opt/llvm/lib" )
12+ include_directories (
13+ "/usr/local/include"
14+ "/usr/local/opt/llvm/include"
15+ "/opt/homebrew/include"
16+ "/opt/homebrew/opt/llvm@19/include"
17+ )
18+ link_directories (
19+ "/usr/local/lib"
20+ "/usr/local/opt/llvm/lib"
21+ "/opt/homebrew/lib"
22+ "/opt/homebrew/opt/llvm@19/lib"
23+ )
1524endif ()
1625
1726INCLUDE (../GetPybind11.cmake )
Original file line number Diff line number Diff line change @@ -32,8 +32,8 @@ def run(self):
3232 cmake_version = parse (
3333 re .search (r"version\s*([\d.]+)" , out .decode ()).group (1 )
3434 )
35- if cmake_version < parse ("3.1 .0" ):
36- raise RuntimeError ("CMake >= 3.1 .0 is required on Windows" )
35+ if cmake_version < parse ("3.31 .0" ):
36+ raise RuntimeError ("CMake >= 3.31 .0 is required on Windows" )
3737
3838 for ext in self .extensions :
3939 self .build_extension (ext )
You can’t perform that action at this time.
0 commit comments