Skip to content

Commit 3f88640

Browse files
add CMAke file
1 parent 99f6f5a commit 3f88640

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
cmake_minimum_required(VERSION 3.15...4.0)
2+
project(${SKBUILD_PROJECT_NAME} LANGUAGES C)
3+
4+
find_package(
5+
Python
6+
COMPONENTS Interpreter Development.Module NumPy
7+
REQUIRED)
8+
include(UseCython)
9+
10+
# FetchContent_Declare(
11+
# gd
12+
# URL https://github.com/libgd/libgd/releases/download/gd-2.3.3/
13+
# URL_HASH stuff
14+
# )
15+
16+
# FetchContent_MakeAvailable(gd)
17+
18+
find_library (libgd
19+
gd
20+
REQUIRED
21+
)
22+
message (STATUS "libgd found at ${libgd}")
23+
24+
find_path (gd_include_path
25+
"gd.h"
26+
REQUIRED)
27+
28+
message (STATUS "gd.h found at ${gd_include_path}")
29+
30+
cython_transpile(py_gd/py_gd.pyx
31+
LANGUAGE C
32+
OUTPUT_VARIABLE py_gd_c)
33+
34+
python_add_library(py_gd MODULE "${py_gd_c}" WITH_SOABI)
35+
target_link_libraries(py_gd PUBLIC "${libgd}" Python::NumPy)
36+
target_include_directories(py_gd PUBLIC "${gd_include_path}")
37+
install(TARGETS py_gd DESTINATION py_gd)
38+
39+
40+
cython_transpile(py_gd/spline.pyx LANGUAGE C OUTPUT_VARIABLE spline_c)
41+
42+
python_add_library(spline MODULE "${spline_c}" WITH_SOABI)
43+
target_link_libraries(spline PUBLIC Python::NumPy)
44+
install(TARGETS spline DESTINATION py_gd)
45+
46+

0 commit comments

Comments
 (0)