Files
OrcaSlicer/deps/PNG/PNG.cmake
Kris Austin 7eaff76cec build: use clang-cl for Windows CI builds (faster slicing and faster builds) (#15428)
* ci: build the Windows x64 dependencies and slicer with clang-cl

Passes -l -x from the Windows jobs, using the clang-cl and Ninja options
added in #15373. Ninja runs each dependency's build step as a plain command,
so the jobs set up a VC environment for OpenSSL's nmake. arm64 stays on MSVC
for now.

The deps cache key gains the compiler, so windows-x64 becomes
windows-x64-clang and windows-arm64 becomes windows-arm64-msvc.

* deps: select OpenSSL's ARM64 target from DEPS_ARCH

CMAKE_GENERATOR_PLATFORM is only set by -A, which Ninja never receives, so
the Ninja build selected the x64 target on ARM64. DEPS_ARCH is derived from
CMAKE_SYSTEM_PROCESSOR and is already independent of the generator.

* ci: build the Windows ARM64 dependencies and slicer with clang-cl

Three dependencies need handling first. libpng and OpenCV each build an ARM
SIMD path that does not compile with clang-cl, so those paths are off; PNG
already had the same opt-out for Apple ARM. OCCT is built with cl, since
clang-cl cannot emit one of its large generated files and there is no option
to turn that off. All three are gated to Windows ARM64 with clang.
2026-09-01 10:30:45 -03:00

53 lines
2.0 KiB
CMake

if (APPLE)
# Only disable NEON extension for Apple ARM builds, leave it enabled for Raspberry PI.
set(_disable_neon_extension "-DPNG_ARM_NEON=off")
elseif ("${DEPS_ARCH}" STREQUAL "arm64" AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
# libpng's CMake ignores PNG_ARM_NEON on Windows ARM64 and skips the NEON
# sources, but pngpriv.h enables NEON anyway.
set(_disable_neon_extension "-DCMAKE_C_FLAGS=/DWIN32 /D_WINDOWS /DPNG_ARM_NEON_OPT=0")
else ()
set(_disable_neon_extension "")
endif ()
if(APPLE AND IS_CROSS_COMPILE)
# TODO: check if it doesn't create problem when compiling from arm to x86_64
orcaslicer_add_cmake_project(PNG
GIT_REPOSITORY https://github.com/glennrp/libpng.git
GIT_TAG v1.6.35
DEPENDS ${ZLIB_PKG}
PATCH_COMMAND ${GIT_EXECUTABLE} checkout -f -- . && git clean -df &&
${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/macos-arm64.patch ${CMAKE_CURRENT_LIST_DIR}/0002-clang19-macos.patch
CMAKE_ARGS
-DPNG_SHARED=OFF
-DPNG_STATIC=ON
-DPNG_PREFIX=prusaslicer_
-DPNG_TESTS=OFF
-DDISABLE_DEPENDENCY_TRACKING=OFF
${_disable_neon_extension}
)
else ()
set(_patch_step "")
if (APPLE)
set(_patch_step PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/PNG.patch ${CMAKE_CURRENT_LIST_DIR}/0002-clang19-macos.patch)
endif ()
orcaslicer_add_cmake_project(PNG
# GIT_REPOSITORY https://github.com/glennrp/libpng.git
# GIT_TAG v1.6.35
URL https://github.com/glennrp/libpng/archive/refs/tags/v1.6.35.zip
URL_HASH SHA256=3d22d46c566b1761a0e15ea397589b3a5f36ac09b7c785382e6470156c04247f
DEPENDS ${ZLIB_PKG}
"${_patch_step}"
CMAKE_ARGS
-DPNG_SHARED=OFF
-DPNG_STATIC=ON
-DPNG_PREFIX=prusaslicer_
-DPNG_TESTS=OFF
-DDISABLE_DEPENDENCY_TRACKING=OFF
${_disable_neon_extension}
)
endif()
if (MSVC)
add_debug_dep(dep_PNG)
endif ()