-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path_generate.sh
More file actions
executable file
·72 lines (51 loc) · 2.15 KB
/
Copy path_generate.sh
File metadata and controls
executable file
·72 lines (51 loc) · 2.15 KB
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
#!/bin/sh
set -e
#git clone https://github.com/ctypesgen/ctypesgen
# --- or ---
#python -m venv .
#source ./bin/activate
#pip install -r requirements.txt
if [ ! -e ./ctypesgen ]; then
git clone https://github.com/ctypesgen/ctypesgen
fi
# Generate ctypes bindings
python3 ctypesgen/run.py -a -lomapi -o pylibomapi.py ../../include/omapi.h
#ctypesgen -a -lomapi -o pylibomapi.py ../../include/omapi.h
# Option: Customize WindowsLibraryLoader / name_formats to add the 64-bit library build to the list of libraries to try on Windows
#sed -i '.bak' -e 's/"lib%s.dll", /"lib%s.dll", "lib%s64.dll", /' pylibomapi.py
# Option: Conditionally change `# Begin libraries` / `_libs["omapi"] = load_library("omapi")` on 64-bit Windows to load "omapi64" instead.
# load_library("omapi" + ("64" if sys.platform == "win32" and sys.maxsize > 2**32 else ""))
sed -i '.bak' -e 's/load_library("omapi")/load_library("omapi" + ("64" if sys.platform == "win32" and sys.maxsize > 2**32 else ""))/' pylibomapi.py
# Alternative: Could rename the 64-bit library to '*.dll'/'*'/'*lib.dll'
# Alternative: Use add_library_search_dirs() to use a subdirectory for the 64-bit library
# Copy .lib so paths are relative
if [ -e ../../src/libomapi.a ]; then
cp ../../src/libomapi.a .
fi
# Copy .so for test program -- build with: make libomapi.so
if [ -e ../../src/libomapi.so ]; then
cp ../../src/libomapi.so .
fi
# Copy .dylib for test program
if [ -e ../../src/libomapi.dylib ]; then
cp ../../src/libomapi.dylib .
fi
# Copy .dll for test program on Windows -- build with: build.cmd
if [ -e ../../src/libomapi.dll ]; then
cp ../../src/libomapi.dll .
fi
# Copy stub .lib for test program on Windows -- build with: build.cmd
if [ -e ../../src/libomapi.lib ]; then
cp ../../src/libomapi.lib .
fi
# Copy 64-bit .dll for test program on Windows -- build with: build.cmd x64
if [ -e ../../src/libomapi64.dll ]; then
cp ../../src/libomapi64.dll .
fi
# Copy stub .lib for test program on Windows -- build with: build.cmd x64
if [ -e ../../src/libomapi64.lib ]; then
cp ../../src/libomapi64.lib .
fi
#nm libomapi.a | grep _OmS | grep -v _OmSe
#dumpbin /exports libomapi.dll
#dumpbin /exports libomapi64.dll