File: wrap

package info (click to toggle)
btllib 1.4.10%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,340 kB
  • sloc: cpp: 61,642; sh: 301; python: 222; makefile: 6
file content (64 lines) | stat: -rwxr-xr-x 1,641 bytes parent folder | download
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
#!/bin/bash

if [ -z "${MESON_SOURCE_ROOT}" ]; then
  echo "[ERROR] This script can only be ran with meson!"
  exit 1
fi

set -e

# Remove old wrapper files
rm -f ${MESON_SOURCE_ROOT}/wrappers/python/btllib.py

# Generate python swig files
cd ${MESON_SOURCE_ROOT}

include_files=$(scripts/get-files include)

echo "%module btllib

%{
#define SWIG_FILE_WITH_INIT
" > wrappers/python/btllib.i

for file in ${include_files}; do
  relative=$(scripts/get-include-relative ${file})
  path="${relative}/$(basename ${file})"
  echo "#include \"$path\"" >> wrappers/python/btllib.i
done

echo "%}

%include <stdint.i>
%include <typemaps.i>
%include <pyprimtypes.swg>
%include <pyopers.swg>
%include <std_common.i>
%include <cstring.i>
%include <std_string.i>
%include <exception.i>
%include <std_iostream.i>
%include <carrays.i>
%include <std_vector.i>
%include <stl.i>

%include \"../extra_common.i\"
%include \"extra.i\"
" >> wrappers/python/btllib.i

for file in ${include_files}; do
  relative=$(scripts/get-include-relative ${file})
  path="${relative}/$(basename ${file})"
  echo "%include \"$path\"" >> wrappers/python/btllib.i
done

echo "%include \"../extra_templates.i\"" >> wrappers/python/btllib.i

ln -sf $PWD/include wrappers/python/
cd wrappers/python
swig -python -py3 -fastproxy -fastdispatch -builtin -c++ -Iinclude btllib.i
rm -f include

# The following line is necessary because SWIG produces inconsistent code that cannot be compiled on all platforms. On some platforms, uint64_t is unsigned long int and unsigned long long int on others.
sed -i'.tmp' 's~unsigned long long~uint64_t~g' btllib_wrap.cxx
rm -f btllib_wrap.cxx.tmp