-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
111 lines (84 loc) · 2.67 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.15)
IF (NOT WIN32)
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
ENDIF(NOT WIN32)
project(HPC_Datastore_pybind C CXX)
# disable info message print
add_compile_options(-DDATASTORE_NINFO)
# FMT library
find_package(fmt CONFIG REQUIRED)
set(LIBS ${LIBS} fmt::fmt)
# POCO library
find_package(Poco CONFIG REQUIRED Net JSON)
set(LIBS ${LIBS} Poco::Net Poco::JSON)
# FFTW3 library
find_package(FFTW3 CONFIG REQUIRED)
set(LIBS ${LIBS} FFTW3::fftw3)
find_package(FFTW3f CONFIG REQUIRED)
set(LIBS ${LIBS} FFTW3::fftw3f)
find_package(FFTW3l CONFIG REQUIRED)
set(LIBS ${LIBS} FFTW3::fftw3l)
# Clapack library
find_package(clapack CONFIG REQUIRED)
set(LIBS ${LIBS} lapack)
# F2C library
if(UNIX)
if(NOT APPLE)
set(LIBS ${LIBS} f2c)
endif(NOT APPLE)
endif(UNIX)
# BLAS library
find_package(OpenBLAS CONFIG REQUIRED)
set(LIBS ${LIBS} OpenBLAS::OpenBLAS)
# TIFF library
find_package(TIFF REQUIRED)
set(LIBS ${LIBS} ${TIFF_LIBRARIES})
# JPEG library
find_package(JPEG REQUIRED)
set(LIBS ${LIBS} ${JPEG_LIBRARIES})
# PNG library
find_package(libpng CONFIG REQUIRED)
IF (WIN32)
SET(LIBS ${LIBS} png)
ELSE(WIN32)
SET(LIBS ${LIBS} png_static)
ENDIF(WIN32)
# ICS library
find_package(libics CONFIG REQUIRED)
set(LIBS ${LIBS} libics)
# ZLIB library
find_package(ZLIB REQUIRED)
set(LIBS ${LIBS} ZLIB::ZLIB)
# HDF5 library
find_package(hdf5 CONFIG REQUIRED)
IF (WIN32)
SET(LIBS ${LIBS} hdf5::hdf5-shared hdf5::hdf5_hl-shared)
ELSE(WIN32)
SET(LIBS ${LIBS} hdf5::hdf5-static hdf5::hdf5_hl-static)
ENDIF(WIN32)
# RXSpencer library
find_package(RXSpencer CONFIG REQUIRED)
set(LIBS ${LIBS} rxspencer)
# I3D library
set(STATIC_DIR "${CMAKE_SOURCE_DIR}/extern/hpc-datastore-cpp/static_i3dlib")
IF (WIN32)
set(LIBS "${STATIC_DIR}/libs/cbia.lib.i3dalgo.dyn.rel.x64.16.lib" "${STATIC_DIR}/libs/cbia.lib.i3dcore.dyn.rel.x64.16.lib" ${LIBS})
ELSE (WIN32)
set(LIBS "${STATIC_DIR}/libs/libi3dcore.a" "${STATIC_DIR}/libs/libi3dalgo.a" ${LIBS})
ENDIF(WIN32)
set(INCL_DIRS ${INCL_DIRS} "${STATIC_DIR}/includes")
# Pybind11 library
add_subdirectory("${CMAKE_SOURCE_DIR}/extern/pybind11")
set(INCL_DIRS ${INCL_DIRS} "${CMAKE_SOURCE_DIR}/extern/pybind11/include")
set(MODULE_NAME "hpc_datastore")
pybind11_add_module(${MODULE_NAME} src/main.cpp)
target_link_libraries(${MODULE_NAME} PUBLIC ${LIBS})
target_include_directories(${MODULE_NAME} SYSTEM PUBLIC ${INCL_DIRS})
# add compile options
set_target_properties(${MODULE_NAME} PROPERTIES CXX_STANDARD 20)
IF (WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS 1)
ELSE (WIN32)
set_target_properties(${MODULE_NAME} PROPERTIES COMPILE_FLAGS "-Wall -Wextra -Wconversion -fmax-errors=1 -g -O2 -fPIC")
ENDIF(WIN32)