Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add --local-flint to set rpath in dev build #135

Merged
merged 2 commits into from
Jun 13, 2024
Merged
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 .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/*
build-install/*
dist/*
src/flint/**/*.c
src/flint/*.html
Expand Down
10 changes: 10 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ gmp_dep = dependency('gmp')
mpfr_dep = dependency('mpfr')
flint_dep = dependency('flint')

# Add rpaths for a local build of flint found via pkgconfig
# https://github.com/mesonbuild/meson/issues/13046
if get_option('add_flint_rpath')
flint_lib_dir = flint_dep.get_pkgconfig_variable('libdir')
add_project_link_arguments(
'-Wl,-rpath=' + flint_lib_dir,
language: 'c',
)
endif

# flint.pc was missing -lflint until Flint 3.1.0
if flint_dep.version().version_compare('<3.1')
flint_dep = cc.find_library('flint')
Expand Down
1 change: 1 addition & 0 deletions meson.options
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
option('add_flint_rpath', type : 'boolean', value : false)
7 changes: 7 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cython
spin
meson
meson-python
pytest
coverage
pytest-cov
17 changes: 15 additions & 2 deletions src/flint/flintlib/flint.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,26 @@ cdef extern from "flint/fmpz.h":

ctypedef slong fmpz_struct

cdef extern from *:
"""
/*
* Functions renamed in Flint 3.2.0
*/
#if __FLINT_RELEASE < 30200 /* Flint < 3.2.0 */

#define flint_rand_init flint_randinit
#define flint_rand_clear flint_randclear

#endif
"""

cdef extern from "flint/flint.h":
const char * FLINT_VERSION
const int __FLINT_RELEASE
const int FLINT_BITS
ctypedef void * flint_rand_t
void flint_randinit(flint_rand_t state)
void flint_randclear(flint_rand_t state)
void flint_rand_init(flint_rand_t state)
void flint_rand_clear(flint_rand_t state)
void flint_set_num_threads(long)
long flint_get_num_threads()
void flint_cleanup()
Expand Down
2 changes: 1 addition & 1 deletion src/flint/pyflint.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ cimport cython
from flint.flint_base.flint_context cimport thectx

cdef flint_rand_t global_random_state
flint_randinit(global_random_state)
flint_rand_init(global_random_state)

ctx = thectx
Loading