1apply plugin: 'c'
2apply plugin: 'sdk-files'
3apply plugin: 'native-setup'
4
5executables {
6    mksdcard {}
7}
8
9sources {
10    mksdcard {
11        c {
12            source {
13                srcDir "src/source"
14                include "**/*.c"
15            }
16        }
17    }
18}
19
20binaries.all {
21    cCompiler.args "-D_FILE_OFFSET_BITS=64"
22}
23
24sdk {
25    mac {
26        item( { getExeName("darwin") } ) {
27            executable true
28            builtBy 'darwinMksdcardExecutable'
29        }
30    }
31    linux {
32        item( { getExeName("linux") } ) {
33            executable true
34            builtBy 'linuxMksdcardExecutable'
35        }
36    }
37    windows {
38        item( { getExeName("windows32") } ) {
39            name 'mksdcard.exe'
40            builtBy 'windows32MksdcardExecutable'
41        }
42    }
43}
44
45def getExeName(String platform) {
46    // binaries will return a set of binaries
47    def binaries = executables.mksdcard.binaries.matching { it.name == "${platform}MksdcardExecutable" }
48    // calling .exeFile on the set returns an array with the result from each item in the set...
49    return binaries.executableFile.get(0)
50}
51
52