Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sage
Path: blob/develop/src/sage_setup/library_order.py
4052 views
1
#########################################################
2
### Library order
3
#########################################################
4
5
# This list defines the *order* of linking libraries. A library should
6
# be put *before* any library it links to. Cython allows
7
# defining libraries using "# distutils: libraries = LIB". However, if
8
# there are multiple libraries, the order is undefined so we need to
9
# manually reorder the libraries according to this list. Any libraries which are not
10
# listed here will be added at the end of the list (without changing
11
# their relative order).
12
from sage.env import cython_aliases, default_required_modules, default_optional_modules
13
14
modules = default_required_modules + default_optional_modules
15
16
aliases = cython_aliases(required_modules=(), optional_modules=modules)
17
18
library_order_list = aliases.get("SINGULAR_LIBRARIES", []) + [
19
"intl", "curl",
20
"ec", "ecm"
21
] + aliases.get("LINBOX_LIBRARIES", []) + aliases.get("FFLASFFPACK_LIBRARIES", []) + aliases.get("GSL_LIBRARIES", []) + [
22
"pari", "flint", "ecl", "glpk", "ppl",
23
] + [
24
"mpfi", "mpfr", "mpc", "ntl", "gmp", "gmpxx",
25
"brial",
26
"brial_groebner",
27
"m4rie",
28
] + aliases.get("M4RI_LIBRARIES", []) + [
29
"gap",
30
] + aliases.get("GDLIB_LIBRARIES", []) + aliases.get("LIBPNG_LIBRARIES", []) + [
31
"m", "readline", "Lfunction",
32
] + aliases.get("CBLAS_LIBRARIES", []) + aliases.get("ZLIB_LIBRARIES", [])
33
34
# Make a dict with library:order pairs, where the order are negative
35
# integers sorted according to library_order_list. When sorting,
36
# unlisted libraries have order 0, so they appear after the libraries
37
# in library_order_list.
38
n = len(library_order_list)
39
library_order = {}
40
for i in range(n):
41
lib = library_order_list[i]
42
library_order[lib] = i-n
43
44