@@ -35,8 +35,8 @@ string getFileExtension( const wchar_t* filePath )
3535
3636int _wmain (int argc, wchar_t ** argv)
3737{
38- path exePath (argv[0 ]);
39- auto exeDir = weakly_canonical ( exePath) .parent_path ();
38+ path exePath = weakly_canonical (argv[0 ]);
39+ auto exeDir = exePath.parent_path ();
4040 path scriptToRun;
4141
4242 for (auto & pit : directory_iterator (exeDir))
@@ -131,14 +131,32 @@ int _wmain(int argc, wchar_t** argv)
131131 c.General .OutDir = LR"( .\)" ;
132132 c.General .UseDebugLibraries = true ;
133133 c.General .LinkIncremental = true ;
134+ c.General .ConfigurationType = conftype_DynamicLibrary;
134135 c.CCpp .Optimization .Optimization = optimization_Disabled;
135- c.CCpp .General .AdditionalIncludeDirectories = exeDir.append (" SolutionProjectModel" ).c_str ();
136+ c.CCpp .General .AdditionalIncludeDirectories = path ( exeDir) .append (" SolutionProjectModel" ).c_str ();
136137 c.CCpp .Language .LanguageStandard = cpplang_stdcpp17;
137138 c.Linker .System .SubSystem = subsystem_Windows;
138139 c.Linker .Debugging .GenerateDebugInformation = debuginfo_true;
139140 }
140141 );
141142
143+ auto dll = path (exeDir).append (" SolutionProjectModel.dll" );
144+ auto f = p.File (dll.c_str (), true );
145+ f->General .ItemType = CustomBuild;
146+ auto exePathRelative = relative (exePath, projectDir);
147+ f->VisitTool (
148+ [&](PlatformConfigurationProperties* props)
149+ {
150+ CustomBuildToolProperties& custtool = *((CustomBuildToolProperties*)props);
151+ CStringW cmd = CStringW (" \" " ) + exePathRelative.c_str () + " \" %(FullPath) >$(IntermediateOutputPath)%(Filename).def" ;
152+ cmd += " \n " ;
153+ cmd += " lib /nologo /def:$(IntermediateOutputPath)%(Filename).def /machine:$(Platform) /out:$(IntermediateOutputPath)%(Filename)_lib.lib" ;
154+ custtool.Message = " Generating static library for %(Identity)..." ;
155+ custtool.Command = cmd;
156+ custtool.Outputs = " $(IntermediateOutputPath)%(Filename)_lib.lib" ;
157+ }
158+ , &CustomBuildToolProperties::GetType ());
159+
142160 if ( !p.Save () )
143161 {
144162 printf (" Error: Could not save project file '%S'" , scriptToRun.stem ().c_str () );
0 commit comments