Skip to content

Commit 1618780

Browse files
authored
Enable use of Ninja Multi-Config generator for Linux builds (#1017)
1 parent fbb5412 commit 1618780

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

.github/workflows/linux.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,14 @@ jobs:
5858
doc: OFF, jni: ON, loadtests: OpenGL+Vulkan, py: ON, tools: ON, tools_cts: ON,
5959
sse: ON, opencl: OFF
6060
}
61-
- name: Clang Debug
61+
- name: Clang
6262
os: ubuntu-22.04
63-
generator: Ninja
64-
arch: x86_64
65-
compiler: clang
66-
vk_sdk_ver: '1.3.290'
67-
options: {
68-
config: Debug,
69-
doc: OFF, jni: ON, loadtests: OpenGL+Vulkan, py: ON, tools: ON, tools_cts: OFF,
70-
sse: ON, opencl: OFF
71-
}
72-
- name: Clang Release
73-
os: ubuntu-22.04
74-
generator: Ninja
63+
generator: Ninja Multi-Config
7564
arch: x86_64
7665
compiler: clang
7766
vk_sdk_ver: '1.3.290'
7867
options: {
79-
config: Release,
68+
config: 'Debug,Release',
8069
doc: OFF, jni: ON, loadtests: OpenGL+Vulkan, py: ON, tools: ON, tools_cts: OFF,
8170
sse: ON, opencl: OFF
8271
}

scripts/build_linux.sh

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,39 @@ if [[ "$ARCH" = "aarch64" && "$FEATURE_LOADTESTS" =~ "Vulkan" ]]; then
5454
else
5555
FEATURE_LOADTESTS=OpenGL
5656
fi
57-
echo "Forcing FEATURE_LOADTESTS to \"$FEATURE_LOADTESTS\" as no Vulkan SDK yet for Linux/arm64."
57+
echo "$0: Forcing FEATURE_LOADTESTS to \"$FEATURE_LOADTESTS\" as no Vulkan SDK yet for Linux/arm64."
5858
fi
5959

60+
if [ ! "$CMAKE_GEN" = "Ninja Multi-Config" ]; then
61+
# Single configuration generator.
62+
if [[ "$CONFIGURATION" =~ "," ]]; then
63+
echo "$0: Multiple build configurations specified with single-configuration CMake generator."
64+
exit 1
65+
fi
66+
fi
67+
68+
cmake_args=("-G" "$CMAKE_GEN")
69+
6070
if [[ -z $BUILD_DIR ]]; then
6171
BUILD_DIR=build/linux
6272
if [ "$ARCH" != $(uname -m) ]; then
6373
BUILD_DIR+="-$ARCH-"
6474
fi
65-
if [ "$CMAKE_GEN" = "Ninja" -o "$CMAKE_GEN" = "Unix Makefiles" ]; then
66-
# Single configuration generators.
75+
if [ ! "$CMAKE_GEN" = "Ninja Multi-Config" ]; then
76+
# Single configuration generator. That only a single configuration
77+
# is specified has already been verified.
6778
BUILD_DIR+="-$CONFIGURATION"
79+
CMAKE_BUILD_TYPE=$CONFIGURATION
6880
fi
6981
fi
82+
cmake_args+=("-B" $BUILD_DIR)
83+
if [ -n "$CMAKE_BUILD_TYPE" ]; then
84+
cmake_args+=("-D" "CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE")
85+
fi
7086

7187
mkdir -p $BUILD_DIR
7288

73-
cmake_args=("-G" "$CMAKE_GEN"
74-
"-B" $BUILD_DIR \
75-
"-D" "CMAKE_BUILD_TYPE=$CONFIGURATION" \
89+
cmake_args+=(\
7690
"-D" "KTX_FEATURE_DOC=$FEATURE_DOC" \
7791
"-D" "KTX_FEATURE_JNI=$FEATURE_JNI" \
7892
"-D" "KTX_FEATURE_LOADTEST_APPS=$FEATURE_LOADTESTS" \

0 commit comments

Comments
 (0)