alliedmodders / ambuild

AlliedModders C++ Build System
BSD 3-Clause "New" or "Revised" License
60 stars 31 forks source link

Improve VS generation for x64 projects #146

Closed GAMMACASE closed 11 months ago

GAMMACASE commented 1 year ago

This adds compiler arch lookup to target correct platform arch, so the end project would be correctly generated for x64 projects. Previously it would end up generating x86 vcxproj files no matter what for a few reasons:

  1. Compiler::clone function that's commonly used through out the metamod & sourcemod and other solutions (example: https://github.com/alliedmodders/metamod-source/blob/2261ff4f9c898933e02363f337de4f0dff77e687/AMBuildScript#L347 https://github.com/alliedmodders/sourcemod/blob/20aae06f127d021734ee2ff8b9664907ca7ea752/AMBuildScript#L536-L546 etc) doesn't respect the target.arch and doesn't pass it to the newly created instance which expects target_arch, resulting in further code in build scripts to target x86 instead of what was asked for. Fixing this correctly respects the target arch of the compiler.
  2. There's no specific platform lookup and all the projects were treated as Win32 no matter what, this pr introduces changes to that and lookups the target arch by looking at a current compiler that's being used to generate.
GAMMACASE commented 1 year ago

I've also committed small change in regards to addCopy being non implemented in the vs generator resulting in errors thrown when packagescripts are executed, since they utilize the Generator::AddCopy API

dvander commented 11 months ago

Sorry for the delay here, thanks for doing this!