mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Projucer: Add an option to enable clang-tidy in Android builds
This commit is contained in:
parent
9b131c9628
commit
e37d70934a
6 changed files with 35 additions and 7 deletions
|
|
@ -1,8 +1,10 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
def ndkVersionString = "25.2.9519653"
|
||||
|
||||
android {
|
||||
compileSdkVersion 33
|
||||
ndkVersion "25.2.9519653"
|
||||
ndkVersion ndkVersionString
|
||||
namespace "com.rmsl.jucedemorunner"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
def ndkVersionString = "25.2.9519653"
|
||||
|
||||
android {
|
||||
compileSdkVersion 33
|
||||
ndkVersion "25.2.9519653"
|
||||
ndkVersion ndkVersionString
|
||||
namespace "com.juce.audioperformancetest"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
def ndkVersionString = "25.2.9519653"
|
||||
|
||||
android {
|
||||
compileSdkVersion 33
|
||||
ndkVersion "25.2.9519653"
|
||||
ndkVersion ndkVersionString
|
||||
namespace "com.juce.audiopluginhost"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
def ndkVersionString = "25.2.9519653"
|
||||
|
||||
android {
|
||||
compileSdkVersion 33
|
||||
ndkVersion "25.2.9519653"
|
||||
ndkVersion ndkVersionString
|
||||
namespace "com.juce.networkgraphicsdemo"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public:
|
|||
androidReadMediaVideoPermission, androidExternalWritePermission,
|
||||
androidInAppBillingPermission, androidVibratePermission, androidOtherPermissions, androidPushNotifications,
|
||||
androidEnableRemoteNotifications, androidRemoteNotificationsConfigFile, androidEnableContentSharing, androidKeyStore,
|
||||
androidKeyStorePass, androidKeyAlias, androidKeyAliasPass, gradleVersion, gradleToolchain, androidPluginVersion;
|
||||
androidKeyStorePass, androidKeyAlias, androidKeyAliasPass, gradleVersion, gradleToolchain, gradleClangTidy, androidPluginVersion;
|
||||
|
||||
//==============================================================================
|
||||
AndroidProjectExporter (Project& p, const ValueTree& t)
|
||||
|
|
@ -151,6 +151,7 @@ public:
|
|||
androidKeyAliasPass (settings, Ids::androidKeyAliasPass, getUndoManager(), "android"),
|
||||
gradleVersion (settings, Ids::gradleVersion, getUndoManager(), "7.5.1"),
|
||||
gradleToolchain (settings, Ids::gradleToolchain, getUndoManager(), "clang"),
|
||||
gradleClangTidy (settings, Ids::gradleClangTidy, getUndoManager(), false),
|
||||
androidPluginVersion (settings, Ids::androidPluginVersion, getUndoManager(), "7.3.0"),
|
||||
AndroidExecutable (getAppSettings().getStoredPath (Ids::androidStudioExePath, TargetOS::getThisOS()).get().toString())
|
||||
{
|
||||
|
|
@ -171,6 +172,9 @@ public:
|
|||
{ "clang", "gcc" },
|
||||
{ "clang", "gcc" }),
|
||||
"The toolchain that gradle should invoke for NDK compilation (variable model.android.ndk.tooclhain in app/build.gradle)");
|
||||
|
||||
props.add (new ChoicePropertyComponent (gradleClangTidy, "Use Clang-Tidy"),
|
||||
"If enabled and the toolchain is clang this will run clang-tidy when compiling.");
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -680,10 +684,22 @@ private:
|
|||
|
||||
mo << "apply plugin: 'com.android." << (isLibrary() ? "library" : "application") << "'" << newLine << newLine;
|
||||
|
||||
// CMake 3.22 will fail to build Android projects that set ANDROID_ARM_MODE unless NDK 24+ is used
|
||||
mo << "def ndkVersionString = \"25.2.9519653\"" << newLine << newLine;
|
||||
|
||||
if (gradleClangTidy.get() && gradleToolchain.get().toString() == "clang")
|
||||
mo << "Properties properties = new Properties()" << newLine
|
||||
<< "properties.load(project.rootProject.file(\"local.properties\").newDataInputStream())" << newLine
|
||||
<< "def llvmDir = \"${properties.getProperty('sdk.dir')}/ndk/${ndkVersionString}/toolchains/llvm\"" << newLine
|
||||
<< "def clangTidySearch = fileTree(llvmDir).filter { file -> file.name.matches('^clang-tidy(.exe)?$') }" << newLine
|
||||
<< "if (clangTidySearch.size() != 1) {" << newLine
|
||||
<< " throw new GradleException(\"Could not locate a unique clang-tidy in ${llvmDir}\")" << newLine
|
||||
<< "}" << newLine
|
||||
<< "def clangTidy = clangTidySearch.getSingleFile().getAbsolutePath()" << newLine << newLine;
|
||||
|
||||
mo << "android {" << newLine;
|
||||
mo << " compileSdkVersion " << static_cast<int> (androidTargetSDK.get()) << newLine;
|
||||
// CMake 3.22 will fail to build Android projects that set ANDROID_ARM_MODE unless NDK 24+ is used
|
||||
mo << " ndkVersion \"25.2.9519653\"" << newLine;
|
||||
mo << " ndkVersion ndkVersionString" << newLine;
|
||||
mo << " namespace " << project.getBundleIdentifierString().toLowerCase().quoted() << newLine;
|
||||
mo << " externalNativeBuild {" << newLine;
|
||||
mo << " cmake {" << newLine;
|
||||
|
|
@ -1488,6 +1504,9 @@ private:
|
|||
cmakeArgs.add ("\"-DANDROID_ARM_MODE=arm\"");
|
||||
cmakeArgs.add ("\"-DANDROID_ARM_NEON=TRUE\"");
|
||||
|
||||
if (isClang && gradleClangTidy.get())
|
||||
cmakeArgs.add ("\"-DCMAKE_CXX_CLANG_TIDY=${clangTidy}\"");
|
||||
|
||||
auto cppStandard = [this]
|
||||
{
|
||||
auto projectStandard = project.getCppStandardString();
|
||||
|
|
|
|||
|
|
@ -283,6 +283,7 @@ namespace Ids
|
|||
const Identifier androidPluginVersion ("gradleWrapperVersion"); // old name is very confusing, but we need to remain backward compatible
|
||||
DECLARE_ID (gradleToolchain);
|
||||
DECLARE_ID (gradleToolchainVersion);
|
||||
DECLARE_ID (gradleClangTidy);
|
||||
DECLARE_ID (linuxExtraPkgConfig);
|
||||
DECLARE_ID (font);
|
||||
DECLARE_ID (colour);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue