Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gradia/constants.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later

rootdir = '@ROOT_PATH@'
libdir = '@LIB_DIR@'
datadir = '@DATA_DIR@'
pkgdatadir = '@PKGDATA_DIR@'
localedir = '@LOCALE_DIR@'
Expand Down
5 changes: 3 additions & 2 deletions gradia/graphics/gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
from dataclasses import dataclass, field
from ctypes import CDLL, POINTER, Structure, c_double, c_int, c_uint8
import json
import os

from PIL import Image

from gradia.graphics.background import Background
from gradia.utils.colors import parse_rgb_string
from gradia.constants import libdir


Step = tuple[float, str] # (position, "rgb(r,g,b)")
Expand Down Expand Up @@ -98,8 +100,7 @@ def _load_c_lib(cls) -> None:
if cls._c_lib is not None:
return

from importlib.resources import files
gradia_path = files("gradia").joinpath("libgradient_gen.so")
gradia_path = os.path.join(libdir, "libgradient_gen.so")
cls._c_lib = CDLL(str(gradia_path))
cls._c_lib.generate_gradient.argtypes = [
POINTER(c_uint8), c_int, c_int,
Expand Down
2 changes: 1 addition & 1 deletion gradia/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ shared_library(
'gradient_gen',
'graphics/gradient_gen.c',
install: true,
install_dir: MODULE_DIR,
install_dir: LIB_DIR,
install_rpath: '$ORIGIN',
link_args: ['-lm'],
)
Expand Down
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ PROJECT_RDNN_NAME = 'be.alexandervanhee.gradia'
ROOT_PATH = '/be/alexandervanhee/gradia'
PKGDATA_DIR = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
MODULE_DIR = join_paths(PKGDATA_DIR, 'gradia')
LIB_DIR = join_paths(get_option('prefix'), get_option('libdir'), meson.project_name())

# Set APPLICATION_ID
APPLICATION_ID = PROJECT_RDNN_NAME
Expand Down Expand Up @@ -72,6 +73,7 @@ conf = configuration_data()
conf.set('APP_ID', APPLICATION_ID)
conf.set('ROOT_PATH', ROOT_PATH)
conf.set('PKGDATA_DIR', PKGDATA_DIR)
conf.set('LIB_DIR', LIB_DIR)
conf.set('DATA_DIR', join_paths(get_option('prefix'), get_option('datadir')))
conf.set('LOCALE_DIR', join_paths(get_option('prefix'), get_option('localedir')))
conf.set('PYTHON', PY_INSTALLDIR.full_path())
Expand Down