aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-05-02 21:53:38 +0900
committerOphestra <cat@gensokyo.uk>2026-05-02 21:53:38 +0900
commit041b505c2ea6e3e496497c87e1b3d4f913d0b61e (patch)
tree22d4c157d4ccd78b06e0b1c30e4e8d68d2505275 /internal
parente6debce649366c54406b41a8f8a0be64fabd9aa8 (diff)
internal/rosa/cmake: implicit CMAKE_BUILD_TYPE
Lack of this behaviour is a holdover from when the helper was first split from the (now removed) LLVM helper. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal')
-rw-r--r--internal/rosa/cmake.go20
-rw-r--r--internal/rosa/glslang.go6
-rw-r--r--internal/rosa/llvm.go2
-rw-r--r--internal/rosa/zlib.go2
-rw-r--r--internal/rosa/zstd.go3
5 files changed, 11 insertions, 22 deletions
diff --git a/internal/rosa/cmake.go b/internal/rosa/cmake.go
index bfa035c0..b1499037 100644
--- a/internal/rosa/cmake.go
+++ b/internal/rosa/cmake.go
@@ -122,6 +122,8 @@ type CMakeHelper struct {
// Path elements joined with source.
Append []string
+ // Value of CMAKE_BUILD_TYPE. The zero value is equivalent to "Release".
+ BuildType string
// CMake CACHE entries.
Cache []KV
// Runs after install.
@@ -164,14 +166,7 @@ func (*CMakeHelper) wantsDir() string { return "/cure/" }
// script generates the cure script.
func (attr *CMakeHelper) script(name string) string {
if attr == nil {
- attr = &CMakeHelper{
- Cache: []KV{
- {"CMAKE_BUILD_TYPE", "Release"},
- },
- }
- }
- if len(attr.Cache) == 0 {
- panic("CACHE must be non-empty")
+ attr = new(CMakeHelper)
}
generate := "Ninja"
@@ -189,6 +184,13 @@ func (attr *CMakeHelper) script(name string) string {
script += "\n" + test
}
+ cache := make([]KV, 1, 1+len(attr.Cache))
+ cache[0] = KV{"CMAKE_BUILD_TYPE", "Release"}
+ if attr.BuildType != "" {
+ cache[0][1] = attr.BuildType
+ }
+ cache = append(cache, attr.Cache...)
+
return `
cmake -G ` + generate + ` \
-DCMAKE_C_COMPILER_TARGET="${ROSA_TRIPLE}" \
@@ -196,7 +198,7 @@ cmake -G ` + generate + ` \
-DCMAKE_ASM_COMPILER_TARGET="${ROSA_TRIPLE}" \
-DCMAKE_INSTALL_LIBDIR=lib \
` + strings.Join(slices.Collect(func(yield func(string) bool) {
- for _, v := range attr.Cache {
+ for _, v := range cache {
if !yield("-D" + v[0] + "=" + v[1]) {
return
}
diff --git a/internal/rosa/glslang.go b/internal/rosa/glslang.go
index a2600ea3..663e0610 100644
--- a/internal/rosa/glslang.go
+++ b/internal/rosa/glslang.go
@@ -17,10 +17,6 @@ func (t Toolchain) newSPIRVHeaders() (pkg.Artifact, string) {
"vulkan-sdk-"+version,
checksum,
), nil, &CMakeHelper{
- Cache: []KV{
- {"CMAKE_BUILD_TYPE", "Release"},
- },
-
// upstream has no tests
SkipTest: true,
}), version
@@ -67,7 +63,6 @@ func (t Toolchain) newSPIRVTools() (pkg.Artifact, string) {
checksum,
), nil, &CMakeHelper{
Cache: []KV{
- {"CMAKE_BUILD_TYPE", "Release"},
{"SPIRV-Headers_SOURCE_DIR", "/system"},
},
},
@@ -109,7 +104,6 @@ func (t Toolchain) newGlslang() (pkg.Artifact, string) {
Chmod: true,
}, &CMakeHelper{
Cache: []KV{
- {"CMAKE_BUILD_TYPE", "Release"},
{"BUILD_SHARED_LIBS", "ON"},
{"ALLOW_EXTERNAL_SPIRV_TOOLS", "ON"},
},
diff --git a/internal/rosa/llvm.go b/internal/rosa/llvm.go
index feba103c..7f37c71d 100644
--- a/internal/rosa/llvm.go
+++ b/internal/rosa/llvm.go
@@ -10,8 +10,6 @@ import (
func (t Toolchain) newLLVM() (pkg.Artifact, string) {
cache := []KV{
- {"CMAKE_BUILD_TYPE", "Release"},
-
{"ENABLE_LINKER_BUILD_ID", "ON"},
{"COMPILER_RT_USE_BUILTINS_LIBRARY", "ON"},
{"COMPILER_RT_DEFAULT_TARGET_ONLY", "ON"},
diff --git a/internal/rosa/zlib.go b/internal/rosa/zlib.go
index 4f6591b0..aeb37611 100644
--- a/internal/rosa/zlib.go
+++ b/internal/rosa/zlib.go
@@ -13,8 +13,6 @@ func (t Toolchain) newZlib() (pkg.Artifact, string) {
pkg.TarGzip,
), nil, &CMakeHelper{
Cache: []KV{
- {"CMAKE_BUILD_TYPE", "Release"},
-
{"CMAKE_C_FLAGS", "-fPIC"},
{"ZLIB_BUILD_TESTING", "ON"},
{"ZLIB_BUILD_SHARED", "ON"},
diff --git a/internal/rosa/zstd.go b/internal/rosa/zstd.go
index 52a74e35..8aa40ac5 100644
--- a/internal/rosa/zstd.go
+++ b/internal/rosa/zstd.go
@@ -19,9 +19,6 @@ func (t Toolchain) newZstd() (pkg.Artifact, string) {
Chmod: true,
}, &CMakeHelper{
Append: []string{"build", "cmake"},
- Cache: []KV{
- {"CMAKE_BUILD_TYPE", "Release"},
- },
Test: `
make -C /usr/src/zstd/tests datagen
ZSTD_BIN=/cure/programs/zstd /usr/src/zstd/tests/playTests.sh