VS: Build Arm64X PE binary? (Windows 11 on Arm)

Is there a plan to support the build of Arm64X PE binaries with the Visual Studio 17 2022 generator?

For example, the ODBC driver is better with an Arm64X PE binary.

MariaDB Connector/ODBC is a CMake-enabled project.

The 64-bit ODBC driver is installed at the following location.

C:\Program Files\MariaDB\MariaDB ODBC Driver 64-bit\maodbc.dll

  • ODBC Administrator (Arm64) can load Arm64X maodbc.dll
  • Microsoft Access (x64) can load Arm64X maodbc.dll

Windows 11 can share two 64-bit environments (Arm64 and x64) by having Arm64X binaries.

If CMake can support the build of Arm64X binaries more easily, it helps.

Although Microsoft introduces a workaround method, it is a very complex way.

Build Arm64X Files | Microsoft Learn

It is easier if sln & vcxprojs have both ARM64 and ARM64EC platforms.

Arm64X PE binary is built on ARM64EC platform with <PropertyGroup Condition="..."><BuildAsX>true</BuildAsX></PropertyGroup>. Also ARM64 platform is needed.

The output binary (DLL, EXE, LIB) from the ARM64EC platform is the final binary forming Arm64X.

OutDir and IntDir elements can be solved like the following sample:

    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">...\libmariadb\Release\ARM64\</OutDir>
    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM64EC'">...\libmariadb\Release\</OutDir>
    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">libmariadb.dir\Release\ARM64\</IntDir>
    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM64EC'">libmariadb.dir\Release\ARM64EC\</IntDir>

IntDir in utility projects is already ideal.

    <IntDir Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|ARM64'">$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
    <IntDir Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|ARM64EC'">$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>

Object elements need to have a distinctive IntDir between ARM64 and ARM64EC. It is good to insert $(Platform)\.

<Object Include="V:\mariadb-connector-odbc-for-win10-arm64\arm64x-build\libmariadb\libmariadb\mariadb_obj.dir\$(Configuration)\$(Platform)\my_auth.obj" />

No one is working on this AFAIK, but I’d welcome a contribution.

For now, I have no idea how to implement these ideas in this CMake project.

But I could write some code. So I wrote a converter instead of modifying the existing CMake generator.

BuildHelper/BuildHelper/Program.cs at master · mariadb-connector-odbc-for-win10-arm64/BuildHelper

Usage example:

V:\mariadb-connector-odbc-for-win10-arm64\BuildHelper\BuildHelper>dotnet run -- sln-clone-cp -u V:\mariadb-connector-odbc-for-win10-arm64\arm64x-build\libmariadb\external\zlib\zlib.sln * ARM64 ARM64EC

V:\mariadb-connector-odbc-for-win10-arm64\BuildHelper\BuildHelper>dotnet run -- sln-clone-cp -u V:\mariadb-connector-odbc-for-win10-arm64\arm64x-build\libmariadb\mariadb-connector-c.sln * ARM64 ARM64EC

V:\mariadb-connector-odbc-for-win10-arm64\BuildHelper\BuildHelper>dotnet run -- sln-clone-cp -u V:\mariadb-connector-odbc-for-win10-arm64\arm64x-build\mariadb_connector_odbc.sln * ARM64 ARM64EC

I’m also interested in whether someone else is having the same problem.

And please share if anyone has good ideas to build Arm64X binaries using CMake generator.

I’m also interested in this, not only for the Visual Studio generator but in general on Windows.

What’s needed is to build the library/binary as normal Arm64 and then again as Arm64EC, and then link it all together passing a rsp file to the linker. The process is outlined here: Build Arm64X Files | Microsoft Learn , but the way they’re suggesting doing it with CMake feels like a bit of a hack around this not being supported directly.

@brad.king would there be interest in accepting a patch providing some sort of direct Arm64X support? If so, what would you want this to look like, e.g. some sort of target property? I’m happy to give implementing it a go if it’d be likely to be accepted.

@DavidTruby thanks. Please open an issue to propose the work in more detail.