Skip to content

Commit 01b7bb2

Browse files
committed
Fix cmake build
1 parent 358588d commit 01b7bb2

6 files changed

Lines changed: 41 additions & 2 deletions

File tree

.github/workflows/cmake_build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ jobs:
5050
which curl jq || apt -q update
5151
which curl || apt -yq install curl
5252
which jq || apt -yq install jq
53+
git config --global --add safe.directory $GITHUB_WORKSPACE
54+
cd ${{ inputs.cmake_build_target_directory }}
5355
CONFIG_JSON='${{ inputs.update_cmake_lists_config }}' FAIL_ON_CHANGES=true ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/cmake-update-cmake-lists.sh
5456
- name: CMake build
5557
run: |

.github/workflows/scripts/cmake-build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ log "Building Ninja build files for target"
3333
build_dir="${target_dir}/build"
3434
mkdir -p "$build_dir"
3535
cd "${build_dir}" || fatal "Could not 'cd' to ${build_dir}"
36-
ASM="$ASSEMBLY_COMPILER_BIN" "$CMAKE_BIN" build -G Ninja -S ..
36+
ASM="$ASSEMBLY_COMPILER_BIN" "$CMAKE_BIN" -G Ninja -S ..
3737

3838
log "Building target"
3939
"$NINJA_BIN"

.github/workflows/scripts/cmake-update-cmake-lists.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ echo "$config" | jq -c '.targets[]' | while read -r target; do
126126
done
127127

128128
if [[ "${fail_on_changes}" == true ]]; then
129-
if [ -n "$(git status --untracked-files=no --porcelain)" ]; then
129+
git_status_output=$(git status --untracked-files=no --porcelain 2>&1) || fatal "git status failed: $git_status_output"
130+
if [ -n "$git_status_output" ]; then
130131
fatal "Changes in the cmake files detected. Please update. -- $(git diff)"
131132
else
132133
log "✅ CMake files are up-to-date."

tests/TestPackage/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2026 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
113
cmake_minimum_required(VERSION 3.24)
214

315
project(TestPackage

tests/TestPackage/Sources/Target1/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2026 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
113
add_library(Target1
214
"Target1.swift"
315
)

tests/TestPackage/Sources/Target2/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2026 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
113
add_library(Target2
214
"Target2.swift"
315
)

0 commit comments

Comments
 (0)