Continued struggle with native build for windows

(Alexander Nozik) #1

I have a project that needs to be compiled against existing pre-compiled library. I tried MinGW at first, but encountered binary incompatibility probably because gradle currently supports MinGW-32. No way around it so I tried to use MSVC instead. I reinstalled MSVC 2017, according to release notes, gradle 4.5 should support it.

By default it can’t find the installation directory, so I had to write toolset definition like this:

    toolChains {
        ms(VisualCpp) {
            // Specify the installDir if Visual Studio cannot be located
            installDir = "C:\\Microsoft Visual Studio\\2017\\Professional\\"

I had to install MSVC itself, not just build tools because gradle refused to recognize stand-alone build tools (which is odd). But now it can’t find windows SDK:

> No tool chain is available to build for platform 'windows_x86':
    - Tool chain 'ms' (Visual Studio): Could not locate a Windows SDK installation, using the Windows registry and system path.

I found windowsSdkDir field in documentation, but I tried different directories and could not find what to write there in order to make it work. The problem is that Windows SDK takes root inside operating system and appears in a lot of places and symlinks. I do not know which place gradle expects.

By the way, documentation of native toolchains is very bad. I’ve spent half a day trying to find anything and failed. And I have been using gradle for a few years, so I can’t say that I am inexperienced with it.