我正在使用odb编译器作为自定义构建工具。即使输入文件没有更改,构建工具仍然会不断执行。
命令行:
odb -Ic:\menuplan\src\ingredient -o c:\menuplan\src\ingredient
-d mysql --hxx-prologue "#include \"odb/traits.hxx\"" --generate-query
--generate-schema --schema-format separate
c:\menuplan\src\ingredient\ing_odb_category.hpp`
输入文件是:
ing_odb_category.hpp
。输出结果:
ing_odb_category-odb.hxx;ing_odb_category-odb.ixx;ing_odb_category-odb.cxx;ing_odb_category-schema.cxx
需要额外的依赖项:
ing_odb_category.hpp
描述:
odb ing_odb_category.hpp
来自Visual Studio 2010的输出:
2>------ Build started: Project: vs_2010, Configuration: Debug Win32 ------
2> odb ing_odb_category.hpp
odb
工具以 ing_odb_category.hpp
作为输入并生成 ing_odb_category-odb.hxx
, ing_odb_category-odb.ixx
,ing_odb_category-odb.cxx
, ing_odb_category-schema.cxx
文件。即使
ing_odb_category.hpp
文件没有更改,我也可以连续多次构建解决方案,自定义构建事件仍将运行。如何让 Visual Studio 仅在头文件更改时执行自定义构建?从 vcxproj 文件中:
<CustomBuild Include="..\ing_odb_category.hpp">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">odb -Ic:\menuplan\src\ingredient -o c:\menuplan\src\ingredient -d mysql --hxx-prologue "#include \"odb/traits.hxx\"" --generate-query --generate-schema --schema-format separate c:\menuplan\src\ingredient\ing_odb_category.hpp</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Static_Unicode|Win32'">odb -Ic:\menuplan\src\ingredient -o c:\menuplan\src\ingredient -d mysql --hxx-prologue "#include \"odb/traits.hxx\"" --generate-query --generate-schema --schema-format separate c:\menuplan\src\ingredient\ing_odb_category.hpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">odb ing_odb_category.hpp</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug_Static_Unicode|Win32'">odb ing_odb_category.hpp</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ing_odb_category-odb.hxx;ing_odb_category-odb.ixx;ing_odb_category-odb.cxx;ing_odb_category-schema.cxx</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Static_Unicode|Win32'">ing_odb_category-odb.hxx;ing_odb_category-odb.ixx;ing_odb_category-odb.cxx;ing_odb_category-schema.cxx</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ing_odb_category.hpp</AdditionalInputs>
</CustomBuild>
环境:
- Visual Studio 2010
- Windows 7 - 64位