Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 19854

CppApplication vs. cpp plugin

$
0
0

Hello everyone,

I am experiencing a very confusing phenomenon when building my c++ project with gradle.
Initially, I have made a build.gradle script that was utilizing the ‘cpp-application’ plugin to build my application, it was working fine on Windows, but I was having issues when trying to build on MacOSX since some of the source code for that platform included objective-cpp files… Therefore I switched to using the ‘cpp’ and ‘objective-cpp’ plugins to customize my source sets per operating system/platform…
I am able to build on both platform with this new build.gradle script, however, my compiled and linked application is running INCREDIBLY slow with this configuration. That is, my executable application is a multithreaded one with 2 main threads running in ‘parallel’ (if the host machine cpu supports multihreading, which in our day and age is almost any machine running win or macos). The compiled and linked executable using the ‘cpp-application’ plugin was running at the correct speed. I have verified and compared the default compiler and linker arguments the ‘cpp-application’ plugin provides when building, and used the same in the second configuration, to no avail… It seems like the binary in the second configuration is not compiled to be multithreaded, and instead uses only one thread which runs concurrently for both ‘threaded’ portions of the code…

Does anyone have any insight as to why this is happening? I’m sure this is more related to the actual toolchains than gradle itself… But i cannot understand what the ‘cpp-application’ plugin is doing differently in its build steps which enables my binary to run in a parallel multithreaded way…

Toolchain on Windows = Visual Cpp 2017
ToolChain on MacOS = Clang


Viewing all articles
Browse latest Browse all 19854

Trending Articles