1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// The core/BUILD.kts of the reference module.
isPublic = true
c.staticlib("core") { // //core/:core
sources(glob("src/**/*.c"))
exclude(glob("src/experimental/**"))
headers("include") // seen here and by dependents
privateHeaders("src") // here only
textualHeaders(glob("include/**/*.inc")) // included, never compiled alone
includePrefix = "greeter" // #include <greeter/core.h>; default: none
stripIncludePrefix = "include" // default: none
targetTriple(
"x86_64-unknown-linux-gnu",
"aarch64-unknown-linux-gnu",
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
) // default: the host's triple
compiler = Compiler.CLANG // CLANG, GCC, MSVC, CLANG_CL, ZIG_CC; default: found on the machine
standard = CStandard.C23 // C89, C99, C11, C17, C23; default: newest the compiler supports
gnuExtensions = false
defines("GREETER_API=1")
privateDefines("CORE_INTERNAL")
flags("-Wshadow")
warnings = Warnings.ALL // ALL, DEFAULT, NONE; default: DEFAULT
warningsAsErrors = false
precompiledHeader = "src/pch.h" // default: none
debugInfo = DebugInfo.SPLIT // NONE, FULL, SPLIT; default: FULL in DEBUG, NONE in RELEASE
pic = true // staticlib only; default: true when a sharedlib depends on it
alwaysLink = false // staticlib only; whole-archive; default: false
outputName = "greeter-core" // default: the target name
if (BUILD_MODE == BuildMode.RELEASE) optimize = Optimize.SPEED
}
c.sharedlib("core-shared") { // //core/:core-shared
sources(glob("src/**/*.c"))
headers("include")
depends(":core")
exports("core_*") // sharedlib only; default: every symbol that is not hidden
soVersion = "1" // sharedlib only; libgreeter-core.so.1; default: none
rpath("\$ORIGIN")
if (OS == Os.WINDOWS) defFile = "core.def" // sharedlib only
if (OS == Os.LINUX) linkerScript = "core.lds"
}
|