-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathutils.py
More file actions
29 lines (26 loc) · 663 Bytes
/
utils.py
File metadata and controls
29 lines (26 loc) · 663 Bytes
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
#!/usr/bin/python
import os
recompile = True
ext ='.so'
def compile_lib( name,
FFLAGS = "-std=c++11 -Og -g -Wall",
#LFLAGS = "-I/usr/local/include/SDL2 -lSDL2",
LFLAGS = "",
path = None,
clean = True,
):
print " COMPILATION OF : "+name
if path is not None:
dir_bak = os.getcwd()
os.chdir( path);
print os.getcwd()
if clean:
try:
os.remove( 'lib'+name+ext )
#os.remove( name+".o" )
except:
pass
os.system("g++ "+FFLAGS+" -c -fPIC "+name+".cpp -o "+name+".o "+LFLAGS )
os.system("g++ "+FFLAGS+" -shared -Wl,-soname,lib"+name+ext+" -o lib"+name+ext+" "+name+".o "+LFLAGS)
if path is not None:
os.chdir( dir_bak )