-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
76 lines (69 loc) · 2.48 KB
/
Copy pathCMakeLists.txt
File metadata and controls
76 lines (69 loc) · 2.48 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
cmake_minimum_required(VERSION 3.21)
project(bioimage_cpp LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
find_package(Python 3.10 COMPONENTS Interpreter Development.Module REQUIRED)
find_package(nanobind CONFIG REQUIRED)
nanobind_add_module(_core
NB_STATIC
src/bindings/affinities.cxx
src/bindings/blocking.cxx
src/bindings/distance.cxx
src/bindings/module.cxx
src/bindings/filters.cxx
src/bindings/flow.cxx
src/bindings/graph.cxx
src/bindings/ground_truth.cxx
src/bindings/label_multiset.cxx
src/bindings/mesh.cxx
src/bindings/segmentation.cxx
src/bindings/skeleton.cxx
src/bindings/skeleton_distributed.cxx
src/bindings/transformation.cxx
src/bindings/util.cxx
src/bindings/utils.cxx
src/cpp/segmentation/mutex_watershed.cxx
src/cpp/segmentation/semantic_mutex_watershed.cxx
src/cpp/take_dict.cxx
)
target_include_directories(_core PRIVATE include)
target_compile_features(_core PRIVATE cxx_std_20)
target_compile_options(_core PRIVATE
$<$<NOT:$<CONFIG:Debug>>:-O3>
)
option(
BIOIMAGE_FLOW_FMA_DISPATCH
"Build an x86 FMA-specialized flow tracer with runtime CPU dispatch"
ON
)
if(BIOIMAGE_FLOW_FMA_DISPATCH)
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" _bioimage_system_processor)
if(_bioimage_system_processor MATCHES "^(x86_64|amd64|i[3-6]86)$")
if(MSVC)
target_sources(_core PRIVATE src/cpp/flow/flow_density_fma.cxx)
set_property(
SOURCE src/cpp/flow/flow_density_fma.cxx
APPEND PROPERTY COMPILE_OPTIONS /arch:AVX2
)
target_compile_definitions(
_core PRIVATE
BIOIMAGE_FLOW_FMA_DISPATCH=1
BIOIMAGE_FLOW_FMA_REQUIRES_AVX2=1
)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_sources(_core PRIVATE src/cpp/flow/flow_density_fma.cxx)
set_property(
SOURCE src/cpp/flow/flow_density_fma.cxx
APPEND PROPERTY COMPILE_OPTIONS -mavx -mfma
)
target_compile_definitions(_core PRIVATE BIOIMAGE_FLOW_FMA_DISPATCH=1)
endif()
endif()
endif()
option(BIOIMAGE_PROFILE "Enable per-phase profiling instrumentation (development only)" OFF)
if(BIOIMAGE_PROFILE)
target_compile_definitions(_core PRIVATE BIOIMAGE_PROFILE)
endif()
install(TARGETS _core LIBRARY DESTINATION bioimage_cpp)