Skip to content

Commit dce32b9

Browse files
committed
fix(build): sync Configuration and config properties, update output paths
The build system has two configuration properties that must stay in sync: - Configuration: MSBuild property for managed projects (Debug, Release) - config: Legacy property for native C++ makefiles This commit: 1. Auto-derive config from Configuration when not explicitly set - Prevents accidental mismatches like /p:Configuration=Debug /p:config=release - Validates they match when both are specified, with clear error message 2. Update vcxproj files to use configuration-specific paths - Kernel.vcxproj: Output\Common → Output\$(Configuration)\Common - views.vcxproj: same pattern - TestViews.vcxproj: same pattern - Fixes IntelliSense paths when switching Debug/Release 3. Fix regen_midl.cmd - Remove hardcoded worktree path - Accept optional Configuration parameter (default: Debug) - Auto-detect VS 2022 Community or BuildTools installation
1 parent 6a83eac commit dce32b9

File tree

5 files changed

+55
-6
lines changed

5 files changed

+55
-6
lines changed

Build/SetupInclude.targets

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,33 @@
3434
>
3535
<fwrt Condition="'$(fwrt)' == ''">$(MSBuildThisFileDirectory)..</fwrt>
3636
</PropertyGroup>
37+
<!--
38+
Configuration Synchronization:
39+
There are two configuration properties that must stay in sync:
40+
- Configuration: Standard MSBuild property used by .NET/managed projects (Debug, Release)
41+
- config: Legacy property used by native C++ makefiles (debug, release, bounds, profile)
42+
43+
To prevent mismatches (e.g., Configuration=Debug with config=release), we:
44+
1. Default config from Configuration if not explicitly set
45+
2. Validate they match when both are specified
46+
-->
47+
<PropertyGroup>
48+
<!-- If config is not set, derive it from Configuration (default to Debug if neither set) -->
49+
<config Condition="'$(config)' == '' AND '$(Configuration)' != ''">$(Configuration)</config>
50+
<config Condition="'$(config)' == ''">Debug</config>
51+
</PropertyGroup>
52+
<Target Name="ValidateConfigurationSync"
53+
BeforeTargets="Setup"
54+
Condition="'$(Configuration)' != '' AND '$(config)' != ''">
55+
<!-- Normalize both to compare (handle case differences) -->
56+
<PropertyGroup>
57+
<_ConfigLower>$(Configuration.ToLowerInvariant())</_ConfigLower>
58+
<_configLower>$(config.ToLowerInvariant())</_configLower>
59+
</PropertyGroup>
60+
<Error
61+
Condition="'$(_ConfigLower)' != '$(_configLower)'"
62+
Text="Configuration mismatch detected!%0A%0A Configuration = $(Configuration)%0A config = $(config)%0A%0AThese must match to ensure managed and native builds use the same output paths.%0A%0ASolutions:%0A 1. Use only /p:Configuration=Release (config will be derived automatically)%0A 2. Or explicitly set both to match: /p:Configuration=Release /p:config=Release" />
63+
</Target>
3764
<!-- config is generally either Debug or Release, but might be Bounds or Profile. -->
3865
<!-- if the user gives it lowercase, fix it to be capitalized -->
3966
<Choose>

Src/Kernel/Kernel.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
5252
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">FwKernel.dll</NMakeOutput>
5353
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">x64;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
54-
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\Generic;..\..\Output\Common;..\views\lib;..\Graphite\lib;..\Cellar;..\AppCore;..\..\Include;..\DebugProcs;..\..\Lib\src\graphite2\include;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
54+
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\Generic;..\..\Output\$(Configuration)\Common;..\views\lib;..\Graphite\lib;..\Cellar;..\AppCore;..\..\Include;..\DebugProcs;..\..\Lib\src\graphite2\include;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
5555
<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
5656
<NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
5757
<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>

Src/views/Test/TestViews.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">nmake /nologo BUILD_CONFIG=Debug BUILD_TYPE=d BUILD_ROOT=$(ProjectDir)..\..\..\ BUILD_ARCH=x64 /f testViews.mak clean</NMakeCleanCommandLine>
5151
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)..\..\..\Output\Debug\TestViews.exe</NMakeOutput>
5252
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WIN64;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
53-
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)..\..\..\Src\views;$(ProjectDir)..\..\Views;$(ProjectDir)..\..\Views\Lib;$(ProjectDir)..\..\Kernel;$(ProjectDir)..\..\Generic;$(ProjectDir)..\..\..\Lib\src\unit++;$(ProjectDir)..\..\..\Output\Common;$(ProjectDir)..\..\..\Output\Common\Raw;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
53+
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)..\..\..\Src\views;$(ProjectDir)..\..\Views;$(ProjectDir)..\..\Views\Lib;$(ProjectDir)..\..\Kernel;$(ProjectDir)..\..\Generic;$(ProjectDir)..\..\..\Lib\src\unit++;$(ProjectDir)..\..\..\Output\$(Configuration)\Common;$(ProjectDir)..\..\..\Output\$(Configuration)\Common\Raw;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
5454
<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
5555
<NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
5656
<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>

Src/views/views.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\Bin\mkvw.bat d e</NMakeCleanCommandLine>
8585
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\Output\Debug\views.dll</NMakeOutput>
8686
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">x64;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
87-
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\Output\Common\Raw;..\..\Output\Common;..\Kernel;..\Generic;.;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
87+
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\Output\$(Configuration)\Common\Raw;..\..\Output\$(Configuration)\Common;..\Kernel;..\Generic;.;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
8888
<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
8989
<NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
9090
<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>

regen_midl.cmd

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
@echo off
2-
call C:\BuildTools\VC\Auxiliary\Build\vcvarsall.bat x64
3-
cd /d C:\fw-mounts\C\Users\johnm\Documents\repos\fw-worktrees\agent-1\Output\Common
4-
echo Running MIDL for x64...
2+
REM Usage: regen_midl.cmd [Configuration]
3+
REM Configuration: Debug or Release (default: Debug)
4+
setlocal
5+
set CONFIG=%~1
6+
if "%CONFIG%"=="" set CONFIG=Debug
7+
8+
REM Find vcvarsall.bat - try VS 2022 Community, then BuildTools
9+
if exist "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" (
10+
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
11+
) else if exist "C:\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" (
12+
call "C:\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
13+
) else (
14+
echo ERROR: Cannot find vcvarsall.bat
15+
exit /b 1
16+
)
17+
18+
REM Navigate to configuration-specific output directory
19+
cd /d "%~dp0Output\%CONFIG%\Common"
20+
if errorlevel 1 (
21+
echo ERROR: Directory Output\%CONFIG%\Common does not exist
22+
exit /b 1
23+
)
24+
25+
echo Running MIDL for x64 (%CONFIG% configuration)...
526
midl /env x64 /Oicf /out Raw /dlldata FwKernelPs_d.c FwKernelPs.idl
627
echo MIDL exit code: %ERRORLEVEL%
28+
endlocal

0 commit comments

Comments
 (0)