Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing build for arm64 Windows #582

Merged
merged 62 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
2966544
Working around compiler bug when targeting arm64 windows
Honeybunch May 27, 2022
6daf650
Merge branch 'master' of https://github.com/KhronosGroup/KTX-Software…
Honeybunch May 27, 2022
074db11
Adding arm64 windows build to github actions
Honeybunch May 27, 2022
6c3a69a
Making tests configurable in CI script for windows
Honeybunch May 30, 2022
2ac9944
Trying out a matrix in github actions
Honeybunch May 30, 2022
9e469e4
Changing github actions VS generator string
Honeybunch May 30, 2022
3320e2f
Fixing some of the github action and making sure that the build scrip…
Honeybunch May 30, 2022
e9a72d1
Updating workflow to include doxygen
Honeybunch May 30, 2022
939896d
Installing doxygen for real
Honeybunch May 30, 2022
ae00016
Trying to fix syntax error in actions yml
Honeybunch May 30, 2022
725dbfe
Trying to install doxygen...
Honeybunch May 30, 2022
6289afa
I just want doxygen
Honeybunch May 30, 2022
0fcf8de
Adding error message if you try to package a build that doesn't build…
Honeybunch Jun 1, 2022
3e0ee1e
Easiest build fix is to just tie packaging to building tools
Honeybunch Jun 1, 2022
4e32ebe
Merge branch 'master' of https://github.com/KhronosGroup/KTX-Software…
Honeybunch Jun 4, 2022
bbe254a
Making sure that arm64 windows builds produce uniquely named nsis pac…
Honeybunch Jun 5, 2022
c968927
Fixing workflow syntax
Honeybunch Jun 5, 2022
eea48f5
Fixing workflow syntax again
Honeybunch Jun 5, 2022
bec47b6
Fixing workflow again again
Honeybunch Jun 5, 2022
c37832a
Tweaking run step for installing the signing cert
Honeybunch Jun 5, 2022
d2d4df8
Replacing appveyor secure-file tool with a base64 github secret for now
Honeybunch Jun 5, 2022
d6f530c
removing unnecessary shell specifier
Honeybunch Jun 5, 2022
bc47e32
Fixing up build matrix and making sure clangcl works
Honeybunch Jun 7, 2022
03cd58b
Attempting to fix if statement syntax
Honeybunch Jun 7, 2022
2f2cb61
Fixing up work to install signing cert
Honeybunch Jun 7, 2022
5e49206
Small fix to ensure that non-msvc platforms will build
Honeybunch Jun 7, 2022
c510269
Silencing warning about CMAKE_GENERATOR not being set
Honeybunch Jun 7, 2022
5ab7408
Merge branch 'master' of https://github.com/KhronosGroup/KTX-Software…
Honeybunch Jun 7, 2022
4a5cf09
Fixing workflow syntax
Honeybunch Jun 7, 2022
d9a9949
Mimicing appveyor's CERT_PK_PASS check
Honeybunch Jun 7, 2022
797eb62
Removing astc encoder workaround
Honeybunch Jun 7, 2022
dd9f740
Removing quotes from CMake env vars
Honeybunch Jun 7, 2022
f31c2f4
Attempting to pass an optional toolset to the build script
Honeybunch Jun 7, 2022
f3abd1f
Fixing Get KTX Version syntax
Honeybunch Jun 7, 2022
be5309b
Fixing path to ktx version
Honeybunch Jun 7, 2022
ed5377a
Fixing path to uploadable artifact
Honeybunch Jun 7, 2022
f28ad63
Actually getting the ktx version this time
Honeybunch Jun 7, 2022
69eda1d
Another attempt to get this uploaded
Honeybunch Jun 7, 2022
4fb1e40
Another attempt to get the correct path to the arm64 windows artifact
Honeybunch Jun 7, 2022
275df22
Removing mingw relwithdebinfo build to save time
Honeybunch Jun 7, 2022
eb77adb
Using wildcard to find build artifact
Honeybunch Jun 7, 2022
0c22133
Fixing accidentally removed check in astc-encoder and actually removi…
Honeybunch Jun 7, 2022
7b2b7c0
Some renamings and other small tweaks
Honeybunch Jun 8, 2022
0f0a146
Attempting to setup uploads to release
Honeybunch Jun 8, 2022
dad6a93
Better arm fix for msvc & clangcl
Honeybunch Jun 8, 2022
d8a7080
Undoing modification to astc-encoder's cmake_core
Honeybunch Jun 8, 2022
f968317
Handling secrets as environment variables
Honeybunch Jun 8, 2022
9573b99
Fixing syntax error
Honeybunch Jun 8, 2022
1c88415
Setting up output parameters for signing
Honeybunch Jun 8, 2022
aea3a71
Small tweak to fix warnings in clang-cl
Honeybunch Jun 8, 2022
2c4594c
Merge branch 'master' of https://github.com/KhronosGroup/KTX-Software…
Honeybunch Jun 11, 2022
ed4a7c7
Fixing warnings with clang-cl
Honeybunch Jun 12, 2022
cc4035c
A more robust to muting clang warnings
Honeybunch Jun 12, 2022
fa78044
Fixing comment typo
Honeybunch Jun 13, 2022
9d5e784
Fixing bad msvc check in cmake
Honeybunch Jun 13, 2022
429d5f1
Fixing up some small issues
Honeybunch Jun 13, 2022
5557739
Trying a more thorough check for MSVC
Honeybunch Jun 13, 2022
41a6e1c
Cleaning up some mingw warnings as a treat
Honeybunch Jun 13, 2022
2081778
Lowering version of warning check to match observed behavior of compi…
Honeybunch Jun 14, 2022
9294717
Trying to fix appveyor
Honeybunch Jun 14, 2022
f67090b
Some cleanup and fixing some last warnings with mingw
Honeybunch Jun 14, 2022
9fae48c
Tweak to approach in disabling warning
Honeybunch Jun 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 98 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,105 @@ on:
# Allow manual trigger
workflow_dispatch:


jobs:
windows-arm64:
runs-on: windows-latest
strategy:
matrix:
options: [
{config: Debug, package: NO, tools: ON, docs: OFF},
{config: Release, package: YES, tools: ON, docs: ON}
]
env:
# Skip downloading necessities for the load tests and source and golden
# images for the other tests since we can't run arm64 tests on the x64
# build host.
GIT_LFS_SKIP_SMUDGE: 1

BUILD_DIR: "build/build-batch-vs2022"
CONFIGURATION: "${{matrix.options.config}}"
CMAKE_GEN: "Visual Studio 17 2022" # Only VS version on Windows Server 2022
CMAKE_TOOLSET: "ClangCL"

PACKAGE: ${{matrix.options.package}}
FEATURE_TOOLS: ${{matrix.options.tools}}
FEATURE_DOC: ${{matrix.options.docs}}

PLATFORM: "arm64"
SUPPORT_SSE: OFF

# No tests on arm64 since the host is x64 and can't run the built tests
FEATURE_JNI: OFF # Not sure of the state of JNI on arm64 windows
FEATURE_TESTS: OFF
FEATURE_LOADTESTS: OFF

CERT_PK_PASS: ${{ secrets.CERT_PK_PASS }}
CERT_DC_SECRET: ${{ secrets.CERT_DC_SECRET }}
CERT_DC_SALT: ${{ secrets.CERT_DC_SALT }}

steps:
- uses: actions/checkout@v2
with:
# Fetch all history to make sure tags are
# included (used for version creation)
fetch-depth: 0

# Need doxygen if docs are supposed to be built
# This has been observed to fail due to Sourceforge host failure
# Can't control that so please manually re-run if we time out here
- name: Install Doxygen
if: matrix.options.docs == 'ON'
uses: crazy-max/ghaction-chocolatey@v2
with:
args: install doxygen.install

- name: Install Certificate File Decryption Tool
if: matrix.options.package == 'YES'
run: iex ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/appveyor/secure-file/master/install.ps1'))

- name: Import Certificate to Certificate Store
if: matrix.options.package == 'YES'
id: cert-import
run: |
if ($env:CERT_PK_PASS) {
$cert_file = "the_khronos_group_inc.p12"
appveyor-tools\secure-file -decrypt "${cert_file}.enc" -secret $env:CERT_DC_SECRET -salt $env:CERT_DC_SALT
certutil -p $env:CERT_PK_PASS -importpfx My $cert_file NoExport
rm $cert_file
echo "::set-output name=win_code_sign_identity::'The Khronos Group Inc'"
echo "::set-output name=win_cs_cert_search_machine_store::'ON'"
} else {
echo "::set-output name=win_code_sign_identity::''"
echo "::set-output name=win_cs_cert_search_machine_store::'OFF'"
}

- name: Build arm64 Windows
run: powershell ./ci_scripts/build_win.ps1
env:
WIN_CODE_SIGN_IDENTITY: ${{ steps.cert-import.outputs.win_code_sign_identity }}
WIN_CS_CERT_SEARCH_MACHINE_STORE: ${{ steps.cert-import.outputs.win_cs_cert_search_machine_store }}

- name: Get KTX version
if: matrix.options.package == 'YES'
id: ktx-version
run: |
$env:KTX_VERSION = Get-Content $env:BUILD_DIR/ktx.version
echo "::set-output name=ktx-version::$env:KTX_VERSION"

- name: Upload Artifact
if: matrix.options.package == 'YES'
uses: actions/upload-artifact@v2
with:
name: KTX-Software-${{ steps.ktx-version.outputs.ktx-version }}-Windows-arm64
path: ${{env.BUILD_DIR}}/KTX-Software-*.exe*

- name: Upload To Release
uses: softprops/action-gh-release@v1
if: (matrix.options.package == 'YES') && (github.event_name == 'release') && startsWith(github.ref, 'refs/tags/')
with:
files: ${{env.BUILD_DIR}}/KTX-Software-*.exe*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

mingw:
runs-on: windows-latest
Expand All @@ -31,8 +128,6 @@ jobs:
run: cmake -B build -G "Ninja Multi-Config" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++
- name: Build Mingw x64 Debug
run: cmake --build build --config Debug
- name: Build Mingw x64 RelWithDebInfo
run: cmake --build build --config RelWithDebInfo
- name: Build Mingw x64 Release
run: cmake --build build --config Release

Expand Down
29 changes: 24 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ macro(commom_lib_settings lib write)
-Wno-nested-anon-types
-Wno-gnu-anonymous-struct
>
$<$<CXX_COMPILER_ID:GNU>:
-Wno-cast-function-type
>
# not clang options
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:
-Wno-pedantic
Expand Down Expand Up @@ -524,9 +527,9 @@ PRIVATE
# "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID} "
# "CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}"
#)
if(MSVC)
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
MarkCallow marked this conversation as resolved.
Show resolved Hide resolved
# Currently no need to disable any warnings in basisu code. Rich fixed them.
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set_source_files_properties(
# It's too much work to discriminate which files need which warnings
# disabled.
Expand All @@ -543,7 +546,7 @@ elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
PROPERTIES COMPILE_OPTIONS "-Wno-unused-but-set-variable"
)
endif()
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL "12.0.5")
set_source_files_properties( lib/basisu/encoder/basisu_kernels_sse.cpp
PROPERTIES COMPILE_OPTIONS "-Wno-unused-parameter;-Wno-deprecated-copy;-Wno-uninitialized-const-reference"
Expand All @@ -553,13 +556,22 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
PROPERTIES COMPILE_OPTIONS "-Wno-unused-parameter"
)
endif()
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL "13.1")
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL "12.0.0")
# Primarily an issue on windows using clang/clangcl
# Lowest tested clang version was 12.0.0 and highest was 14.0.4
set_source_files_properties(
lib/basisu/zstd/zstd.c
PROPERTIES COMPILE_OPTIONS "-Wno-unused-function"
)
endif()
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL "13.0.0")
get_source_file_property(zstd_options lib/basisu/zstd/zstd.c COMPILE_OPTIONS)
set_source_files_properties(
# We haven't fixed zstd.c because the fix would have to be applied
# every time the upstream script is used to create an updated
# single file decoder.
lib/basisu/zstd/zstd.c
PROPERTIES COMPILE_OPTIONS "-Wno-unused-but-set-variable"
PROPERTIES COMPILE_OPTIONS "${zstd_options};-Wno-unused-but-set-variable"
)
endif()
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL "15.0")
Expand Down Expand Up @@ -890,6 +902,13 @@ if( APPLE AND CMAKE_OSX_ARCHITECTURES )
else()
set(processor_name ${CMAKE_OSX_ARCHITECTURES})
endif()
elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID)
# When targeting Windows arm64 CMAKE_SYSTEM_PROCESSOR will incorrectly
# return AMD64.
MarkCallow marked this conversation as resolved.
Show resolved Hide resolved
# See: https://gitlab.kitware.com/cmake/cmake/-/issues/15170
# We assume that when building for Windows arm64 that we are using MSVC
# so we can detect the processor arch name with CMAKE_CXX_COMPILER_ARCHITECTURE_ID
set(processor_name ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID})
elseif( CMAKE_SYSTEM_PROCESSOR )
set(processor_name ${CMAKE_SYSTEM_PROCESSOR})
elseif( IOS )
Expand Down
33 changes: 29 additions & 4 deletions ci_scripts/build_win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ function Set-Config-Variable {
$BUILD_DIR = Set-Config-Variable BUILD_DIR "build/build-batch-vs2019"
$CONFIGURATION = Set-Config-Variable CONFIGURATION "Release"
$CMAKE_GEN = Set-Config-Variable CMAKE_GEN "Visual Studio 16 2019"
$CMAKE_TOOLSET = Set-Config-Variable CMAKE_TOOLSET ""
$FEATURE_DOC = Set-Config-Variable FEATURE_DOC "OFF"
$FEATURE_JNI = Set-Config-Variable FEATURE_JNI "OFF"
$FEATURE_LOADTESTS = Set-Config-Variable FEATURE_LOADTESTS "OFF"
$FEATURE_TOOLS = Set-Config-Variable FEATURE_TOOLS "ON"
$FEATURE_TESTS = Set-Config-Variable FEATURE_TESTS "ON"
$PLATFORM = Set-Config-Variable PLATFORM "x64"
$PACKAGE = Set-Config-Variable PACKAGE "NO"
$SUPPORT_SSE = Set-Config-Variable SUPPORT_SSE "ON"
Expand All @@ -41,13 +43,24 @@ $WIN_CS_CERT_SEARCH_MACHINE_STORE = Set-Config-Variable WIN_CS_CERT_SEARCH_MACHI

if ($FEATURE_LOADTESTS -eq "ON") { $need_gles_emulator=1 }

echo "Build via $CMAKE_GEN dir: $build_dir Arch: $PLATFORM Config: $CONFIGURATION, FEATURE_LOADTESTS: $FEATURE_LOADTESTS, FEATURE_DOC: $FEATURE_DOC, FEATURE_JNI: $FEATURE_JNI, FEATURE_TOOLS: $FEATURE_TOOLS, SUPPORT_SSE: $SUPPORT_SSE, SUPPORT_OPENCL: $SUPPORT_OPENCL WIN_CODE_SIGN_IDENTITY: $WIN_CODE_SIGN_IDENTITY WIN_CS_CERT_SEARCH_MACHINE_STORE: $WIN_CS_CERT_SEARCH_MACHINE_STORE"
echo "Build via $CMAKE_GEN dir: $BUILD_DIR Arch: $PLATFORM Toolset: $CMAKE_TOOLSET Config: $CONFIGURATION, FEATURE_LOADTESTS: $FEATURE_LOADTESTS, FEATURE_DOC: $FEATURE_DOC, FEATURE_JNI: $FEATURE_JNI, FEATURE_TOOLS: $FEATURE_TOOLS, FEATURE_TESTS: $FEATURE_TESTS, SUPPORT_SSE: $SUPPORT_SSE, SUPPORT_OPENCL: $SUPPORT_OPENCL WIN_CODE_SIGN_IDENTITY: $WIN_CODE_SIGN_IDENTITY WIN_CS_CERT_SEARCH_MACHINE_STORE: $WIN_CS_CERT_SEARCH_MACHINE_STORE"

cmake . -G "$CMAKE_GEN" -A $PLATFORM -B $BUILD_DIR `
if (($PACKAGE -eq "YES") -and ($FEATURE_TOOLS -eq "OFF")) {
echo "Error: Cannot package a configuration that does not build tools. Set FEATURE_TOOLS to ON or PACKAGE to NO"
exit 2
}

$TOOLSET_OPTION = ""
if($CMAKE_TOOLSET){
$TOOLSET_OPTION = "-T $CMAKE_TOOLSET"
}

cmake . -G "$CMAKE_GEN" -A $PLATFORM $TOOLSET_OPTION -B $BUILD_DIR `
-D KTX_FEATURE_DOC=$FEATURE_DOC `
-D KTX_FEATURE_JNI=$FEATURE_JNI `
-D KTX_FEATURE_LOADTEST_APPS=$FEATURE_LOADTESTS `
-D KTX_FEATURE_TOOLS=$FEATURE_TOOLS `
-D KTX_FEATURE_TESTS=$FEATURE_TESTS `
-D BASISU_SUPPORT_SSE=$SUPPORT_SSE `
-D BASISU_SUPPORT_OPENCL=$SUPPORT_OPENCL `
-D WIN_CODE_SIGN_IDENTITY=$WIN_CODE_SIGN_IDENTITY `
Expand All @@ -58,11 +71,23 @@ pushd $BUILD_DIR
try {
#git status
cmake --build . --config $CONFIGURATION
# Return an error code if cmake fails
if(!$?){
popd
exit 1
}

#git status
if ($PACKAGE -eq "YES") {
cmake --build . --config $CONFIGURATION --target PACKAGE
# Return an error code if cmake fails
if(!$?){
popd
exit 1
}
}
echo "Done building."
} finally {
popd
}
finally {
popd
}
6 changes: 3 additions & 3 deletions cmake/cputypetest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ function(set_target_processor_type out)
set(${out} x86_64 PARENT_SCOPE)

else()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "ARM")
if(MSVC) # MSVC is true for all msvc-style compilers, including clang-cl
if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "ARM" OR "${CMAKE_GENERATOR_PLATFORM}" STREQUAL "arm")
set(processor "arm")
elseif("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "ARM64")
elseif("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "ARM64" OR "${CMAKE_GENERATOR_PLATFORM}" STREQUAL "arm64")
set(processor "arm64")
else()
set(C_PREPROCESS ${CMAKE_C_COMPILER} /EP /nologo)
Expand Down
13 changes: 9 additions & 4 deletions lib/etcdec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,13 @@ submitted to the exclusive jurisdiction of the Swedish Courts.
// the source of the functions or the compiled binary code.
#if defined(_MSC_VER)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you say

#if defined(_MSC_VER) && !__clang__

and then let the existing #elif __clang__ handle the clang case?

Done the way it is here raises the question for me of how does clang_cl handle the pragma warning statements. Does it just ignore them or does it warn about them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could do that yeah. An easy refactor for sure.
ClangCL does report MSVC's error codes so it does also handle the MSVC specific warning statements. That's why I did it this way, I figured whatever warnings we want to disable for MSVC we also want to disable for ClangCL.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you did refactor it.

If CLangCL is handling MSVC specific warnings there shouldn't be any need for the #pragma clang diagnostic ignored "-Wunused-parameter" as that is the same as warning 4100 in CL. Because we do need it, it looks like at best #pragma warning is being ignored. Is CLangCL's handling of #pragma warning documented somewhere?

I agree with the statement "I figured whatever warnings we want to disable for MSVC we also want to disable for ClangCL.". If the original way you did it implements this then restore it but add a comment as to why and about the way CLangCL handles these things.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sorry looks like it just ignores them. This current approach works the same as it did before, it's no longer if/else with _MSC_VER so we apply msvc style warning pragmas for any compiler that has it defined. It's a little odd to read though so if you want I can make it explicit like I did before

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way you have it is fine but I suggest adding a comment // clang_cl defines both _MSC_VER and __clang__ to prevent somebody going down the road of trying #elif in future.

#pragma warning(push)
#pragma warning(disable: 4100 4244 )
#elif __clang__
#pragma warning(disable: 4100 4244)
#endif
// clang-cl defines both _MSC_VER and __clang__
#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#if __clang_major__ > 13 || (__clang_major__ == 13 && __clang_minor__ >= 1)
#if __has_warning("-Wunused-but-set-variable")
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#endif
#elif __GNUC__
Expand Down Expand Up @@ -1862,6 +1864,9 @@ void decompressBlockAlpha16bit(uint8* data, uint8* img, int width, int height, i
// Reenable warnings disabled at the top of this file.
#if defined(_MSC_VER)
#pragma warning(pop)
#else
#endif
#if __clang__
#pragma clang diagnostic pop
#elif __GNUC__
#pragma GCC diagnostic pop
#endif
2 changes: 1 addition & 1 deletion lib/gl_format.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ MODIFICATIONS for use in libktx
#include "formatsize.h"
#include "vkformat_enum.h"

#if defined(_WIN32)
#if defined(_WIN32) && !defined(__MINGW32__)
#define NOMINMAX
#ifndef __cplusplus
#undef inline
Expand Down
3 changes: 1 addition & 2 deletions lib/vk_funcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ static HMODULE
ktxGetVulkanModuleHandle()
{
HMODULE module = NULL;
BOOL found;
found = GetModuleHandleExA(
GetModuleHandleExA(
0,
VULKANLIB,
&module
Expand Down
8 changes: 8 additions & 0 deletions tests/transcodetests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ if(WIN32)
$<$<STREQUAL:"${BASISU_CBIND_LIBTYPE}","STATIC">:KHRONOS_STATIC>
)

# Disable some known warnings in the transcoder
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set_source_files_properties(
${PROJECT_SOURCE_DIR}/lib/basisu/transcoder/basisu_transcoder.cpp
PROPERTIES COMPILE_OPTIONS "-Wno-sign-compare;-Wno-unused-function;-Wno-unused-variable;-Wno-class-memaccess;-Wno-maybe-uninitialized"
)
endif()

# The Windows ktx.dll does not export needed symbols from
# basisu_transcoder.cpp. This is a workaround to get it linking.
add_library(obj_tmp_basisu OBJECT
Expand Down