-
Notifications
You must be signed in to change notification settings - Fork 0
/
Obj2ExeAction.py
executable file
·45 lines (35 loc) · 1.15 KB
/
Obj2ExeAction.py
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
from Action import *
from OptionManager import *
import os
from subprocess import *
class Obj2ExeAction(Action):
def __init__(self, prj):
Action.__init__(self)
self.m_prj = prj
def execute(self, target, allPre, changedPre):
if not self.m_prj.getCompileOk():
return
Action.execute(self, target, allPre, changedPre)
exe_path = target.path()
if self.m_prj.type() == "dll":
cmd = "g++ -shared -fPIC -o "
elif self.m_prj.type() == "lib":
cmd = "ar rcs "
else:
cmd = "g++ -o "
cmd += exe_path
for p in allPre:
if p.path().endswith(".o"):
cmd = cmd + " " + p.path()
# for lib in self.m_prj.librariesList():
# cmd = cmd + "-l" + lib + " "
optMgr = OptionManager()
options = optMgr.getOptionFor(exe_path, self.m_prj.activeConfig())
if not options == "":
cmd = cmd + " " + options
print "Linking..."
#print cmd
#os.system(cmd)
retcode = call(cmd, shell=True)
if retcode != 0:
self.m_prj.setLinkOk(False)