@@ -76,6 +76,10 @@ def source(self):
76
76
def generate (self ):
77
77
if is_msvc (self ):
78
78
tc = MSBuildToolchain (self )
79
+ tc .configuration = "{}{}" .format (
80
+ "Debug" if self .settings .build_type == "Debug" else "Release" ,
81
+ "DLL" if self .options .shared else "LIB" ,
82
+ )
79
83
tc .generate ()
80
84
else :
81
85
env = VirtualBuildEnv (self )
@@ -134,55 +138,23 @@ def _build_msvc(self):
134
138
f"<PlatformToolset>{ toolset } </PlatformToolset>" ,
135
139
)
136
140
137
- # FIXME: There is currently no guarantee from new MSBuild helper that props files
141
+ # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client.
142
+ # There is currently no guarantee from new MSBuild helper that props files
138
143
# generated by MSBuildToolchain and MSBuildDeps have precedence over custom values of project.
139
- # Therefore conantoolchain.props is injected manually before Microsoft.Cpp.Default.props like it was done
140
- # with /p:ForceImportBeforeCppTargets in legacy MSBuild helper.
141
- # see:
142
- # - https://learn.microsoft.com/en-us/cpp/build/modify-project-properties-without-changing-project-file
143
- # - https://github.com/conan-io/conan/issues/12155
144
- conantoolchain_props = os .path .join (self .generators_folder , "conantoolchain.props" )
144
+ # So for the moment, conantoolchain.props is injected manually to emulate
145
+ # /p:ForceImportBeforeCppTargets=<path/to/conantoolchain.props>
146
+ conantoolchain_props = os .path .join (self .generators_folder , MSBuildToolchain .filename )
145
147
replace_in_file (
146
148
self , vcxproj_path ,
147
- "<Import Project=\" $(VCTargetsPath)\\ Microsoft.Cpp.Default.props \" />" ,
148
- f"<Import Project=\" { conantoolchain_props } \" />\n <Import Project=\" $(VCTargetsPath)\\ Microsoft.Cpp.Default.props \" />" ,
149
+ "<Import Project=\" $(VCTargetsPath)\\ Microsoft.Cpp.targets \" />" ,
150
+ f"<Import Project=\" { conantoolchain_props } \" /><Import Project=\" $(VCTargetsPath)\\ Microsoft.Cpp.targets \" />" ,
149
151
)
150
152
151
- # Honor runtime library from profile
152
- runtime_library = MSBuildToolchain (self ).runtime_library
153
- for prop_file , runtime_library_old in [
154
- ("DebugDEXE.props" , "MultiThreadedDebugDLL" ),
155
- ("DebugDLL.props" , "MultiThreadedDebugDLL" ),
156
- ("DebugLEXE.props" , "MultiThreadedDebug" ),
157
- ("DebugLIB.props" , "MultiThreadedDebug" ),
158
- ("DebugLTCG.props" , "MultiThreadedDebug" ),
159
- ("DebugSEXE.props" , "MultiThreadedDebug" ),
160
- ("ReleaseDEXE.props" , "MultiThreadedDLL" ),
161
- ("ReleaseDLL.props" , "MultiThreadedDLL" ),
162
- ("ReleaseLEXE.props" , "MultiThreaded" ),
163
- ("ReleaseLIB.props" , "MultiThreaded" ),
164
- ("ReleaseLTCG.props" , "MultiThreaded" ),
165
- ("ReleaseSEXE.props" , "MultiThreaded" ),
166
- ]:
167
- replace_in_file (
168
- self , os .path .join (msvc_builds_folder , "properties" , prop_file ),
169
- f"<RuntimeLibrary>{ runtime_library_old } </RuntimeLibrary>" ,
170
- f"<RuntimeLibrary>{ runtime_library } </RuntimeLibrary>" ,
171
- )
172
-
173
153
msbuild = MSBuild (self )
174
- build_type = "{}{}" .format (
154
+ msbuild . build_type = "{}{}" .format (
175
155
"Dyn" if self .options .shared else "Static" ,
176
156
"Debug" if self .settings .build_type == "Debug" else "Release" ,
177
157
)
178
-
179
- platform = {
180
- "x86" : "Win32" ,
181
- "x86_64" : "x64" ,
182
- }[str (self .settings .arch )]
183
-
184
- msbuild .build_type = build_type
185
- msbuild .platform = platform
186
158
msbuild .build (os .path .join (msvc_sln_folder , "libsodium.sln" ))
187
159
188
160
def build (self ):
0 commit comments