MSBUILD commands for C++ VS2010
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: MSBUILD commands for C++ VS2010

  1. #1
    Join Date
    Oct 2007
    Location
    India
    Posts
    30

    MSBUILD commands for C++ VS2010

    Hi All,

    I'm working on project migration in which a VS2003 C++ project is migrated to VS2010. The VS2003 project was built using NMAKE whereas the VS2010 project should use MSBUILD.

    Based on the NMAKE commands I'm trying to create the respective MSBUILD file.


    Below is a "compiling and linking command" in NMAKE file.

    #macro DEFINE_FORCE_BUILD_VERSION
    !ifdef FORCE_BUILD_VERSION
    DEFINE_FORCE_BUILD_VERSION=/DFORCE_BUILD_VERSION=$(FORCE_BUILD_VERSION)
    !else
    DEFINE_FORCE_BUILD_VERSION=
    !endif


    cl /GX /MD /Zm800 /I..\..\include /I"$(PBASE_ANCHOR)\hs_regex\include" $(DEFINE_FORCE_BUILD_VERSION) /Fecode_generator.exe code_generator.cpp /link /LIBPATH:"$(PBASE_ANCHOR)\hs_regex\lib" hs_regex_static.lib

    I'm trying to write its corresponding msbuild command.


    <ItemGroup>
    <ClInclude Include="$(PBASE_ANCHOR)\hs_regex\lib\hs_regex.lib" />
    <ClInclude Include="$(PBASE_ANCHOR)\hs_regex\lib\hs_regex_static.lib" />
    </ItemGroup>
    <ItemGroup>
    <ClCompile Include="$(CODEGEN_DIR)\uff_code_generator.cpp" />
    <ClCompile Include="$(CODEGEN_DIR)\cg_bootstrap.cpp" />
    </ItemGroup>

    <Target Name="build" >
    <MSBuild Projects="@(ClCompile)" Targets="$(DEVENV_OPTION)" Properties="Configuration=$(CONFIGURATION)"/>
    </Target>


    This is what I have written to compile-n-link the code_generator.cpp and \cg_bootstrap.cpp.

    Am I missing any targets or properties to get the .exe file, .obj file for code_generator.cpp and cg_bootstrap.cpp??

    Any help would be appreciated.. :-)

  2. #2
    Join Date
    Oct 2007
    Location
    India
    Posts
    30

    Re: MSBUILD commands for C++ VS2010

    Finally I got it solved.


    ---- NMAKE command -----
    cl /GX /MD /Zm800 /I..\..\include /I"$(PBASE_ANCHOR)\hs_regex\include" $(DEFINE_FORCE_BUILD_VERSION) /Fecode_generator.exe code_generator.cpp /link /LIBPATH:"$(PBASE_ANCHOR)\hs_regex\lib" hs_regex_static.lib


    --MSBUILD Command----

    <UsingTask TaskName="CL" AssemblyFile="C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Build.CPPTasks.Win32.dll" />
    <UsingTask TaskName="Link" AssemblyFile="C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Build.CPPTasks.Win32.dll" />

    <ItemGroup>
    <ClCompile Include="$(CODEGEN_DIR)\cg_bootstrap.cpp" />
    </ItemGroup>

    <ItemGroup>
    <Compile Include="$(CODEGEN_DIR)\uff_code_generator.cpp" />
    </ItemGroup>


    <Target Name="build">
    <Message Text="$(PDB_CMD_GLOBAL_TRACE_TARGET)"/>
    <CL Sources="@(ClCompile);" AdditionalOptions="/EHsc" />
    <Link Sources="@(ClCompile -> '%(Filename).obj')" />
    <Exec Command="cg_bootstrap.exe cg_validators.inc" />
    <CL Sources="@(Compile)" AdditionalOptions="/EHsc /MD /Zm800 /Feuff_code_generator.exe uff_code_generator.cpp" AdditionalIncludeDirectories="..\..\include;$(PBASE_ANCHOR)\hs_regex\include" />
    <Link Sources="@(Compile -> '%(Filename).obj')" ForceFileOutput="UndefinedSymbolOnly" AdditionalDependencies="hs_regex_static.lib" AdditionalLibraryDirectories="$(PBASE_ANCHOR)\hs_regex\lib" />

    <Exec Command="copy /y %22$(CODEGEN_DIR)\uff_code_generator.exe%22 %22$(BUILDBIN)%22" />
    </Target>


    Thanks,

    Dinesh Sundaram

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center