[Solved] CLI switch between Win32 and x64 Platform for build automation on Windows?


#1

Hello JUCErs,

I am trying to automate my build on Windows.

I would like to build all binaries for 64 and 32bit from the command line without the need to go to the Projucer and manually set the Architecture property in the Release settings of the Visual Studio exporter.

I can build the solution with either:

msbuild Solution.sln /p:Configuration=Release /p:Platform=x64
msbuild Solution.sln /p:Configuration=Release /p:Platform=Win32

or

devenv Solution.sln /Build "Release|x64"
devenv Solution.sln /Build "Release|Win32"

But between building the 64 and 32 bit binaries I need to select next to be build architecture from the Projucer and resave the project.

What I want instead is to completely automate the build (I have a NodeJS/grunt cli build that executes all the tasks).

Anyone has an advice?

Update:

  • Why does the Projucer makes you choose between the 2 Architectures, since the solution can have both. Can’t the Projucer just setup the 2 Architectures in the solution?

//cc: @fabian @ed95 @timur


[Solved] How do you replace Project Version through the CLI on Windows?
#2

I’m not at my windows box right now, but IIRC that is the solution.
You can add additional configurations in the projucer and name them e.g. Debug-x64 and Debug-32 (Right click on Debug and select create copy of this configuration). Then you can set the settings for architecture in each one accordingly.

Then call

msbuild Solution.sln /p:Configuration=Debug-x64 /p:Platform=x64
msbuild Solution.sln /p:Configuration=Debug-32 /p:Platform=Win32
msbuild Solution.sln /p:Configuration=Release-x64 /p:Platform=x64
msbuild Solution.sln /p:Configuration=Release-32 /p:Platform=Win32

N.B. eventually you can omit then the p:Platform, but better test yourself…

HTH


#3

Perfect! Thanks so much.


#4

Once you have all the configurations you can use Batch Build inside the VS IDE

Rail


#5

I’m using appveyor for automated Windows builds and found that having 2 separate Visual Studio exporters works great for that. After creating the exporters you should set their target project folders to something sensible and choose the architectures. Then adjust appveyor.yml as follows:

environment:
  matrix:
    - your_solution: 'Builds\VisualStudio2017_x64\YourProject.sln'
    - your_solution: 'Builds\VisualStudio2017_x86\YourProject.sln'
build:
  project: '%your_solution%'
  verbosity: minimal

The build step can also be a script:

build_script:
  - msbuild %your_solution%

Hope that helps!