-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
executable file
·77 lines (61 loc) · 2.44 KB
/
CMakeLists.txt
File metadata and controls
executable file
·77 lines (61 loc) · 2.44 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
cmake_minimum_required(VERSION 3.22)
project(pyxdbc)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()
set(CMAKE_CXX_FLAGS "-O3")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
# Force CMake to use Python 3.9
set(Python3_EXECUTABLE /usr/bin/python3.9 CACHE FILEPATH "Path to Python 3.9")
set(Python3_FIND_STRATEGY LOCATION)
set(Python3_FIND_ABI ANY)
find_package(Python3 3.9 EXACT REQUIRED COMPONENTS Interpreter Development NumPy)
find_package(pybind11 REQUIRED CONFIG)
#find_package(Arrow REQUIRED)
#find_package(Parquet REQUIRED)
#find_library(PARQUET_SHARED_LIB parquet REQUIRED)
# Ensure the library is found
#if (NOT PARQUET_SHARED_LIB)
# message(FATAL_ERROR "Parquet shared library not found.")
#endif()
#find_package(xtensor REQUIRED)
#find_package(xtensor-python REQUIRED)
pybind11_add_module(pyxdbc
python/xdbc.cpp
)
#target_include_directories(pyxdbc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/cpp/include)
#target_link_libraries(pyxdbc PUBLIC xdbc pybind11::module xtensor-python Python3::NumPy -lpq)
target_link_libraries(pyxdbc PUBLIC xdbc pybind11::module Python3::NumPy -lpq)
include_directories(/xdbc-client/xdbc/)
#set(PYTHON_LIBRARY_DIR "/home/harry/miniconda3/lib/python3.9/site-packages")
#set(PYTHON_EXECUTABLE "/home/harry/miniconda3/bin/python3")
#set(PYTHON_LIBRARIES "/home/harry/miniconda3/lib/libpython3.9.so")
execute_process(
COMMAND python3.9 -c "import pyarrow, os; print(os.path.join(os.path.dirname(pyarrow.__file__), 'include'))"
OUTPUT_VARIABLE PYARROW_INCLUDE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND python3.9 -c "import pyarrow, os; print(os.path.dirname(pyarrow.__file__))"
OUTPUT_VARIABLE PYARROW_LIBRARY_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
include_directories(${PYARROW_INCLUDE_DIR})
link_directories(${PYARROW_LIBRARY_DIR})
# Module 2: pyxparquet
pybind11_add_module(pyxdbcparquet
python/xdbcparquet.cpp
)
target_link_libraries(pyxdbcparquet PUBLIC
xdbc pybind11::module -lparquet -larrow -larrow_python
)
#set(PYTHON_LIBRARY_DIR "/root/miniconda3/envs/python39/lib/python3.9/site-packages")
#set(PYTHON_EXECUTABLE "/root/miniconda3/envs/python39/bin/python3")
#set(PYTHON_LIBRARIES "/root/miniconda3/envs/python39/lib/libpython3.9.so")
install(TARGETS pyxdbc pyxdbcparquet
COMPONENT python
LIBRARY DESTINATION "${Python3_SITEARCH}"
)