Compare commits

...

3 Commits

4 changed files with 28 additions and 6 deletions

View File

@ -1,4 +1,12 @@
cmake_minimum_required(VERSION 3.18)
if(MSVC AND ENV{CC} MATCHES ".*clang-cl.*")
set(CMAKE_GENERATOR_TOOLSET "ClangCL")
set(CLANG_CL TRUE)
else()
set(CLANG_CL FALSE)
endif()
include(tools/CompilerWarnings.cmake)
include(tools/CPUFeatures.cmake)
set(CMAKE_VERBOSE_MAKEFILE ON)

View File

@ -78,7 +78,7 @@ archs = ["auto64"] # arm64 windows builds not yet supported
test-command = "cd /d {project} && python -m unittest --verbose" # windows why is this flag required
# MSVC compiled wheels will just have to be serial ops until distutil supports clang-cl
# https://github.com/python/cpython/pull/18371
environment = { CXX = "clang-cl.exe", CC = "clang-cl.exe" }
environment = { QUICKTEX_HWY_MODE = "SSE4", CXX = "clang-cl.exe", CC = "clang-cl.exe" }
[tool.cibuildwheel.linux]
skip = ["cp37-musllinux*", "*musllinux_aarch64*"] # skip targets without available Pillow wheels

View File

@ -46,7 +46,6 @@ class CMakeBuild(build_ext):
"-DPython_EXECUTABLE={}".format(sys.executable),
"-DPython_ROOT_DIR={}".format(os.path.dirname(sys.executable)),
"-DQUICKTEX_VERSION_INFO={}".format(version), # include version info in module
"-DQUICKTEX_MODULE_ONLY=TRUE", # only build the module, not the wrapper
"-DCMAKE_BUILD_TYPE={}".format(cfg), # not used on MSVC, but no harm
# clear cached make program binary, see https://github.com/pypa/setuptools/issues/2912
"-U",
@ -67,6 +66,9 @@ class CMakeBuild(build_ext):
cmake_args += ["-GNinja"]
else:
# if 'CC' in os.environ and 'clang-cl' in os.environ['CC']:
# cmake_args += ["-T", 'ClangCL'] # https://stackoverflow.com/a/64189112/7645957
# Single config generators are handled "normally"
single_config = any(x in cmake_generator for x in {"NMake", "Ninja"})

View File

@ -42,20 +42,32 @@ function(set_simd_flags target_name)
if (highway_mode STREQUAL "AUTO")
# setting -march=native on an M1 causes Clang to freak out
if (MSVC)
#MSVC has no -march=native equivalent. womp
message(WARNING "Compiling using MSVC without settig an explicit QUICKTEX_HWY_MODE defaults to serial operations. Please compile with Clang if you need vectorization")
if (CLANG_CL)
target_compile_options(${target_name} PUBLIC /clang:-march=native)
else()
#MSVC has no -march=native equivalent. womp
message(WARNING "Compiling using cl.exe without settig an explicit QUICKTEX_HWY_MODE defaults to serial operations. Please compile with clang-cl if you need vectorization")
endif()
elseif (!ARM)
target_compile_options(${target_name} PUBLIC -march=native)
endif ()
elseif (highway_mode STREQUAL "SSSE3")
if (MSVC)
message(SEND_ERROR "Compiling using SSSE3 is not supported with the MSVC compiler. Please use AVX or compile withClang")
if (CLANG_CL)
target_compile_options(${target_name} PUBLIC /clang:-mssse3)
else()
message(SEND_ERROR "Compiling using SSSE3 is not supported with the cl.exe compiler. Please use AVX or compile with clang-cl")
endif()
else ()
target_compile_options(${target_name} PUBLIC -mssse3)
endif ()
elseif (highway_mode STREQUAL "SSE4")
if (MSVC)
message(SEND_ERROR "Compiling using SSE4 is not supported with the MSVC compiler. Please use AVX or compile with Clang")
if (CLANG_CL)
target_compile_options(${target_name} PUBLIC /clang:-msse4)
else()
message(SEND_ERROR "Compiling using SSE4 is not supported with the MSVC compiler. Please use AVX or compile with Clang")
endif()
else ()
target_compile_options(${target_name} PUBLIC -msse4)
endif ()