|
Boost-Build : |
From: Olivier.Pomerleau_at_[hidden]
Date: 2006-09-21 12:32:35
Hello,
I have been banging my head on this for a couple too long so I need
some help. Here is the concept of what I am doing:
I use an intermediate language(.idl) to generate 2 cpp and 2 hpp files. I
have an exe(idlcompiler) (that I build to do so) that take the .idl and
generate the cpp and hpp files.
What I want to have:
-If change one idl, I want to regenerate its hpp/cpp files.
-If I change the source code of the exe, I want to rebuild that exe
and then I want all hpp/cpp to be regenerated for their idls.
I ll post part of my jambase that I find relevent. Feel free to ask for
more if you think it is important
Thank you for any information that can help me make this works !
rule Build( target : source * : projectName : libFiles * : ignoredLibs * :
type : aggregatedLibFiles * : ppdefs * : postBuildCommand ? )
{
Depends clean : $(cleanTarget) ;
ALWAYS $(cleanTarget) ;
local CONFIG_NAME = $($(config).NAME) ;
# TODO include cleaning information in variables
Clean $(cleanTarget) : $(target) ;
local compiled = ;
for local src in $(source)
{
....
if $(src:S) = ".idl"
{
#this are the file to be generated
genSourceCpp = $(src:D)\\$(src:B).cpp ;
genSourceHpp = $(src:D)\\$(src:B).hpp ;
genSourceCppWrapper = $(src:D)\\Wrapper_$(src:B).cpp ;
genSourceHppWrapper = $(src:D)\\Wrapper_$(src:B).hpp ;
#depend on the idl File
Depends $(genSourceCpp) : $(src) ;
Depends $(genSourceHpp) : $(src) ;
Depends $(genSourceCppWrapper) : $(src) ;
Depends $(genSourceHppWrapper) : $(src) ;
#depend on the generator
Depends $(src) : $($(config).IDLCOMPILER .EXE) ;
## I have tried depending on the project where my idlcompiler
is made
#Depends $(src) : <projectname>idlcompiler ;
## I have tried depending on a txt file and my cpp/hpp were
always regenerated
#Depends $(src) : z:\\test1.txt2 ;
Clean $(cleanTarget) : $(genSourceCpp) ;
Clean $(cleanTarget) : $(genSourceCppWrapper) ;
IDLCOMPILER on $(genSourceCpp) = $($(config).IDLCOMPILER.EXE )
;
IdlCompile $(genSourceCpp) : $(src) ;
IDLCOMPILER on $(genSourceCppWrapper) =
$($(config).IDLCOMPILER.EXE) ;
IdlCompile $(genSourceCppWrapper) : $(src) ;
comp = $(intermediateDir)\\$(genSourceCpp:B).cpp.obj ;
compiled += $(comp) ;
CompiledCode $(comp) : $(genSourceCpp) : $(config) : :
$(ppdefs) ;
comp = $(intermediateDir)\\$(genSourceCppWrapper:B).cpp.obj ;
compiled += $(comp) ;
CompiledCode $(comp) : $(genSourceCppWrapper) : $(config) : :
$(ppdefs) ;
}
}
Depends $(target) : $(compiled) ;
...
# When using multiple CPUs/threads, make sure no .obj in the same
project
# is built at the same time (to avoid multiple access to .pdb).
JAM_SEMAPHORE on $(compiled) = $(projectName:G=semaphore) ;
# Delete files that can't be built.
# It seems to be useful when .pch is invalid, in that case the
# .lib/.dll/.exe is still there even if it fails to build.
RMOLD $(target) ;
}
Part of my output for dependency are
4 Name: z:\Intermediate\DebugTools\seed_language_test\seed_class.cpp.obj
1> : Updating it
1> : Depends on
.\Techno5thGen\UnitTests\seed_language_test\seed\seed_class.cpp (update)
1> : Depends on
.\Techno5thGen\UnitTests\seed_language_test\seed\seed_class.cpp (internal
node) (update)
1>-> 5 Name:
.\Techno5thGen\UnitTests\seed_language_test\seed\seed_class.cpp
1> : Updating it
1> : Depends on
.\Techno5thGen\UnitTests\seed_language_test\seed\seed_class.seedunittest
(old) (max time)
1>-> 6 Name:
.\Techno5thGen\UnitTests\seed_language_test\seed\seed_class.seedunittest
1> : Outdated, updating it
1> : Depends on z:\test1.txt2 (newer) (max time)
1> 7 Name: z:\test1.txt2
1> : Newer <------------------------------------------ Why
is this always newer? The date doesnt change on the disk...
Olivier Pomerleau
Game Programmer
Artificial Mind & Movement
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk