Cpp-library for arm and aarch64

(Scott Palmer) #1

It seems the cpp-library thinks that the only processor architecture in the world is Intel. How do we extend this to cross-compile for Arm? With the old cpp plugin I had something like this to add a tool-chain for Arm:

toolChains {
    gcc(Gcc) {
        target('x64') {
            compilerProbeArgs '-m64'
        }
        target('x86') {
            compilerProbeArgs '-m32', '-march=i686'
        }
    }
    clang(Clang) {
        target('x64') {
            compilerProbeArgs '-m64'
        }
    }
    gccArm(Gcc) {
        target('arm') {
            path "${ARM_GCC_TOOLS_DIR}/bin"
            cppCompiler.withArguments { args ->
                args << "-I${ARM_GCC_TOOLS_DIR}/include"
            }
        }
    }
    gccArm64(Gcc) {
        target('aarch64') {
            path "${ARM64_GCC_TOOLS_DIR}/bin" 
            cppCompiler.withArguments { args ->
                args << "-I${ARM64_GCC_TOOLS_DIR}/include"
            }
        }
    }
}

Is there a way to get the same behaviour with the new cpp-library plugin? If not yet, when?

0 Likes

(Daniel Lacasse) #2

Thanks for showing interest in cross-compilation with Gradle and the new C++ plugins. We understand it’s an important feature and a feature which is hard to do properly. It is possible to do some cross-compilation with Gradle with lots of tricks and insider knowledge like you already expressed in your tool chain configuration. Unfortunately, that isn’t documented and use quite a bit of internal implementation details which may breaks in the upcoming releases. We are focusing on same target compilation at the moment to nail down the right configuration API an hopefully get to a stable version sooner. Cross-compilation will follow right after.

To help plan the work, am I to understand that you are mostly cross-compiling for ARM architecture (32-bit and 64-bit)? Do you require other cross-compilation architecture?

0 Likes

(Scott Palmer) #3

Our current needs are to produce 4 outputs when building on Linux: 32/64-bit x Intel/Arm, 2 outputs in Windows: 32/64-bit Intel, 1 output on MacOS: 64-bit Intel (but that could change if Apple makes Arm-based Macs).

Thanks!

0 Likes