Last active
January 13, 2021 14:19
-
-
Save CAMOBAP/0a31ea4f4752c5241e6e7bb72e73e38c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prerequisites: | |
* 1. Place glslangValidator binaries to ${project.rootProject.projectDir}/tools, | |
* can be taken from https://github.com/floooh/oryol/tree/master/tools | |
* 2. By default this plugin look for config in path | |
* ${project.rootProject.projectDir}/config/quality/glslangValidator.conf | |
*/ | |
class glslExtension { | |
String src | |
String config | |
} | |
project.extensions.create("glsl", glslExtension) | |
project.afterEvaluate { | |
def isWin = org.apache.tools.ant.taskdefs.condition.Os.isFamily(org.apache.tools.ant.taskdefs.condition.Os.FAMILY_WINDOWS) | |
def execPostfix = isWin ? '.exe' : '' | |
def src = project.fileTree(dir: project.glsl.src, includes: ['**/*.vert', | |
'**/*.tesc', | |
'**/*.geom', | |
'**/*.frag', | |
'**/*.comp']).asPath | |
def cfg = project.glsl.config ? project.glsl.config : | |
"${project.rootProject.projectDir}/config/quality/glslangValidator.conf" | |
def glslValidationTask = project.tasks.create(name: "glslValidate", type: Exec) { | |
group 'GLSL' | |
description 'validate glsl sources' | |
workingDir project.buildDir | |
commandLine "${project.rootProject.projectDir}/tools/glslangValidator${execPostfix}", | |
'-v', | |
'-m', | |
cfg, | |
src | |
} | |
project.tasks.check.dependsOn glslValidationTask | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
... | |
apply from: rootProject.file('gradle/glsl.gradle') | |
... | |
glsl { | |
src 'src/main/assets' | |
} | |
android { | |
... | |
} | |
dependencies { | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment