diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index e00d7a0833..abe28aaf56 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -1,229 +1,236 @@ project (krita-and-all-its-deps) # # Build all dependencies for Krita and finally Krita itself. # Parameters: EXTERNALS_DOWNLOAD_DIR place to download all packages # INSTALL_ROOT place to install everything to # MXE_TOOLCHAIN: the toolchain file to cross-compile using MXE # # Example usage: cmake ..\kritadeposx -DEXTERNALS_DOWNLOAD_DIR=/dev2/d -DINSTALL_ROOT=/dev2/i -DWIN64_BUILD=TRUE -DBOOST_LIBRARYDIR=/dev2/i/lib -G "Visual Studio 11 Win64" cmake_minimum_required(VERSION 2.8.6) if(NOT SUBMAKE_JOBS) set(SUBMAKE_JOBS 1) endif() if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) message(FATAL_ERROR "Compiling in the source directory is not supported. Use for example 'mkdir build; cd build; cmake ..'.") endif (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) # Tools must be obtained to work with: include (ExternalProject) # allow specification of a directory with pre-downloaded # requirements if(NOT IS_DIRECTORY ${EXTERNALS_DOWNLOAD_DIR}) message(FATAL_ERROR "No externals download dir set. Use -DEXTERNALS_DOWNLOAD_DIR") endif() if(NOT IS_DIRECTORY ${INSTALL_ROOT}) message(FATAL_ERROR "No install dir set. Use -DINSTALL_ROOT") endif() set(TOP_INST_DIR ${INSTALL_ROOT}) set(EXTPREFIX "${TOP_INST_DIR}") set(CMAKE_PREFIX_PATH "${EXTPREFIX}") if (${CMAKE_GENERATOR} STREQUAL "Visual Studio 14 2015 Win64") SET(GLOBAL_PROFILE -DCMAKE_MODULE_LINKER_FLAGS=/machine:x64 -DCMAKE_EXE_LINKER_FLAGS=/machine:x64 -DCMAKE_SHARED_LINKER_FLAGS=/machine:x64 -DCMAKE_STATIC_LINKER_FLAGS=/machine:x64 ) endif () message( STATUS "CMAKE_GENERATOR: ${CMAKE_GENERATOR}") message( STATUS "CMAKE_CL_64: ${CMAKE_CL_64}") set(GLOBAL_BUILD_TYPE RelWithDebInfo) set(GLOBAL_PROFILE ${GLOBAL_PROFILE} -DBUILD_TESTING=false) if (MINGW) option(QT_ENABLE_DEBUG_INFO "Build Qt with debug info included" OFF) option(QT_ENABLE_DYNAMIC_OPENGL "Build Qt with dynamic ANGLE support '-opengl dynamic -angle' (needs env var 'WindowsSdkDir' set to path of Windows 10 SDK)" ON) if (QT_ENABLE_DYNAMIC_OPENGL) if (DEFINED ENV{WindowsSdkDir}) message(STATUS "WindowsSdkDir is set to '$ENV{WindowsSdkDir}'") else (DEFINED ENV{WindowsSdkDir}) message(FATAL_ERROR "Environment variable 'WindowsSdkDir' not set! Please set it to path of Windows 10 SDK or disable QT_ENABLE_DYNAMIC_OPENGL") endif () endif () endif (MINGW) if (WIN32) option(USE_QT_TABLET_WINDOWS "Do not use Krita's forked Wintab and Windows Ink support on Windows, but leave everything to Qt." ON) endif () set(SECURITY_EXE_LINKER_FLAGS "") set(SECURITY_SHARED_LINKER_FLAGS "") set(SECURITY_MODULE_LINKER_FLAGS "") if (MINGW) option(USE_MINGW_HARDENING_LINKER "Enable DEP (NX), ASLR and high-entropy ASLR linker flags (mingw-w64)" ON) if (USE_MINGW_HARDENING_LINKER) set(SECURITY_EXE_LINKER_FLAGS "-Wl,--dynamicbase -Wl,--nxcompat -Wl,--disable-auto-image-base") set(SECURITY_SHARED_LINKER_FLAGS "-Wl,--dynamicbase -Wl,--nxcompat -Wl,--disable-auto-image-base") set(SECURITY_MODULE_LINKER_FLAGS "-Wl,--dynamicbase -Wl,--nxcompat -Wl,--disable-auto-image-base") if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") # Enable high-entropy ASLR for 64-bit # The image base has to be >4GB for HEASLR to be enabled. # The values used here are kind of arbitrary. set(SECURITY_EXE_LINKER_FLAGS "${SECURITY_EXE_LINKER_FLAGS} -Wl,--high-entropy-va -Wl,--image-base,0x140000000") set(SECURITY_SHARED_LINKER_FLAGS "${SECURITY_SHARED_LINKER_FLAGS} -Wl,--high-entropy-va -Wl,--image-base,0x180000000") set(SECURITY_MODULE_LINKER_FLAGS "${SECURITY_MODULE_LINKER_FLAGS} -Wl,--high-entropy-va -Wl,--image-base,0x180000000") set(GLOBAL_PROFILE ${GLOBAL_PROFILE} -DCMAKE_EXE_LINKER_FLAGS=${SECURITY_EXE_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS=${SECURITY_SHARED_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS=${SECURITY_MODULE_LINKER_FLAGS} ) endif () else () message(WARNING "Linker Security Flags not enabled!") endif () endif () if (DEFINED EP_PREFIX) set_directory_properties(PROPERTIES EP_PREFIX ${EP_PREFIX}) endif () if (MSVC) message(FATAL_ERROR "Krita cannot be built with MSVC. See the README.md file!") endif() if (MINGW) set(PATCH_COMMAND myptch) endif() if (MSYS) set(PATCH_COMMAND patch) set(GLOBAL_PROFILE ${GLOBAL_PROFILE} -DCMAKE_TOOLCHAIN_FILE=${MXE_TOOLCHAIN} -DCMAKE_FIND_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_SYSTEM_INCLUDE_PATH=${CMAKE_PREFIX_PATH}/include -DCMAKE_INCLUDE_PATH=${CMAKE_PREFIX_PATH}/include -DCMAKE_LIBRARY_PATH=${CMAKE_PREFIX_PATH}/lib -DZLIB_ROOT=${CMAKE_PREFIX_PATH} ) set(GLOBAL_AUTOMAKE_PROFILE --host=i686-pc-mingw32 ) endif() if (APPLE) - set(GLOBAL_PROFILE ${GLOBAL_PROFILE} -DCMAKE_MACOSX_RPATH=ON -DKDE_SKIP_RPATH_SETTINGS=ON -DBUILD_WITH_INSTALL_RPATH=ON -DAPPLE_SUPPRESS_X11_WARNING=ON) + set(GLOBAL_PROFILE ${GLOBAL_PROFILE} + -DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH} + -DCMAKE_INCLUDE_PATH:PATH=${CMAKE_PREFIX_PATH}/include + -DCMAKE_LIBRARY_PATH:PATH=${CMAKE_PREFIX_PATH}/lib + -DCMAKE_MACOSX_RPATH=ON + -DKDE_SKIP_RPATH_SETTINGS=ON + -DBUILD_WITH_INSTALL_RPATH=ON + -DAPPLE_SUPPRESS_X11_WARNING=ON) set(PATCH_COMMAND patch) endif () if (ANDROID) set (GLOBAL_PROFILE ${GLOBAL_PROFILE} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DANDROID_PLATFORM=${ANDROID_PLATFORM} -DANDROID_ABI=${ANDROID_ABI}) endif() if (UNIX AND NOT APPLE) set(LINUX true) set(PATCH_COMMAND patch) endif () function(TestCompileLinkPythonLibs OUTPUT_VARNAME) include(CheckCXXSourceCompiles) set(CMAKE_REQUIRED_INCLUDES ${PYTHON_INCLUDE_PATH}) set(CMAKE_REQUIRED_LIBRARIES ${PYTHON_LIBRARIES}) if (MINGW) set(CMAKE_REQUIRED_DEFINITIONS -D_hypot=hypot) endif () unset(${OUTPUT_VARNAME} CACHE) CHECK_CXX_SOURCE_COMPILES(" #include int main(int argc, char *argv[]) { Py_InitializeEx(0); }" ${OUTPUT_VARNAME}) endfunction() if (MINGW) option(ENABLE_PYTHON_DEPS "Enable Python deps (sip, pyqt)" ON) if (ENABLE_PYTHON_DEPS) if (ENABLE_PYTHON_2) message(FATAL_ERROR "Python 2.7 is not supported on Windows at the moment.") else(ENABLE_PYTHON_2) find_package(PythonInterp 3.8 EXACT) find_package(PythonLibs 3.8 EXACT) endif() if (PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND) message(STATUS "Python requirements met.") TestCompileLinkPythonLibs(CAN_USE_PYTHON_LIBS) if (NOT CAN_USE_PYTHON_LIBS) message(FATAL_ERROR "Compiling with Python library failed, please check whether the architecture is correct!") endif () else (PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND) message(FATAL_ERROR "Python requirements not met. To disable Python deps, set ENABLE_PYTHON_DEPS to OFF.") endif () endif () endif () # this list must be dependency-ordered if (ENABLE_PYTHON_DEPS OR NOT MINGW) add_subdirectory( ext_python ) endif () if (MINGW) add_subdirectory( ext_patch ) add_subdirectory( ext_png2ico ) endif () add_subdirectory( ext_lzma ) add_subdirectory( ext_iconv ) add_subdirectory( ext_gettext ) add_subdirectory( ext_zlib ) add_subdirectory( ext_boost ) add_subdirectory( ext_jpeg ) add_subdirectory( ext_tiff ) add_subdirectory( ext_png ) add_subdirectory( ext_eigen3 ) add_subdirectory( ext_expat ) # for exiv2 add_subdirectory( ext_exiv2 ) add_subdirectory( ext_ilmbase ) add_subdirectory( ext_lcms2 ) add_subdirectory( ext_openexr ) add_subdirectory( ext_openssl ) add_subdirectory( ext_vc ) add_subdirectory( ext_gsl ) add_subdirectory( ext_fftw3 ) add_subdirectory( ext_ocio ) add_subdirectory( ext_openjpeg ) if (MSVC) add_subdirectory( ext_pthreads ) endif (MSVC) add_subdirectory( ext_fontconfig) add_subdirectory( ext_freetype) add_subdirectory( ext_qt ) add_subdirectory( ext_poppler ) add_subdirectory( ext_libraw ) add_subdirectory( ext_frameworks ) if (ENABLE_PYTHON_DEPS OR NOT MINGW) add_subdirectory( ext_sip ) add_subdirectory( ext_pyqt ) endif () if (MINGW) add_subdirectory( ext_drmingw ) # add_subdirectory( ext_ffmpeg ) endif () if (NOT APPLE) add_subdirectory( ext_gmic ) endif () if(UNIX) add_subdirectory( ext_pkgconfig ) - add_subdirectory( ext_heif ) endif() +add_subdirectory( ext_heif ) add_subdirectory(ext_giflib) add_subdirectory(ext_quazip) diff --git a/3rdparty/ext_heif/01-fix-sse41.diff b/3rdparty/ext_heif/01-fix-sse41.diff new file mode 100644 index 0000000000..b01acb5eff --- /dev/null +++ b/3rdparty/ext_heif/01-fix-sse41.diff @@ -0,0 +1,35 @@ +diff --git a/libde265/CMakeLists.txt b/libde265/CMakeLists.txt +index 48e3c80c..30c362d4 100644 +--- a/libde265/CMakeLists.txt ++++ b/libde265/CMakeLists.txt +@@ -43,6 +43,8 @@ set (libde265_headers + bitstream.h + cabac.h + configparam.h ++ de265.h ++ de265-version.h + deblock.h + decctx.h + dpb.h +@@ -73,7 +75,7 @@ set (libde265_headers + vui.h + ) + +-if(MSVC) ++if(MSVC OR MINGW) + set (libde265_sources + ${libde265_sources} + ../extra/win32cond.c +diff --git a/libde265/x86/CMakeLists.txt b/libde265/x86/CMakeLists.txt +index 0fd6fcfe..7095584e 100644 +--- a/libde265/x86/CMakeLists.txt ++++ b/libde265/x86/CMakeLists.txt +@@ -18,6 +18,6 @@ endif() + + set(X86_OBJECTS $ $ PARENT_SCOPE) + +-if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") ++if(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET_TARGET_PROPERTIES(x86_sse PROPERTIES COMPILE_FLAGS "${sse_flags}") +-endif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") ++endif(CMAKE_SIZEOF_VOID_P EQUAL 8) diff --git a/3rdparty/ext_heif/02-skip-pdb-in-mingw.diff b/3rdparty/ext_heif/02-skip-pdb-in-mingw.diff new file mode 100644 index 0000000000..7ee26db2dc --- /dev/null +++ b/3rdparty/ext_heif/02-skip-pdb-in-mingw.diff @@ -0,0 +1,13 @@ +diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt +index c019c2e07..c2e5ed92b 100644 +--- a/source/CMakeLists.txt ++++ b/source/CMakeLists.txt +@@ -584,7 +584,7 @@ if((WIN32 AND ENABLE_CLI) OR (WIN32 AND ENABLE_SHARED)) + install(FILES "${PROJECT_BINARY_DIR}/RelWithDebInfo/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo) + install(FILES "${PROJECT_BINARY_DIR}/Debug/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug OPTIONAL NAMELINK_ONLY) + install(FILES "${PROJECT_BINARY_DIR}/RelWithDebInfo/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo OPTIONAL NAMELINK_ONLY) +- else() ++ elseif(NOT MINGW) + install(FILES "${PROJECT_BINARY_DIR}/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug) + install(FILES "${PROJECT_BINARY_DIR}/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo) + install(FILES "${PROJECT_BINARY_DIR}/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug OPTIONAL NAMELINK_ONLY) diff --git a/3rdparty/ext_heif/03-fix-build-macos-windows.diff b/3rdparty/ext_heif/03-fix-build-macos-windows.diff new file mode 100644 index 0000000000..ef12a45773 --- /dev/null +++ b/3rdparty/ext_heif/03-fix-build-macos-windows.diff @@ -0,0 +1,469 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ce7a01b..b473cee 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -51,11 +51,9 @@ if (has_potentially_evaluated_expression) + add_definitions(-Wno-error=potentially-evaluated-expression) + endif() + +-if (UNIX) +- find_package(PkgConfig) +- pkg_check_modules(LIBDE265 libde265) +- pkg_check_modules(X265 x265) +-endif() ++LIST (APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules") ++find_package(Libde265 REQUIRED) ++find_package(X265 REQUIRED) + + # Create libheif pkgconfig file + set(prefix ${CMAKE_INSTALL_PREFIX}) +@@ -79,6 +77,10 @@ configure_file(libheif.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libheif.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libheif.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + +-add_subdirectory (examples) ++option(BUILD_EXAMPLES "Build examples" OFF) ++ ++if(BUILD_EXAMPLES) ++ add_subdirectory (examples) ++endif() + add_subdirectory (libheif) + add_subdirectory (gdk-pixbuf) +diff --git a/cmake/modules/FindLibde265.cmake b/cmake/modules/FindLibde265.cmake +new file mode 100644 +index 0000000..cfad2b6 +--- /dev/null ++++ b/cmake/modules/FindLibde265.cmake +@@ -0,0 +1,39 @@ ++if (NOT WIN32) ++ include(LibFindMacros) ++ libfind_pkg_check_modules(LIBDE265_PKGCONF libde265) ++ ++ find_path(LIBDE265_INCLUDE_DIR ++ NAMES libde265/de265.h ++ HINTS ${LIBDE265_PKGCONF_INCLUDE_DIRS} ${LIBDE265_PKGCONF_INCLUDEDIR} ++ PATH_SUFFIXES DE265 ++ ) ++ ++ find_library(LIBDE265_LIBRARY ++ NAMES libde265 de265 ++ HINTS ${LIBDE265_PKGCONF_LIBRARY_DIRS} ${LIBDE265_PKGCONF_LIBDIR} ++ ) ++ ++ set(LIBDE265_PROCESS_LIBS LIBDE265_LIBRARY) ++ set(LIBDE265_PROCESS_INCLUDES LIBDE265_INCLUDE_DIR) ++ libfind_process(LIBDE265) ++ ++else() ++ find_path(LIBDE265_INCLUDE_DIR ++ NAMES libde265/de265.h ++ ) ++ ++ find_library ( ++ LIBDE265_LIBRARY ++ NAMES libde265 de265 ++ ) ++ ++ if (LIBDE265_LIBRARY) ++ set(LIBDE265_LIBRARY_DIR ${LIBDE265_LIBRARY}) ++ endif() ++ ++ set (LIBDE265_LIBRARIES ${LIBDE265_LIBRARY}) ++ ++ if(LIBDE265_INCLUDE_DIR AND LIBDE265_LIBRARY_DIR) ++ set (LIBDE265_FOUND true) ++ endif() ++endif() +diff --git a/cmake/modules/FindX265.cmake b/cmake/modules/FindX265.cmake +new file mode 100644 +index 0000000..78db10a +--- /dev/null ++++ b/cmake/modules/FindX265.cmake +@@ -0,0 +1,39 @@ ++if (NOT WIN32) ++ include(LibFindMacros) ++ libfind_pkg_check_modules(X265_PKGCONF x265) ++ ++ find_path(X265_INCLUDE_DIR ++ NAMES x265.h ++ HINTS ${X265_PKGCONF_INCLUDE_DIRS} ${X265_PKGCONF_INCLUDEDIR} ++ PATH_SUFFIXES X265 ++ ) ++ ++ find_library(X265_LIBRARY ++ NAMES x265 ++ HINTS ${X265_PKGCONF_LIBRARY_DIRS} ${X265_PKGCONF_LIBDIR} ++ ) ++ ++ set(X265_PROCESS_LIBS X265_LIBRARY) ++ set(X265_PROCESS_INCLUDES X265_INCLUDE_DIR) ++ libfind_process(X265) ++ ++else() ++ find_path(X265_INCLUDE_DIR ++ NAMES x265.h ++ ) ++ ++ find_library ( ++ X265_LIBRARY ++ NAMES libx265 libx265 ++ ) ++ ++ if (X265_LIBRARY) ++ set(X265_LIBRARY_DIR ${X265_LIBRARY}) ++ endif() ++ ++ set (X265_LIBRARIES ${X265_LIBRARY}) ++ ++ if(X265_INCLUDE_DIR AND X265_LIBRARY_DIR) ++ set (X265_FOUND true) ++ endif() ++endif() +diff --git a/cmake/modules/LibFindMacros.cmake b/cmake/modules/LibFindMacros.cmake +new file mode 100644 +index 0000000..e293eff +--- /dev/null ++++ b/cmake/modules/LibFindMacros.cmake +@@ -0,0 +1,269 @@ ++# Version 2.3 ++# Public Domain, originally written by Lasse Kärkkäinen ++# Maintained at https://github.com/Tronic/cmake-modules ++# Please send your improvements as pull requests on Github. ++ ++# Find another package and make it a dependency of the current package. ++# This also automatically forwards the "REQUIRED" argument. ++# Usage: libfind_package( [extra args to find_package]) ++macro (libfind_package PREFIX PKG) ++ set(${PREFIX}_args ${PKG} ${ARGN}) ++ if (${PREFIX}_FIND_REQUIRED) ++ set(${PREFIX}_args ${${PREFIX}_args} REQUIRED) ++ endif() ++ find_package(${${PREFIX}_args}) ++ set(${PREFIX}_DEPENDENCIES ${${PREFIX}_DEPENDENCIES};${PKG}) ++ unset(${PREFIX}_args) ++endmacro() ++ ++# A simple wrapper to make pkg-config searches a bit easier. ++# Works the same as CMake's internal pkg_check_modules but is always quiet. ++macro (libfind_pkg_check_modules) ++ find_package(PkgConfig QUIET) ++ if (PKG_CONFIG_FOUND) ++ pkg_check_modules(${ARGN} QUIET) ++ endif() ++endmacro() ++ ++# Avoid useless copy&pasta by doing what most simple libraries do anyway: ++# pkg-config, find headers, find library. ++# Usage: libfind_pkg_detect( FIND_PATH [other args] FIND_LIBRARY [other args]) ++# E.g. libfind_pkg_detect(SDL2 sdl2 FIND_PATH SDL.h PATH_SUFFIXES SDL2 FIND_LIBRARY SDL2) ++function (libfind_pkg_detect PREFIX) ++ # Parse arguments ++ set(argname pkgargs) ++ foreach (i ${ARGN}) ++ if ("${i}" STREQUAL "FIND_PATH") ++ set(argname pathargs) ++ elseif ("${i}" STREQUAL "FIND_LIBRARY") ++ set(argname libraryargs) ++ else() ++ set(${argname} ${${argname}} ${i}) ++ endif() ++ endforeach() ++ if (NOT pkgargs) ++ message(FATAL_ERROR "libfind_pkg_detect requires at least a pkg_config package name to be passed.") ++ endif() ++ # Find library ++ libfind_pkg_check_modules(${PREFIX}_PKGCONF ${pkgargs}) ++ if (pathargs) ++ find_path(${PREFIX}_INCLUDE_DIR NAMES ${pathargs} HINTS ${${PREFIX}_PKGCONF_INCLUDE_DIRS}) ++ endif() ++ if (libraryargs) ++ find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS}) ++ endif() ++ # Read pkg-config version ++ if (${PREFIX}_PKGCONF_VERSION) ++ set(${PREFIX}_VERSION ${${PREFIX}_PKGCONF_VERSION} PARENT_SCOPE) ++ endif() ++endfunction() ++ ++# Extracts a version #define from a version.h file, output stored to _VERSION. ++# Usage: libfind_version_header(Foobar foobar/version.h FOOBAR_VERSION_STR) ++# Fourth argument "QUIET" may be used for silently testing different define names. ++# This function does nothing if the version variable is already defined. ++function (libfind_version_header PREFIX VERSION_H DEFINE_NAME) ++ # Skip processing if we already have a version or if the include dir was not found ++ if (${PREFIX}_VERSION OR NOT ${PREFIX}_INCLUDE_DIR) ++ return() ++ endif() ++ set(quiet ${${PREFIX}_FIND_QUIETLY}) ++ # Process optional arguments ++ foreach(arg ${ARGN}) ++ if (arg STREQUAL "QUIET") ++ set(quiet TRUE) ++ else() ++ message(AUTHOR_WARNING "Unknown argument ${arg} to libfind_version_header ignored.") ++ endif() ++ endforeach() ++ # Read the header and parse for version number ++ set(filename "${${PREFIX}_INCLUDE_DIR}/${VERSION_H}") ++ if (NOT EXISTS ${filename}) ++ if (NOT quiet) ++ message(AUTHOR_WARNING "Unable to find ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}") ++ endif() ++ return() ++ endif() ++ file(READ "${filename}" header) ++ string(REGEX REPLACE ".*#[ \t]*define[ \t]*${DEFINE_NAME}[ \t]*\"([^\n]*)\".*" "\\1" match "${header}") ++ # No regex match? ++ if (match STREQUAL header) ++ if (NOT quiet) ++ message(AUTHOR_WARNING "Unable to find \#define ${DEFINE_NAME} \"\" from ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}") ++ endif() ++ return() ++ endif() ++ # Export the version string ++ set(${PREFIX}_VERSION "${match}" PARENT_SCOPE) ++endfunction() ++ ++# Do the final processing once the paths have been detected. ++# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain ++# all the variables, each of which contain one include directory. ++# Ditto for ${PREFIX}_PROCESS_LIBS and library files. ++# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES. ++# Also handles errors in case library detection was required, etc. ++function (libfind_process PREFIX) ++ # Skip processing if already processed during this configuration run ++ if (${PREFIX}_FOUND) ++ return() ++ endif() ++ ++ set(found TRUE) # Start with the assumption that the package was found ++ ++ # Did we find any files? Did we miss includes? These are for formatting better error messages. ++ set(some_files FALSE) ++ set(missing_headers FALSE) ++ ++ # Shorthands for some variables that we need often ++ set(quiet ${${PREFIX}_FIND_QUIETLY}) ++ set(required ${${PREFIX}_FIND_REQUIRED}) ++ set(exactver ${${PREFIX}_FIND_VERSION_EXACT}) ++ set(findver "${${PREFIX}_FIND_VERSION}") ++ set(version "${${PREFIX}_VERSION}") ++ ++ # Lists of config option names (all, includes, libs) ++ unset(configopts) ++ set(includeopts ${${PREFIX}_PROCESS_INCLUDES}) ++ set(libraryopts ${${PREFIX}_PROCESS_LIBS}) ++ ++ # Process deps to add to ++ foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES}) ++ if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS) ++ # The package seems to export option lists that we can use, woohoo! ++ list(APPEND includeopts ${${i}_INCLUDE_OPTS}) ++ list(APPEND libraryopts ${${i}_LIBRARY_OPTS}) ++ else() ++ # If plural forms don't exist or they equal singular forms ++ if ((NOT DEFINED ${i}_INCLUDE_DIRS AND NOT DEFINED ${i}_LIBRARIES) OR ++ (${i}_INCLUDE_DIR STREQUAL ${i}_INCLUDE_DIRS AND ${i}_LIBRARY STREQUAL ${i}_LIBRARIES)) ++ # Singular forms can be used ++ if (DEFINED ${i}_INCLUDE_DIR) ++ list(APPEND includeopts ${i}_INCLUDE_DIR) ++ endif() ++ if (DEFINED ${i}_LIBRARY) ++ list(APPEND libraryopts ${i}_LIBRARY) ++ endif() ++ else() ++ # Oh no, we don't know the option names ++ message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes and libs. Aieeh!") ++ endif() ++ endif() ++ endforeach() ++ ++ if (includeopts) ++ list(REMOVE_DUPLICATES includeopts) ++ endif() ++ ++ if (libraryopts) ++ list(REMOVE_DUPLICATES libraryopts) ++ endif() ++ ++ string(REGEX REPLACE ".*[ ;]([^ ;]*(_INCLUDE_DIRS|_LIBRARIES))" "\\1" tmp "${includeopts} ${libraryopts}") ++ if (NOT tmp STREQUAL "${includeopts} ${libraryopts}") ++ message(AUTHOR_WARNING "Plural form ${tmp} found in config options of ${PREFIX}. This works as before but is now deprecated. Please only use singular forms INCLUDE_DIR and LIBRARY, and update your find scripts for LibFindMacros > 2.0 automatic dependency system (most often you can simply remove the PROCESS variables entirely).") ++ endif() ++ ++ # Include/library names separated by spaces (notice: not CMake lists) ++ unset(includes) ++ unset(libs) ++ ++ # Process all includes and set found false if any are missing ++ foreach (i ${includeopts}) ++ list(APPEND configopts ${i}) ++ if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND") ++ list(APPEND includes "${${i}}") ++ else() ++ set(found FALSE) ++ set(missing_headers TRUE) ++ endif() ++ endforeach() ++ ++ # Process all libraries and set found false if any are missing ++ foreach (i ${libraryopts}) ++ list(APPEND configopts ${i}) ++ if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND") ++ list(APPEND libs "${${i}}") ++ else() ++ set (found FALSE) ++ endif() ++ endforeach() ++ ++ # Version checks ++ if (found AND findver) ++ if (NOT version) ++ message(WARNING "The find module for ${PREFIX} does not provide version information, so we'll just assume that it is OK. Please fix the module or remove package version requirements to get rid of this warning.") ++ elseif (version VERSION_LESS findver OR (exactver AND NOT version VERSION_EQUAL findver)) ++ set(found FALSE) ++ set(version_unsuitable TRUE) ++ endif() ++ endif() ++ ++ # If all-OK, hide all config options, export variables, print status and exit ++ if (found) ++ foreach (i ${configopts}) ++ mark_as_advanced(${i}) ++ endforeach() ++ if (NOT quiet) ++ message(STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}") ++ if (LIBFIND_DEBUG) ++ message(STATUS " ${PREFIX}_DEPENDENCIES=${${PREFIX}_DEPENDENCIES}") ++ message(STATUS " ${PREFIX}_INCLUDE_OPTS=${includeopts}") ++ message(STATUS " ${PREFIX}_INCLUDE_DIRS=${includes}") ++ message(STATUS " ${PREFIX}_LIBRARY_OPTS=${libraryopts}") ++ message(STATUS " ${PREFIX}_LIBRARIES=${libs}") ++ endif() ++ endif() ++ set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE) ++ set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE) ++ set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE) ++ set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE) ++ set (${PREFIX}_FOUND TRUE PARENT_SCOPE) ++ return() ++ endif() ++ ++ # Format messages for debug info and the type of error ++ set(vars "Relevant CMake configuration variables:\n") ++ foreach (i ${configopts}) ++ mark_as_advanced(CLEAR ${i}) ++ set(val ${${i}}) ++ if ("${val}" STREQUAL "${i}-NOTFOUND") ++ set (val "") ++ elseif (val AND NOT EXISTS ${val}) ++ set (val "${val} (does not exist)") ++ else() ++ set(some_files TRUE) ++ endif() ++ set(vars "${vars} ${i}=${val}\n") ++ endforeach() ++ set(vars "${vars}You may use CMake GUI, cmake -D or ccmake to modify the values. Delete CMakeCache.txt to discard all values and force full re-detection if necessary.\n") ++ if (version_unsuitable) ++ set(msg "${PREFIX} ${${PREFIX}_VERSION} was found but") ++ if (exactver) ++ set(msg "${msg} only version ${findver} is acceptable.") ++ else() ++ set(msg "${msg} version ${findver} is the minimum requirement.") ++ endif() ++ else() ++ if (missing_headers) ++ set(msg "We could not find development headers for ${PREFIX}. Do you have the necessary dev package installed?") ++ elseif (some_files) ++ set(msg "We only found some files of ${PREFIX}, not all of them. Perhaps your installation is incomplete or maybe we just didn't look in the right place?") ++ if(findver) ++ set(msg "${msg} This could also be caused by incompatible version (if it helps, at least ${PREFIX} ${findver} should work).") ++ endif() ++ else() ++ set(msg "We were unable to find package ${PREFIX}.") ++ endif() ++ endif() ++ ++ # Fatal error out if REQUIRED ++ if (required) ++ set(msg "REQUIRED PACKAGE NOT FOUND\n${msg} This package is REQUIRED and you need to install it or adjust CMake configuration in order to continue building ${CMAKE_PROJECT_NAME}.") ++ message(FATAL_ERROR "${msg}\n${vars}") ++ endif() ++ # Otherwise just print a nasty warning ++ if (NOT quiet) ++ message(WARNING "WARNING: MISSING PACKAGE\n${msg} This package is NOT REQUIRED and you may ignore this warning but by doing so you may miss some functionality of ${CMAKE_PROJECT_NAME}. \n${vars}") ++ endif() ++endfunction() +diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt +index c5d30e5..afb381b 100644 +--- a/examples/CMakeLists.txt ++++ b/examples/CMakeLists.txt +@@ -15,10 +15,12 @@ include (${CMAKE_ROOT}/Modules/FindJPEG.cmake) + + if(JPEG_FOUND) + add_definitions(-DHAVE_LIBJPEG=1) ++include_directories(SYSTEM ${JPEG_INCLUDE_DIR}) + + include (${CMAKE_ROOT}/Modules/CheckCXXSourceCompiles.cmake) + + set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARIES}) ++set(CMAKE_REQUIRED_INCLUDES ${JPEG_INCLUDE_DIR}) + check_cxx_source_compiles(" + #include + #include +@@ -42,6 +44,7 @@ set (additional_libraries + ${additional_libraries} + ${JPEG_LIBRARIES} + ) ++ + endif() + + if(UNIX) +diff --git a/gdk-pixbuf/CMakeLists.txt b/gdk-pixbuf/CMakeLists.txt +index e647ea4..5f9f7e1 100644 +--- a/gdk-pixbuf/CMakeLists.txt ++++ b/gdk-pixbuf/CMakeLists.txt +@@ -3,7 +3,7 @@ if(UNIX) + pkg_check_modules(GDKPIXBUF2 gdk-pixbuf-2.0) + + if(GDKPIXBUF2_FOUND) +- execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} gdk-pixbuf-2.0 --variable gdk_pixbuf_moduledir OUTPUT_VARIABLE GDKPIXBUF2_MODULE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) ++ execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} gdk-pixbuf-2.0 --variable gdk_pixbuf_moduledir --define-variable=prefix=${CMAKE_INSTALL_PREFIX} OUTPUT_VARIABLE GDKPIXBUF2_MODULE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) + + add_library(pixbufloader-heif MODULE pixbufloader-heif.c) + +diff --git a/libheif/CMakeLists.txt b/libheif/CMakeLists.txt +index 874cb39..81e5c64 100644 +--- a/libheif/CMakeLists.txt ++++ b/libheif/CMakeLists.txt +@@ -8,6 +8,7 @@ set(libheif_headers + error.h + heif_api_structs.h + heif_context.h ++ heif_cxx.h + heif_file.h + heif.h + heif_image.h +@@ -68,6 +69,7 @@ if(LIBDE265_FOUND) + set(LIBDE265_LINKDIR "-L${LIBDE265_LIBRARY_DIRS}") + endif() + ++ include_directories(SYSTEM ${LIBDE265_INCLUDE_DIR}) + target_link_libraries(heif PRIVATE ${LIBDE265_LIBRARIES} ${LIBDE265_LINKDIR}) + + install(FILES heif_decoder_libde265.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}) +@@ -79,12 +81,14 @@ if(X265_FOUND) + heif_encoder_x265.cc + heif_encoder_x265.h + ) ++ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${X265_CFLAGS}") + + if (NOT "${X265_LIBRARY_DIRS}" STREQUAL "") + set(X265_LINKDIR "-L${X265_LIBRARY_DIRS}") + endif() + ++ include_directories(SYSTEM ${X265_INCLUDE_DIR}) + target_link_libraries(heif PRIVATE ${X265_LIBRARIES} ${X265_LINKDIR}) + + install(FILES heif_encoder_x265.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}) diff --git a/3rdparty/ext_heif/CMakeLists.txt b/3rdparty/ext_heif/CMakeLists.txt index 1b710db6bd..e82c7f31f5 100644 --- a/3rdparty/ext_heif/CMakeLists.txt +++ b/3rdparty/ext_heif/CMakeLists.txt @@ -1,74 +1,133 @@ SET(EXTPREFIX_heif "${EXTPREFIX}" ) ExternalProject_Add( ext_libde265 DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL https://github.com/strukturag/libde265/releases/download/v1.0.3/libde265-1.0.3.tar.gz - URL_MD5 0e1e26ffcb2177c3749c748e20fcd588 + URL https://github.com/strukturag/libde265/releases/download/v1.0.5/libde265-1.0.5.tar.gz + URL_MD5 385c88166cb255a068a8c936d0ab23ef - BUILD_IN_SOURCE 1 + PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/01-fix-sse41.diff - CONFIGURE_COMMAND /configure --prefix=${EXTPREFIX_heif} ${GLOBAL_AUTOMAKE_PROFILE} - BUILD_COMMAND make - INSTALL_COMMAND make install - - UPDATE_COMMAND "" -) - -ExternalProject_Add( - ext_yasm - DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz - URL_MD5 fc9e586751ff789b34b1f21d572d96af - - CONFIGURE_COMMAND /configure --prefix=${EXTPREFIX_heif} ${GLOBAL_AUTOMAKE_PROFILE} - BUILD_COMMAND make - INSTALL_COMMAND make install + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_heif} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} UPDATE_COMMAND "" ) +if (WIN32) + if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + ExternalProject_Add( + ext_nasm + DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} + URL https://www.nasm.us/pub/nasm/releasebuilds/2.14.03rc2/win64/nasm-2.14.03rc2-win64.zip + URL_MD5 f12d14ca46cf397a1d27ac0edde548fb + + BUILD_COMMAND ${CMAKE_COMMAND} -E echo Deploying nasm 64-bit dependencies + CONFIGURE_COMMAND "" + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory /rdoff ${EXTPREFIX_heif}/bin/rdoff + COMMAND ${CMAKE_COMMAND} -E copy /nasm.exe ${EXTPREFIX_heif}/bin/nasm.exe + COMMAND ${CMAKE_COMMAND} -E copy /ndisasm.exe ${EXTPREFIX_heif}/bin/ndisasm.exe + + UPDATE_COMMAND "" + ) + else("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + ExternalProject_Add( + ext_nasm + DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} + URL https://www.nasm.us/pub/nasm/releasebuilds/2.14.03rc2/win32/nasm-2.14.03rc2-win32.zip + URL_MD5 9ec22ac06a6b9d993ef503ea2fe074ab + + BUILD_COMMAND ${CMAKE_COMMAND} -E echo Deploying nasm 64-bit dependencies + CONFIGURE_COMMAND "" + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory /rdoff ${EXTPREFIX_heif}/bin/rdoff + COMMAND ${CMAKE_COMMAND} -E copy /nasm.exe ${EXTPREFIX_heif}/bin/nasm.exe + COMMAND ${CMAKE_COMMAND} -E copy /ndisasm.exe ${EXTPREFIX_heif}/bin/ndisasm.exe + + UPDATE_COMMAND "" + ) + endif ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") +else (WIN32) ExternalProject_Add( ext_nasm DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} URL https://www.nasm.us/pub/nasm/releasebuilds/2.14.03rc2/nasm-2.14.03rc2.tar.gz URL_MD5 4cd1fe6788cd15d08c1a8f18b6d2428e CONFIGURE_COMMAND /configure --prefix=${EXTPREFIX_heif} ${GLOBAL_AUTOMAKE_PROFILE} BUILD_COMMAND make INSTALL_COMMAND make install UPDATE_COMMAND "" ) +endif(WIN32) -ExternalProject_Add( - ext_libx265 - DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://ftp.videolan.org/pub/videolan/x265/x265_3.0.tar.gz - URL_MD5 8ff1780246bb7ac8506239f6129c04ec - - INSTALL_DIR ${EXTPREFIX_heif} - SOURCE_SUBDIR source/ - - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_heif} - - BUILD_COMMAND make - INSTALL_COMMAND make install +IF ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + ExternalProject_Add(ext_libx265_10bit + DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} + URL http://ftp.videolan.org/pub/videolan/x265/x265_3.2.1.tar.gz + URL_MD5 94808045a34d88a857e5eaf3f68f4bca - UPDATE_COMMAND "" - DEPENDS ext_yasm ext_nasm -) + SOURCE_SUBDIR source/ + + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_heif} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DHIGH_BIT_DEPTH=TRUE -DEXPORT_C_API=FALSE -DENABLE_CLI=FALSE -DENABLE_SHARED=FALSE + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy libx265.a ${EXTPREFIX_heif}/lib/libx265_main10.a + ) + ExternalProject_Add(ext_libx265_12bit + DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} + URL http://ftp.videolan.org/pub/videolan/x265/x265_3.2.1.tar.gz + URL_MD5 94808045a34d88a857e5eaf3f68f4bca + + SOURCE_SUBDIR source/ + + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_heif} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} + -DHIGH_BIT_DEPTH=TRUE -DMAIN12=TRUE -DEXPORT_C_API=FALSE -DENABLE_CLI=FALSE -DENABLE_SHARED=FALSE + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy libx265.a ${EXTPREFIX_heif}/lib/libx265_main12.a + ) + ExternalProject_Add( + ext_libx265 + DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} + URL http://ftp.videolan.org/pub/videolan/x265/x265_3.2.1.tar.gz + URL_MD5 94808045a34d88a857e5eaf3f68f4bca + + SOURCE_SUBDIR source/ + + PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/02-skip-pdb-in-mingw.diff + + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_heif} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DENABLE_SHARED=TRUE -DENABLE_HDR10_PLUS=TRUE -DEXTRA_LIB:String=x265_main10.a$x265_main12.a -DEXTRA_LINK_FLAGS:String=-L${EXTPREFIX_heif}/lib -DLINKED_10BIT=TRUE -DLINKED_12BIT=TRUE + + UPDATE_COMMAND "" + + DEPENDS ext_nasm ext_libx265_10bit ext_libx265_12bit + ) +else ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + # x265 in 32-bit platforms cannot support 10-bit and 12-bit images + # because they either crash on malloc or require SSE4.1+ extensions + ExternalProject_Add( + ext_libx265 + DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} + URL http://ftp.videolan.org/pub/videolan/x265/x265_3.2.1.tar.gz + URL_MD5 94808045a34d88a857e5eaf3f68f4bca + + SOURCE_SUBDIR source/ + + PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/02-skip-pdb-in-mingw.diff + + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_heif} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DENABLE_SHARED=TRUE + + UPDATE_COMMAND "" + + DEPENDS ext_nasm + ) +endif ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") ExternalProject_Add( ext_libheif DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL https://github.com/strukturag/libheif/releases/download/v1.4.0/libheif-1.4.0.tar.gz - URL_MD5 b3c726609a8750c5fc1687a7b193adff + URL https://github.com/strukturag/libheif/releases/download/v1.6.2/libheif-1.6.2.tar.gz + URL_HASH SHA256=bb229e855621deb374f61bee95c4642f60c2a2496bded35df3d3c42cc6d8eefc - CONFIGURE_COMMAND /configure --prefix=${EXTPREFIX_heif} ${GLOBAL_AUTOMAKE_PROFILE} + PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/03-fix-build-macos-windows.diff - BUILD_COMMAND CXXFLAGS="-Wno-error" make - INSTALL_COMMAND make install + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_heif} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} -DBUILD_EXAMPLES=ON ${GLOBAL_PROFILE} UPDATE_COMMAND "" - DEPENDS ext_libde265 ext_libx265 ext_pkgconfig + DEPENDS ext_libde265 ext_libx265 ext_jpeg ext_png ) diff --git a/build-tools/windows/build.cmd b/build-tools/windows/build.cmd index eaf74bba25..0c3f57f830 100644 --- a/build-tools/windows/build.cmd +++ b/build-tools/windows/build.cmd @@ -1,819 +1,819 @@ @echo off setlocal enabledelayedexpansion goto begin :: Subroutines :find_on_path out_variable file_name set %1=%~f$PATH:2 goto :EOF :get_dir_path out_variable file_path set %1=%~dp2 goto :EOF :get_full_path out_variable file_path setlocal set FULL_PATH=%~f2 if not exist "%FULL_PATH%" ( set FULL_PATH= ) else ( if exist "%FULL_PATH%\" ( set FULL_PATH= ) ) endlocal & set "%1=%FULL_PATH%" goto :EOF :get_full_path_dir out_variable file_path setlocal set FULL_PATH=%~dp2 if not exist "%FULL_PATH%" ( set FULL_PATH= ) endlocal & set "%1=%FULL_PATH%" goto :EOF :prompt_for_string out_variable prompt set /p %1=%~2^> goto :EOF :prompt_for_positive_integer out_variable prompt setlocal call :prompt_for_string USER_INPUT "%~2" if "%USER_INPUT%" == "" set USER_INPUT=0 set /a RESULT=%USER_INPUT% if not %RESULT% GTR 0 ( set RESULT= ) endlocal & set "%1=%RESULT%" goto :EOF :prompt_for_file out_variable prompt setlocal :prompt_for_file__retry call :prompt_for_string USER_INPUT "%~2" if "%USER_INPUT%" == "" ( endlocal set %1= goto :EOF ) call :get_full_path RESULT "%USER_INPUT%" if "%RESULT%" == "" ( echo Input does not point to valid file! set USER_INPUT= goto prompt_for_file__retry ) endlocal & set "%1=%RESULT%" goto :EOF :prompt_for_dir out_variable prompt setlocal :prompt_for_dir__retry call :prompt_for_string USER_INPUT "%~2" if "%USER_INPUT%" == "" ( endlocal set %1= goto :EOF ) call :get_full_path_dir RESULT "%USER_INPUT%\" if "%RESULT%" == "" ( echo Input does not point to valid dir! set USER_INPUT= goto prompt_for_dir__retry ) endlocal & set "%1=%RESULT%" goto :EOF :usage echo Usage: echo %~n0 [--no-interactive] [ OPTIONS ... ] echo. echo Basic options: echo --no-interactive Run without interactive prompts echo When not specified, the script will prompt echo for some of the parameters. echo --jobs ^ Set parallel jobs count when building echo Defaults to no. of logical cores echo --skip-deps Skips (re)building of deps echo --skip-krita Skips (re)building of Krita echo --cmd Launch a cmd prompt instead of building. echo The environment is set up like the build echo environment with some helper command macros. echo. echo Path options: echo --src-dir ^ Specify Krita source dir echo If unspecified, this will be determined from echo the script location. echo --download-dir ^ Specify deps download dir echo Can be omitted if --skip-deps is used echo --deps-build-dir ^ Specify deps build dir echo Can be omitted if --skip-deps is used echo --deps-install-dir ^ Specify deps install dir echo --krita-build-dir ^ Specify Krita build dir echo Can be omitted if --skip-krita is used echo --krita-install-dir ^ Specify Krita install dir echo Can be omitted if --skip-krita is used echo. goto :EOF :usage_and_exit call :usage exit /b :usage_and_fail call :usage exit /b 100 :: ---------------------------- :begin echo Krita build script for Windows echo. :: command-line args parsing set ARG_NO_INTERACTIVE= set ARG_JOBS= set ARG_SKIP_DEPS= set ARG_SKIP_KRITA= set ARG_SRC_DIR= set ARG_DOWNLOAD_DIR= set ARG_DEPS_BUILD_DIR= set ARG_DEPS_INSTALL_DIR= set ARG_KRITA_BUILD_DIR= set ARG_KRITA_INSTALL_DIR= set ARG_CMD= :args_parsing_loop set CURRENT_MATCHED= if not "%1" == "" ( if "%1" == "--no-interactive" ( set ARG_NO_INTERACTIVE=1 set CURRENT_MATCHED=1 ) if "%1" == "--jobs" ( if not "%ARG_JOBS%" == "" ( echo ERROR: Arg --jobs specified more than once 1>&2 echo. goto usage_and_fail ) set /a "ARG_JOBS=%2" if not !ARG_JOBS! GTR 0 ( echo ERROR: Arg --jobs is not a positive integer 1>&2 echo. goto usage_and_fail ) shift /2 set CURRENT_MATCHED=1 ) if "%1" == "--skip-deps" ( set ARG_SKIP_DEPS=1 set CURRENT_MATCHED=1 ) if "%1" == "--skip-krita" ( set ARG_SKIP_KRITA=1 set CURRENT_MATCHED=1 ) if "%1" == "--src-dir" ( if not "%ARG_SRC_DIR%" == "" ( echo ERROR: Arg --src-dir specified more than once 1>&2 echo. goto usage_and_fail ) if not exist "%~f2\" ( echo ERROR: Arg --src-dir does not point to a directory 1>&2 echo. goto usage_and_fail ) call :get_dir_path ARG_SRC_DIR "%~f2\" shift /2 set CURRENT_MATCHED=1 ) if "%1" == "--download-dir" ( if not "%ARG_DOWNLOAD_DIR%" == "" ( echo ERROR: Arg --download-dir specified more than once 1>&2 echo. goto usage_and_fail ) if "%~f2" == "" ( echo ERROR: Arg --download-dir does not point to a valid path 1>&2 echo. goto usage_and_fail ) call :get_dir_path ARG_DOWNLOAD_DIR "%~f2\" shift /2 set CURRENT_MATCHED=1 ) if "%1" == "--deps-build-dir" ( if not "%ARG_DEPS_BUILD_DIR%" == "" ( echo ERROR: Arg --deps-build-dir specified more than once 1>&2 echo. goto usage_and_fail ) if "%~f2" == "" ( echo ERROR: Arg --deps-build-dir does not point to a valid path 1>&2 echo. goto usage_and_fail ) call :get_dir_path ARG_DEPS_BUILD_DIR "%~f2\" shift /2 set CURRENT_MATCHED=1 ) if "%1" == "--deps-install-dir" ( if not "%ARG_DEPS_INSTALL_DIR%" == "" ( echo ERROR: Arg --deps-install-dir specified more than once 1>&2 echo. goto usage_and_fail ) if "%~f2" == "" ( echo ERROR: Arg --deps-install-dir does not point to a valid path 1>&2 echo. goto usage_and_fail ) call :get_dir_path ARG_DEPS_INSTALL_DIR "%~f2\" shift /2 set CURRENT_MATCHED=1 ) if "%1" == "--krita-build-dir" ( if not "%ARG_KRITA_BUILD_DIR%" == "" ( echo ERROR: Arg --krita-build-dir specified more than once 1>&2 echo. goto usage_and_fail ) if "%~f2" == "" ( echo ERROR: Arg --krita-build-dir does not point to a valid path 1>&2 echo. goto usage_and_fail ) call :get_dir_path ARG_KRITA_BUILD_DIR "%~f2\" shift /2 set CURRENT_MATCHED=1 ) if "%1" == "--krita-install-dir" ( if not "%ARG_KRITA_INSTALL_DIR%" == "" ( echo ERROR: Arg --krita-install-dir specified more than once 1>&2 echo. goto usage_and_fail ) if "%~f2" == "" ( echo ERROR: Arg --krita-install-dir does not point to a valid path 1>&2 echo. goto usage_and_fail ) call :get_dir_path ARG_KRITA_INSTALL_DIR "%~f2\" shift /2 set CURRENT_MATCHED=1 ) if "%1" == "--cmd" ( set ARG_CMD=1 set CURRENT_MATCHED=1 ) if "%1" == "--help" ( goto usage_and_exit ) if not "!CURRENT_MATCHED!" == "1" ( echo ERROR: Unknown option %1 1>&2 echo. goto usage_and_fail ) shift /1 goto args_parsing_loop ) if "%ARG_NO_INTERACTIVE%" == "1" ( echo Non-interactive mode ) else ( echo Interactive mode :: Trick to pause on exit call :real_begin pause exit /b !ERRORLEVEL! ) :real_begin echo. if "%ARG_SKIP_DEPS%" == "1" ( if "%ARG_SKIP_KRITA%" == "1" ( echo ERROR: You cannot skip both deps and Krita 1>&2 echo. exit /b 102 ) echo Building of deps will be skipped. ) else ( if "%ARG_SKIP_KRITA%" == "1" ( echo Building of Krita will be skipped. ) else ( echo Both deps and Krita will be built. ) ) :: Check environment config if "%CMAKE_EXE%" == "" ( call :find_on_path CMAKE_EXE cmake.exe if "!CMAKE_EXE!" == "" ( if not "%ARG_NO_INTERACTIVE%" == "1" ( call :prompt_for_file CMAKE_EXE "Provide path to cmake.exe" ) if "!CMAKE_EXE!" == "" ( echo ERROR: CMake not found! 1>&2 exit /b 102 ) ) else ( echo Found CMake on PATH: !CMAKE_EXE! if not "%ARG_NO_INTERACTIVE%" == "1" ( choice /c ny /n /m "Is this correct? [y/n] " if errorlevel 3 exit 255 if not errorlevel 2 ( call :prompt_for_file CMAKE_EXE "Provide path to cmake.exe" if "!CMAKE_EXE!" == "" ( echo ERROR: CMake not found! 1>&2 exit /b 102 ) ) ) ) ) echo CMake: %CMAKE_EXE% if "%SEVENZIP_EXE%" == "" ( call :find_on_path SEVENZIP_EXE 7z.exe if "!SEVENZIP_EXE!" == "" ( set "SEVENZIP_EXE=%ProgramFiles%\7-Zip\7z.exe" if "!SEVENZIP_EXE!" == "" ( set "SEVENZIP_EXE=%ProgramFiles(x86)%\7-Zip\7z.exe" ) if "!SEVENZIP_EXE!" == "" ( echo 7-Zip not found ) ) ) if "%SEVENZIP_EXE%" == "" ( echo 7-Zip: %SEVENZIP_EXE% ) if "%MINGW_BIN_DIR%" == "" ( call :find_on_path MINGW_BIN_DIR_MAKE_EXE mingw32-make.exe if "!MINGW_BIN_DIR_MAKE_EXE!" == "" ( if not "%ARG_NO_INTERACTIVE%" == "1" ( call :prompt_for_file MINGW_BIN_DIR_MAKE_EXE "Provide path to mingw32-make.exe of mingw-w64" ) if "!MINGW_BIN_DIR_MAKE_EXE!" == "" ( echo ERROR: mingw-w64 not found! 1>&2 exit /b 102 ) call :get_dir_path MINGW_BIN_DIR "!MINGW_BIN_DIR_MAKE_EXE!" ) else ( call :get_dir_path MINGW_BIN_DIR "!MINGW_BIN_DIR_MAKE_EXE!" echo Found mingw on PATH: !MINGW_BIN_DIR! if not "%ARG_NO_INTERACTIVE%" == "1" ( choice /c ny /n /m "Is this correct? [y/n] " if errorlevel 3 exit 255 if not errorlevel 2 ( call :prompt_for_file MINGW_BIN_DIR_MAKE_EXE "Provide path to mingw32-make.exe of mingw-w64" if "!MINGW_BIN_DIR_MAKE_EXE!" == "" ( echo ERROR: mingw-w64 not found! 1>&2 exit /b 102 ) call :get_dir_path MINGW_BIN_DIR "!MINGW_BIN_DIR_MAKE_EXE!" ) ) ) ) echo mingw-w64: %MINGW_BIN_DIR% if "%PYTHON_BIN_DIR%" == "" ( call :find_on_path PYTHON_BIN_DIR_PYTHON_EXE python.exe if "!PYTHON_BIN_DIR_PYTHON_EXE!" == "" ( if not "%ARG_NO_INTERACTIVE%" == "1" ( call :prompt_for_file PYTHON_BIN_DIR_PYTHON_EXE "Provide path to python.exe of Python 3.6.2" ) if "!PYTHON_BIN_DIR_PYTHON_EXE!" == "" ( echo ERROR: Python not found! 1>&2 exit /b 102 ) call :get_dir_path PYTHON_BIN_DIR "!PYTHON_BIN_DIR_PYTHON_EXE!" ) else ( call :get_dir_path PYTHON_BIN_DIR "!PYTHON_BIN_DIR_PYTHON_EXE!" echo Found Python on PATH: !PYTHON_BIN_DIR! if not "%ARG_NO_INTERACTIVE%" == "1" ( choice /c ny /n /m "Is this correct? [y/n] " if errorlevel 3 exit 255 if not errorlevel 2 ( call :prompt_for_file PYTHON_BIN_DIR_PYTHON_EXE "Provide path to python.exe of Python 3.6.2" if "!PYTHON_BIN_DIR_PYTHON_EXE!" == "" ( echo ERROR: Python not found! 1>&2 exit /b 102 ) call :get_dir_path PYTHON_BIN_DIR "!PYTHON_BIN_DIR_PYTHON_EXE!" ) ) ) ) echo Python: %PYTHON_BIN_DIR% if "%ARG_SKIP_DEPS%" == "1" goto skip_windows_sdk_dir_check if "%WindowsSdkDir%" == "" if not "%ProgramFiles(x86)%" == "" set "WindowsSdkDir=%ProgramFiles(x86)%\Windows Kits\10" if "%WindowsSdkDir%" == "" set "WindowsSdkDir=%ProgramFiles(x86)%\Windows Kits\10" if exist "%WindowsSdkDir%\" ( pushd "%WindowsSdkDir%" if exist "bin\x64\fxc.exe" ( set HAVE_FXC_EXE=1 if "%WindowsSdkVerBinPath%" == "" set "WindowsSdkVerBinPath=%WindowsSdkDir%" ) else ( for /f "delims=" %%a in ('dir /a:d /b "bin\10.*"') do ( if exist "bin\%%a\x64\fxc.exe" ( set HAVE_FXC_EXE=1 if "%WindowsSdkVerBinPath%" == "" set "WindowsSdkVerBinPath=%WindowsSdkDir%\bin\%%a\" ) ) ) popd ) set QT_ENABLE_DYNAMIC_OPENGL=ON if not "%HAVE_FXC_EXE%" == "1" ( set WindowsSdkDir= echo Windows SDK 10 with fxc.exe not found echo Qt will *not* be built with ANGLE ^(dynamic OpenGL^) support. if not "%ARG_NO_INTERACTIVE%" == "1" ( choice /c ny /n /m "Is this ok? [y/n] " if errorlevel 3 exit 255 if not errorlevel 2 ( exit /b 102 ) ) set QT_ENABLE_DYNAMIC_OPENGL=OFF ) else echo Windows SDK 10 with fxc.exe found on %WindowsSdkDir% :skip_windows_sdk_dir_check if not "%ARG_JOBS%" == "" ( set "PARALLEL_JOBS=%ARG_JOBS%" ) if "%PARALLEL_JOBS%" == "" ( echo Number of logical CPU cores detected: %NUMBER_OF_PROCESSORS% echo Enabling %NUMBER_OF_PROCESSORS% parallel jobs set PARALLEL_JOBS=%NUMBER_OF_PROCESSORS% if not "%ARG_NO_INTERACTIVE%" == "1" ( choice /c ny /n /m "Is this correct? [y/n] " if errorlevel 3 exit 255 if not errorlevel 2 ( call :prompt_for_positive_integer PARALLEL_JOBS "Provide no. of parallel jobs" if "!PARALLEL_JOBS!" == "" ( echo ERROR: Invalid job count! 1>&2 exit /b 102 ) ) ) ) echo Parallel jobs count: %PARALLEL_JOBS% if not "%ARG_SRC_DIR%" == "" ( set "KRITA_SRC_DIR=%ARG_SRC_DIR%" ) if "%KRITA_SRC_DIR%" == "" ( :: Check whether this looks like to be in the source tree set "_temp=%~dp0" if "!_temp:~-21!" == "\build-tools\windows\" ( if exist "!_temp:~0,-21!\CMakeLists.txt" ( if exist "!_temp:~0,-21!\3rdparty\CMakeLists.txt" ( set "KRITA_SRC_DIR=!_temp:~0,-21!\" echo Script is running inside Krita src dir ) ) ) ) if "%KRITA_SRC_DIR%" == "" ( if not "%ARG_NO_INTERACTIVE%" == "1" ( call :prompt_for_dir KRITA_SRC_DIR "Provide path of Krita src dir" ) if "!KRITA_SRC_DIR!" == "" ( echo ERROR: Krita src dir not found! 1>&2 exit /b 102 ) ) echo Krita src: %KRITA_SRC_DIR% if "%ARG_SKIP_DEPS%" == "1" goto skip_deps_args_check if not "%ARG_DOWNLOAD_DIR%" == "" ( set "DEPS_DOWNLOAD_DIR=%ARG_DOWNLOAD_DIR%" ) if "%DEPS_DOWNLOAD_DIR%" == "" ( set DEPS_DOWNLOAD_DIR=%CD%\d\ echo Using default deps download dir: !DEPS_DOWNLOAD_DIR! if not "%ARG_NO_INTERACTIVE%" == "1" ( choice /c ny /n /m "Is this ok? [y/n] " if errorlevel 3 exit 255 if not errorlevel 2 ( call :prompt_for_dir DEPS_DOWNLOAD_DIR "Provide path of depps download dir" ) ) if "!DEPS_DOWNLOAD_DIR!" == "" ( echo ERROR: Deps download dir not set! 1>&2 exit /b 102 ) ) echo Deps download dir: %DEPS_DOWNLOAD_DIR% if not "%ARG_DEPS_BUILD_DIR%" == "" ( set "DEPS_BUILD_DIR=%ARG_DEPS_BUILD_DIR%" ) if "%DEPS_BUILD_DIR%" == "" ( set DEPS_BUILD_DIR=%CD%\b_deps\ echo Using default deps build dir: !DEPS_BUILD_DIR! if not "%ARG_NO_INTERACTIVE%" == "1" ( choice /c ny /n /m "Is this ok? [y/n] " if errorlevel 3 exit 255 if not errorlevel 2 ( call :prompt_for_dir DEPS_BUILD_DIR "Provide path of deps build dir" ) ) if "!DEPS_BUILD_DIR!" == "" ( echo ERROR: Deps build dir not set! 1>&2 exit /b 102 ) ) echo Deps build dir: %DEPS_BUILD_DIR% :skip_deps_args_check if not "%ARG_DEPS_INSTALL_DIR%" == "" ( set "DEPS_INSTALL_DIR=%ARG_DEPS_INSTALL_DIR%" ) if "%DEPS_INSTALL_DIR%" == "" ( set DEPS_INSTALL_DIR=%CD%\i_deps\ echo Using default deps install dir: !DEPS_INSTALL_DIR! if not "%ARG_NO_INTERACTIVE%" == "1" ( choice /c ny /n /m "Is this ok? [y/n] " if errorlevel 3 exit 255 if not errorlevel 2 ( call :prompt_for_dir DEPS_INSTALL_DIR "Provide path of deps install dir" ) ) if "!DEPS_INSTALL_DIR!" == "" ( echo ERROR: Deps install dir not set! 1>&2 exit /b 102 ) ) echo Deps install dir: %DEPS_INSTALL_DIR% if "%ARG_SKIP_KRITA%" == "1" goto skip_krita_args_check if not "%ARG_KRITA_BUILD_DIR%" == "" ( set "KRITA_BUILD_DIR=%ARG_KRITA_BUILD_DIR%" ) if "%KRITA_BUILD_DIR%" == "" ( set KRITA_BUILD_DIR=%CD%\b\ echo Using default Krita build dir: !KRITA_BUILD_DIR! if not "%ARG_NO_INTERACTIVE%" == "1" ( choice /c ny /n /m "Is this ok? [y/n] " if errorlevel 3 exit 255 if not errorlevel 2 ( call :prompt_for_dir KRITA_BUILD_DIR "Provide path of Krita build dir" ) ) if "!KRITA_BUILD_DIR!" == "" ( echo ERROR: Krita build dir not set! 1>&2 exit /b 102 ) ) echo Krita build dir: %KRITA_BUILD_DIR% if not "%ARG_KRITA_INSTALL_DIR%" == "" ( set "KRITA_INSTALL_DIR=%ARG_KRITA_INSTALL_DIR%" ) if "%KRITA_INSTALL_DIR%" == "" ( set KRITA_INSTALL_DIR=%CD%\i\ echo Using default Krita install dir: !KRITA_INSTALL_DIR! if not "%ARG_NO_INTERACTIVE%" == "1" ( choice /c ny /n /m "Is this ok? [y/n] " if errorlevel 3 exit 255 if not errorlevel 2 ( call :prompt_for_dir KRITA_INSTALL_DIR "Provide path of Krita install dir" ) ) if "!KRITA_INSTALL_DIR!" == "" ( echo ERROR: Krita install dir not set! 1>&2 exit /b 102 ) ) echo Krita install dir: %KRITA_INSTALL_DIR% :skip_krita_args_check echo. if not "%ARG_NO_INTERACTIVE%" == "1" ( choice /c ny /n /m "Is the above ok? [y/n] " if errorlevel 3 exit 255 if not errorlevel 2 ( exit /b 1 ) echo. ) :: Initialize clean PATH set PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\ set PATH=%MINGW_BIN_DIR%;%PYTHON_BIN_DIR%;%PATH% echo Creating dirs... if NOT "%ARG_SKIP_DEPS%" == "1" ( mkdir %DEPS_DOWNLOAD_DIR% if errorlevel 1 ( if not exist "%DEPS_DOWNLOAD_DIR%\" ( echo ERROR: Cannot create deps download dir! 1>&2 exit /b 103 ) ) mkdir %DEPS_BUILD_DIR% if errorlevel 1 ( if not exist "%DEPS_BUILD_DIR%\" ( echo ERROR: Cannot create deps build dir! 1>&2 exit /b 103 ) ) mkdir %DEPS_INSTALL_DIR% if errorlevel 1 ( if not exist "%DEPS_INSTALL_DIR%\" ( echo ERROR: Cannot create deps install dir! 1>&2 exit /b 103 ) ) ) if NOT "%ARG_SKIP_KRITA%" == "1" ( mkdir %KRITA_BUILD_DIR% if errorlevel 1 ( if not exist "%KRITA_BUILD_DIR%\" ( echo ERROR: Cannot create Krita build dir! 1>&2 exit /b 103 ) ) mkdir %KRITA_INSTALL_DIR% if errorlevel 1 ( if not exist "%KRITA_INSTALL_DIR%\" ( echo ERROR: Cannot create Krita install dir! 1>&2 exit /b 103 ) ) ) echo. set CMAKE_BUILD_TYPE=RelWithDebInfo set QT_ENABLE_DEBUG_INFO=OFF :: Paths for CMake set "BUILDDIR_DOWNLOAD_CMAKE=%DEPS_DOWNLOAD_DIR:\=/%" set "BUILDDIR_DOWNLOAD_CMAKE=%BUILDDIR_DOWNLOAD_CMAKE: =\ %" set "BUILDDIR_DEPS_INSTALL_CMAKE=%DEPS_INSTALL_DIR:\=/%" set "BUILDDIR_DEPS_INSTALL_CMAKE=%BUILDDIR_DEPS_INSTALL_CMAKE: =\ %" set "BUILDDIR_KRITA_INSTALL_CMAKE=%KRITA_INSTALL_DIR:\=/%" set "BUILDDIR_KRITA_INSTALL_CMAKE=%BUILDDIR_KRITA_INSTALL_CMAKE: =\ %" set PATH=%DEPS_INSTALL_DIR%\bin;%PATH% if not "%GETTEXT_SEARCH_PATH%" == "" ( set PATH=!PATH!;!GETTEXT_SEARCH_PATH! ) :: Prepare the CMake command lines set CMDLINE_CMAKE_DEPS="%CMAKE_EXE%" "%KRITA_SRC_DIR%\3rdparty" ^ -DSUBMAKE_JOBS=%PARALLEL_JOBS% ^ -DQT_ENABLE_DEBUG_INFO=%QT_ENABLE_DEBUG_INFO% ^ -DQT_ENABLE_DYNAMIC_OPENGL=%QT_ENABLE_DYNAMIC_OPENGL% ^ -DEXTERNALS_DOWNLOAD_DIR=%BUILDDIR_DOWNLOAD_CMAKE% ^ -DINSTALL_ROOT=%BUILDDIR_DEPS_INSTALL_CMAKE% ^ -G "MinGW Makefiles" ^ -DUSE_QT_TABLET_WINDOWS=ON ^ -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% set CMDLINE_CMAKE_KRITA="%CMAKE_EXE%" "%KRITA_SRC_DIR%\." ^ -DBoost_DEBUG=OFF ^ -DBOOST_INCLUDEDIR=%BUILDDIR_DEPS_INSTALL_CMAKE%/include ^ -DBOOST_ROOT=%BUILDDIR_DEPS_INSTALL_CMAKE% ^ -DBOOST_LIBRARYDIR=%BUILDDIR_DEPS_INSTALL_CMAKE%/lib ^ -DCMAKE_PREFIX_PATH=%BUILDDIR_DEPS_INSTALL_CMAKE% ^ -DCMAKE_INSTALL_PREFIX=%BUILDDIR_KRITA_INSTALL_CMAKE% ^ -DBUILD_TESTING=OFF ^ -DHAVE_MEMORY_LEAK_TRACKER=OFF ^ -DFOUNDATION_BUILD=ON ^ -DUSE_QT_TABLET_WINDOWS=ON ^ -DHIDE_SAFE_ASSERTS=ON ^ -Wno-dev ^ -G "MinGW Makefiles" ^ -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% :: Launch CMD prompt if requested if "%ARG_CMD%" == "1" ( doskey cmake-deps=cmd /c "pushd %DEPS_BUILD_DIR% && %CMDLINE_CMAKE_DEPS%" doskey cmake-krita=cmd /c "pushd %KRITA_BUILD_DIR% && %CMDLINE_CMAKE_KRITA%" doskey make-deps=cmd /c "pushd %DEPS_BUILD_DIR% && "%CMAKE_EXE%" --build . --config %CMAKE_BUILD_TYPE% --target $*" doskey make-krita=cmd /c "pushd %KRITA_BUILD_DIR% && "%CMAKE_EXE%" --build . --config %CMAKE_BUILD_TYPE% --target install -- -j%PARALLEL_JOBS%" echo. title Krita build - %KRITA_SRC_DIR% ^(deps: %DEPS_BUILD_DIR%, krita: %KRITA_BUILD_DIR%^) echo You're now in the build environment. echo The following macros are available: echo cmake-deps echo -- Run CMake for the deps. echo make-deps ^ echo -- Run build for the specified deps target. The target name should echo include the `ext_` prefix, e.g. `ext_qt`. echo cmake-krita echo -- Run CMake for Krita. echo make-krita echo -- Run build for Krita's `install` target. echo. echo For more info, type `doskey /macros` to view the macro commands. cmd /k exit ) if "%ARG_SKIP_DEPS%" == "1" goto skip_build_deps pushd %DEPS_BUILD_DIR% if errorlevel 1 ( echo ERROR: Cannot enter deps build dir! 1>&2 exit /b 104 ) echo Running CMake for deps... @echo on %CMDLINE_CMAKE_DEPS% @if errorlevel 1 ( @echo ERROR: CMake configure failed! 1>&2 @exit /b 104 ) @echo off echo. set EXT_TARGETS=patch png2ico zlib gettext openssl boost exiv2 fftw3 eigen3 set EXT_TARGETS=%EXT_TARGETS% jpeg lcms2 ocio ilmbase openexr png tiff gsl vc libraw set EXT_TARGETS=%EXT_TARGETS% giflib qt kwindowsystem drmingw gmic freetype poppler set EXT_TARGETS=%EXT_TARGETS% python sip pyqt -set EXT_TARGETS=%EXT_TARGETS% lzma quazip openjpeg +set EXT_TARGETS=%EXT_TARGETS% lzma quazip openjpeg libheif for %%a in (%EXT_TARGETS%) do ( echo Building ext_%%a... "%CMAKE_EXE%" --build . --config %CMAKE_BUILD_TYPE% --target ext_%%a if errorlevel 1 ( echo ERROR: Building of ext_%%a failed! 1>&2 exit /b 105 ) ) echo. echo ******** Built deps ******** popd :skip_build_deps if "%ARG_SKIP_KRITA%" == "1" goto skip_build_krita pushd %KRITA_BUILD_DIR% if errorlevel 1 ( echo ERROR: Cannot enter Krita build dir! 1>&2 exit /b 104 ) echo Running CMake for Krita... @echo on %CMDLINE_CMAKE_KRITA% @if errorlevel 1 ( @echo ERROR: CMake configure failed! 1>&2 @exit /b 104 ) @echo off echo. echo Building Krita... "%CMAKE_EXE%" --build . --config %CMAKE_BUILD_TYPE% --target install -- -j%PARALLEL_JOBS% if errorlevel 1 ( echo ERROR: Building of Krita failed! 1>&2 exit /b 105 ) echo. echo ******** Built Krita ******** popd :skip_build_krita echo Krita build completed! diff --git a/cmake/modules/FindHEIF.cmake b/cmake/modules/FindHEIF.cmake index 2f7fa9befa..8b6efab6af 100644 --- a/cmake/modules/FindHEIF.cmake +++ b/cmake/modules/FindHEIF.cmake @@ -1,50 +1,50 @@ # - Try to find the libheif library # Once done this will define # # HEIF_FOUND - system has heif # HEIF_INCLUDE_DIRS - the heif include directories # HEIF_LIBRARIES - the libraries needed to use heif # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # if (NOT WIN32) include(LibFindMacros) libfind_pkg_check_modules(HEIF_PKGCONF libheif) find_path(HEIF_INCLUDE_DIR NAMES libheif/heif.h HINTS ${HEIF_PKGCONF_INCLUDE_DIRS} ${HEIF_PKGCONF_INCLUDEDIR} PATH_SUFFIXES heif ) find_library(HEIF_LIBRARY NAMES heif HINTS ${HEIF_PKGCONF_LIBRARY_DIRS} ${HEIF_PKGCONF_LIBDIR} ) set(HEIF_PROCESS_LIBS HEIF_LIBRARY) set(HEIF_PROCESS_INCLUDES HEIF_INCLUDE_DIR) libfind_process(HEIF) else() find_path(HEIF_INCLUDE_DIR - NAMES heif.h + NAMES libheif/heif.h ) find_library ( HEIF_LIBRARY NAMES libheif libheif DOC "Libraries to link against for HEIF Support" ) if (HEIF_LIBRARY) set(HEIF_LIBRARY_DIR ${HEIF_LIBRARY}) endif() set (HEIF_LIBRARIES ${HEIF_LIBRARY}) if(HEIF_INCLUDE_DIR AND HEIF_LIBRARY_DIR) set (HEIF_FOUND true) endif() endif() diff --git a/packaging/macos/osxbuild.sh b/packaging/macos/osxbuild.sh index 9c9b1efdcc..0a86bbb0e2 100755 --- a/packaging/macos/osxbuild.sh +++ b/packaging/macos/osxbuild.sh @@ -1,537 +1,543 @@ #!/usr/bin/env bash # osxbuild.sh automates building and installing of krita and krita dependencies # for OSX, the script only needs you to set BUILDROOT environment to work # properly. # # Run with no args for a short help about each command. # builddeps: Attempts to build krita dependencies in the necessary order, # intermediate steps for creating symlinks and fixing rpath of some # packages midway is also managed. Order goes from top to bottom, to add # new steps just place them in the proper place. # rebuilddeps: This re-runs all make and make install of dependencies 3rdparty # this was needed as deleting the entire install directory an rerunning build # step for dependencies does not install if they are already built. This step # forces installation. Have not tested it lately so it might not be needed anymore # build: Runs cmake build and make step for krita sources. It always run cmake step, so # it might take a bit longer than a pure on the source tree. The script tries # to set the make flag -jN to a proper N. # install: Runs install step for krita sources. # fixboost: Search for all libraries using boost and sets a proper @rpath for boost as by # default it fails to set a proper @rpath # buildinstall: Runs build, install and fixboost steps.# if test -z $BUILDROOT; then echo "ERROR: BUILDROOT env not set, exiting!" echo "\t Must point to the root of the buildfiles as stated in 3rdparty Readme" exit fi echo "BUILDROOT set to ${BUILDROOT}" export KIS_SRC_DIR=${BUILDROOT}/krita export KIS_TBUILD_DIR=${BUILDROOT}/depbuild export KIS_TDEPINSTALL_DIR=${BUILDROOT}/depinstall export KIS_DOWN_DIR=${BUILDROOT}/down export KIS_BUILD_DIR=${BUILDROOT}/kisbuild export KIS_INSTALL_DIR=${BUILDROOT}/i # flags for OSX environment # Qt only supports from 10.12 up, and https://doc.qt.io/qt-5/macos.html#target-platforms warns against setting it lower export MACOSX_DEPLOYMENT_TARGET=10.12 export QMAKE_MACOSX_DEPLOYMENT_TARGET=10.12 # Build time variables if test -z $(which cmake); then echo "ERROR: cmake not found, exiting!" exit fi -export PATH=${KIS_INSTALL_DIR}/bin:$PATH +export PATH=${KIS_INSTALL_DIR}/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin +export PKG_CONFIG_PATH=${KIS_INSTALL_DIR}/share/pkgconfig:${KIS_INSTALL_DIR}/lib/pkgconfig +export CMAKE_PREFIX_PATH=${KIS_INSTALL_DIR} export C_INCLUDE_PATH=${KIS_INSTALL_DIR}/include:/usr/include:${C_INCLUDE_PATH} export CPLUS_INCLUDE_PATH=${KIS_INSTALL_DIR}/include:/usr/include:${CPLUS_INCLUDE_PATH} export LIBRARY_PATH=${KIS_INSTALL_DIR}/lib:/usr/lib:${LIBRARY_PATH} # export CPPFLAGS=-I${KIS_INSTALL_DIR}/include # export LDFLAGS=-L${KIS_INSTALL_DIR}/lib export FRAMEWORK_PATH=${KIS_INSTALL_DIR}/lib/ # export PYTHONHOME=${KIS_INSTALL_DIR} # export PYTHONPATH=${KIS_INSTALL_DIR}/sip:${KIS_INSTALL_DIR}/lib/python3.8/site-packages:${KIS_INSTALL_DIR}/lib/python3.8 # This will make the debug output prettier export KDE_COLOR_DEBUG=1 export QTEST_COLORED=1 export OUPUT_LOG="${BUILDROOT}/osxbuild.log" export ERROR_LOG="${BUILDROOT}/osxbuild-error.log" printf "" > "${OUPUT_LOG}" printf "" > "${ERROR_LOG}" # configure max core for make compile ((MAKE_THREADS=1)) if test ${OSTYPE} == "darwin*"; then ((MAKE_THREADS = $(sysctl -n hw.logicalcpu))) fi # Prints stderr and stdout to log files # >(tee) works but breaks sigint log_cmd () { if [[ "${VERBOSE}" ]]; then "$@" 1>> ${OUPUT_LOG} 2>> ${ERROR_LOG} else "$@" 2>> ${ERROR_LOG} | tee -a ${OUPUT_LOG} > /dev/null fi } # Log messages to logfile log () { if [[ "${VERBOSE}" ]]; then printf "%s\n" "${@}" | tee -a ${OUPUT_LOG} else printf "%s\n" "${@}" | tee -a ${OUPUT_LOG} > /dev/null fi } # if previous command gives error # print msg print_if_error() { error_stat="${?}" if [ ${error_stat} -ne 0 ]; then printf "\e[31m%s %s\e[0m\n" "Error:" "${1}" 2>> ${ERROR_LOG} printf "%s\r" "${error_stat}" fi } # print status messages print_msg() { printf "\e[32m%s\e[0m\n" "${1}" printf "%s\n" "${1}" >> ${OUPUT_LOG} } check_dir_path () { printf "%s" "Checking if ${1} exists and is dir... " if test -d ${1}; then echo -e "OK" elif test -e ${1}; then echo -e "\n\tERROR: file ${1} exists but is not a directory!" >&2 return 1 else echo -e "Creating ${1}" mkdir ${1} fi return 0 } # builds dependencies for the first time cmake_3rdparty () { cd ${KIS_TBUILD_DIR} local build_pkgs=("${@}") # convert to array if [[ ${2} = "1" ]]; then local nofix="true" local build_pkgs=(${build_pkgs[@]:0:1}) fi for package in ${build_pkgs[@]} ; do print_msg "Building ${package}" log_cmd cmake --build . --config RelWithDebInfo --target ${package} if [[ ! $(print_if_error "Failed build ${package}") ]]; then print_msg "Build Success! ${package}" fi # fixes does not depend on failure if [[ ! ${nofix} ]]; then build_3rdparty_fixes ${package} fi done } build_3rdparty_fixes(){ pkg=${1} if [[ "${pkg}" = "ext_qt" && -e "${KIS_INSTALL_DIR}/bin/qmake" ]]; then ln -sf qmake "${KIS_INSTALL_DIR}/bin/qmake-qt5" elif [[ "${pkg}" = "ext_openexr" ]]; then # open exr will fail the first time is called # rpath needs to be fixed an build rerun log "Fixing rpath on openexr file: b44ExpLogTable" log "Fixing rpath on openexr file: dwaLookups" log_cmd install_name_tool -add_rpath ${KIS_INSTALL_DIR}/lib $(find ${KIS_TBUILD_DIR}/ext_openexr/ext_openexr-prefix/src/ext_openexr-build -name b44ExpLogTable) log_cmd install_name_tool -add_rpath ${KIS_INSTALL_DIR}/lib $(find ${KIS_TBUILD_DIR}/ext_openexr/ext_openexr-prefix/src/ext_openexr-build -name dwaLookups) # we must rerun build! cmake_3rdparty ext_openexr "1" elif [[ "${pkg}" = "ext_fontconfig" ]]; then log "fixing rpath on fc-cache" log_cmd install_name_tool -add_rpath ${KIS_INSTALL_DIR}/lib ${KIS_TBUILD_DIR}/ext_fontconfig/ext_fontconfig-prefix/src/ext_fontconfig-build/fc-cache/.libs/fc-cache # rerun rebuild cmake_3rdparty ext_fontconfig "1" fi } build_3rdparty () { print_msg "building in ${KIS_TBUILD_DIR}" log "$(check_dir_path ${KIS_TBUILD_DIR})" log "$(check_dir_path ${KIS_DOWN_DIR})" log "$(check_dir_path ${KIS_INSTALL_DIR})" cd ${KIS_TBUILD_DIR} log_cmd cmake ${KIS_SRC_DIR}/3rdparty/ \ -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 \ -DCMAKE_INSTALL_PREFIX=${KIS_INSTALL_DIR} \ + -DCMAKE_PREFIX_PATH:PATH=${KIS_INSTALL_DIR} \ -DEXTERNALS_DOWNLOAD_DIR=${KIS_DOWN_DIR} \ -DINSTALL_ROOT=${KIS_INSTALL_DIR} # -DCPPFLAGS=-I${KIS_INSTALL_DIR}/include \ # -DLDFLAGS=-L${KIS_INSTALL_DIR}/lib print_msg "finished 3rdparty build setup" if [[ -n ${1} ]]; then cmake_3rdparty "${@}" exit fi # build 3rdparty tools # The order must not be changed! cmake_3rdparty \ ext_pkgconfig \ ext_gettext \ ext_openssl \ ext_qt \ ext_zlib \ ext_boost \ ext_eigen3 \ ext_exiv2 \ ext_fftw3 \ ext_ilmbase \ ext_jpeg \ ext_lcms2 \ ext_ocio \ - ext_openexr + ext_openexr \ + ext_openjpeg cmake_3rdparty \ ext_png \ ext_tiff \ ext_gsl \ ext_vc \ ext_libraw \ ext_giflib \ ext_freetype \ ext_fontconfig \ ext_poppler # Stop if qmake link was not created # this meant qt build fail and further builds will # also fail. log_cmd test -L "${KIS_INSTALL_DIR}/bin/qmake-qt5" if [[ $(print_if_error "qmake link missing!") ]]; then printf " link: ${KIS_INSTALL_DIR}/bin/qmake-qt5 missing! It probably means ext_qt failed!! check, fix and rerun!\n" exit fi # for python cmake_3rdparty \ ext_python \ ext_sip \ ext_pyqt cmake_3rdparty ext_libheif cmake_3rdparty \ ext_extra_cmake_modules \ ext_kconfig \ ext_kwidgetsaddons \ ext_kcompletion \ ext_kcoreaddons \ ext_kguiaddons \ ext_ki18n \ ext_kitemmodels \ ext_kitemviews \ ext_kimageformats \ ext_kwindowsystem \ ext_quazip } # Recall cmake for all 3rd party packages # make is only on target first run # subsequent runs only call make install rebuild_3rdparty () { print_msg "starting rebuild of 3rdparty packages" build_install_ext() { for pkg in ${@:1:${#@}}; do { cd ${KIS_TBUILD_DIR}/${pkg}/${pkg}-prefix/src/${pkg}-stamp } || { cd ${KIS_TBUILD_DIR}/ext_frameworks/${pkg}-prefix/src/${pkg}-stamp } || { cd ${KIS_TBUILD_DIR}/ext_heif/${pkg}-prefix/src/${pkg}-stamp } log "Installing ${pkg} files..." rm ${pkg}-configure ${pkg}-build ${pkg}-install cmake_3rdparty ${pkg} cd ${KIS_TBUILD_DIR} done } # Do not process complete list only pkgs given. if ! test -z ${1}; then build_install_ext ${@} exit fi build_install_ext \ ext_pkgconfig \ ext_iconv \ ext_gettext \ ext_openssl \ ext_qt \ ext_zlib \ ext_boost \ ext_eigen3 \ ext_expat \ ext_exiv2 \ ext_fftw3 \ ext_ilmbase \ ext_jpeg \ ext_patch \ ext_lcms2 \ ext_ocio \ ext_ilmbase \ ext_openexr \ + ext_openjpeg + + build_install_ext \ ext_png \ ext_tiff \ ext_gsl \ ext_vc \ ext_libraw \ ext_giflib \ ext_fontconfig \ ext_freetype \ ext_poppler \ ext_python \ ext_sip \ ext_pyqt \ build_install_ext \ - ext_yasm \ ext_nasm \ ext_libx265 \ ext_libde265 \ - ext_libheif \ + ext_libheif # Build kde_frameworks build_install_ext \ ext_extra_cmake_modules \ ext_kconfig \ ext_kwidgetsaddons \ ext_kcompletion \ ext_kcoreaddons \ ext_kguiaddons \ ext_ki18n \ ext_kitemmodels \ ext_kitemviews \ ext_kimageformats \ ext_kwindowsystem \ - ext_quazip \ - ext_openjpeg + ext_quazip } #not tested set_krita_dirs() { if [[ -n ${1} ]]; then KIS_BUILD_DIR=${BUILDROOT}/b_${1} KIS_INSTALL_DIR=${BUILDROOT}/i_${1} KIS_SRC_DIR=${BUILDROOT}/src_${1} fi } # build_krita # run cmake krita build_krita () { export DYLD_FRAMEWORK_PATH=${FRAMEWORK_PATH} echo ${KIS_BUILD_DIR} echo ${KIS_INSTALL_DIR} log_cmd check_dir_path ${KIS_BUILD_DIR} cd ${KIS_BUILD_DIR} cmake ${KIS_SRC_DIR} \ -DFOUNDATION_BUILD=ON \ -DBoost_INCLUDE_DIR=${KIS_INSTALL_DIR}/include \ -DCMAKE_INSTALL_PREFIX=${KIS_INSTALL_DIR} \ + -DCMAKE_PREFIX_PATH=${KIS_INSTALL_DIR} \ -DDEFINE_NO_DEPRECATED=1 \ -DBUILD_TESTING=OFF \ -DHIDE_SAFE_ASSERTS=ON \ -DKDE_INSTALL_BUNDLEDIR=${KIS_INSTALL_DIR}/bin \ -DPYQT_SIP_DIR_OVERRIDE=${KIS_INSTALL_DIR}/share/sip/ \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 \ -DPYTHON_INCLUDE_DIR=${KIS_INSTALL_DIR}/lib/Python.framework/Headers # copiling phase make -j${MAKE_THREADS} # compile integrations if test ${OSTYPE} == "darwin*"; then cd ${KIS_BUILD_DIR}/krita/integration/kritaquicklook make -j${MAKE_THREADS} fi } build_krita_tarball () { filename="$(basename ${1})" KIS_CUSTOM_BUILD="${BUILDROOT}/releases/${filename%.tar.gz}" print_msg "Tarball BUILDROOT is ${KIS_CUSTOM_BUILD}" filename_dir=$(dirname "${1}") cd "${filename_dir}" file_abspath="$(pwd)/${1##*/}" mkdir "${KIS_CUSTOM_BUILD}" 2> /dev/null cd "${KIS_CUSTOM_BUILD}" mkdir "src" "build" 2> /dev/null tar -xzf "${file_abspath}" --strip-components=1 --directory "src" if [[ $(print_if_error "Untar ${file_abspath} failed!") ]]; then exit fi KIS_BUILD_DIR="${KIS_CUSTOM_BUILD}/build" KIS_SRC_DIR="${KIS_CUSTOM_BUILD}/src" build_krita print_msg "Build done!" print_msg "to install run osxbuild.sh install ${KIS_BUILD_DIR}" } install_krita () { # custom install provided if [[ -n "${1}" ]]; then KIS_BUILD_DIR="${1}" fi print_msg "Install krita from ${KIS_BUILD_DIR}" log_cmd check_dir_path ${KIS_BUILD_DIR} cd ${KIS_BUILD_DIR} if [[ $(print_if_error "could not cd to ${KIS_BUILD_DIR}") ]]; then exit fi make install # compile integrations if test ${OSTYPE} == "darwin*"; then cd ${KIS_BUILD_DIR}/krita/integration/kritaquicklook make install fi } # Runs all fixes for path and packages. # Historically only fixed boost @rpath fix_boost_rpath () { # helpers to define function only once fixboost_find () { for FILE in "${@}"; do if [[ -n "$(otool -L $FILE | grep boost)" ]]; then log "Fixing -- $FILE" log_cmd install_name_tool -change libboost_system.dylib @rpath/libboost_system.dylib $FILE fi done } batch_fixboost() { xargs -P4 -I FILE bash -c 'fixboost_find "FILE"' } export -f fixboost_find export -f log export -f log_cmd print_msg "Fixing boost in... ${KIS_INSTALL_DIR}" # install_name_tool -add_rpath ${KIS_INSTALL_DIR}/lib $BUILDROOT/$KRITA_INSTALL/bin/krita.app/Contents/MacOS/gmic_krita_qt log_cmd install_name_tool -add_rpath ${KIS_INSTALL_DIR}/lib ${KIS_INSTALL_DIR}/bin/krita.app/Contents/MacOS/krita # echo "Added rpath ${KIS_INSTALL_DIR}/lib to krita bin" # install_name_tool -add_rpath ${BUILDROOT}/deps/lib ${KIS_INSTALL_DIR}/bin/krita.app/Contents/MacOS/krita log_cmd install_name_tool -change libboost_system.dylib @rpath/libboost_system.dylib ${KIS_INSTALL_DIR}/bin/krita.app/Contents/MacOS/krita find -L "${KIS_INSTALL_DIR}" -name '*so' -o -name '*dylib' | batch_fixboost log "Fixing boost done!" } print_usage () { printf "USAGE: osxbuild.sh [pkg|file]\n" printf "BUILDSTEPS:\t\t" printf "\n builddeps \t\t Run cmake step for 3rd party dependencies, optionally takes a [pkg] arg" printf "\n rebuilddeps \t\t Rerun make and make install step for 3rd party deps, optionally takes a [pkg] arg \t\t\t useful for cleaning install directory and quickly reinstall all deps." printf "\n fixboost \t\t Fixes broken boost \@rpath on OSX" printf "\n build \t\t\t Builds krita" printf "\n buildtarball \t\t\t Builds krita from provided [file] tarball" printf "\n install \t\t Installs krita. Optionally accepts a [build dir] as argument \t\t\t this will install krita from given directory" printf "\n buildinstall \t\t Build and Installs krita, running fixboost after installing" printf "\n" } if [[ ${#} -eq 0 ]]; then echo "ERROR: No option given!" print_usage exit 1 fi if [[ ${1} = "builddeps" ]]; then build_3rdparty "${@:2}" elif [[ ${1} = "rebuilddeps" ]]; then rebuild_3rdparty "${@:2}" elif [[ ${1} = "fixboost" ]]; then if [[ -d ${1} ]]; then KIS_BUILD_DIR="${1}" fi fix_boost_rpath elif [[ ${1} = "build" ]]; then build_krita ${2} elif [[ ${1} = "buildtarball" ]]; then # uncomment line to optionally change # install directory providing a third argument # This is not on by default as build success requires all # deps installed in the given dir beforehand. # KIS_INSTALL_DIR=${3} build_krita_tarball ${2} elif [[ ${1} = "install" ]]; then install_krita ${2} fix_boost_rpath elif [[ ${1} = "buildinstall" ]]; then build_krita ${2} install_krita ${2} fix_boost_rpath ${2} elif [[ ${1} = "test" ]]; then ${KIS_INSTALL_DIR}/bin/krita.app/Contents/MacOS/krita else echo "Option ${1} not supported" print_usage exit 1 fi # after finishig sometimes it complains about missing matching quotes.