Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
macos: add optional openMP dependency to G'MIC
Ivan Yossi8dd13df957af
diff --git a/3rdparty_plugins/ext_gmic/0001-force-turn-off-aligned_alloc.patch b/3rdparty_plugins/ext_gmic/0001-force-turn-off-aligned_alloc.patchnew file mode 100644index 0000000000..8d2ad5c379--- /dev/null+++ b/3rdparty_plugins/ext_gmic/0001-force-turn-off-aligned_alloc.patch@@ -0,0 +1,25 @@+From 48e70c9899e2b4280d2060393453f9c7f90e8be7 Mon Sep 17 00:00:00 2001+From: Ivan Yossi <[email protected]>+Date: Mon, 19 Jan 2026 18:36:00 -0600+Subject: [PATCH] force turn off aligned_alloc++---+ runtime/src/kmp_config.h.cmake | 2 +-+ 1 file changed, 1 insertion(+), 1 deletion(-)++diff --git a/runtime/src/kmp_config.h.cmake b/runtime/src/kmp_config.h.cmake+index d64c9a4..417f336 100644+--- a/runtime/src/kmp_config.h.cmake++++ b/runtime/src/kmp_config.h.cmake+@@ -90,7 +90,7 @@+ #define KMP_HAVE_XMMINTRIN_H LIBOMP_HAVE_XMMINTRIN_H+ #cmakedefine01 LIBOMP_HAVE__MM_MALLOC+ #define KMP_HAVE__MM_MALLOC LIBOMP_HAVE__MM_MALLOC+-#cmakedefine01 LIBOMP_HAVE_ALIGNED_ALLOC++#define LIBOMP_HAVE_ALIGNED_ALLOC 0+ #define KMP_HAVE_ALIGNED_ALLOC LIBOMP_HAVE_ALIGNED_ALLOC+ #cmakedefine01 LIBOMP_HAVE_POSIX_MEMALIGN+ #define KMP_HAVE_POSIX_MEMALIGN LIBOMP_HAVE_POSIX_MEMALIGN+--+2.50.1 (Apple Git-155)+diff --git a/3rdparty_plugins/ext_gmic/CMakeLists.txt b/3rdparty_plugins/ext_gmic/CMakeLists.txtindex ed65c71c17..d6708efe76 100644--- a/3rdparty_plugins/ext_gmic/CMakeLists.txt+++ b/3rdparty_plugins/ext_gmic/CMakeLists.txt@@ -14,3 +14,38 @@ ExternalProject_Add( ext_gmicUPDATE_COMMAND "")++if (APPLE)+ ExternalProject_Add( ext_openmp+ DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}+ URL https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.0/openmp-21.1.0.src.tar.xz+ URL_HASH SHA256=60d6c4d2019d546aefc029c9b2c4006dc78419dba4cfd0a376ae025be8ff9778++ INSTALL_DIR ${PREFIX_ext_gmic}++ # aligned_alloc not available in macOS<=10.15, remove after support for those versions dropped+ PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0001-force-turn-off-aligned_alloc.patch++ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_gmic} -DOPENMP_STANDALONE_BUILD=ON+ -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE}++ UPDATE_COMMAND ""+ )++ ExternalProject_Add_Step(ext_openmp download-cmake-modules+ COMMENT "Downloading llvm-cmake modules"+ WORKING_DIRECTORY <SOURCE_DIR>/cmake++ # we use external cmake exec to check hash and do some retries before hard failing+ COMMAND ${CMAKE_COMMAND}+ -DEXT_TMP_DIR=<TMP_DIR>+ -D URL=https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.0/cmake-21.1.0.src.tar.xz+ -D URL_SHA=528347c84c3571d9d387b825ef8b07c7ad93e9437243c32173838439c3b6028f+ -P "${CMAKE_CURRENT_SOURCE_DIR}/download_llvm-cmake_modules.cmake"++ DEPENDERS configure+ DEPENDEES patch+ )++ ExternalProject_Add_StepDependencies(ext_gmic install ext_openmp)+endif()diff --git a/3rdparty_plugins/ext_gmic/download_llvm-cmake_modules.cmake b/3rdparty_plugins/ext_gmic/download_llvm-cmake_modules.cmakenew file mode 100644index 0000000000..738af77b09--- /dev/null+++ b/3rdparty_plugins/ext_gmic/download_llvm-cmake_modules.cmake@@ -0,0 +1,53 @@+cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)++set(DST_FILE "${EXT_TMP_DIR}/llvm-cmake-modules.tar.xz")+set(SHA_OK NO)+set(DOWNLOAD_TRIES 0)++while(NOT SHA_OK AND DOWNLOAD_TRIES LESS 5)+ message(STATUS "downloading file...+ ${URL}")++ file(DOWNLOAD "${URL}" "${DST_FILE}"+ STATUS DOWNLOAD_STATUS+ SHOW_PROGRESS+ )++ list(GET DOWNLOAD_STATUS 0 DOWNLOAD_STATUS_CODE)++ if(NOT DOWNLOAD_STATUS_CODE EQUAL 0)+ message(STATUS "file download error:+ ${DOWNLOAD_STATUS}")++ math(EXPR DOWNLOAD_TRIES "${DOWNLOAD_TRIES} + 1")+ continue()+ endif()++ file(SHA256 "${DST_FILE}" ACTUAL_SHA)+ if(${URL_SHA} STREQUAL ${ACTUAL_SHA})+ set(SHA_OK YES)+ else()+ message(STATUS "file hash mismatch, retrying+ actual hash: [${ACTUAL_SHA}]+ ")+ endif()+ math(EXPR DOWNLOAD_TRIES "${DOWNLOAD_TRIES} + 1")+endwhile()++if(NOT DOWNLOAD_STATUS_CODE EQUAL 0)+ message(FATAL_ERROR "+ ERROR: Download failed, status: ${DOWNLOAD_STATUS}+ ")+endif()++if(DOWNLOAD_TRIES GREATER_EQUAL 5)+ message(FATAL_ERROR "+ ERROR: file hash mismatch+ expected hash: [${URL_SHA}]+ actual hash: [${ACTUAL_SHA}]+ ")+endif()+++message(STATUS "Extracting llvm-cmake Modules to ${CMAKE_CURRENT_BINARY_DIR}")+execute_process(COMMAND tar --strip-components=2 -xf "${EXT_TMP_DIR}/llvm-cmake-modules.tar.xz")