问题
I'm maintaining this solution in Visual Studio 2008, but I build my deliverables with bjam. The solution includes 3 projects. jamfiles are setup to build 2 versions of the solution (say A and B), and then 32-bit and 64-bit executables for each version.
My problem is that bjam is not finding the .h files for one of the projects in the solution, generating the error below. These .h files are physically located 2 directories up and one down in an "include" folder.
If I copy the .h files to where the project's jamfile is located, the errors go away, and the solution builds perfectly. However, we must keep the .h files in the "include" folder.
My question is, how do I instruct bjam to look for .h files in the "include" folder? Below is the jamfile for the problematic project, and my site-config.jam file
Any hints will be much appreciated. Thanks.
-----------------------------------
ERROR:
compile-c-c++ Utilities\TemperatureLog\bin\msvc-9.0\small_x86\threading-multi\user-interface-gui\TemperatureLog.obj
TemperatureLog.cpp
c:\winirdir\build\winir\utilities\temperaturelog\TemperatureLogDlg.h(50) : error C2653: 'SBF' : is not a class or namespace name
c:\winirdir\build\winir\utilities\temperaturelog\TemperatureLogDlg.h(50) : error C2143: syntax error : missing ';' before '*'
c:\winirdir\build\winir\utilities\temperaturelog\TemperatureLogDlg.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\winirdir\build\winir\utilities\temperaturelog\TemperatureLogDlg.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
------------------------------------------
JAMFILE:
project temperaturelog :
: requirements <define>_AFXDLL
<user-interface>gui
:
;
sources = [ glob *.cpp ] TemperatureLog.rc ;
exe TemperatureLog$(suffix) : $(sources)
/sbfsdk//SbfSdk$(suffix)
:
: small_x86
;
exe TemperatureLog$(suffix)_x64 : $(sources)
/sbfsdk//SbfSdk$(suffix)_x64
:
: small_x64
;
exe TemperatureLog$(suffix)_sap : $(sources)
/sbfsdk//SbfSdk$(suffix)_sap
:
: smallSapera_x86
;
exe TemperatureLog$(suffix)_sap_x64 : $(sources)
/sbfsdk//SbfSdk$(suffix)_sap_x64
:
: smallSapera_x64
;
install dist_x86 : TemperatureLog$(suffix) :
<variant>small_x86 : <location>$(installRoot_x86) ;
install dist_x64 : TemperatureLog$(suffix)_x64 :
<variant>small_x64 : <location>$(installRoot_x64) ;
install dist_sap_x86 : TemperatureLog$(suffix)_sap :
<variant>smallSapera_x86 : <location>$(installRoot_x86) ;
install dist_sap_x64 : TemperatureLog$(suffix)_sap_x64 :
<variant>smallSapera_x64 : <location>$(installRoot_x64) ;
--------------------------------
site-config.jam
project site-config ;
path-constant BoostRoot : C:/Boost/boost_1_44_0 ;
lib shlwapi : : <name>shlwapi ;
lib advapi32 : : <name>advapi32 ;
lib gdi32 : : <name>gdi32 ;
lib user32 : : <name>user32 ;
lib ole32 : : <name>ole32 ;
lib vfw32 : : <name>vfw32 ;
lib delayimp : : <name>delayimp ;
lib gdiplus : : <name>gdiplus ;
lib strmiids : : <name>strmiids ;
lib winmm : : <name>winmm ;
lib msvcrt : : <name>msvcrt ;
lib atls : : <name>atls ;
lib ksproxy : : <name>ksproxy ;
lib kernel32 : : <name>kernel32 ;
lib oleaut32 : : <name>oleaut32 ;
lib uuid : : <name>uuid ;
lib htmlhelp : : <name>htmlhelp ;
lib version : : <name>version ;
lib msi : : <name>msi ;
path-constant PleoraRoot : "C:/Program Files (x86)/Pleora Technologies Inc/iPORT Software" ;
lib cyutilslib_x86 : : <name>CyUtilsLib <search>$(PleoraRoot)/Libraries
:
: <include>$(PleoraRoot)/Includes
;
lib cyutilslib_x64 : : <name>CyUtilsLib64 <search>$(PleoraRoot)/Libraries
:
: <include>$(PleoraRoot)/Includes
;
path-constant PdvRoot : "C:/EDT/pdv" ;
lib pdvlib_x86 : : <name>pdvlib <search>$(PdvRoot)/lib/x86
:
: <include>$(PdvRoot)
;
lib pdvlib_x64 : : <name>pdvlib <search>$(PdvRoot)/lib/amd64
:
: <include>$(PdvRoot)
;
path-constant VceRoot : "C:/Program Files/Imperx/FrameLink Express/SDK" ;
lib vceclb_x86 : : <name>vceclb <search>$(VceRoot)/lib/win32
:
: <include>$(VceRoot)/inc
;
lib vceclb_x64 : : <name>vceclb <search>$(VceRoot)/lib/x64
:
: <include>$(VceRoot)/inc
;
path-constant DirectXRoot : "C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)" ;
lib d3dx9_x86 : : <name>d3dx9 <search>$(DirectXRoot)/Lib/x86
:
: <include>$(DirectXRoot)/Include
;
lib d3dx9_x64 : : <name>d3dx9 <search>$(DirectXRoot)/Lib/x64
:
: <include>$(DirectXRoot)/Include
;
lib d3d9_x86 : : <name>d3d9 <search>$(DirectXRoot)/Lib/x86
:
: <include>$(DirectXRoot)/Include
;
lib d3d9_x64 : : <name>d3d9 <search>$(DirectXRoot)/Lib/x64
:
: <include>$(DirectXRoot)/Include
;
path-constant IfcRoot : "C:/IFC510" ;
lib ifc21 : : <name>ifc21 <search>$(IfcRoot)/lib
:
: <include>$(IfcRoot)/include
;
path-constant PythonRoot : "C:/Required_Binaries/Python-2.7.1" ;
lib python_x86 : : <name>python27 <search>$(PythonRoot)/PCBuild
:
: <include>$(PythonRoot)/Include <include>$(PythonRoot)/PC
;
lib python_x64 : : <name>python27 <search>$(PythonRoot)/PCBuild/amd64
:
: <include>$(PythonRoot)/Include <include>$(PythonRoot)/PC
;
# path-constants work up to here, but not after this, so we use the full path. Why??
path-constant DirectShowRoot : "C:/Program Files/Microsoft SDKs/Windows/v7.0/Samples/multimedia/directshow/baseclasses" ;
lib Strmbase_x86 : : <name>strmbase <search>"C:/Program Files/Microsoft SDKs/Windows/v7.0/Samples/multimedia/directshow/baseclasses/Release_MBCS"
:
: <include>$(DirectShowRoot)
;
lib Strmbase_x64 : : <name>strmbase <search>"C:/Program Files/Microsoft SDKs/Windows/v7.0/Samples/multimedia/directshow/baseclasses/x64/Release_MBCS"
:
: <include>$(DirectShowRoot)
;
path-constant SaperaRoot : "C:/DALSA/Sapera" ;
lib SapClassBasic_x86 : : <name>SapClassBasic <search>"C:/Dalsa/Sapera/Lib/Win32"
:
: <include>$(SaperaRoot)/Classes/Basic <include>$(SaperaRoot)/Include
;
lib SapClassBasic_x64 : : <name>SapClassBasic <search>"C:/Dalsa/Sapera/Lib/Win64"
:
: <include>$(SaperaRoot)/Classes/Basic <include>$(SaperaRoot)/Include
;
path-constant SbfSdkInc : "C:\WinIRDir\build\WinIR\SbfSdk\include" ;
path-constant ActRoot : "C:/Program Files (x86)/Active Silicon/Phoenix/Win/SDK6.47" ;
lib ActiveSilicon_x86 : : <name>phxlw32 <search>$(ActRoot)/Lib/win32
:
: <include>$(ActRoot)/Include
;
lib ActiveSilicon_x64 : : <name>phxlx64 <search>$(ActRoot)/Lib/win64
:
: <include>$(ActRoot)/Include
;
回答1:
Try something like this with your first exe rule:
exe TemperatureLog$(suffix) : $(sources) /sbfsdk//SbfSdk$(suffix) : <include>../../include : small_x86 ;
More details can be found here
If that works, then instead of duplicating it for every exe
rule, you may be able to move it into the project
rule with:
project temperaturelog : requirements <define>_AFXDLL <user-interface>gui <include>../../include ;
Then it should apply to all rules invoked as part of this project.
来源:https://stackoverflow.com/questions/10644892/how-can-i-get-bjam-to-find-my-h-files-in-other-directories