-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
94 lines (72 loc) · 2.66 KB
/
Copy pathCMakeLists.txt
File metadata and controls
94 lines (72 loc) · 2.66 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
cmake_minimum_required(VERSION 3.15)
project(PyCAPIO
LANGUAGES CXX
DESCRIPTION "Native integration of the CAPIO methodology within the python interpreter"
VERSION 0.0.2
)
include(FetchContent)
include(ExternalProject)
include(GNUInstallDirs)
option(CAPIO_LOG "Enable log capabilities within the CAPIO communication queues and libcapio adapter" OFF)
set(CAPIO_RELEASE_TAG "master" CACHE STRING "Default CAPIO tag used to compile PyCAPIO.")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -pedantic -O0")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG v3.0.1
)
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
message(STATUS "Enabling CAPIO Logger")
add_compile_definitions(CAPIO_LOG)
endif ()
message(STATUS "Using CAPIO on tag ${CAPIO_RELEASE_TAG}")
FetchContent_Declare(
capio
GIT_REPOSITORY https://github.com/High-Performance-IO/capio.git
GIT_TAG ${CAPIO_RELEASE_TAG}
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
)
set(CAPIO_LOG ${CAPIO_LOG} CACHE BOOL "" FORCE)
set(CAPIO_BUILD_POSIX False CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(pybind11 capio)
if (SKBUILD_SCRIPTS_DIR)
set(CAPIO_INSTALL_DIR ${SKBUILD_SCRIPTS_DIR})
else ()
set(CAPIO_INSTALL_DIR bin)
endif ()
install(
TARGETS capio_server
RUNTIME DESTINATION ${CAPIO_INSTALL_DIR}
)
########################
# PYBIND11 TARGET
########################
file(GLOB PYCAPIO_SOURCES "${CMAKE_SOURCE_DIR}/src/*.cpp")
pybind11_add_module(_pycapio ${PYCAPIO_SOURCES})
# patch server_println by copying server_println.hpp from server/utils/server_println.hpp to posix/utils/server_println.hpp
file(COPY "${capio_SOURCE_DIR}/capio/server/include/utils/server_println.hpp"
DESTINATION "${capio_SOURCE_DIR}/capio/posix/utils/")
message(WARNING "WARN: patch for server_println.hpp copied to posix has been applied!")
target_compile_definitions(_pycapio PRIVATE PYCAPIO_BINDINGS)
target_compile_definitions(_pycapio PRIVATE CAPIO_VERSION="${CMAKE_PROJECT_VERSION}")
message(STATUS "CAPIO_PREFIX = ${capio_SOURCE_DIR}")
target_include_directories(_pycapio PRIVATE
${capio_SOURCE_DIR}/capio
${capio_SOURCE_DIR}/capio/posix
${CMAKE_SOURCE_DIR}/include
)
target_compile_options(
_pycapio
PRIVATE
$<$<CXX_COMPILER_ID:GNU,Clang>:-Wall -Wextra -Wpedantic>
)
install(
TARGETS _pycapio
LIBRARY DESTINATION pycapio
)