-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
30 lines (22 loc) · 1.07 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
cmake_minimum_required(VERSION 3.20)
project(pycds)
set(CMAKE_C_STANDARD 11)
if (MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /we4013")
else ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration")
endif ()
# Only for IDE linting, skbuild will handle wheel dependencies.
if (NOT SKBUILD)
#set(Python_ROOT_DIR "")
endif ()
find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development.Module)
add_compile_definitions(Py_BUILD_CORE Py_BUILD_CORE_MODULE) # for sizeof(PyGC_Head)
add_compile_definitions(NEED_OPCODE_TABLES) # for _PyOpcode_Caches and _PyOpcode_Deopt
python_add_library(_cds MODULE WITH_SOABI src/_cds/_cdsmodule.c src/_cds/lookup_table.c src/_cds/hashtable.c src/_cds/platforms.c)
# clinic-generated files access core header.
target_include_directories(_cds PRIVATE "${Python_INCLUDE_DIRS}/internal")
# todo: if find cpython repo, run clinic
# currently we manually run `python3 ../cpython/Tools/clinic/clinic.py --make --srcdir src/_cds`
install(TARGETS _cds LIBRARY DESTINATION .)
install(FILES src/artifacts/pycds.pth DESTINATION .)