Skip to content

Commit f9597f8

Browse files
authored
CI and Build Improvements (KhronosGroup#687)
Remove VS2015 build from CI. Move Windows builds (except VS2017) to GitHub Actions. Run Windows builds and tests with both MSVC and CLangCL on VS2022. Build one configuration with VS2019 to ensure it still works. Build Windows release packages with VS2022 and CLangCL. Turn on warnings as errors. Fix bug that prevented /W4 for CLangCL. Fix all warnings. Update the included zstd.c and regen golden images for affected tests. Stop using deprecated code in GitHub Actions. Update Linux CI runner to Ubuntu Jammy Update Vulkan SDK used in Linux and Windows CI to 1.3.243. Fix issue with Doxygen builds that caused intermittent failures.
1 parent 163128b commit f9597f8

14 files changed

Lines changed: 29383 additions & 10642 deletions

File tree

CMakeLists.txt

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ include(CMakeDependentOption)
2222
include(cmake/codesign.cmake)
2323
include(cmake/cputypetest.cmake)
2424

25-
find_package(OpenCL)
26-
2725
# OPTIONS
2826

2927
if( IOS OR EMSCRIPTEN )
@@ -64,6 +62,10 @@ CMAKE_DEPENDENT_OPTION( BASISU_SUPPORT_OPENCL
6462
OFF
6563
)
6664

65+
if(BASISU_SUPPORT_OPENCL)
66+
find_package(OpenCL)
67+
endif()
68+
6769
if(BASISU_SUPPORT_OPENCL AND WIN32 AND NOT OpenCL_FOUND)
6870
# To avoid fiddly setting up of OpenCL on Windows CI VMs, use copy in repo.
6971
set(OpenCL_INCLUDE_DIR
@@ -212,13 +214,11 @@ include(cmake/mkvk.cmake)
212214

213215
# Global compile & link options including optimization flags
214216
if(MSVC)
215-
# With /W4 VS2015 (V19.0) issues many warnings that VS2017 & 2019 don't
216-
# so only increase warning level for recent versions.
217-
add_compile_options($<$<VERSION_GREATER_EQUAL:${CMAKE_CXX_COMPILER_VERSION},19.16>:/W4>)
217+
add_compile_options( /W4;/WX )
218218
add_compile_options( $<IF:$<CONFIG:Debug>,/Gz,/O2> )
219219
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU"
220220
OR ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
221-
add_compile_options(-Wall -Wextra)
221+
add_compile_options(-Wall -Wextra -Werror)
222222
add_compile_options( $<IF:$<CONFIG:Debug>,-O0,-O3> )
223223
if(EMSCRIPTEN)
224224
add_link_options( $<IF:$<CONFIG:Debug>,-gsource-map,-O3> )
@@ -606,10 +606,39 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
606606
lib/basisu/transcoder/basisu_transcoder.cpp
607607
PROPERTIES COMPILE_OPTIONS "-Wno-sign-compare;-Wno-unused-function;-Wno-unused-variable;-Wno-class-memaccess;-Wno-maybe-uninitialized"
608608
)
609-
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL "11.0")
609+
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL "11")
610+
# class-memaccess warnings n basisu_comp.cpp have been
611+
# fixed. Fixing those in the included basisu_miniz.h is
612+
# more intrusive than I want to attempt.
613+
#
614+
# The extra warnings are raised in basisu_miniz.h.
610615
set_source_files_properties(
611-
lib/basisu/zstd/zstd.c
612-
PROPERTIES COMPILE_OPTIONS "-Wno-unused-but-set-variable"
616+
lib/basisu/encoder/basisu_comp.cpp
617+
PROPERTIES COMPILE_OPTIONS "-Wno-class-memaccess;-Wno-extra"
618+
)
619+
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "12" )
620+
# Version 11 raises several stringop-overflow warnings in some
621+
# very hard to decipher code. They appear to be bogus based on
622+
# the facts that we have never seen a crash and version 12 no
623+
# longer raises the warnings.
624+
get_source_file_property(cur_options
625+
lib/basisu/encoder/basisu_comp.cpp
626+
COMPILE_OPTIONS
627+
)
628+
set_source_files_properties(
629+
lib/basisu/encoder/basisu_comp.cpp
630+
PROPERTIES COMPILE_OPTIONS "${cur_options};-Wno-stringop-overflow"
631+
)
632+
endif()
633+
endif()
634+
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL "12.0")
635+
# Version 12 newly raises this warning on basisu_uastc_enc.cpp.
636+
# There seems no way for the index calculated by the code at
637+
# line 326, where the error is raised, to be > the array length.
638+
# Also we have never seen any crashes.
639+
set_source_files_properties(
640+
lib/basisu/encoder/basisu_uastc_enc.cpp
641+
PROPERTIES COMPILE_OPTIONS "-Wno-stringop-overflow"
613642
)
614643
endif()
615644
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@@ -631,31 +660,16 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
631660
else()
632661
set( clang_version ${CMAKE_CXX_COMPILER_VERSION} )
633662
endif()
663+
# BEWARE: set_source_files_properties is not additive; it replaces.
634664
if (${clang_version} VERSION_GREATER_EQUAL "12.0.0")
635665
set_source_files_properties( lib/basisu/encoder/basisu_kernels_sse.cpp
636666
PROPERTIES COMPILE_OPTIONS "-Wno-unused-parameter;-Wno-deprecated-copy;-Wno-uninitialized-const-reference"
637667
)
638-
# Primarily an issue on windows using clang/clangcl
639-
# Lowest tested clang version was 12.0.0 and highest was 14.0.4
640-
set_source_files_properties(
641-
lib/basisu/zstd/zstd.c
642-
PROPERTIES COMPILE_OPTIONS "-Wno-unused-function"
643-
)
644668
else()
645669
set_source_files_properties( lib/basisu/encoder/basisu_kernels_sse.cpp
646670
PROPERTIES COMPILE_OPTIONS "-Wno-unused-parameter"
647671
)
648672
endif()
649-
if (${clang_version} VERSION_GREATER_EQUAL "13.0.0")
650-
get_source_file_property(zstd_options lib/basisu/zstd/zstd.c COMPILE_OPTIONS)
651-
set_source_files_properties(
652-
# We haven't fixed zstd.c because the fix would have to be applied
653-
# every time the upstream script is used to create an updated
654-
# single file decoder.
655-
lib/basisu/zstd/zstd.c
656-
PROPERTIES COMPILE_OPTIONS "${zstd_options};-Wno-unused-but-set-variable"
657-
)
658-
endif()
659673
if (${clang_version} VERSION_GREATER_EQUAL "15.0")
660674
# These are for Emscripten which is ahead of xcode in its clang
661675
# version. Also future proofing for when xcode catches up.
@@ -669,13 +683,23 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
669683
)
670684
set_source_files_properties(
671685
lib/basisu/zstd/zstd.c
672-
PROPERTIES COMPILE_OPTIONS "-Wno-unused-but-set-variable;-Wno-bitwise-instead-of-logical"
686+
PROPERTIES COMPILE_OPTIONS "-Wno-unused-function"
673687
)
674688
endif()
675689
else()
676690
message(FATAL_ERROR "${CMAKE_CXX_COMPILER_ID} not yet supported.")
677691
endif()
678692

693+
# Retrieve the final set of properties for use by the transcodetests.
694+
# We do this because the CMake feature that would allow the transcodetests
695+
# target to retrieve these from the ktx target are not available until
696+
# v18 and we still need to work with v16 in the Emscripten Docker image.
697+
get_source_file_property(transcoder_options
698+
lib/basisu/transcoder/basisu_transcoder.cpp
699+
COMPILE_OPTIONS
700+
)
701+
get_source_file_property(zstd_options lib/basisu/zstd/zstd.c COMPILE_OPTIONS)
702+
679703
target_include_directories(
680704
ktx
681705
PRIVATE

cmake/docs.cmake

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@
33

44
find_package(Doxygen REQUIRED)
55

6+
set(docdest "${CMAKE_CURRENT_BINARY_DIR}/docs")
7+
8+
# The torturous Doxygen output settings are a hack
9+
# to workaround a doxygen limitation where it will
10+
# only create the trailing directory of the path
11+
# given in, e.g DOXYGEN_HTML_OUTPUT while enabling
12+
# us to put each sub-document in its own directory of
13+
# the html output.
14+
615
# Global
716
set( DOXYGEN_PROJECT_LOGO icons/ktx_logo_200.png )
8-
set( DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/docs)
17+
set( DOXYGEN_OUTPUT_DIRECTORY ${docdest}/html)
918
set( DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES )
1019
set( DOXYGEN_EXTRACT_LOCAL_CLASSES NO )
1120
set( DOXYGEN_HIDE_UNDOC_MEMBERS YES )
@@ -18,16 +27,17 @@ set( DOXYGEN_HTML_TIMESTAMP YES )
1827
set( DOXYGEN_DISABLE_INDEX YES )
1928
set( DOXYGEN_GENERATE_TREEVIEW YES )
2029
set( DOXYGEN_GENERATE_LATEX NO )
30+
set( DOXYGEN_GENERATE_HTML YES )
2131
set( DOXYGEN_GENERATE_MAN YES )
22-
32+
set( DOXYGEN_MAN_OUTPUT ../man )
2333

2434
function( add_docs_cmake target )
2535
# Make `docs.cmake` show up in IDE/project
26-
get_target_property( DOC_SOURCES ${target} SOURCES )
36+
get_target_property( doc_sources ${target} SOURCES )
2737
set_target_properties(
2838
${target}
2939
PROPERTIES
30-
SOURCES "${DOC_SOURCES};cmake/docs.cmake"
40+
SOURCES "${doc_sources};cmake/docs.cmake"
3141
)
3242
endfunction()
3343

@@ -42,7 +52,7 @@ function( CreateDocLibKTX )
4252
# This does not hide the scope (class) names in the Modules list
4353
# in the ToC. See https://github.com/doxygen/doxygen/issues/9921.
4454
set( DOXYGEN_HIDE_SCOPE_NAMES YES )
45-
set( DOXYGEN_HTML_OUTPUT html/libktx )
55+
set( DOXYGEN_HTML_OUTPUT libktx )
4656
# Order is important here. '_' suffixed prefices must come first
4757
# otherwise the non-suffixed is stripped first leaving just '_'.
4858
set( DOXYGEN_IGNORE_PREFIX KTX_;ktx_;KTX;ktx )
@@ -77,10 +87,7 @@ function( CreateDocLibKTX )
7787
ktx_size_t dataSize\; \\
7888
ktx_uint8_t* pData\;"
7989
)
80-
set( DOXYGEN_GENERATE_TAGFILE ${CMAKE_BINARY_DIR}/docs/libktx.tag )
81-
82-
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/docs )
83-
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/docs/html )
90+
set( DOXYGEN_GENERATE_TAGFILE ${docdest}/libktx.tag )
8491
8592
doxygen_add_docs(
8693
libktx.doc
@@ -114,9 +121,9 @@ function( CreateDocKTXTools )
114121
set( DOXYGEN_FILE_PATTERNS *.cpp )
115122
set( DOXYGEN_RECURSIVE YES )
116123
set( DOXYGEN_EXAMPLE_PATH utils )
117-
set( DOXYGEN_HTML_OUTPUT html/ktxtools )
124+
set( DOXYGEN_HTML_OUTPUT ktxtools )
118125
set( DOXYGEN_MAN_EXTENSION .1 )
119-
set( DOXYGEN_GENERATE_TAGFILE ${CMAKE_BINARY_DIR}/docs/ktxtools.tag )
126+
set( DOXYGEN_GENERATE_TAGFILE ${docdest}/ktxtools.tag )
120127
121128
doxygen_add_docs(
122129
ktxtools.doc
@@ -139,9 +146,9 @@ function( CreateDocKTX )
139146
set( DOXYGEN_EXCLUDE_PATTERNS ktxint.h )
140147
set( DOXYGEN_EXAMPLE_PATH lib )
141148
set( DOXYGEN_HTML_HEADER pkgdoc/header.html )
142-
set( DOXYGEN_MAN_OUTPUT man/ktx )
149+
set( DOXYGEN_HTML_OUTPUT . )
143150
set( DOXYGEN_MAN_LINKS YES )
144-
set( DOXYGEN_TAGFILES ${CMAKE_BINARY_DIR}/docs/libktx.tag=libktx ${CMAKE_BINARY_DIR}/docs/ktxtools.tag=ktxtools )
151+
set( DOXYGEN_TAGFILES ${docdest}/libktx.tag=libktx ${docdest}/ktxtools.tag=ktxtools )
145152
146153
doxygen_add_docs(
147154
ktxpkg.doc
@@ -163,16 +170,16 @@ add_dependencies( ktxpkg.doc ktxtools.doc )
163170
164171
165172
install(
166-
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs/html
173+
DIRECTORY ${docdest}/html
167174
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
168-
COMPONENT dev
175+
COMPONENT tools
169176
)
170177
171178
install( DIRECTORY
172-
${CMAKE_CURRENT_BINARY_DIR}/docs/man/man1
179+
${docdest}/man/man1
173180
## Omit those, since at the moment they contain a lot of undesired files generated by Doxygen
174-
# ${CMAKE_CURRENT_BINARY_DIR}/docs/man/man3
175-
# ${CMAKE_CURRENT_BINARY_DIR}/docs/man/ktx/man3
181+
# ${docdest}/man/man3
182+
# ${docdest}/man/ktx/man3
176183
DESTINATION
177184
"${CMAKE_INSTALL_MANDIR}"
178185
COMPONENT tools

lib/basisu/encoder/basisu_comp.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,8 +1819,7 @@ namespace basisu
18191819
total_faces = 6;
18201820
}
18211821

1822-
basist::ktx2_header header;
1823-
memset(&header, 0, sizeof(header));
1822+
basist::ktx2_header header = {};
18241823

18251824
memcpy(header.m_identifier, basist::g_ktx2_file_identifier, sizeof(basist::g_ktx2_file_identifier));
18261825
header.m_pixel_width = base_width;

lib/basisu/encoder/basisu_miniz.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,10 @@ tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_nex
11811181
{
11821182
mz_uint8 *p = r->m_tables[0].m_code_size; mz_uint i;
11831183
r->m_table_sizes[0] = 288; r->m_table_sizes[1] = 32; TINFL_MEMSET(r->m_tables[1].m_code_size, 5, 32);
1184-
for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8;
1184+
for ( i = 0; i <= 143; ++i) *p++ = 8;
1185+
for ( ; i <= 255; ++i) *p++ = 9;
1186+
for ( ; i <= 279; ++i) *p++ = 7;
1187+
for ( ; i <= 287; ++i) *p++ = 8;
11851188
}
11861189
else
11871190
{
@@ -1594,10 +1597,11 @@ static void tdefl_optimize_huffman_table(tdefl_compressor *d, int table_num, int
15941597
mz_uint bits = b; mz_uint len = l; MZ_ASSERT(bits <= ((1U << len) - 1U)); \
15951598
d->m_bit_buffer |= (bits << d->m_bits_in); d->m_bits_in += len; \
15961599
while (d->m_bits_in >= 8) { \
1597-
if (d->m_pOutput_buf < d->m_pOutput_buf_end) \
1600+
if (d->m_pOutput_buf < d->m_pOutput_buf_end) { \
15981601
*d->m_pOutput_buf++ = (mz_uint8)(d->m_bit_buffer); \
1599-
d->m_bit_buffer >>= 8; \
1600-
d->m_bits_in -= 8; \
1602+
} \
1603+
d->m_bit_buffer >>= 8; \
1604+
d->m_bits_in -= 8; \
16011605
} \
16021606
} MZ_MACRO_END
16031607

@@ -1968,7 +1972,10 @@ static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahe
19681972
if (TDEFL_READ_UNALIGNED_WORD(&d->m_dict[probe_pos + match_len - 1]) == c01) break;
19691973
TDEFL_PROBE; TDEFL_PROBE; TDEFL_PROBE;
19701974
}
1971-
if (!dist) break; q = (const mz_uint16*)(d->m_dict + probe_pos); if (TDEFL_READ_UNALIGNED_WORD(q) != s01) continue; p = s; probe_len = 32;
1975+
if (!dist) break;
1976+
q = (const mz_uint16*)(d->m_dict + probe_pos);
1977+
if (TDEFL_READ_UNALIGNED_WORD(q) != s01) continue;
1978+
p = s; probe_len = 32;
19721979
do { } while ( (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) &&
19731980
(TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (--probe_len > 0) );
19741981
if (!probe_len)

lib/basisu/encoder/basisu_uastc_enc.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2573,8 +2573,7 @@ namespace basisu
25732573
unpacked_uastc_block temp_ublock_unpacked;
25742574
unpack_uastc(temp_ublock, temp_ublock_unpacked, false);
25752575

2576-
unpacked_uastc_block ublock;
2577-
memset(&ublock, 0, sizeof(ublock));
2576+
unpacked_uastc_block ublock = {};
25782577
ublock.m_mode = best_results.m_uastc_mode;
25792578
ublock.m_common_pattern = best_results.m_common_pattern;
25802579
ublock.m_astc = temp_ublock_unpacked.m_astc;
@@ -3388,8 +3387,7 @@ namespace basisu
33883387
}
33893388
}
33903389

3391-
unpacked_uastc_block unpacked_ublock;
3392-
memset(&unpacked_ublock, 0, sizeof(unpacked_ublock));
3390+
unpacked_uastc_block unpacked_ublock = {};
33933391

33943392
uint64_t total_overall_err[MAX_ENCODE_RESULTS];
33953393
float uastc_err_f[MAX_ENCODE_RESULTS];

lib/basisu/encoder/cppspmd_sse.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ struct spmd_kernel
12061206
CPPSPMD_FORCE_INLINE vint load_all(const vint_vref& src)
12071207
{
12081208
// TODO: There's surely a better way
1209-
__m128i k;
1209+
__m128i k = {};
12101210

12111211
k = insert_x(k, ((int*)(&src.m_pValue[extract_x(src.m_vindex)]))[0]);
12121212
k = insert_y(k, ((int*)(&src.m_pValue[extract_y(src.m_vindex)]))[1]);

lib/basisu/encoder/jpgd.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -947,15 +947,15 @@ namespace jpgd {
947947
// Finds the next marker.
948948
int jpeg_decoder::next_marker()
949949
{
950-
uint c, bytes;
950+
uint c; //, bytes;
951951

952-
bytes = 0;
952+
//bytes = 0;
953953

954954
do
955955
{
956956
do
957957
{
958-
bytes++;
958+
//bytes++;
959959
c = get_bits(8);
960960
} while (c != 0xFF);
961961

@@ -1303,7 +1303,7 @@ namespace jpgd {
13031303
int i;
13041304
jpgd_block_t* p;
13051305
jpgd_quant_t* q;
1306-
int mcu_row, mcu_block, row_block = 0;
1306+
int mcu_row, mcu_block; //, row_block = 0;
13071307
int component_num, component_id;
13081308
int block_x_mcu[JPGD_MAX_COMPONENTS];
13091309

@@ -1338,7 +1338,7 @@ namespace jpgd {
13381338
if (p[g_ZAG[i]])
13391339
p[g_ZAG[i]] = static_cast<jpgd_block_t>(p[g_ZAG[i]] * q[i]);
13401340

1341-
row_block++;
1341+
//row_block++;
13421342

13431343
if (m_comps_in_scan == 1)
13441344
block_x_mcu[component_id]++;
@@ -1425,7 +1425,7 @@ namespace jpgd {
14251425
// Decodes and dequantizes the next row of coefficients.
14261426
void jpeg_decoder::decode_next_row()
14271427
{
1428-
int row_block = 0;
1428+
//int row_block = 0;
14291429

14301430
for (int mcu_row = 0; mcu_row < m_mcus_per_row; mcu_row++)
14311431
{
@@ -1528,7 +1528,7 @@ namespace jpgd {
15281528

15291529
m_mcu_block_max_zag[mcu_block] = k;
15301530

1531-
row_block++;
1531+
//row_block++;
15321532
}
15331533

15341534
transform_mcu(mcu_row);

0 commit comments

Comments
 (0)