Building MapGuide trunk with Visual Studio Express Edition
Environment Setup
With the move to VS2012 as the defacto C++ compiler for windows, building MapGuide on Windows with free tools has never been easier.
Visual Studio 2012 Express for Windows Desktop now includes *both* x86 and x64 C++ compilers. Installation of additional Windows SDKs and other tools to get the x64 compiler is no longer required. However it is worth noting that the x64 compiler that comes with Visual Studio 2012 Express is a cross-compiler (ie. x86_amd64), and not a native one. This is not really important for building MapGuide, but something to note for when building FDO.
Before building MapGuide manually via Visual Studio or via msbuild from the command-line, you must set up some environment variables.
To set up the environment for 32-bit compilation, launch the Developer Command Prompt for VS2012 and run:
setenvironment.bat
To set up the environment for 64-bit compilation, launch the Developer Command Prompt for VS2012 and run:
setenvironment64.bat
Launching Visual Studio (wdexpress.exe) from that same command-line afterwards will carry the initialized environment variables into Visual Studio.
All future references to Visual Studio in this page, assume it has been launched with these environment variables set.
Build Oem
Manual
Open Oem.sln in Visual Studio 2012 Express and build the solution using your configuration of choice.
Then open the CS-Map OpenSource.sln and build that solution using the same configuration.
Automated
From the Developer Command Prompt for VS2012 type the following from the Oem folder:
msbuild.exe /p:Configuration=Release Oem.sln
Then go into the CS-Map folder and type the following:
msbuild.exe /p:Configuration=Release OpenSource.sln
A note about building CS-Map in 64-bit
When building the OpenSource.sln in a 32-bit system using the 64-bit cross compiler, you will get a post-build error. This is because the Compiler.vcproj project has a post-build step that runs the compiled executable to compile the Coordinate System dictionaries. The compiled executable being a 64-bit binary, will not run on a 32-bit system. The current CS-Map trunk has been patched to not run the post-build event for x64 if being cross-compiled on a 32-bit machine.
Nevertheless, the Coordinate System Dictionaries will still have to be compiled at least once. To resolve this, build the OpenSource.sln (Compiler and Library) in 32-bit first, this will trigger the post-build event and compile your CS dictionaries. Then only build the Library.vcproj project in 64-bit. For subsequent builds, you only need to build the Library.vcproj project
Build Server
Manual
Open Server.sln in Visual Studio 2012 Express and build the solution using the same configuration used to build your Oem components.
Automated
From the Developer Command Prompt for VS2012 type the following from the MgDev\Server folder:
msbuild.exe /p:Configuration=Release Server.sln
Build WebTier
Manual
Open WebTier.sln in Visual Studio 2012 Express and build the solution using the same configuration used to build the Server solution.
Automated
From the Developer Command Prompt for VS2012 type the following from the MgDev\Web\src folder:
msbuild.exe /p:Configuration=Release WebTier.sln
Doing it all automatically
A build.bat
file has been provided in the MgDev directory that does all of the above.
Typing the following from the command line:
build.bat
Will build the full Oem, Server and WebTier solutions
Typing the following afterwards:
build.bat -a=install
will copy all the compiled binaries and required files into a pre-defined output directory (default is MgDev\Release
for 32-bit and MgDev\Release64
for 64-bit. You can specify a custom output directory by using the -o
switch)