From bakefile to msvs2088prj [long]

Mauro Ziliani <[email protected]> Thu, 31 Dec 2009 09:09:44 +0100
Newsgroups gmane.comp.sysutils.bakefile.devel
Message-ID <[email protected]>
Hi all.
Finally I can drive bakefile as I like.

But I have the last stone to brake.
My source project tree is the following

solution.bkl
app/main.cxx
lib/lib.cxx

I'd like to do this.
1. solution.sln in the project root
2. A file .vcproj for each sub dir in the project.


That is, after making bakefile -f msvs2008prj solution.bkl,

solution.bkl
solution.sln
app/main.cxx
app/app.vcproj
lib/lib.cxx
lib/lib.vcproj

My solution.bkl is

---- solution.bkl ----
<?xml version='1.0' encoding='utf-8'?>
<makefile>

<option name="BUILD">
<values>release,debug</values>
<default-value>debug</default-value>
</option>

<set var="DEBUG_SUFFIX">
     $(substituteFromDict(BUILD, {'debug':'d','release':''}))
</set>

<set var="DEBUG_INFO">
     $(substituteFromDict(BUILD, {'debug':'on','release':'off'}))
</set>
<set var="OPTIMIZE">
     $(substituteFromDict(BUILD, {'debug':'off','release':'size'}))
</set>

<set var="BUILDDIR">
     $(FORMAT)_build_$(BUILD)
</set>

<template id="base">
<dirname>$(BUILD)</dirname>

<debug-info>$(DEBUG_INFO)</debug-info>
<optimize>$(OPTIMIZE)</optimize>
<runtime-libs>dynamic</runtime-libs>
<threading>multi</threading>

<if cond="FORMAT in ['msvs2008prj']">
<set var="MSVS_PROJECT_FILE">$(id)/$(id).vcproj</set>
</if>
</template>

<template id="applicazione" template="base">
<exename>$(id)$(DEBUG_SUFFIX)</exename>
</template>

<template id="libreria" template="base">
<libname>$(id)$(DEBUG_SUFFIX)</libname>
</template>

<exe id="app" template="applicazione">
<app-type>console</app-type>

<sources>main.cxx</sources>
</exe>

<lib id="lib" template="libreria">
<sources>lib.cxx</sources>
</lib>

</makefile>
---- solution.bkl ----

I'd like to move <sources> tags from lib and app to <template id="base"> 
using $(fileList("*.cxx")) python function.

<template id="base">
<dirname>$(BUILD)</dirname>

<debug-info>$(DEBUG_INFO)</debug-info>
<optimize>$(OPTIMIZE)</optimize>
<runtime-libs>dynamic</runtime-libs>
<threading>multi</threading>

<if cond="FORMAT in ['msvs2008prj']">
<set var="MSVS_PROJECT_FILE">$(id)/$(id).vcproj</set>
<set-srcdir>$(id)</set-srcdir>
</if>

<sources>$(fileList("*.cxx"))</sources>
</template>

But into vcproj files the SRCDIR is <built-in function id> and not the 
folder of the subproject.

Any idea?

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev