-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharcher-pkgconfig-tcl.lib
88 lines (63 loc) · 2.92 KB
/
archer-pkgconfig-tcl.lib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env tclsh
# commands to set environment variables related to pkg-config
# as used by the programming environment
# For OpenMP
# PE_<PRODUCT>_OMP_REQUIRES
# PE_<PRODUCT>_OMP_REQUIRES_openmp
# PE_<PRODUCT>_PKGCONFIG_VARIABLES
# The last assumes a list of length 1 is appropriate.
proc set_pkgconfig_openmp_requires { ucName } {
# Set the following for upper case Name to handle OpenMP
setenv PE_${ucName}_OMP_REQUIRES ""
setenv PE_${ucName}_OMP_REQUIRES_openmp _mp
setenv PE_${ucName}_PKGCONFIG_VARIABLES PE_${ucName}_OMP_REQUIRES_@openmp@
}
# Paths
# Specifically, relavant variables are:
# PE_PKGCONFIG_PRODUCTS e.g., PE_LIBSCI
# PE_<PRODUCT>_FIXED_PRGENV e.g., PE_LIBSCI_FIXED_PRGENV {GNU CRAYCLANG}
# PE_GNU_FIXED_PKGCONFIG_PATH e.g., /path/to/libsci/GNU/9.1/lib/pkgconfig
# PE_CRAYCLANG_FIXED_PKGCONFIG_PATH
# ... etc for each relevant implementation with exactly one compiler version
# PE_<PRODUCT>_VOLATILE_PRGENV e.g. {CRAY AOCC}
# PE_<PRODUCT>_VOLATILE_PKGCONFIG_PATH special value
# PE_<PRODUCT>_GENCOMPILERS_CRAY e.g. 10.1
# PE_<PRODUCT>_GENCOMPS_CRAY e.g. 101
# ... etc for each pe where there are two or more compiler versions
proc set_pkgconfig_paths { prod_root ucName } {
# prod_root is top level directory, e.g., /work/y07/shared/libs/metis
# ucName is product uppercase name e.g., "METIS"
prepend-path PE_PKGCONFIG_PRODUCTS PE_${ucName}
# For each PrgEnv present, see what compiler versions are available
foreach pe [ glob -tails -directory $prod_root GNU CRAY CRAYCLANG AOCC ] {
set dir $prod_root/$pe
if { [ file exists $dir ] } {
set dirs_${pe} [ lsort -decreasing [ glob -tails -directory $dir * ] ]
if { [ llength [ set dirs_${pe} ] ] > 1 } {
set gencomps_${pe} [ lsearch -glob -inline -all -not [ set dirs_${pe} ] *.* ]
set gencompilers_${pe} [ lsearch -glob -inline -all [ set dirs_${pe} ] *.* ]
lappend PE_PRODUCT_VOLATILE_PRGENV ${pe}
} else {
set relevant $dir/[ lsearch -glob -inline [ set dirs_${pe} ] *.* ]
set pe_product_${pe}_fixed_path $relevant/lib/pkgconfig
lappend pe_product_fixed_prgenv ${pe}
}
}
}
if { [ info exist PE_PRODUCT_VOLATILE_PRGENV ] } {
set newpath ${prod_root}/@PRGENV@/@PE_${ucName}_GENCOMPS@/lib/pkgconfig
setenv PE_${ucName}_VOLATILE_PRGENV $PE_PRODUCT_VOLATILE_PRGENV
setenv PE_${ucName}_VOLATILE_PKGCONFIG_PATH $newpath
foreach prgenv $PE_PRODUCT_VOLATILE_PRGENV {
setenv PE_${ucName}_GENCOMPS_${prgenv} [ set gencomps_${prgenv} ]
setenv PE_${ucName}_GENCOMPILERS_${prgenv} [ set gencompilers_${prgenv} ]
}
}
if { [ info exist pe_product_fixed_prgenv ] } {
setenv PE_${ucName}_FIXED_PRGENV $pe_product_fixed_prgenv
foreach prgenv $pe_product_fixed_prgenv {
set newpath [ set pe_product_${prgenv}_fixed_path ]
prepend-path PE_${prgenv}_FIXED_PKGCONFIG_PATH $newpath
}
}
}