Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Current »

IncrediBuild doesn't yet support the new CMake feature in Visual Studio 2017, so below is a general command line workaround that will let you take advantage of the new feature.

For the sake of this demonstration, you can use a CMake sample project, which is located here:
https://www.codeproject.com/Articles/1181455/A-CMake-tutorial-for-Visual-Cplusplus-developers

What is applicable to this sample project will also be applicable to your CMake files and solutions

Generation:

  1. After downloading the project, copy all files to the same folder.

  2. Load in the relevant project folder to Visual Studio. CMake will auto-generate a new file, which we will need to copy the CMake output in Visual Studio.


  3. The following command was automatically generated in the directory shown by the CMake output.
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\CMake.exe" -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\Beelal\CMakeBuilds\4ad98d3d-1ddb-bf3a-b858-3709d1a407c1\build\x86-Debug\install" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_MAKE_PROGRAM="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe" "C:\Users\Beelal\Desktop\cmakedemo\cmakedemo\src
    - Save the command as "generation_command.bat"

  4. Next, to get this command to work with IncrediBuild I needed to first create an XML profile and a second build command that included the automatically generated command.
    • Save the XML profile as "profile.xml" and include the following in the file:
  5. Now we, in a sense, "wrap" the original command with IncrediBuild by using the following commands:
    • "ibconsole /command="generation_command.bat" /profile="profile.xml" /openmonitor"
    • You can create a batch file command ib_command.bat so you don't need to manually type in the command again.
  6. Performing the above steps will trigger IncrediBuild to generate the relevant Solution.


Building the solution:

  1. After generating the solution done by completing the steps above, you can now build the solution with IncrediBuild's acceleration.

  2. The following command was used for the project located under C:\Users\Beelal\CMakeBuilds\4ad98d3d-1ddb-bf3a-b858-3709d1a407c1:
    • "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\CMake.exe" --build "C:\Users\Beelal\CMakeBuilds\4ad98d3d-1ddb-bf3a-b858-3709d1a407c1\install\x86-Debug" --clean-first -- "-v"
    • Save the command as build_command.bat

  3. To Build with IncrediBuild, now all you have to do is use the following command:
    • buildconsole /command="build_command.bat"

  4. Now your CMake solution should successfully build with IncrediBuild enabled.


  • No labels