-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
104 lines (93 loc) · 2.82 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
cmake_minimum_required(VERSION 3.22)
project(ScanImageTiff VERSION 1.0.3 DESCRIPTION "tiff file io for tiffs written with scanImage" LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if (WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
configure_file(src/ScanImageTiff_version.cpp.in ScanImageTiff_version.cpp @ONLY)
add_library(ScanImageTiff_version STATIC ScanImageTiff_version.cpp)
# ---------- python ------------
find_package (Python3 COMPONENTS Interpreter Development NumPy)
include( FetchContent )
# ---------- libtiff latest stable-----------
FetchContent_Declare(
tiff
GIT_REPOSITORY https://gitlab.com/libtiff/libtiff.git
GIT_TAG master
)
option(tiff-docs "" OFF)
option(tiff-tests "" OFF)
option(tiff-tools "" OFF)
option(tiff-contrib "" OFF)
FetchContent_MakeAvailable(tiff)
FetchContent_Declare(
date_src
GIT_REPOSITORY https://github.com/HowardHinnant/date.git
GIT_TAG v3.0.1 # adjust tag/branch/commit as needed
)
FetchContent_MakeAvailable(date_src)
FetchContent_Declare(
carma
GIT_REPOSITORY https://github.com/RUrlus/carma
GIT_TAG v0.6.3
)
FetchContent_MakeAvailable(carma)
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11
GIT_TAG v2.10.0
)
FetchContent_MakeAvailable(pybind11)
FetchContent_GetProperties(pybind11)
if(NOT pybind11_POPULATED)
FetchContent_Populate(pybind11)
add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR})
endif()
# ---------- includes -----------
include_directories( ${TIFF_INCLUDE_DIRS} )
include_directories( ${Python3_INCLUDE_DIRS} )
include_directories(( ${Python3_NumPy_INCLUDE_DIRS}))
pybind11_add_module(scanimagetiffio SHARED
src/ScanImageTiffPy.cpp
src/ScanImageTiff.cpp
src/VRDataFiles.cpp
)
target_link_libraries(scanimagetiffio
PUBLIC
tiff
armadillo
carma::carma
${Python3_LIBRARIES}
date::date
ScanImageTiff_version
)
target_include_directories(scanimagetiffio PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
# # remove the "lib" from start of the library name
set_target_properties(scanimagetiffio PROPERTIES PREFIX "")
# generate the compile_commands.json file for clangd
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
# install
install(TARGETS scanimagetiffio DESTINATION ${Python3_SITEARCH})
add_library(${PROJECT_NAME} SHARED
src/ScanImageTiff.cpp
src/VRDataFiles.cpp
)
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER include/ScanImageTiff.h)
target_link_libraries(${PROJECT_NAME}
PUBLIC
armadillo
carma::carma
tiff
${Python3_LIBRARIES}
date::date
ScanImageTiff_version
)
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
PUBLIC_HEADER DESTINATION include
)
add_subdirectory(tests)