Building Alternative Executable in RiverWare Source Tree
Phil Weinstein, CADSWES,
Original Draft: 6-15-2015. Edit: 6-22-2015.
Document Status:
Primarily as a proof-of-concept for a design provision of a new RiverWare Scenario Explorer application, changes to the Windows Visual Studio 2010 build were devised to support the creation of distinct executables (i.e. other than just riverware.exe) in the RiverWare source tree.
As a demonstration, a second application is built from the RiverWare source tree which consists of only the RiverWare Unit Converter. Closing this dialog exits the application:
The two main technical requirements for the build process are:
[Note, Phil, 6-16-2015]:
The process described below was the first attempt at addressing those requirements. Frankly, I'm feeling that the use of Qt qmake for this is too heavy handed. (And part of this process is not working well -- there is a problem with the release build). Even though there is no editing of files, some of the steps outlined below for switching the build to a different executable are tedious. And, I think, it adds unwarranted complexity to the build configuration. (Note that all those generated vcxproj files get checked in to the git repository).
Probably -- for the purpose of getting compile-time symbols into the build -- running a stand-alone script to swap in different header files -- would be the right idea.
In the process documented here, no editing of any files is required for switching the build between RiverWare and the Unit Converter application. This process involves these steps:
This results in one of the following two C++ preprocessor symbols to be defined:
To implement the showing of the application's initial, top-level dialog, changes in only the following C++ file were required:
Here is some information about the resulting executables. Note that the Unit Converter build DOES instantiate the Workspace GUI. But it doesn't show it.
Application | Path | Executable | Size | ||
RiverWare | Release | EngrObjs\Release | riverware.exe | 29.5 MB | 30,933,504 bytes |
Debug | EngrObjs\Debug | 58.7 MB | 61,652,992 bytes | ||
Unit Converter | Release | EngrObjs\Release | unitconvert.exe | Problem* | |
Debug | EngrObjs\Debug | 58.7 MB | 61,652,992 bytes |
*Build problem: the following error is preventing a complete release build:
C:\Riverware\staff\philw\WinPhilDev\EngrObjs\version.cpp : fatal error C1083: Cannot open compiler generated file: '.\Release\riverware\version.obj': No such file or directory.
Known problem. Since the qmake scripts generate only one primary project, after running one of these scripts, the following error is reported when loading the solution:
Microsoft Visual Studio
One or more projects in the solution were not loaded correctly. Please see the Output Window for details.C:\Riverware\staff\philw\WinPhilDev\EngrObjs\riverware.vcxproj : error : Project "C:\Riverware\staff\philw\WinPhilDev\EngrObjs\riverware.vcxproj" could not be found.
The former content of EngrObjs/riverware.pro was moved to EngrObjs/cadswesApp.pri.
The riverware.pro and a new unitconvert.pro just include that cadswesApp.pri file ...
include(cadswesApp.pri) |
After running qmakeUnitConvert.pl, the resulting unitconvert.vcxproj file was added to the solution (in Visual Studio). The dependencies on the other projects are set up in the same way as for riverware.vcxproj.
OLD: | my $cmd = "qmake $pro"; | ||
![]() |
|||
NEW: | my $cmd = "qmake \"DEFINES += CadswesApp_RiverWare\" $pro"; |
This file was copied from qmake.pl. The following changes were applied:
OLD: | chdir 'EngrObjs'; make ('riverware'); chdir '..'; |
||
![]() |
|||
NEW: | chdir 'EngrObjs';
make ('unitconvert'); chdir '..'; |
||
![]() |
|||
OLD: | my $cmd = "qmake $pro"; | ||
![]() |
|||
NEW: | my $cmd = "qmake \"DEFINES += CadswesApp_UnitConverter\" $pro"; |
NEW: | #include "UnitConvertDlg.hpp" | ||
![]() |
|||
OLD: | workspace->show(); | ||
![]() |
|||
NEW: | #ifdef CadswesApp_RiverWare { workspace->show(); } #elif defined CadswesApp_UnitConverter { workspace->hide(); UnitConvertDlg::showDlg(); } #elif { Undefined CadswesApp; // ERROR } #endif |
The code for this experiment is checked in to the AltExecTest1 GIT branch:
https://cadswes2.colorado.edu/internal/cgi-bin/gitweb/gitweb.pl/builds.git/shortlog/refs/heads/AltExecTest1
Excluding the 3 dozen vcxproj file changes being checked in with this commit, the actual significant changes are in these files:
--- (end) ---