-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
84 lines (67 loc) · 1.83 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
cmake_minimum_required(VERSION 3.27)
project(dataframe LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23)
if (TARGET dataframe)
return()
endif()
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
# Fetching externals
include(FetchContent)
FetchContent_Declare(
glaze
GIT_REPOSITORY https://github.com/stephenberry/glaze.git
GIT_TAG main
)
FetchContent_MakeAvailable(glaze)
include_directories(
src
${glaze_SOURCE_DIR}/include
)
set(SRC_FILES
src/utils.hpp
src/utils.cpp
src/Config.hpp
src/Sample.hpp
src/DataSlide.hpp
src/DataFrame.hpp
src/DataFrame.cpp
src/Simulator.hpp
src/TimeSamplingDriver.hpp
src/types.h
)
add_library(dataframe ${SRC_FILES})
find_package(fmt)
target_link_libraries(dataframe fmt::fmt)
if (DEFINED DF_BUILDING_PY_BINDINGS)
find_package(Python 3.10
REQUIRED COMPONENTS Interpreter Development.Module
OPTIONAL_COMPONENTS Development.SABIModule
)
# Finding nanobind
execute_process(
COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE NB_DIR)
list(APPEND CMAKE_PREFIX_PATH "${NB_DIR}")
find_package(nanobind CONFIG REQUIRED)
nanobind_add_module(
dataframe_bindings
STABLE_ABI
NB_STATIC
${SRC_FILES}
src/PyDataFrame.hpp
src/PyDataFrameModule.cpp
)
target_link_libraries(dataframe_bindings PRIVATE fmt::fmt)
install(
TARGETS dataframe_bindings
LIBRARY DESTINATION dataframe
)
elseif (DEFINED DF_BUILDING_BINARIES)
add_executable(test src/test.cpp)
target_link_libraries(test PRIVATE dataframe fmt::fmt)
endif()