Fix NoAvx build configuration for AVX enabled machines. #2523
+19
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

I want to build Whisper Runtimes for machines without AVX on an AVX-enabled host with Windows OS. This is for providing the runtimes for Whisper.net for users without AVX,
Because the checks if AVX, AVX2, etc are executed regardless of if the options are provided or not and updated it anyway, I cannot build these runtimes for Whisper.net.Runtime.NoAvx:
See: sandrohanea/whisper.net#239
I checked the build and indeed, even if I set

-DGGML_AVX=OFFit will still be set to true because it is available on the host machine:https://github.com/sandrohanea/whisper.net/actions/runs/11572290952/job/32211959849
This PR is addressing this issue to run those checks only if the option is already true, allowing it to be overridden to false if the capability is not found on the machine.
It also changes the default for MSVC to have INS_ENB by default on (to keep the same behaviour if building on an AVX enabled host)
This configuration will allow:
building AVX-enabled library on AVX-enabled host
building NotAVX-enabled library on AVX-enabled host
building NotAVX-enabled library on NotAVX-enabled host
Building AVX-enabled library by default on AVX-Enabled Host
Building NotAVX-enabled library by default on NotAVX-Enabled Host