Skip to content

Commit

Permalink
MSBuild start UI in case of MPI and/or Debug model: check model.exe n…
Browse files Browse the repository at this point in the history
…ame and set template in batch file
  • Loading branch information
amc1999 committed Apr 26, 2023
1 parent 0e8846a commit 940c007
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
15 changes: 2 additions & 13 deletions props/model-ompp.4.build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -298,18 +298,7 @@
StartOmppUI
-->

<!--
RUN_TEMPLATE is a name of pre-selected template file to run the model
RUN_TEMPLATE value is passed to UI model run page and automatically pre-selected
User can override this selection by choosing different template in UI
Template files are located in OM_ROOT/etc directory
-->
<PropertyGroup>
<RUN_TEMPLATE Condition="'$(Configuration)'=='Debug' And '$(Platform)'=='Win32'">run.Debug.template.txt</RUN_TEMPLATE>
<RUN_TEMPLATE Condition="'$(Configuration)'=='Debug' And '$(Platform)'=='x64'">run.Debug.template.txt</RUN_TEMPLATE>
<RUN_TEMPLATE Condition="'$(OM_CFG_DEFAULT_RUN_TMPL)'!=''">$(OM_CFG_DEFAULT_RUN_TMPL)</RUN_TEMPLATE>
<RUN_TEMPLATE Condition="'$(Configuration)'=='Release' And '$(Platform)'=='Win32'"></RUN_TEMPLATE>
<RUN_TEMPLATE Condition="'$(Configuration)'=='Release' And '$(Platform)'=='x64'"></RUN_TEMPLATE>
<OMS_URL_TICKLE>$(PUBLISH_DIR)/$(MODEL_NAME).oms_url.tickle</OMS_URL_TICKLE>
<ABS_OM_ROOT Condition="'$(OM_ROOT)'!=''">$([System.IO.Path]::GetFullPath('$(OM_ROOT)'))</ABS_OM_ROOT>
<!-- bug: System.IO.Path::GetFullPath('../../..') return: C:\Program Files (x86)\Microsoft Visual Studio\2019 -->
Expand All @@ -325,11 +314,11 @@
>
<Message Text="Using batch file to start openM++ UI:" />
<Message
Text="(set MODEL_NAME=$(MODEL_NAME)) &amp; (set OM_ROOT=$(ABS_OM_ROOT)) &amp; (set OM_CFG_DEFAULT_RUN_TMPL=$(RUN_TEMPLATE)) &amp; $(ABS_START_UI_BAT)"
Text="(set MODEL_NAME=$(MODEL_NAME)) &amp; (set OM_ROOT=$(ABS_OM_ROOT)) &amp; $(ABS_START_UI_BAT)"
/>
<Exec
WorkingDirectory="$(PUBLISH_DIR)"
Command="(set MODEL_NAME=$(MODEL_NAME)) &amp; (set OM_ROOT=$(ABS_OM_ROOT)) &amp; (set OM_CFG_DEFAULT_RUN_TMPL=$(RUN_TEMPLATE)) &amp; $(ABS_START_UI_BAT)"
Command="(set MODEL_NAME=$(MODEL_NAME)) &amp; (set OM_ROOT=$(ABS_OM_ROOT)) &amp; $(ABS_START_UI_BAT)"
/>
</Target>

Expand Down
20 changes: 20 additions & 0 deletions props/start-ui-at-build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,26 @@ if not defined model_exe_name (
)
)
)
if not defined model_exe_name (
if exist "%MODEL_NAME%_mpi.exe" (

set model_exe_name=%MODEL_NAME%_mpi.exe

if not defined OM_CFG_DEFAULT_RUN_TMPL (
set OM_CFG_DEFAULT_RUN_TMPL=mpi.ModelRun.template.txt
)
)
)
if not defined model_exe_name (
if exist "%MODEL_NAME%D_mpi.exe" (

set model_exe_name=%MODEL_NAME%D_mpi.exe

if not defined OM_CFG_DEFAULT_RUN_TMPL (
set OM_CFG_DEFAULT_RUN_TMPL=mpi.ModelDebug.template.txt
)
)
)
if not defined model_exe_name (
@echo ERROR: %MODEL_NAME% exe not found
EXIT 1
Expand Down

0 comments on commit 940c007

Please sign in to comment.