Skip to content
This repository was archived by the owner on Jun 16, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions ion/ionvcproj.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@
</Link>
<PreBuildEvent>
<Command>
cd $ionhome
ion $flags $package
set IONHOME=$ionhome
cd $packagepathparent
$ioncmd $flags $package
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
Expand All @@ -135,12 +136,14 @@

ionhome = os.getenv("IONHOME")
if not ionhome:
print("Error: IONHOME is not set")
sys.exit(1)
print("Error: IONHOME is not set")
sys.exit(1)
else:
ioncmd = ntpath.join(ionhome, "ion") # assumes executable is named 'ion'

ionpath = os.getenv("IONPATH")
if not ionpath:
print("Error: IONPATH is not set")
print("Error: IONPATH is not set")

packagepath = package.replace('.', '\\')
for base in ionpath.split(';'):
Expand All @@ -152,25 +155,28 @@
print("Error: Package %s not found in IONPATH" % package)
sys.exit(1)

packagepathparent = os.path.dirname(packagepath)
template = string.Template(template)
guid = uuid.uuid3(base_guid, package)
cfile = ntpath.join(ntpath.abspath(os.getcwd()), package, "%s.c" % (package))
flags = ' '.join(["-o " + cfile] + flags)
ionfilelist = glob.glob(ntpath.join(packagepath, "*.ion"))
ionfiles = '\n'.join(""" <Text Include="%s" />""" % ionfile for ionfile in ionfilelist)
ionfiles = '\n'.join(""" <Text Include="%s" />""" %
ionfile for ionfile in ionfilelist)
vcxproj_str = template.substitute(
guid=guid,
package=package,
ionhome=ionhome,
cfile=cfile,
packagepath=packagepath,
ionfiles=ionfiles,
flags = flags,
guid=guid,
package=package,
ionhome=ionhome,
cfile=cfile,
packagepath=packagepath,
packagepathparent=packagepathparent,
ionfiles=ionfiles,
flags=flags,
ioncmd=ioncmd
)

if not os.path.isdir(package):
os.mkdir(package)

vcxproj = open("%s/%s.vcxproj" % (package, package), "w")
vcxproj.write(vcxproj_str)