File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,35 +5,18 @@ find_package(
55 Python
66 COMPONENTS Interpreter Development.Module NumPy
77 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- # )
158
16- # FetchContent_MakeAvailable(gd )
9+ include ( UseCython )
1710
1811set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR } /cmake" )
12+ find_package (GD MODULE REQUIRED )
1913
20- find_package (GD
21- MODULE
22- REQUIRED
23- )
24- cython_transpile (py_gd/py_gd.pyx
25- LANGUAGE C
26- OUTPUT_VARIABLE py_gd_c )
27-
14+ cython_transpile (py_gd/py_gd.pyx LANGUAGE C OUTPUT_VARIABLE py_gd_c )
2815python_add_library (py_gd MODULE "${py_gd_c} " WITH_SOABI )
2916target_link_libraries (py_gd PUBLIC GD::GD Python::NumPy )
3017install (TARGETS py_gd DESTINATION py_gd)
3118
32- get_filename_component (GD_LIBRARY_DIR "${GD_LIBRARIES} " DIRECTORY )
33- set_target_properties (py_gd PROPERTIES INSTALL_RPATH "${GD_LIBRARY_DIR} " )
34-
3519cython_transpile (py_gd/spline.pyx LANGUAGE C OUTPUT_VARIABLE spline_c )
36-
3720python_add_library (spline MODULE "${spline_c} " WITH_SOABI )
3821target_link_libraries (spline PUBLIC Python::NumPy )
3922install (TARGETS spline DESTINATION py_gd)
Original file line number Diff line number Diff line change 1+ find_package (PkgConfig )
2+ if (PKG_CONFIG_FOUND)
3+ pkg_check_modules (PC_GD QUIET GD )
4+ endif ()
15
2- find_path (GD_INCLUDE_DIR
3- "gd.h"
4- REQUIRED )
6+ find_path (GD_INCLUDE_DIR
7+ NAMES gd.h
8+ HINTS "${PC_GD_INCLUDE_DIRS} "
9+ REQUIRED
10+ )
511
6- find_library (GD_LIBRARY
7- gd
8- REQUIRED
9- )
12+ find_library (GD_LIBRARY
13+ NAMES gd
14+ HINTS "${PC_GD_INCLUDE_DIRS} "
15+ REQUIRED
16+ )
1017
1118cmake_path (ABSOLUTE_PATH GD_LIBRARY )
1219cmake_path (ABSOLUTE_PATH GD_INCLUDE_DIR )
20+ get_filename_component (GD_LIBRARY_DIR "${GD_LIBRARIES} " DIRECTORY )
1321
1422message (STATUS "libgd found at ${GD_LIBRARY} , ${GD_INCLUDE_DIR} " )
1523
@@ -24,13 +32,16 @@ find_package_handle_standard_args(GD
2432if (GD_FOUND)
2533 set (GD_LIBRARIES "${GD_LIBRARY} " )
2634 set (GD_INCLUDE_DIRS "${GD_INCLUDE_DIR} " )
35+ set (Foo_DEFINITIONS ${PC_GD_CFLAGS_OTHER} )
2736endif ()
2837
2938if (GD_FOUND AND NOT TARGET GD::GD)
3039 add_library (GD::GD UNKNOWN IMPORTED )
3140 set_target_properties (GD::GD PROPERTIES
3241 IMPORTED_LOCATION "${GD_LIBRARY} "
42+ INTERFACE_COMPILE_OPTIONS "${PC_GD_CFLAGS_OTHER} "
3343 INTERFACE_INCLUDE_DIRECTORIES "${GD_INCLUDE_DIR} "
44+ INTERFACE_LINK_DIRECTORIES "${GD_LIBRARY_DIR} "
3445 )
3546endif ()
3647
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ linux.before-all = [
5151 " dnf install -y gd-devel" ,
5252]
5353windows.before-all = [
54- " vcpkg install libgd" ,
54+ " vcpkg install libgd pkgconf " ,
5555]
5656macos.before-all = [
5757 " git clone https://github.com/libgd/libgd.git --branch gd-2.3.3 --depth 1" ,
You can’t perform that action at this time.
0 commit comments