-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
138 lines (110 loc) · 6 KB
/
CMakeLists.txt
File metadata and controls
138 lines (110 loc) · 6 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# --------------------- CMake configuration --------------------
cmake_minimum_required(VERSION 3.20)
set(CMAKE_OSX_DEPLOYMENT_TARGET "15.0" CACHE STRING "Minimum OS X deployment version")
project(FlowCyPy LANGUAGES CXX)
# CMake settings
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Type of build")
# --------------------- CMake configuration --------------------
# --------------------- Set the output directory for libraries --------------------
set(LOCAL_CXX_DIR "${PROJECT_NAME}/cpp")
set(LOCAL_BIN_DIR "${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/binary")
include_directories(${LOCAL_CXX_DIR})
# --------------------- Set the output directory for libraries --------------------
# --------------------- Platform-specific compiler and linker options --------------------
# --- macOS: use shared Homebrew libomp, not a vendored copy -------------
if(APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
if(DEFINED ENV{HOMEBREW_PREFIX})
set(OpenMP_ROOT "$ENV{HOMEBREW_PREFIX}/opt/libomp")
else()
set(OpenMP_ROOT "/opt/homebrew/opt/libomp")
endif()
set(CMAKE_PREFIX_PATH "${OpenMP_ROOT};${CMAKE_PREFIX_PATH}")
endif()
find_package(OpenMP REQUIRED)
add_library(flowcypy_openmp INTERFACE)
target_link_libraries(flowcypy_openmp INTERFACE OpenMP::OpenMP_CXX)
if(APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_include_directories(flowcypy_openmp INTERFACE "${OpenMP_ROOT}/include")
endif()
# Platform-specific settings for static linking
if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message("MinGW detected on Windows")
set(STATIC_LINK_OPTIONS "-static")
add_compile_options(-fopenmp)
add_link_options(-static -fopenmp -Wl,--whole-archive -lgomp -Wl,--no-whole-archive)
endif()
if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/W4 /permissive- /Zc:preprocessor)
else()
add_compile_options(-Wall -Wextra -pedantic-errors -Wno-unused-parameter)
endif()
# --------------------- Platform-specific compiler and linker options --------------------
# --------------------- Find dependencies and compile options --------------------
find_package(OpenMP REQUIRED)
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
find_package(pybind11 CONFIG REQUIRED)
# find_package(PkgConfig REQUIRED)
find_package(PkgConfig)
pkg_search_module(FFTW REQUIRED fftw3 IMPORTED_TARGET)
# --------------------- Find dependencies and compile options --------------------
# ----------------- logging build configuration --------------------
message(STATUS "")
message(STATUS "==================== Build configuration ====================")
message(STATUS "Compiler information")
message(STATUS " C compiler : ${CMAKE_C_COMPILER}")
message(STATUS " C compiler ID : ${CMAKE_C_COMPILER_ID}")
message(STATUS " C compiler version : ${CMAKE_C_COMPILER_VERSION}")
message(STATUS " CXX compiler : ${CMAKE_CXX_COMPILER}")
message(STATUS " CXX compiler ID : ${CMAKE_CXX_COMPILER_ID}")
message(STATUS " CXX compiler version : ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS " Fortran compiler : ${CMAKE_Fortran_COMPILER}")
message(STATUS " Fortran ID : ${CMAKE_Fortran_COMPILER_ID}")
message(STATUS " Fortran version : ${CMAKE_Fortran_COMPILER_VERSION}")
message(STATUS "")
message(STATUS "OpenMP configuration")
message(STATUS " OpenMP detected : ${OpenMP_FOUND}")
message(STATUS " OpenMP CXX found : ${OpenMP_CXX_FOUND}")
message(STATUS " OpenMP flags : ${OpenMP_CXX_FLAGS}")
message(STATUS " OpenMP include dirs : ${OpenMP_CXX_INCLUDE_DIRS}")
message(STATUS " OpenMP libraries : ${OpenMP_CXX_LIBRARIES}")
message(STATUS " OpenMP lib names : ${OpenMP_CXX_LIB_NAMES}")
message(STATUS " OpenMP version : ${OpenMP_CXX_VERSION}")
message(STATUS "")
message(STATUS "FFTW3_FOUND : ${FFTW_FOUND}")
message(STATUS "FFTW3_INCLUDE_DIRS : ${FFTW_INCLUDE_DIRS}")
message(STATUS "FFTW3_LIBRARIES : ${FFTW_LIBRARIES}")
message(STATUS "")
message(STATUS "Python configuration")
message(STATUS " Python executable : ${Python_EXECUTABLE}")
message(STATUS " Python version : ${PYBIND11_PYTHON_VERSION}")
message(STATUS " Python include dir : ${Python_INCLUDE_DIRS}")
message(STATUS " Python site packages : ${Python_SITELIB}")
message(STATUS "")
message(STATUS "FlowCyPy integration")
message(STATUS " FlowCyPy version : ${PACKAGE_VERSION}")
message(STATUS " FlowCyPy include dir : ${LOCAL_CXX_DIR}")
message(STATUS "")
message(STATUS "Install destination")
message(STATUS " Binary output path : ${LOCAL_BIN_DIR}")
message(STATUS "==============================================================")
message(STATUS "")
# ----------------- logging build configuration --------------------
# ----------------- collect subdirectories --------------------
add_subdirectory(FlowCyPy/cpp/utils) # utils
add_subdirectory(FlowCyPy/cpp/pint) # pint
add_subdirectory(FlowCyPy/cpp/fluidics/distributions) # distributions
add_subdirectory(FlowCyPy/cpp/fluidics/populations) # populations
add_subdirectory(FlowCyPy/cpp/fluidics/flow_cell) # flow_cell
add_subdirectory(FlowCyPy/cpp/opto_electronics/source) # source
add_subdirectory(FlowCyPy/cpp/opto_electronics/detector) # detector
add_subdirectory(FlowCyPy/cpp/opto_electronics/amplifier) # amplifier
add_subdirectory(FlowCyPy/cpp/opto_electronics/digitizer) # digitizer
add_subdirectory(FlowCyPy/cpp/opto_electronics/circuits) # circuits
add_subdirectory(FlowCyPy/cpp/digital_processing/discriminator) # discriminator
add_subdirectory(FlowCyPy/cpp/digital_processing/peak_locator) # peak_locator
add_subdirectory(FlowCyPy/cpp/digital_processing/classifier) # classifier
# ----------------- collect subdirectories --------------------