Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
81 lines (73 loc) · 3.39 KB
/
Copy pathCMakeLists.txt
File metadata and controls
81 lines (73 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
cmake_minimum_required(VERSION 3.18)
project(pypulseqpp_extensions LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# The trajectory solver is a submodule rather than a copy, so a checkout that
# forgot --recursive has no sources here. Say so now: the alternative is a
# hundred lines of missing-header errors.
set(MRARBGRAD ${CMAKE_SOURCE_DIR}/external/MRArbGrad/mrarbgrad_src/ext)
if(NOT EXISTS ${MRARBGRAD}/mag/Mag.cpp)
message(FATAL_ERROR
"external/MRArbGrad is empty. Run:\n"
" git submodule update --init --recursive")
endif()
find_package(pybind11 CONFIG REQUIRED)
find_package(Python COMPONENTS Development.Module REQUIRED)
find_package(Threads REQUIRED)
# One extension module holding the sequence core and its binding. List the
# sources explicitly: a glob makes a new file compile without anyone deciding
# it should.
pybind11_add_module(_ext
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/analysis.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/corners.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/dedup.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/expand.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/md5.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/read.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/read_binary.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/write_binary.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/sequence.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/shape.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/fov.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/kspace.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/loops.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/pns.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/raster.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/resonance.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/rf_safety.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/rfft.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/safety.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/timing.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/waveforms.cpp
${CMAKE_SOURCE_DIR}/src/cpp/pulseq/write_text.cpp
${CMAKE_SOURCE_DIR}/src/cpp/bindings/module.cpp
${CMAKE_SOURCE_DIR}/src/cpp/bindings/pulseqpp_eventtypes.cpp
${CMAKE_SOURCE_DIR}/src/cpp/bindings/arbgrad.cpp
${CMAKE_SOURCE_DIR}/src/cpp/bindings/sampling.cpp
${CMAKE_SOURCE_DIR}/src/cpp/bindings/sim.cpp
${CMAKE_SOURCE_DIR}/src/cpp/bindings/ptx.cpp
${CMAKE_SOURCE_DIR}/src/cpp/bindings/slr.cpp
${CMAKE_SOURCE_DIR}/src/cpp/bindings/labels.cpp
# The three translation units of the MRArbGrad solver; the rest of it is
# headers. See external/NOTICE.md.
${MRARBGRAD}/mag/Mag.cpp
${MRARBGRAD}/utility/global.cpp
${MRARBGRAD}/utility/v3.cpp
)
target_include_directories(_ext PRIVATE
${CMAKE_SOURCE_DIR}/src/cpp
${CMAKE_SOURCE_DIR}/src/cpp/bindings
${MRARBGRAD}
)
# Deduplication partitions independent work across standard C++ threads. The
# FFT loads MKL at run time when one is installed (src/cpp/pulseq/rfft.hpp),
# which on older glibc needs libdl.
target_link_libraries(_ext PRIVATE Threads::Threads ${CMAKE_DL_LIBS})
# Built into the build tree, never beside the sources: the wheel takes the
# module from the install step, so a binary left in the source tree would be
# swept into wheels built for every other interpreter too.
set_target_properties(_ext PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/src/pypulseqpp"
)
install(TARGETS _ext DESTINATION pypulseqpp)