I know that the tool chain is selected from the target machine automatically and that I can change it using the model block. With the cpp-library plugin can I add a new target like:
model {
toolChains {
gcc(Gcc) {
target("embedded") {
path 'C:/CRIOCompiler23Q4/oecore-x86_64-core2-64-toolchain/sysroots/x86_64-w64-mingw32/usr/bin/x86_64-nilrt-linux'
cCompiler.executable 'x86_64-nilrt-linux-gcc.exe'
cppCompiler.executable 'x86_64-nilrt-linux-g++.exe'
assembler.executable 'x86_64-nilrt-linux-as.exe'
linker.executable 'x86_64-nilrt-linux-ld.exe'
staticLibArchiver.executable 'x86_64-nilrt-linux-ar.exe'
cppCompiler.withArguments { args -> {
args.remove(args.indexOf('-nostdinc'))
args << "--sysroot=C:/CRIOCompiler23Q4/oecore-x86_64-core2-64-toolchain/sysroots/core2-64-nilrt-linux"
args << "-DLINUX"
args << "-DPRIVATE"
args << "-Daps1Main"
args << "-pthread"
args << "-g"
args << "-std=gnu++17"
}
}
}
Then have it build the both the code for the target machine ‘machines.windows.x86_64’ and for the cross compiler 'embedded '? Can I define a targetMachine? Something like ‘machines.embedded.x86_64’ or more generically ‘machines.target.platform’.
Then in the code block for library you would have something like.
library {
linkage = [Linkage.STATIC]
targetMachines.add(machines.windows.x86_64)
targetMachines.add(machines.linux.x86_64)
targetMachines.add(machines.embedded.x86_64)
model {
toolChains {
gcc(Gcc) {
target("embedded") {
path 'C:/CRIOCompiler23Q4/oecore-x86_64-core2-64-toolchain/sysroots/x86_64-w64-mingw32/usr/bin/x86_64-nilrt-linux'
cCompiler.executable 'x86_64-nilrt-linux-gcc.exe'
cppCompiler.executable 'x86_64-nilrt-linux-g++.exe'
assembler.executable 'x86_64-nilrt-linux-as.exe'
linker.executable 'x86_64-nilrt-linux-ld.exe'
staticLibArchiver.executable 'x86_64-nilrt-linux-ar.exe'
cppCompiler.withArguments { args -> {
args.remove(args.indexOf('-nostdinc'))
args << "--sysroot=C:/CRIOCompiler23Q4/oecore-x86_64-core2-64-toolchain/sysroots/core2-64-nilrt-linux"
args << "-DLINUX"
args << "-DPRIVATE"
args << "-Daps1Main"
args << "-pthread"
args << "-g"
args << "-std=gnu++17"
}
}
}
}
}