diff --git a/.gitignore b/.gitignore index 12aaec21d3..bd300c1e51 100644 --- a/.gitignore +++ b/.gitignore @@ -1,28 +1,26 @@ *.trace build qtcreator-build *.kdev4 *~ .kateconfig CMakeLists.txt.user* .directory -*.rej -*.orig *.autosave *.swp .gdb_history .kdev_include_paths *.config *.creator *.creator.user *.files *.includes .DS_Store *.kate-swap .idea GTAGS GPATH GRTAGS GSYMS BROWSE *.kate-swp diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 9327a5db4f..34d916a31d 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -1,116 +1,121 @@ 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 (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 (MSVC) set(GLOBAL_PROFILE ${GLOBAL_PROFILE} -DCMAKE_EXE_LINKER_FLAGS=/PROFILE -DCMAKE_SHARED_LINKER_FLAGS=/PROFILE) set(PATCH_COMMAND myptch) 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(PATCH_COMMAND patch) endif () if (UNIX AND NOT APPLE) set(LINUX true) set(PATCH_COMMAND patch) endif () # this list must be dependency-ordered if (MSVC) add_subdirectory( ext_patch ) add_subdirectory( ext_png2ico ) endif (MSVC) +if (MINGW) + add_subdirectory( ext_patch ) + add_subdirectory( ext_png2ico ) +endif (MINGW) add_subdirectory( ext_iconv ) add_subdirectory( ext_gettext ) add_subdirectory( ext_zlib ) add_subdirectory( ext_libxml2 ) add_subdirectory( ext_libxslt ) 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_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_freetype) -if (LINUX) add_subdirectory( ext_fontconfig) -endif() +add_subdirectory( ext_freetype) add_subdirectory( ext_qt ) add_subdirectory( ext_poppler ) add_subdirectory( ext_libraw ) add_subdirectory( ext_frameworks ) if (MSVC) add_subdirectory( google-breakpad ) endif() diff --git a/3rdparty/README.md b/3rdparty/README.md index 0567b67876..b6513b08c1 100644 --- a/3rdparty/README.md +++ b/3rdparty/README.md @@ -1,305 +1,215 @@ = CMake external projects to build krita's dependencies on Linux, Windows or OSX = If you need to build Krita's dependencies for the following reasons: * you develop on Windows and aren't using Emerge * you develop on OSX and aren't using Homebrew * you want to build a generic, distro-agnostic version of Krita for Linux * you develop on Linux, but some dependencies aren't available for your distribution and you know what you're doing, you can use the following guide to build the dependencies that Krita needs. If you develop on Linux and your distribution has the dependencies available, YOU DO NOT NEED THIS GUIDE AND YOU SHOULD STOP READING NOW Otherwise you risk major confusion. == Prerequisites == Note: on all operating systems the entire procedure is done in a terminal window. 1. git: https://git-scm.com/downloads. Make sure git is in your path 2. cmake 3.3.2: https://cmake.org/download/. Make sure cmake is in your path. 3. Make sure you have a compiler: * Linux: gcc, minimum version 4.8 * OSX: clang, you need to install xcode for this - * Windows: MSVC 2015 Community Edition: https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx -4. If you compile Qt on Windows, you will also need Python 2.7: https://www.python.org/download/releases/2.7/. Make sure to have python.exe in you path. + * Windows: (http://tdm-gcc.tdragon.net/, version 5.1). MSVC cannot build G'Mic correctly. For some reason, cmake wants to use nmake even when using mingw, so copy mingw32-make.exe to nmake.exe. And remember to install the OpenMP plugin in tdm-gcc. +4. If you compile Qt on Windows, you will also need Python 2.7: https://www.python.org/download/releases/2.7/. Make sure to have python.exe in your path. == Setup your environment == Windows Only: When launching the commands from the console, run first "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat" in it (include the quotes). This way all the environment variables for the compiler will be ready. == Prepare your directory layout == 1. Make a toplevel build directory, say $HOME/dev or c:\dev. We'll refer to this directory as BUILDROOT. You can use a variable for this, on WINDOWS %BUILDROOT%, on OSX and Linux $BUILDROOT. You will have to replace BUILDROOT with $BUILDROOT or %BUILDROOT whenever you copy and paste a command, depending on your operating system. 2. Checkout krita in BUILDROOT cd BUILDROOT git clone git://anongit.kde.org/krita.git 3. Create the build directory mkdir BUILDROOT/b 4. Create the downloads directory mkdir BUILDROOT/d 5. Create the install directory mkdir BUILDROOT/i -== Qt == - -Install Qt. You have three options: - -* build from source yourself -* install with the qt.io installer. -* build using the krita/3rdparty/ext_qt project as detailed in the next section. - -Either way, make sure qmake is in your environment path. If you are using Qt 5.6 for example, this is the default location for Windows: -C:\Qt\Qt5.6.0\5.6\msvc2015_64\bin, when using the qt.io installer. - -When building from source, you need the following modules: - -* qtbase -* qtdeclarative -* qtimageformats -* qtscript -* qtscript -* qtsvg -* qttools -* qttranslations - - On Windows, you also need qtwinextras, on Linux qtx11extras, on OSX qtmacextras. - -When installing from source, you can use these example configure commands: - -* Linux: - - ./configure \ - -skip qt3d \ - -skip qtactiveqt \ - -skip qtcanvas3d \ - -skip qtconnectivity \ - -skip qtdoc \ - -skip qtenginio \ - -skip qtgraphicaleffects \ - -skip qtlocation \ - -skip qtmultimedia \ - -skip qtsensors \ - -skip qtserialport \ - -skip qtwayland \ - -skip qtwebchannel \ - -skip qtwebengine \ - -skip qtwebkit \ - -skip qtwebkit-examples \ - -skip qtwebsockets \ - -skip qtxmlpatterns \ - -opensource -confirm-license -release \ - -no-qml-debug -no-mtdev -no-journald \ - -no-openssl -no-libproxy \ - -no-pulseaudio -no-alsa -no-nis \ - -no-cups -no-tslib -no-pch \ - -no-dbus -no-gstreamer -no-system-proxies \ - -no-openssl -no-libproxy -no-pulseaudio \ - -qt-xcb -xcb -qt-freetype -qt-harfbuzz \ - -qt-pcre -qt-xkbcommon-x11 -xcb-xlib \ - -prefix BUILDROOT/i - make -j8 - -* OSX - -./configure \ - -skip qt3d \ - -skip qtactiveqt \ - -skip qtcanvas3d \ - -skip qtconnectivity \ - -skip qtdoc \ - -skip qtenginio \ - -skip qtgraphicaleffects \ - -skip qtlocation \ - -skip qtmultimedia \ - -skip qtsensors \ - -skip qtserialport \ - -skip qtwayland \ - -skip qtwebchannel \ - -skip qtwebengine \ - -skip qtwebsockets \ - -skip qtxmlpatterns \ - -opensource -confirm-license -release \ - -no-qml-debug -no-mtdev -no-journald \ - -no-openssl -no-libproxy \ - -no-pulseaudio -no-alsa -no-nis \ - -no-cups -no-tslib -no-pch \ - -no-dbus -no-gstreamer -no-system-proxies \ - -no-openssl -no-libproxy -no-pulseaudio \ - -nomake examples -nomake tests \ - -prefix $BUILDROOT/i - -* Windows - - To do a normal release build use: - - configure -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdoc -skip qtenginio -skip qtgraphicaleffects -skip qtlocation -skip qtmultimedia -skip qtsensors -skip qtserialport -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtxmlpatterns -no-sql-sqlite -nomake examples -nomake tools -no-compile-examples -no-dbus -no-iconv -no-angle -no-ssl -no-openssl -no-wmf-backend -no-qml-debug -no-libproxy -no-system-proxies -no-nis -no-icu -no-mtdev -opensource -confirm-license -release -opengl desktop -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -prefix %BUILDROOT%\i - - If a release with debug info for developing purposes is needed, add the -force-debug-info to the configure options above, so that the pdb files will be generated. - - N.B.: if you don't have the Qt 5.6 pre-built binaries already - installed, you will need to copy Qt5Core.dll, coming from those - binaries inside the Qt build directory, under the path qtbase\bin, - otherwise you'll get an error about it missing when using jom - and a more cryptic error with nmake. The same has to be done with - Qt5Xml.dll, to be copied under qttools\bin. Don't use the dlls - coming from the QtCreator folder, they won't work. - == Prepare the externals build == 1. enter the BUILDROOT/b directory 2. run cmake: + * Linux: - cmake ../krita/3rdparty -DINSTALL_ROOT=BUILDROOT/i -DEXTERNALS_DOWNLOAD_DIR=BUILDROOT/d -DCMAKE_INSTALL_PREFIX=BUILDROOT/i -: + export PATH=$BUILDROOT/i/bin + cmake ../krita/3rdparty \ + -DINSTALL_ROOT=$BUILDROOT/i \ + -DEXTERNALS_DOWNLOAD_DIR=$BUILDROOT/d \ + -DCMAKE_INSTALL_PREFIX=BUILDROOT/i + * OSX: + + export PATH=$BUILDROOT/i/bin + cmake ../krita/3rdparty/ \ + -DCMAKE_INSTALL_PREFIX=$BUILDROOT/i \ + -DEXTERNALS_DOWNLOAD_DIR=$BUILDROOT/d \ + -DINSTALL_ROOT=$BUILDROOT/i + + * Windows 32 bits: + + TODO * Windows 64 bits: Note that the cmake command needs to point to your BUILDROOT like /dev/d, not c:\dev\d. set PATH=BUILDROOT\i\bin\;BUILDROOT\i\lib;%PATH% - cmake ..\krita\3rdparty -DEXTERNALS_DOWNLOAD_DIR=/dev/d -DINSTALL_ROOT=/dev/i -G "Visual Studio 14 Win64" - + cmake ..\krita\3rdparty -DEXTERNALS_DOWNLOAD_DIR=/dev/d -DINSTALL_ROOT=/dev/i -G "MinGW Makefiles" 3. build the packages: -With a judicious application of DEPENDS statements, it's possible to build it all in one go, but in my experience that fails anyway, so it's better to build the dependencies indepdendently. +With a judicious application of DEPENDS statements, it's possible to build it all in one go, but in my experience that fails always, so it's better to build the dependencies independently. On Windows: cmake --build . --config RelWithDebInfo --target ext_patch cmake --build . --config RelWithDebInfo --target ext_png2ico - cmake --build . --config RelWithDebInfo --target ext_pthreads - -On all operation systems, if you have decided to build Qt using the ext_qt project: - - cmake --build . --config RelWithDebInfo --target ext_qt - + cmake --build . --config RelWithDebInfo --target ext_gettext On all operating systems: + cmake --build . --config RelWithDebInfo --target ext_qt + cmake --build . --config RelWithDebInfo --target ext_zlib cmake --build . --config RelWithDebInfo --target ext_boost cmake --build . --config RelWithDebInfo --target ext_eigen3 cmake --build . --config RelWithDebInfo --target ext_exiv2 cmake --build . --config RelWithDebInfo --target ext_fftw3 cmake --build . --config RelWithDebInfo --target ext_ilmbase cmake --build . --config RelWithDebInfo --target ext_jpeg cmake --build . --config RelWithDebInfo --target ext_lcms2 cmake --build . --config RelWithDebInfo --target ext_ocio cmake --build . --config RelWithDebInfo --target ext_openexr Note for OSX: On OSX, you need to first build openexr; that will fail; then you need to set the rpath for the two utilities correctly, then try to build openexr again. install_name_tool -add_rpath $BUILD_ROOT/i/lib $BUILD_ROOT/b/ext_openexr/ext_openexr-prefix/src/ext_openexr-build/IlmImf/./b44ExpLogTable install_name_tool -add_rpath $BUILD_ROOT/i/lib $BUILD_ROOT/b/ext_openexr/ext_openexr-prefix/src/ext_openexr-build/IlmImf/./dwaLookups On All operating systems: cmake --build . --config RelWithDebInfo --target ext_png cmake --build . --config RelWithDebInfo --target ext_tiff cmake --build . --config RelWithDebInfo --target ext_gsl cmake --build . --config RelWithDebInfo --target ext_vc cmake --build . --config RelWithDebInfo --target ext_libraw - cmake --build . --config RelWithDebInfo --target ext_openjpeg On Windows and OSX - cmake --build . --config RelWithDebInfo --target ext_kwindowsystem + cmake --build . --config RelWithDebInfo --target ext_kcrash On Windows (Note: skip this for now if you're using msvc 2015, poppler isn't compatible with that compiler yet) cmake --build . --config RelWithDebInfo --target ext_freetype cmake --build . --config RelWithDebInfo --target ext_poppler On Linux cmake --build . --config RelWithDebInfo --target ext_kcrash Note: poppler should be buildable on Linux as well with a home-built freetype and fontconfig, but I don't know how to make fontconfig find freetype, and on Linux, fontconfig is needed for poppler. Poppler is needed for PDF import. Note 2: libcurl still isn't available. == Build Krita == 1. Make a krita build directory: mkdir BUILDROOT/build 2. Enter the BUILDROOT/build 3. Run On Windows - Depending on what you want to use, run this command for MSBuild: +Depending on what you want to use, run this command for MSBuild: cmake ..\krita -G "Visual Studio 14 Win64" -DBoost_DEBUG=OFF -DBOOST_INCLUDEDIR=c:\dev\i\include -DBOOST_DEBUG=ON -DBOOST_ROOT=c:\dev\i -DBOOST_LIBRARYDIR=c:\dev\i\lib -DCMAKE_INSTALL_PREFIX=c:\dev\i -DCMAKE_PREFIX_PATH=c:\dev\i -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=OFF -DKDE4_BUILD_TESTS=OFF -DHAVE_MEMORY_LEAK_TRACKER=OFF -DPACKAGERS_BUILD=ON -Wno-dev -DDEFINE_NO_DEPRECATED=1 - Or this to later use jom (faster compiling, uses all cores, ships with QtCreator/pre-built Qt binaries): +Or this to use jom (faster compiling, uses all cores, ships with QtCreator/pre-built Qt binaries): cmake ..\krita -G "NMake Makefiles" -DBoost_DEBUG=OFF -DBOOST_INCLUDEDIR=c:\dev\i\include -DBOOST_DEBUG=ON -DBOOST_ROOT=c:\dev\i -DBOOST_LIBRARYDIR=c:\dev\i\lib -DCMAKE_INSTALL_PREFIX=c:\dev\i -DCMAKE_PREFIX_PATH=c:\dev\i -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=OFF -DKDE4_BUILD_TESTS=OFF -DHAVE_MEMORY_LEAK_TRACKER=OFF -DPACKAGERS_BUILD=ON -Wno-dev -DDEFINE_NO_DEPRECATED=1 On Linux - cmake ../krita -DCMAKE_INSTALL_PREFIX=BUILDROOT/i -DDEFINE_NO_DEPRECATED=1 -DPACKAGERS_BUILD=ON -DBUILD_TESTING=OFF -DKDE4_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo + cmake ../krita -DCMAKE_INSTALL_PREFIX=BUILDROOT/i -DDEFINE_NO_DEPRECATED=1 -DPACKAGERS_BUILD=ON -DBUILD_TESTING=OFF -DKDE4_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfobg On OSX cmake ../krita -DCMAKE_INSTALL_PREFIX=/Users/boud/dev/i -DDEFINE_NO_DEPRECATED=1 -DBUILD_TESTING=OFF -DKDE4_BUILD_TESTS=OFF -DPACKAGERS_BUILD=ON -DBUNDLE_INSTALL_DIR=$HOME/dev/i/bin -DCMAKE_BUILD_TYPE=RelWithDebInfo 4. Run On Linux and OSX + make make install On Windows + Either use MSBuild to build (-- /m tells msbuild to use all your cores): cmake --build . --config RelWithDebInfo --target INSTALL -- /m Or use jom which should be in a path similar to C:\Qt\Qt5.6.0\Tools\QtCreator\bin\jom.exe. So, from the same folder, instead of running cmake run: "C:\Qt\Qt5.6.0\Tools\QtCreator\bin\jom.exe" install 6. Run krita: On Linux BUILDROOT/i/bin/krita On Windows BUILDROOT\i\bin\krita.exe On OSX BUILDROOT/i/bin/krita.app/Contents/MacOS/krita == Packaging a Windows Build == + If you want to create a stripped down version of Krita to distribute, after building everything just copy the makepkg.bat file from the "windows" folder inside krita root source folder to BUILDROOT and run it. -That will copy the Krita necessary files into the specified folder and leave behind developer related files, so the resulting folder will be a smaller install folder. +That will copy the necessary files into the specified folder and leave behind developer related files, so the resulting folder will be a smaller install folder. == Common Issues == + - On Windows, if you get a 'mspdb140.dll' missing alert window, it means you did not run the bat file. Make sure to include the quotes in the command: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat" - On Windows, if you get an error about Qt5Core.dll missing/not found or nmake exit with an error that mention QT_PLUGIN_PATH, you have to copy a couple of dlls in the Qt build directory, look for the N.B. in the Qt instructions at the start of the Readme. - If you receive an error while compiling about "missing QtCore5.cmake", or something similar, check to make sure qmake is in your PATH. Restart your command line after any changes are made. diff --git a/3rdparty/ext_boost/CMakeLists.txt b/3rdparty/ext_boost/CMakeLists.txt index 277780cef8..759e6cd761 100755 --- a/3rdparty/ext_boost/CMakeLists.txt +++ b/3rdparty/ext_boost/CMakeLists.txt @@ -1,64 +1,88 @@ SET(PREFIX_ext_boost "${EXTPREFIX}" ) if (MSVC) if (${CMAKE_GENERATOR} STREQUAL "Visual Studio 14 2015 Win64") ExternalProject_Add( ext_boost DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/boost_1_55_0.zip - URL_MD5 8aca361a4713a1f491b0a5e33fee0f1f + URL http://files.kde.org/krita/build/dependencies/boost_1_61_0.zip + URL_MD5 015ae4afa6f3e597232bfe1dab949ace CONFIGURE_COMMAND /bootstrap.bat --prefix=${PREFIX_ext_boost} BUILD_COMMAND /b2.exe --with-system --build-dir=build-dir --prefix=${PREFIX_ext_boost} toolset=msvc-14.0 variant=release link=shared threading=multi architecture=x86 address-model=64 variant=release install INSTALL_COMMAND "" INSTALL_DIR ${EXTPREFIX_boost} UPDATE_COMMAND "" ALWAYS 0 BUILD_IN_SOURCE 1 ) ExternalProject_Add_Step( ext_boost post_install COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_boost}/lib/boost_system-vc140-mt-1_55.dll ${PREFIX_ext_boost}/bin/boost_system-vc140-mt-1_55.dll DEPENDEES install ) + else() ExternalProject_Add( ext_boost DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/boost_1_55_0.zip - URL_MD5 8aca361a4713a1f491b0a5e33fee0f1f + URL http://files.kde.org/krita/build/dependencies/boost_1_61_0.zip + URL_MD5 015ae4afa6f3e597232bfe1dab949ace CONFIGURE_COMMAND /bootstrap.bat --prefix=${PREFIX_ext_boost} BUILD_COMMAND /b2.exe --with-system --build-dir=build-dir --prefix=${PREFIX_ext_boost} toolset=msvc-14.0 variant=release link=shared threading=multi architecture=x86 variant=release install INSTALL_COMMAND "" INSTALL_DIR ${EXTPREFIX_boost} UPDATE_COMMAND "" ALWAYS 0 BUILD_IN_SOURCE 1 ) ExternalProject_Add_Step( ext_boost post_install COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_boost}/lib/boost_system-vc140-mt-1_55.dll ${PREFIX_ext_boost}/bin/boost_system-vc140-mt-1_55.dll DEPENDEES install ) endif() +elseif(MINGW) + ExternalProject_Add( + ext_boost + + DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} + URL http://files.kde.org/krita/build/dependencies/boost_1_61_0.zip + URL_MD5 015ae4afa6f3e597232bfe1dab949ace + + CONFIGURE_COMMAND /bootstrap.bat mingw --prefix=${PREFIX_ext_boost} + BUILD_COMMAND /b2.exe --with-system --build-dir=build-dir --prefix=${PREFIX_ext_boost} toolset=gcc variant=release link=shared threading=multi architecture=x86 variant=release install + INSTALL_COMMAND "" + INSTALL_DIR ${EXTPREFIX_boost} + + UPDATE_COMMAND "" + ALWAYS 0 + BUILD_IN_SOURCE 1 + ) + ExternalProject_Add_Step( + ext_boost + post_install + COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_boost}/lib/libboost_system-mgw51-mt-1_55.dll ${PREFIX_ext_boost}/bin/ + DEPENDEES install + ) else() ExternalProject_Add( ext_boost DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/boost_1_55_0.tar.bz2 - URL_MD5 d6eef4b4cacb2183f2bf265a5a03a354 + URL http://files.kde.org/krita/build/dependencies/boost_1_61_0.tar.bz2 + URL_MD5 6095876341956f65f9d35939ccea1a9f CONFIGURE_COMMAND /bootstrap.sh --prefix=${PREFIX_ext_boost} --with-libraries=system BUILD_COMMAND /b2 install INSTALL_COMMAND "" INSTALL_DIR ${PREFIX_ext_boost} UPDATE_COMMAND "" ALWAYS 0 BUILD_IN_SOURCE 1 ) endif() diff --git a/3rdparty/ext_eigen3/CMakeLists.txt b/3rdparty/ext_eigen3/CMakeLists.txt index 5b5a448f12..6e49a85622 100644 --- a/3rdparty/ext_eigen3/CMakeLists.txt +++ b/3rdparty/ext_eigen3/CMakeLists.txt @@ -1,13 +1,13 @@ SET(EXTPREFIX_eigen3 "${EXTPREFIX}" ) ExternalProject_Add( ext_eigen3 DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/eigen3-3.2.6.tar.gz - URL_MD5 9f93bfc14ba0816220c9674e99b8c418 + URL http://files.kde.org/krita/build/dependencies/eigen-eigen-07105f7124f9.tar.gz + URL_MD5 135d8d43aaee5fb54cf5f3e981b1a6db INSTALL_DIR ${EXTPREFIX_eigen3} PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/dart.diff CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_eigen3} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} UPDATE_COMMAND "" ALWAYS 0 ) diff --git a/3rdparty/ext_eigen3/dart.diff b/3rdparty/ext_eigen3/dart.diff index 1d140454db..15770fbe18 100644 --- a/3rdparty/ext_eigen3/dart.diff +++ b/3rdparty/ext_eigen3/dart.diff @@ -1,13 +1,24 @@ diff --git a/cmake/EigenConfigureTesting.cmake b/cmake/EigenConfigureTesting.cmake -index 11ecc95..f7f8b34 100644 +index 2b11d83..8cf56ff 100644 --- a/cmake/EigenConfigureTesting.cmake +++ b/cmake/EigenConfigureTesting.cmake -@@ -41,7 +41,7 @@ endif() +@@ -26,19 +26,6 @@ include(CTest) - # copy ctest properties, which currently - # o raise the warning levels --configure_file(${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl ${CMAKE_BINARY_DIR}/DartConfiguration.tcl) -+#configure_file(${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl ${CMAKE_BINARY_DIR}/DartConfiguration.tcl) + set(EIGEN_TEST_BUILD_FLAGS " " CACHE STRING "Options passed to the build command of unit tests") - # restore default CMAKE_MAKE_PROGRAM - set(CMAKE_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM_SAVE}) +-# Overwrite default DartConfiguration.tcl such that ctest can build our unit tests. +-# Recall that our unit tests are not in the "all" target, so we have to explicitely ask ctest to build our custom 'buildtests' target. +-# At this stage, we can also add custom flags to the build tool through the user defined EIGEN_TEST_BUILD_FLAGS variable. +-file(READ "${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl" EIGEN_DART_CONFIG_FILE) +-# try to grab the default flags +-string(REGEX MATCH "MakeCommand:.*-- (.*)\nDefaultCTestConfigurationType" EIGEN_DUMMY ${EIGEN_DART_CONFIG_FILE}) +-if(NOT CMAKE_MATCH_1) +-string(REGEX MATCH "MakeCommand:.*[^c]make (.*)\nDefaultCTestConfigurationType" EIGEN_DUMMY ${EIGEN_DART_CONFIG_FILE}) +-endif() +-string(REGEX REPLACE "MakeCommand:.*DefaultCTestConfigurationType" "MakeCommand: ${CMAKE_COMMAND} --build . --target buildtests --config \"\${CTEST_CONFIGURATION_TYPE}\" -- ${CMAKE_MATCH_1} ${EIGEN_TEST_BUILD_FLAGS}\nDefaultCTestConfigurationType" +- EIGEN_DART_CONFIG_FILE2 ${EIGEN_DART_CONFIG_FILE}) +-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl" ${EIGEN_DART_CONFIG_FILE2}) +- + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTestCustom.cmake) + + # some documentation of this function would be nice diff --git a/3rdparty/ext_exiv2/CMakeLists.txt b/3rdparty/ext_exiv2/CMakeLists.txt index c9b3fdc9b8..5c3838dfd0 100755 --- a/3rdparty/ext_exiv2/CMakeLists.txt +++ b/3rdparty/ext_exiv2/CMakeLists.txt @@ -1,16 +1,17 @@ SET(PREFIX_ext_exiv2 "${EXTPREFIX}" ) ExternalProject_Add( ext_exiv2 DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} URL http://files.kde.org/krita/build/dependencies/exiv2-0.25.tar.gz URL_MD5 258d4831b30f75a01e0234065c6c2806 PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/tzname.patch + COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/patch_mingw.patch INSTALL_DIR ${PREFIX_ext_exiv2} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_exiv2} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DEXIV2_ENABLE_BUILD_SAMPLES=OFF -DEXIV2_ENABLE_BUILD_PO=OFF -DEXIV2_ENABLE_NLS=OFF -DICONV_INCLUDE_DIR=${PREFIX_ext_exiv2}/include UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_iconv ext_zlib ext_expat ) diff --git a/3rdparty/ext_exiv2/patch_mingw.patch b/3rdparty/ext_exiv2/patch_mingw.patch new file mode 100644 index 0000000000..e9cf1c8252 --- /dev/null +++ b/3rdparty/ext_exiv2/patch_mingw.patch @@ -0,0 +1,25 @@ +diff a/src/CMakeLists.txt b/src/CMakeLists.txt +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -291,6 +291,9 @@ IF (CYGWIN OR MINGW) + TARGET_LINK_LIBRARIES( exiv2lib psapi ) + ENDIF(CYGWIN OR MINGW) + ++IF (MINGW) ++ TARGET_LINK_LIBRARIES( exiv2lib ws2_32 ) ++ENDIF(MINGW) + + INSTALL( TARGETS exiv2lib ${INSTALL_TARGET_STANDARD_ARGS} ) + +diff a/src/http.cpp b/src/http.cpp +--- a/src/http.cpp ++++ b/src/http.cpp +@@ -53,7 +53,7 @@ + #include + #include + #include +-#ifndef __MINGW__ ++#if !defined(__MINGW__) && !defined(__MINGW32__) && !defined(__MINGW64__) + #define snprintf sprintf_s + #define write _write + #define read _read diff --git a/3rdparty/ext_expat/CMakeLists.txt b/3rdparty/ext_expat/CMakeLists.txt index 2a10474e9a..8d297addd1 100755 --- a/3rdparty/ext_expat/CMakeLists.txt +++ b/3rdparty/ext_expat/CMakeLists.txt @@ -1,35 +1,35 @@ SET(PREFIX_ext_expat "${EXTPREFIX}" ) -if (MSVC) +if (WIN32) ExternalProject_Add( ext_expat DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} URL http://files.kde.org/krita/build/dependencies/expat-2.1.0.tar.gz URL_MD5 dd7dab7a5fea97d2a6a43f511449b7cd PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/expat-2.1.0-20130311.diff INSTALL_DIR ${PREFIX_ext_expat} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_expat} -DBUILD_tests=OFF -DBUILD_examples=OFF -DBUILD_tools=OFF -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_patch ) else() ExternalProject_Add( ext_expat DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} URL http://files.kde.org/krita/build/dependencies/expat-2.1.0.tar.gz URL_MD5 dd7dab7a5fea97d2a6a43f511449b7cd INSTALL_DIR ${PREFIX_ext_expat} CONFIGURE_COMMAND /configure --prefix=${PREFIX_ext_expat} ${GLOBAL_AUTOMAKE_PROFILE} BUILD_COMMAND make INSTALL_COMMAND make install UPDATE_COMMAND "" ALWAYS 0 ) endif() diff --git a/3rdparty/ext_fftw3/CMakeLists.txt b/3rdparty/ext_fftw3/CMakeLists.txt index 474363952a..76a92661b4 100755 --- a/3rdparty/ext_fftw3/CMakeLists.txt +++ b/3rdparty/ext_fftw3/CMakeLists.txt @@ -1,50 +1,66 @@ SET(PREFIX_ext_fftw3 "${EXTPREFIX}" ) if (MSVC) if (${CMAKE_GENERATOR} STREQUAL "Visual Studio 14 2015 Win64") ExternalProject_Add( ext_fftw3 DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} URL http://files.kde.org/krita/build/dependencies/fftw-3.3.4-dll64.zip URL_MD5 c4ec1e6d84e7a8b1cd61121d11d44ee4 INSTALL_DIR ${PREFIX_ext_fftw3} CONFIGURE_COMMAND "" BUILD_COMMAND ${CMAKE_COMMAND} -E echo deploying fftw3 64 binary INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory /bin ${PREFIX_ext_fftw3}/bin COMMAND ${CMAKE_COMMAND} -E copy_directory /lib ${PREFIX_ext_fftw3}/lib COMMAND ${CMAKE_COMMAND} -E copy_directory /include ${PREFIX_ext_fftw3}/include UPDATE_COMMAND "" ALWAYS 0 ) else() ExternalProject_Add( ext_fftw3 DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} URL http://files.kde.org/krita/build/dependencies/fftw-3.3.4-dll32.zip URL_MD5 03754fe2a7fbaf983b0cc9a728e0a5b3 INSTALL_DIR ${PREFIX_ext_fftw3} CONFIGURE_COMMAND "" BUILD_COMMAND ${CMAKE_COMMAND} -E echo deploying fftw3 32 binary INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory /bin ${PREFIX_ext_fftw3}/bin COMMAND ${CMAKE_COMMAND} -E copy_directory /lib ${PREFIX_ext_fftw3}/lib COMMAND ${CMAKE_COMMAND} -E copy_directory /include ${PREFIX_ext_fftw3}/include UPDATE_COMMAND "" ALWAYS 0 ) endif() -else (MSVC) +elseif (MINGW) + ExternalProject_Add( ext_fftw3 + DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} + URL http://files.kde.org/krita/build/dependencies/fftw-3.3.4-dll64.zip + URL_MD5 c4ec1e6d84e7a8b1cd61121d11d44ee4 + + INSTALL_DIR ${PREFIX_ext_fftw3} + CONFIGURE_COMMAND "" + BUILD_COMMAND ${CMAKE_COMMAND} -E echo deploying fftw3 64 binary + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory /bin ${PREFIX_ext_fftw3}/bin + COMMAND ${CMAKE_COMMAND} -E copy_directory /lib ${PREFIX_ext_fftw3}/lib + COMMAND ${CMAKE_COMMAND} -E copy_directory /include ${PREFIX_ext_fftw3}/include + + UPDATE_COMMAND "" + ALWAYS 0 + ) +else () ExternalProject_Add( ext_fftw3 DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} URL http://files.kde.org/krita/build/dependencies/fftw-3.3.4.tar.gz URL_MD5 2edab8c06b24feeb3b82bbb3ebf3e7b3 INSTALL_DIR ${PREFIX_ext_fftw3} CONFIGURE_COMMAND /configure --prefix=${PREFIX_ext_fftw3} ${GLOBAL_AUTOMAKE_PROFILE} --enable-static=false --enable-shared=yes BUILD_COMMAND make INSTALL_COMMAND make install UPDATE_COMMAND "" ALWAYS 0 ) -endif (MSVC) +endif () diff --git a/3rdparty/ext_fontconfig/CMakeLists.txt b/3rdparty/ext_fontconfig/CMakeLists.txt index 1f385d3cd8..9bd9075895 100755 --- a/3rdparty/ext_fontconfig/CMakeLists.txt +++ b/3rdparty/ext_fontconfig/CMakeLists.txt @@ -1,13 +1,13 @@ SET(PREFIX_ext_fontconfig "${EXTPREFIX}" ) ExternalProject_Add( ext_fontconfig DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/fontconfig-2.11.94.tar.gz - URL_MD5 479be870c7f83f15f87bac085b61d641 + URL http://files.kde.org/krita/build/dependencies/fontconfig-2.12.0.tar.gz + URL_MD5 d8b056231abcb6257db6dc6d745360b2 CONFIGURE_COMMAND /configure --prefix=${PREFIX_ext_fontconfig} ${GLOBAL_AUTOMAKE_PROFILE} BUILD_COMMAND make INSTALL_COMMAND make install UPDATE_COMMAND "" ALWAYS 0 ) diff --git a/3rdparty/ext_frameworks/CMakeLists.txt b/3rdparty/ext_frameworks/CMakeLists.txt index 0f7278813e..d1074cee57 100755 --- a/3rdparty/ext_frameworks/CMakeLists.txt +++ b/3rdparty/ext_frameworks/CMakeLists.txt @@ -1,241 +1,239 @@ SET(EXTPREFIX_frameworks "${EXTPREFIX}" ) # # All needed frameworks: # # Archive # Config # WidgetsAddons # Completion # CoreAddons # GuiAddons # I18n # ItemModels # ItemViews # WindowSystem # On Linux: # KCrash ExternalProject_Add( ext_extra_cmake_modules DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/extra-cmake-modules-5.17.0.zip - URL_MD5 c302bb1771b7c366c6eeebf3742b2f54 + URL http://download.kde.org/stable/frameworks/5.24/extra-cmake-modules-5.24.0.zip + URL_MD5 e0c19ba97ebd964f9bdc9110c64ce96a + PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/ecm_install_to_share.diff INSTALL_DIR ${EXTPREFIX_frameworks} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_frameworks} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DCMAKE_SYSTEM_PREFIX_PATH=${EXTPREFIX} -DBUILD_TESTING=false UPDATE_COMMAND "" ALWAYS 0 ) ExternalProject_Add( ext_karchive DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/karchive-5.17.0.zip - URL_MD5 d6bf0fcb6dbcffe1328b75f427593fd0 + URL http://download.kde.org/stable/frameworks/5.24/karchive-5.24.0.zip + URL_MD5 739843accfe9bd85ab2f1582722cf01e INSTALL_DIR ${EXTPREFIX_frameworks} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_frameworks} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DCMAKE_SYSTEM_PREFIX_PATH=${EXTPREFIX} -DBUILD_TESTING=false UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_extra_cmake_modules ) ExternalProject_Add( ext_kconfig DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/kconfig-5.17.0.zip - URL_MD5 f321e98ce591fdb3632e04c770a5b0c6 + URL http://download.kde.org/stable/frameworks/5.24/kconfig-5.24.0.zip + URL_MD5 f87ecff795eb76e4ec6561758a5baf87 PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/kconfig.diff INSTALL_DIR ${EXTPREFIX_frameworks} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_frameworks} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DCMAKE_SYSTEM_PREFIX_PATH=${EXTPREFIX} -DBUILD_TESTING=false UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_karchive ) ExternalProject_Add( ext_kwidgetsaddons DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/kwidgetsaddons-5.17.0.zip - URL_MD5 bd32206b1973a3a13e7c405f135479c7 + URL http://download.kde.org/stable/frameworks/5.24/kwidgetsaddons-5.24.0.zip + URL_MD5 0e399b427814a4814c65a3cf407f9d79 INSTALL_DIR ${EXTPREFIX_frameworks} PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/kwidgetsaddons.diff CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_frameworks} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DCMAKE_SYSTEM_PREFIX_PATH=${EXTPREFIX} -DBUILD_TESTING=false UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_kconfig ) ExternalProject_Add( ext_kcompletion DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/kcompletion-5.17.0.zip - URL_MD5 f853f34a8bb8433ced2d7c46148361ce + URL http://download.kde.org/stable/frameworks/5.24/kcompletion-5.24.0.zip + URL_MD5 e8764251ab45005aa81dba242852300c INSTALL_DIR ${EXTPREFIX_frameworks} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_frameworks} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DCMAKE_SYSTEM_PREFIX_PATH=${EXTPREFIX} -DBUILD_TESTING=false UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_kwidgetsaddons ) ExternalProject_Add( ext_kcoreaddons DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/kcoreaddons-5.17.0.zip - URL_MD5 75145cb1bc3a78fe4f13ce4383e76947 + URL http://download.kde.org/stable/frameworks/5.24/kcoreaddons-5.24.0.zip + URL_MD5 2885878625b19ad0300ef3770b897112 INSTALL_DIR ${EXTPREFIX_frameworks} PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/desktoptojson.diff CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_frameworks} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DCMAKE_SYSTEM_PREFIX_PATH=${EXTPREFIX} -DBUILD_TESTING=false UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_kcompletion ) ExternalProject_Add( ext_kguiaddons DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/kguiaddons-5.17.0.zip - URL_MD5 43b49b25d3ee9025d7172033d255e3b5 + URL http://download.kde.org/stable/frameworks/5.24/kguiaddons-5.24.0.zip + URL_MD5 9bdadbc57d0634816ef80ee9798c3d6c INSTALL_DIR ${EXTPREFIX_frameworks} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_frameworks} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DCMAKE_SYSTEM_PREFIX_PATH=${EXTPREFIX} -DBUILD_TESTING=false UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_kcoreaddons ) ExternalProject_Add( ext_ki18n DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/ki18n-5.17.0.zip - URL_MD5 7d60380d09f98defbf878ea9daba0fbb + URL http://download.kde.org/stable/frameworks/5.24/ki18n-5.24.0.zip + URL_MD5 5724e8af1c1edc9ad24a17a0d94d80c8 INSTALL_DIR ${EXTPREFIX_frameworks} PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/ki18n.diff COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/ki18n-appdatalocation.diff CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_frameworks} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DCMAKE_SYSTEM_PREFIX_PATH=${EXTPREFIX} -DBUILD_TESTING=false UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_kguiaddons ) ExternalProject_Add( ext_kitemmodels DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/kitemmodels-5.17.0.zip - URL_MD5 708504fd52db768093baac3666503bc3 + URL http://download.kde.org/stable/frameworks/5.24/kitemmodels-5.24.0.zip + URL_MD5 ff41589f48395fc01d5fc7887593779d INSTALL_DIR ${EXTPREFIX_frameworks} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_frameworks} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DCMAKE_SYSTEM_PREFIX_PATH=${EXTPREFIX} -DBUILD_TESTING=false UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_ki18n ) ExternalProject_Add( ext_kitemviews DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/kitemviews-5.17.0.zip - URL_MD5 9280c5e7e669cd6241b62c5a6958202d + URL http://download.kde.org/stable/frameworks/5.24/kitemviews-5.24.0.zip + URL_MD5 33f638d027a3011a6a69f7484eee3287 INSTALL_DIR ${EXTPREFIX_frameworks} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_frameworks} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DCMAKE_SYSTEM_PREFIX_PATH=${EXTPREFIX} -DBUILD_TESTING=false UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_kitemmodels ) ExternalProject_Add( ext_kimageformats DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/kimageformats-02-02-2016.tgz - URL_MD5 09a923703832181455bc61d67c692040 + URL http://download.kde.org/stable/frameworks/5.24/kimageformats-5.24.0.zip + URL_MD5 c1964516bcb2bfe882858f0c0913deb5 INSTALL_DIR ${EXTPREFIX_frameworks} PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/kimageformats.diff CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_frameworks} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DCMAKE_SYSTEM_PREFIX_PATH=${EXTPREFIX} -DBUILD_TESTING=false UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_kitemviews ) ExternalProject_Add( ext_kwindowsystem DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/kwindowsystem-5.17.0.zip - URL_MD5 990c241d7fa88774ccd5176ec6bdcbdc + URL http://download.kde.org/stable/frameworks/5.24/kwindowsystem-5.24.0.zip + URL_MD5 5915e4f63ded983af6db7db3a6cbae1a INSTALL_DIR ${EXTPREFIX_frameworks} PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/kwindowsystem-x11.diff CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_frameworks} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DCMAKE_SYSTEM_PREFIX_PATH=${EXTPREFIX} -DBUILD_TESTING=false UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_kimageformats ) - -if (LINUX) ExternalProject_Add( ext_kcrash DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/kcrash-5.17.0.zip - URL_MD5 b6b865aff352d697928a9165c6564f8f + URL http://download.kde.org/stable/frameworks/5.24/kcrash-5.24.0.zip + URL_MD5 a2e41e6650105fc3ac8fbd44afbae4fe INSTALL_DIR ${EXTPREFIX_frameworks} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_frameworks} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DCMAKE_SYSTEM_PREFIX_PATH=${EXTPREFIX} -DBUILD_TESTING=false UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_kwindowsystem ) -endif() diff --git a/3rdparty/ext_frameworks/ecm_install_to_share.diff b/3rdparty/ext_frameworks/ecm_install_to_share.diff new file mode 100644 index 0000000000..b38eabbd88 --- /dev/null +++ b/3rdparty/ext_frameworks/ecm_install_to_share.diff @@ -0,0 +1,32 @@ +commit a4170399404bf32e874e35d35f8a66703b2fff92 +Author: Boudewijn Rempt +Date: Sat Jul 30 14:33:10 2016 +0200 + + Revert "Use "${BIN_INSTALL_DIR}/data" for DATAROOTDIR on Windows." + + This reverts commit 2503481e4537b88d76b4a596f519cb3311e1ca2a. + +diff --git a/kde-modules/KDEInstallDirs.cmake b/kde-modules/KDEInstallDirs.cmake +index e84c0b3..1773706 100644 +--- a/kde-modules/KDEInstallDirs.cmake ++++ b/kde-modules/KDEInstallDirs.cmake +@@ -489,15 +489,10 @@ _define_absolute(SHAREDSTATEDIR "com" + + + +-if (WIN32) +- _define_relative(DATAROOTDIR BINDIR "data" +- "read-only architecture-independent data root" +- SHARE_INSTALL_PREFIX) +-else() +- _define_absolute(DATAROOTDIR "share" +- "read-only architecture-independent data root" +- SHARE_INSTALL_PREFIX) +-endif() ++ ++_define_absolute(DATAROOTDIR "share" ++ "read-only architecture-independent data root" ++ SHARE_INSTALL_PREFIX) + + _define_relative(DATADIR DATAROOTDIR "" + "read-only architecture-independent data" diff --git a/3rdparty/ext_frameworks/kconfig.diff b/3rdparty/ext_frameworks/kconfig.diff index 78ec89c164..75df9fd9d3 100644 --- a/3rdparty/ext_frameworks/kconfig.diff +++ b/3rdparty/ext_frameworks/kconfig.diff @@ -1,271 +1,133 @@ -diff --git a/autotests/kconfig_compiler/test4main.cpp b/autotests/kconfig_compiler/test4main.cpp -index b4569ba..1e1f017 100644 ---- a/autotests/kconfig_compiler/test4main.cpp -+++ b/autotests/kconfig_compiler/test4main.cpp -@@ -34,7 +34,7 @@ int main(int argc, char **argv) - group.writeEntry(QLatin1String("foo bar"), QStringLiteral("Value")); - } - Test4 *t = Test4::self(); -- bool ok = QFile::exists(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/test4rc"); -+ bool ok = QFile::exists(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/test4rc"); - if (!ok) { - qWarning() << "config file was not created!"; - } -diff --git a/autotests/kconfignokdehometest.cpp b/autotests/kconfignokdehometest.cpp -index d9712ee..b393361 100644 ---- a/autotests/kconfignokdehometest.cpp -+++ b/autotests/kconfignokdehometest.cpp -@@ -37,7 +37,7 @@ private Q_SLOTS: - void KConfigNoKdeHomeTest::testNoKdeHome() - { - QStandardPaths::setTestModeEnabled(true); -- QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); -+ QString configPath = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation); - QDir configDir(configPath); - QVERIFY(configDir.removeRecursively()); - QVERIFY(!QFile::exists(configPath)); -diff --git a/autotests/kconfigskeletontest.cpp b/autotests/kconfigskeletontest.cpp -index 898366c..e39b488 100644 ---- a/autotests/kconfigskeletontest.cpp -+++ b/autotests/kconfigskeletontest.cpp -@@ -37,7 +37,7 @@ QTEST_MAIN(KConfigSkeletonTest) - - void KConfigSkeletonTest::init() - { -- QFile::remove(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/kconfigskeletontestrc"); -+ QFile::remove(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/kconfigskeletontestrc"); - s = new KConfigSkeleton("kconfigskeletontestrc"); - s->setCurrentGroup("MyGroup"); - itemBool = s->addItemBool("MySetting1", mMyBool, DEFAULT_SETTING1); diff --git a/autotests/kconfigtest.cpp b/autotests/kconfigtest.cpp -index e92197f..b64535a 100644 +index 2b905b5..8c72d58 100644 --- a/autotests/kconfigtest.cpp +++ b/autotests/kconfigtest.cpp -@@ -80,7 +80,7 @@ QTEST_MAIN(KConfigTest) - #define TEST_SUBDIR "kconfigtest_subdir/" - - static inline QString testConfigDir() { -- return QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/" TEST_SUBDIR; -+ return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/" TEST_SUBDIR; - } - - static inline QString kdeGlobalsPath() { -@@ -263,7 +263,7 @@ static QList readLinesFrom(const QString &path) - - static QList readLines(const char *fileName = TEST_SUBDIR "kconfigtest") - { -- const QString path = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); -+ const QString path = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation); - Q_ASSERT(!path.isEmpty()); - return readLinesFrom(path + '/' + fileName); - } -@@ -315,7 +315,7 @@ void KConfigTest::testRevertAllEntries() - void KConfigTest::testSimple() - { - // kdeglobals (which was created in initTestCase) must be found this way: -- const QStringList kdeglobals = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, QLatin1String("kdeglobals")); -+ const QStringList kdeglobals = QStandardPaths::locateAll(QStandardPaths::AppConfigLocation, QLatin1String("kdeglobals")); - QVERIFY(!kdeglobals.isEmpty()); - - KConfig sc2(TEST_SUBDIR "kconfigtest"); -@@ -383,7 +383,7 @@ void KConfigTest::testDefaults() - group.writeEntry("entry2", Value2); - QVERIFY(group.sync()); - -- config.addConfigSources(QStringList() << QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + '/' + defaultsFile); -+ config.addConfigSources(QStringList() << QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + '/' + defaultsFile); - - config.setReadDefaults(true); - QCOMPARE(group.readEntry("entry1", QString()), Default); -@@ -405,7 +405,7 @@ void KConfigTest::testDefaults() - - // Check that everything is OK on disk, too - KConfig reader(TEST_SUBDIR "defaulttest", KConfig::NoGlobals); -- reader.addConfigSources(QStringList() << QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + '/' + defaultsFile); -+ reader.addConfigSources(QStringList() << QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + '/' + defaultsFile); - KConfigGroup readerGroup = reader.group("any group"); - QCOMPARE(readerGroup.readEntry("entry1", QString()), Default); - QCOMPARE(readerGroup.readEntry("entry2", QString()), QString()); +@@ -570,7 +570,7 @@ void KConfigTest::testPathQtHome() + qunsetenv("QT_CACHE_HOME"); + qunsetenv("QT_CONFIG_HOME"); + QVERIFY(group.hasKey("dataDir")); +- QCOMPARE(group.readEntry("dataDir", QString()), QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation).append(QStringLiteral("/kconfigtest"))); ++ QCOMPARE(group.readEntry("dataDir", QString()), QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).append(QStringLiteral("/kconfigtest"))); + QVERIFY(group.hasKey("cacheDir")); + QCOMPARE(group.readEntry("cacheDir", QString()), QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation).append(QStringLiteral("/kconfigtest"))); + QVERIFY(group.hasKey("configDir")); diff --git a/autotests/kdesktopfiletest.cpp b/autotests/kdesktopfiletest.cpp -index a90faf3..f752960 100644 +index 393a6a0..083626d 100644 --- a/autotests/kdesktopfiletest.cpp +++ b/autotests/kdesktopfiletest.cpp -@@ -199,7 +199,7 @@ void KDesktopFileTest::testIsAuthorizedDesktopFile() - qWarning("Skipping test for http_cache_cleaner.desktop, not found. kio not installed?"); - } - -- const QString autostartFile = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("autostart/plasma-desktop.desktop")); -+ const QString autostartFile = QStandardPaths::locate(QStandardPaths::AppConfigLocation, QStringLiteral("autostart/plasma-desktop.desktop")); - if (!autostartFile.isEmpty()) { - QVERIFY(KDesktopFile::isAuthorizedDesktopFile(autostartFile)); +@@ -201,7 +201,7 @@ void KDesktopFileTest::testIsAuthorizedDesktopFile() + QVERIFY(QFile::exists(fileName)); + QVERIFY(!KDesktopFile::isAuthorizedDesktopFile(fileName)); + +- const QString installedFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("/kservices5/http_cache_cleaner.desktop")); ++ const QString installedFile = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("/kservices5/http_cache_cleaner.desktop")); + if (!installedFile.isEmpty()) { + QVERIFY(KDesktopFile::isAuthorizedDesktopFile(installedFile)); } else { -diff --git a/autotests/ksharedconfigtest.cpp b/autotests/ksharedconfigtest.cpp -index ae3d40a..7228629 100644 ---- a/autotests/ksharedconfigtest.cpp -+++ b/autotests/ksharedconfigtest.cpp -@@ -39,7 +39,7 @@ void KSharedConfigTest::initTestCase() - { - QStandardPaths::enableTestMode(true); - -- m_path = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) -+ m_path = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) - + QLatin1Char('/') + QCoreApplication::applicationName() + QStringLiteral("rc"); - QFile::remove(m_path); - } diff --git a/autotests/test_kconf_update.cpp b/autotests/test_kconf_update.cpp -index 4180619..40d2f41 100644 +index 4180619..32cd88a 100644 --- a/autotests/test_kconf_update.cpp +++ b/autotests/test_kconf_update.cpp -@@ -330,8 +330,8 @@ void TestKConfUpdate::test() - if (useVersion5) - updContent.prepend("Version=5\n"); +@@ -625,7 +625,7 @@ void TestKConfUpdate::testScript() -- QString oldConfPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + oldConfName; -- QString newConfPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + newConfName; -+ QString oldConfPath = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + QLatin1Char('/') + oldConfName; -+ QString newConfPath = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + QLatin1Char('/') + newConfName; + QSharedPointer updFile(writeUpdFile(updContent)); - QFile::remove(oldConfPath); - QFile::remove(newConfPath); -@@ -631,7 +631,7 @@ void TestKConfUpdate::testScript() +- const QString scriptDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/kconf_update"; ++ const QString scriptDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/kconf_update"; + QVERIFY(QDir().mkpath(scriptDir)); + QString scriptPath = scriptDir + "/test.sh"; writeFile(scriptPath, updScript); - QCOMPARE(readFile(scriptPath), updScript); - -- QString confPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + "testrc"; -+ QString confPath = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + QLatin1Char('/') + "testrc"; - writeFile(confPath, oldConfContent); - QCOMPARE(readFile(confPath), oldConfContent); - +diff --git a/docs/options.md b/docs/options.md +index ba7e2d8..a960a7d 100644 +--- a/docs/options.md ++++ b/docs/options.md +@@ -96,4 +96,4 @@ They are: + + `$QT_CACHE_HOME` - QStandardPaths::GenericConfigLocation + `$QT_CONFIG_HOME` - QStandardPaths::GenericConfigLocation +- `$QT_DATA_HOME` - QStandardPaths::GenericDataLocation ++ `$QT_DATA_HOME` - QStandardPaths::AppDataLocation diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp -index 07fa6f5..c3fc16d 100644 +index ad52da9..0401ced 100644 --- a/src/core/kconfig.cpp +++ b/src/core/kconfig.cpp -@@ -66,7 +66,7 @@ KConfigPrivate::KConfigPrivate(KConfig::OpenFlags flags, - bFileImmutable(false), bForceGlobal(false), bSuppressGlobal(false), - configState(KConfigBase::NoAccess) - { -- sGlobalFileName = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1String("/kdeglobals"); -+ sGlobalFileName = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + QLatin1String("/kdeglobals"); - - static QBasicAtomicInt use_etc_kderc = Q_BASIC_ATOMIC_INITIALIZER(-1); - if (use_etc_kderc.load() < 0) { -@@ -582,7 +582,7 @@ void KConfigPrivate::changeFileName(const QString &name) - fileName = KConfig::mainConfigName(); - file = QStandardPaths::writableLocation(resourceType) + QLatin1Char('/') + fileName; - } else if (wantGlobals()) { // accessing "kdeglobals" by specifying no filename and NoCascade - XXX used anywhere? -- resourceType = QStandardPaths::GenericConfigLocation; -+ resourceType = QStandardPaths::AppConfigLocation; - fileName = QStringLiteral("kdeglobals"); - file = sGlobalFileName; - } else { -@@ -650,8 +650,8 @@ QStringList KConfigPrivate::getGlobalFiles() const - { - QMutexLocker locker(&s_globalFilesMutex); - if (s_globalFiles()->isEmpty()) { -- const QStringList paths1 = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, QStringLiteral("kdeglobals")); -- const QStringList paths2 = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, QStringLiteral("system.kdeglobals")); -+ const QStringList paths1 = QStandardPaths::locateAll(QStandardPaths::AppConfigLocation, QStringLiteral("kdeglobals")); -+ const QStringList paths2 = QStandardPaths::locateAll(QStandardPaths::AppConfigLocation, QStringLiteral("system.kdeglobals")); - - const bool useEtcKderc = !etc_kderc.isEmpty(); - s_globalFiles()->reserve(paths1.size() + paths2.size() + (useEtcKderc ? 1 : 0)); -diff --git a/src/core/kconfig.h b/src/core/kconfig.h -index 6cc7323..30a1e52 100644 ---- a/src/core/kconfig.h -+++ b/src/core/kconfig.h -@@ -128,7 +128,7 @@ public: - * @sa KSharedConfig::openConfig(const QString&, OpenFlags, QStandardPaths::StandardLocation) - */ - explicit KConfig(const QString &file = QString(), OpenFlags mode = FullConfig, -- QStandardPaths::StandardLocation type = QStandardPaths::GenericConfigLocation); -+ QStandardPaths::StandardLocation type = QStandardPaths::AppConfigLocation); - - /** - * @internal -@@ -142,7 +142,7 @@ public: - * - * @since 4.1 - */ -- KConfig(const QString &file, const QString &backend, QStandardPaths::StandardLocation type = QStandardPaths::GenericConfigLocation); -+ KConfig(const QString &file, const QString &backend, QStandardPaths::StandardLocation type = QStandardPaths::AppConfigLocation); - - virtual ~KConfig(); - +@@ -228,7 +228,7 @@ QString KConfigPrivate::expandString(const QString &value) + env = QString::fromLocal8Bit(pEnv.constData()); + } else { + if (aVarName == QStringLiteral("QT_DATA_HOME")) { +- env = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); ++ env = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); + } else if (aVarName == QStringLiteral("QT_CONFIG_HOME")) { + env = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); + } else if (aVarName == QStringLiteral("QT_CACHE_HOME")) { diff --git a/src/core/kdesktopfile.cpp b/src/core/kdesktopfile.cpp -index eda7c29..8d14189 100644 +index 4a55030..e28e5df 100644 --- a/src/core/kdesktopfile.cpp +++ b/src/core/kdesktopfile.cpp -@@ -81,10 +81,10 @@ QString KDesktopFile::locateLocal(const QString &path) - QString relativePath; - QChar plus(QLatin1Char('/')); - // Relative to config? (e.g. for autostart) -- Q_FOREACH (const QString &dir, QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation)) { -+ Q_FOREACH (const QString &dir, QStandardPaths::standardLocations(QStandardPaths::AppConfigLocation)) { +@@ -88,7 +88,7 @@ QString KDesktopFile::locateLocal(const QString &path) + } + } + // Relative to xdg data dir? (much more common) +- Q_FOREACH (const QString &dir, QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation)) { ++ Q_FOREACH (const QString &dir, QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)) { if (path.startsWith(dir + plus)) { relativePath = dir.mid(path.length() + 1); -- return QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + relativePath; -+ return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + QLatin1Char('/') + relativePath; } +@@ -97,7 +97,7 @@ QString KDesktopFile::locateLocal(const QString &path) + // What now? The desktop file doesn't come from XDG_DATA_DIRS. Use filename only and hope for the best. + relativePath = path.mid(path.lastIndexOf(QLatin1Char('/')) + 1); } - // Relative to xdg data dir? (much more common) -@@ -143,7 +143,7 @@ bool KDesktopFile::isAuthorizedDesktopFile(const QString &path) +- return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + relativePath; ++ return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1Char('/') + relativePath; + } + + bool KDesktopFile::isDesktopFile(const QString &path) +@@ -134,7 +134,7 @@ bool KDesktopFile::isAuthorizedDesktopFile(const QString &path) } } - const QString autostartDir = QStringLiteral("autostart/"); -- Q_FOREACH (const QString &xdgDataPrefix, QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation)) { -+ Q_FOREACH (const QString &xdgDataPrefix, QStandardPaths::standardLocations(QStandardPaths::AppConfigLocation)) { + const QString servicesDir = QStringLiteral("kservices5/"); // KGlobal::dirs()->xdgDataRelativePath("services") +- Q_FOREACH (const QString &xdgDataPrefix, QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation)) { ++ Q_FOREACH (const QString &xdgDataPrefix, QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)) { if (QDir(xdgDataPrefix).exists()) { const QString prefix = QFileInfo(xdgDataPrefix).canonicalFilePath(); - if (realPath.startsWith(prefix + QLatin1Char('/') + autostartDir, sensitivity)) { -diff --git a/src/core/kdesktopfile.h b/src/core/kdesktopfile.h -index f3b293f..990465a 100644 ---- a/src/core/kdesktopfile.h -+++ b/src/core/kdesktopfile.h -@@ -45,7 +45,7 @@ public: - * - * @param resourceType Allows you to change what sort of resource - * to search for if @p fileName is not absolute. -- * For instance, you might want to specify GenericConfigLocation. -+ * For instance, you might want to specify AppConfigLocation. - * @param fileName The name or path of the desktop file. If it - * is not absolute, it will be located - * using the resource type @p resType. -diff --git a/src/core/ksharedconfig.cpp b/src/core/ksharedconfig.cpp -index 8eb1308..b0e3c1c 100644 ---- a/src/core/ksharedconfig.cpp -+++ b/src/core/ksharedconfig.cpp -@@ -102,7 +102,7 @@ KSharedConfigPtr KSharedConfig::openConfig(const QString &_fileName, - - KSharedConfigPtr ptr(new KSharedConfig(fileName, flags, resType)); - -- if (_fileName.isEmpty() && flags == FullConfig && resType == QStandardPaths::GenericConfigLocation) { -+ if (_fileName.isEmpty() && flags == FullConfig && resType == QStandardPaths::AppConfigLocation) { - list->mainConfig = ptr; - - const bool isMainThread = !qApp || QThread::currentThread() == qApp->thread(); -diff --git a/src/core/ksharedconfig.h b/src/core/ksharedconfig.h -index 2d08379..804d4b8 100644 ---- a/src/core/ksharedconfig.h -+++ b/src/core/ksharedconfig.h -@@ -73,7 +73,7 @@ public: - */ - static KSharedConfig::Ptr openConfig(const QString &fileName = QString(), - OpenFlags mode = FullConfig, -- QStandardPaths::StandardLocation type = QStandardPaths::GenericConfigLocation); -+ QStandardPaths::StandardLocation type = QStandardPaths::AppConfigLocation); - - virtual ~KSharedConfig(); - + if (realPath.startsWith(prefix + QLatin1Char('/') + servicesDir, sensitivity)) { diff --git a/src/kconf_update/kconf_update.cpp b/src/kconf_update/kconf_update.cpp -index 9567c2d..ca5f824 100644 +index 2acd720..d89ae3d 100644 --- a/src/kconf_update/kconf_update.cpp +++ b/src/kconf_update/kconf_update.cpp -@@ -447,7 +447,7 @@ void KonfUpdate::gotFile(const QString &_file) - delete m_oldConfig2; - m_oldConfig2 = Q_NULLPTR; +@@ -125,7 +125,7 @@ KonfUpdate::KonfUpdate(QCommandLineParser *parser) + m_bUseConfigInfo = false; + if (parser->isSet(QStringLiteral("check"))) { + m_bUseConfigInfo = true; +- const QString file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kconf_update/" + parser->value(QStringLiteral("check"))); ++ const QString file = QStandardPaths::locate(QStandardPaths::AppDataLocation, "kconf_update/" + parser->value(QStringLiteral("check"))); + if (file.isEmpty()) { + qWarning("File '%s' not found.", parser->value(QStringLiteral("check")).toLocal8Bit().data()); + log() << "File '" << parser->value(QStringLiteral("check")) << "' passed on command line not found" << endl; +@@ -177,7 +177,7 @@ KonfUpdate::log() + { + if (!m_textStream) { + #if 0 +- QString dir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + "kconf_update/log"; ++ QString dir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1Char('/') + "kconf_update/log"; + QDir().mkpath(dir); + QString file = dir + "/update.log"; + m_file = new QFile(file); +@@ -206,7 +206,7 @@ QStringList KonfUpdate::findUpdateFiles(bool dirtyOnly) + { + QStringList result; + +- const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("kconf_update"), QStandardPaths::LocateDirectory); ++ const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, QStringLiteral("kconf_update"), QStandardPaths::LocateDirectory); + Q_FOREACH (const QString &d, dirs) { + const QDir dir(d); + +@@ -760,7 +760,7 @@ void KonfUpdate::gotScript(const QString &_script) + return; + } -- QString file = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + m_oldFile; -+ QString file = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + QLatin1Char('/') + m_oldFile; - QFileInfo info(file); - if (info.exists() && info.size() == 0) { - // Delete empty file. +- QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kconf_update/") + script); ++ QString path = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("kconf_update/") + script); + if (path.isEmpty()) { + if (interpreter.isEmpty()) { + path = CMAKE_INSTALL_PREFIX "/" LIB_INSTALL_DIR "/kconf_update_bin/" + script; diff --git a/3rdparty/ext_frameworks/ki18n-appdatalocation.diff b/3rdparty/ext_frameworks/ki18n-appdatalocation.diff index 098a38d991..b55c02155f 100644 --- a/3rdparty/ext_frameworks/ki18n-appdatalocation.diff +++ b/3rdparty/ext_frameworks/ki18n-appdatalocation.diff @@ -1,22 +1,22 @@ diff --git a/src/kcatalog.cpp b/src/kcatalog.cpp -index 7711e9b..b6280ed 100644 +index 6682d62..d975c57 100644 --- a/src/kcatalog.cpp +++ b/src/kcatalog.cpp -@@ -112,7 +112,7 @@ QString KCatalog::catalogLocaleDir(const QByteArray &domain, +@@ -118,7 +118,7 @@ QString KCatalog::catalogLocaleDir(const QByteArray &domain, { - QString relpath = QString::fromLatin1("%1/LC_MESSAGES/%2.mo") + QString relpath = QStringLiteral("%1/LC_MESSAGES/%2.mo") .arg(language, QFile::decodeName(domain)); - QString file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, + QString file = QStandardPaths::locate(QStandardPaths::AppDataLocation, - QString::fromLatin1("locale/") + relpath); + QStringLiteral("locale/") + relpath); QString localeDir; if (file.isEmpty()) { -@@ -127,7 +127,7 @@ QString KCatalog::catalogLocaleDir(const QByteArray &domain, +@@ -133,7 +133,7 @@ QString KCatalog::catalogLocaleDir(const QByteArray &domain, QSet KCatalog::availableCatalogLanguages(const QByteArray &domain_) { QString domain = QFile::decodeName(domain_); - QStringList localeDirPaths = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, + QStringList localeDirPaths = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, - QString::fromLatin1("locale"), + QStringLiteral("locale"), QStandardPaths::LocateDirectory); QSet availableLanguages; diff --git a/3rdparty/ext_freetype/CMakeLists.txt b/3rdparty/ext_freetype/CMakeLists.txt index 0e651f08f3..e53643a284 100755 --- a/3rdparty/ext_freetype/CMakeLists.txt +++ b/3rdparty/ext_freetype/CMakeLists.txt @@ -1,12 +1,12 @@ SET(PREFIX_ext_freetype "${EXTPREFIX}" ) ExternalProject_Add( ext_freetype DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/freetype-2.6.tar.gz - URL_MD5 1d733ea6c1b7b3df38169fbdbec47d2b + URL http://files.kde.org/krita/build/dependencies/freetype-2.6.5.tar.gz + URL_MD5 31b2276515d9ee1c7f37d9c9f4f3145a INSTALL_DIR ${PREFIX_ext_freetype} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_freetype} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} UPDATE_COMMAND "" ALWAYS 0 ) diff --git a/3rdparty/ext_gettext/CMakeLists.txt b/3rdparty/ext_gettext/CMakeLists.txt index e2bd0d58ba..b72178076b 100644 --- a/3rdparty/ext_gettext/CMakeLists.txt +++ b/3rdparty/ext_gettext/CMakeLists.txt @@ -1,32 +1,32 @@ SET(PREFIX_ext_gettext "${EXTPREFIX}" ) -if (MSVC) +if (MSVC OR MINGW) ExternalProject_Add( ext_gettext DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} URL http://files.kde.org/krita/build/dependencies/gettext-0.18.tar.gz URL_MD5 d52a3e061032a1ed13856d42fc86f0fd PATCH_COMMAND ${PATCH_COMMAND} --binary -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/gettext-0.18-20130319.diff INSTALL_DIR ${PREFIX_ext_gettext} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_gettext} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_patch ext_iconv ) -else (MSVC) +else (MSVC OR MINGW) ExternalProject_Add( ext_gettext DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/gettext-0.19.6.tar.gz - URL_MD5 6d1447f8c5c45c329371ef4bfe7d79a5 + URL http://files.kde.org/krita/build/dependencies/gettext-0.19.8.tar.gz + URL_MD5 e4fffc004f21596becd1055cf36be31d INSTALL_DIR ${PREFIX_ext_gettext} - CONFIGURE_COMMAND /configure --prefix=${PREFIX_ext_gettext} --disable-java ${GLOBAL_AUTOMAKE_PROFILE} + CONFIGURE_COMMAND /configure --prefix=${PREFIX_ext_gettext} --disable-java ${GLOBAL_AUTOMAKE_PROFILE} --disable-native-java BUILD_COMMAND make INSTALL_COMMAND make install UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_iconv ) -endif (MSVC) +endif (MSVC OR MINGW) diff --git a/3rdparty/ext_gsl/CMakeLists.txt b/3rdparty/ext_gsl/CMakeLists.txt index ff3a62155a..38f32cefd6 100644 --- a/3rdparty/ext_gsl/CMakeLists.txt +++ b/3rdparty/ext_gsl/CMakeLists.txt @@ -1,28 +1,28 @@ # # From https://github.com/ampl/gsl. which adds CMake support to gsl # SET(EXTPREFIX_gsl "${EXTPREFIX}" ) -if (MSVC) +if (MSVC OR MINGW) ExternalProject_Add( ext_gsl DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} GIT_REPOSITORY https://github.com/ampl/gsl.git GIT_TAG 709cc572279e4a56b0e218b834f202c1b3f757af INSTALL_DIR ${EXTPREFIX_gsl} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_gsl} -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} UPDATE_COMMAND "" ALWAYS 0 ) else() ExternalProject_Add( ext_gsl DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} URL http://files.kde.org/krita/build/dependencies/gsl-2.1.tar.gz URL_MD5 625f4105fcf653822a96294c1b801ad4 INSTALL_DIR ${EXTPREFIX_gsl} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_gsl} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DGSL_SHARED=ON UPDATE_COMMAND "" ALWAYS 0 ) endif() diff --git a/3rdparty/ext_iconv/CMakeLists.txt b/3rdparty/ext_iconv/CMakeLists.txt index 4fc37fa762..4087a298af 100755 --- a/3rdparty/ext_iconv/CMakeLists.txt +++ b/3rdparty/ext_iconv/CMakeLists.txt @@ -1,31 +1,31 @@ SET(PREFIX_ext_iconv "${EXTPREFIX}" ) -if (MSVC) +if (MSVC OR MINGW) ExternalProject_Add( ext_iconv DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} URL http://files.kde.org/krita/build/dependencies/win-iconv-0.0.6.tar.bz2 URL_MD5 1e97ed4d9e7379ff0ee22077256e8c58 INSTALL_DIR ${PREFIX_ext_iconv} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_iconv} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} UPDATE_COMMAND "" ALWAYS 0 ) else () ExternalProject_Add( ext_iconv DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} URL http://files.kde.org/krita/build/dependencies/libiconv-1.14.tar.gz URL_MD5 e34509b1623cec449dfeb73d7ce9c6c6 INSTALL_DIR ${PREFIX_ext_iconv} PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/iconv.diff CONFIGURE_COMMAND ./configure --prefix=${PREFIX_ext_iconv} ${GLOBAL_AUTOMAKE_PROFILE} BUILD_COMMAND make INSTALL_COMMAND make install UPDATE_COMMAND "" BUILD_IN_SOURCE 1 ALWAYS 0 ) endif () diff --git a/3rdparty/ext_ilmbase/CMakeLists.txt b/3rdparty/ext_ilmbase/CMakeLists.txt index ebf00e8404..0ca9f2d2ef 100755 --- a/3rdparty/ext_ilmbase/CMakeLists.txt +++ b/3rdparty/ext_ilmbase/CMakeLists.txt @@ -1,24 +1,37 @@ SET(PREFIX_ext_ilmbase "${EXTPREFIX}" ) ExternalProject_Add( ext_ilmbase DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} URL http://files.kde.org/krita/build/dependencies/ilmbase-2.2.0.tar.gz URL_MD5 b540db502c5fa42078249f43d18a4652 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_ilmbase} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DNAMESPACE_VERSIONING=OFF UPDATE_COMMAND "" ALWAYS 0 ) if (MSVC) ExternalProject_Add_Step( ext_ilmbase post_install COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_ilmbase}/lib/Half.dll ${PREFIX_ext_ilmbase}/bin/Half.dll COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_ilmbase}/lib/Iex.dll ${PREFIX_ext_ilmbase}/bin/Iex.dll COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_ilmbase}/lib/Imath.dll ${PREFIX_ext_ilmbase}/bin/Imath.dll COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_ilmbase}/lib/IlmThread.dll ${PREFIX_ext_ilmbase}/bin/IlmThread.dll COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_ilmbase}/lib/IexMath.dll ${PREFIX_ext_ilmbase}/bin/IexMath.dll DEPENDEES install ) endif() + +if (MINGW) + ExternalProject_Add_Step( + ext_ilmbase + post_install + COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_ilmbase}/lib/libHalf.dll ${PREFIX_ext_ilmbase}/bin/libHalf.dll + COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_ilmbase}/lib/libIex.dll ${PREFIX_ext_ilmbase}/bin/libIex.dll + COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_ilmbase}/lib/libImath.dll ${PREFIX_ext_ilmbase}/bin/libImath.dll + COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_ilmbase}/lib/libIlmThread.dll ${PREFIX_ext_ilmbase}/bin/libIlmThread.dll + COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_ilmbase}/lib/libIexMath.dll ${PREFIX_ext_ilmbase}/bin/libIexMath.dll + DEPENDEES install + ) +endif() diff --git a/3rdparty/ext_jpeg/CMakeLists.txt b/3rdparty/ext_jpeg/CMakeLists.txt index b33122d53a..168603644c 100755 --- a/3rdparty/ext_jpeg/CMakeLists.txt +++ b/3rdparty/ext_jpeg/CMakeLists.txt @@ -1,27 +1,27 @@ SET(PREFIX_ext_jpeg "${EXTPREFIX}" ) -if (MSVC) +if (MSVC OR MINGW) ExternalProject_Add( ext_jpeg - DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/libjpeg-turbo-1.4.2.tar.gz - URL_MD5 86b0d5f7507c2e6c21c00219162c3c44 + DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} + URL http://files.kde.org/krita/build/dependencies/libjpeg-turbo-1.5.0.tar.gz + URL_MD5 3fc5d9b6a8bce96161659ae7a9939257 INSTALL_DIR ${PREFIX_ext_jpeg} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_jpeg} -DWITH_SIMD=OFF -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} UPDATE_COMMAND "" ALWAYS 0 ) else() ExternalProject_Add( ext_jpeg DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/libjpeg-turbo-1.4.2.tar.gz - URL_MD5 86b0d5f7507c2e6c21c00219162c3c44 + URL http://files.kde.org/krita/build/dependencies/libjpeg-turbo-1.5.0.tar.gz + URL_MD5 3fc5d9b6a8bce96161659ae7a9939257 CONFIGURE_COMMAND /configure --prefix=${PREFIX_ext_jpeg} ${GLOBAL_AUTOMAKE_PROFILE} --without-simd BUILD_COMMAND make INSTALL_COMMAND make install UPDATE_COMMAND "" ALWAYS 0 ) endif() diff --git a/3rdparty/ext_lcms2/CMakeLists.txt b/3rdparty/ext_lcms2/CMakeLists.txt index 5945813953..032e759376 100755 --- a/3rdparty/ext_lcms2/CMakeLists.txt +++ b/3rdparty/ext_lcms2/CMakeLists.txt @@ -1,29 +1,29 @@ SET(PREFIX_ext_lcms2 "${EXTPREFIX}" ) -if (MSVC) +if (MSVC OR MINGW) ExternalProject_Add( ext_lcms2 DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/lcms2-2.7.tar.gz - URL_MD5 06c1626f625424a811fb4b5eb070839d + URL http://files.kde.org/krita/build/dependencies/lcms2-2.8.tar.gz + URL_MD5 87a5913f1a52464190bb655ad230539c - PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/lcms2-2.4-20130124.diff + PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/lcms2-2.8-20160725.diff INSTALL_DIR ${PREFIX_ext_lcms2} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_lcms2} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_lcms2} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DBUILD_TESTS=FALSE -DBUILD_UTILS=FALSE -DBUILD_STATIC=FALSE UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_patch ) -else (MSVC) +else (MSVC OR MINGW) ExternalProject_Add( ext_lcms2 DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/lcms2-2.7.tar.gz - URL_MD5 06c1626f625424a811fb4b5eb070839d + URL http://files.kde.org/krita/build/dependencies/lcms2-2.8.tar.gz + URL_MD5 87a5913f1a52464190bb655ad230539c CONFIGURE_COMMAND /configure --prefix=${PREFIX_ext_lcms2} ${GLOBAL_AUTOMAKE_PROFILE} BUILD_COMMAND make INSTALL_COMMAND make install UPDATE_COMMAND "" ALWAYS 0 ) -endif (MSVC) +endif (MSVC OR MINGW) diff --git a/3rdparty/ext_lcms2/lcms2-2.4-20130124.diff b/3rdparty/ext_lcms2/lcms2-2.8-20160725.diff old mode 100755 new mode 100644 similarity index 68% rename from 3rdparty/ext_lcms2/lcms2-2.4-20130124.diff rename to 3rdparty/ext_lcms2/lcms2-2.8-20160725.diff index f1b1a44184..f97f06b881 --- a/3rdparty/ext_lcms2/lcms2-2.4-20130124.diff +++ b/3rdparty/ext_lcms2/lcms2-2.8-20160725.diff @@ -1,242 +1,250 @@ -diff -Nru -x '*~' lcms2-2.4.orig/CMakeLists.txt lcms2-2.4/CMakeLists.txt ---- lcms2-2.4.orig/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 -+++ lcms2-2.4/CMakeLists.txt 2013-01-24 11:35:17.013861600 +0100 +commit fa73cd1733b3cf122489d2c757485db0ac7b5cd3 +Author: Boudewijn Rempt +Date: Tue Jul 26 10:12:27 2016 +0200 + + ... + +diff --git a/CMakeLists.txt b/CMakeLists.txt +new file mode 100644 +index 0000000..90cee70 +--- /dev/null ++++ b/CMakeLists.txt @@ -0,0 +1,22 @@ +project(lcms2) + -+option(BUILD_TESTS "build the test executable" OFF) -+option(BUILD_STATIC "build the static library" OFF) ++option(BUILD_TESTS "build the test executable" ON) ++option(BUILD_STATIC "build the static library" ON) +option(BUILD_UTILS "build the utilities executables" ON) + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +cmake_minimum_required(VERSION 2.6) + +include_directories( +${CMAKE_BINARY_DIR}/include +${CMAKE_SOURCE_DIR}/include +) + +add_subdirectory(src) +if(BUILD_TESTS) + add_subdirectory(testbed) +endif(BUILD_TESTS) +if(BUILD_UTILS) + add_subdirectory(utils) +endif(BUILD_UTILS) -diff -Nru -x '*~' lcms2-2.4.orig/include/lcms2.h lcms2-2.4/include/lcms2.h ---- lcms2-2.4.orig/include/lcms2.h 2012-09-10 18:01:51.000000000 +0200 -+++ lcms2-2.4/include/lcms2.h 2013-01-24 11:35:17.022862100 +0100 -@@ -199,25 +199,25 @@ +diff --git a/include/lcms2.h b/include/lcms2.h +index 739e6e1..969bc3a 100644 +--- a/include/lcms2.h ++++ b/include/lcms2.h +@@ -212,15 +212,14 @@ typedef int cmsBool; + #endif // CMS_USE_BIG_ENDIAN + +- // Calling convention -- this is hardly platform and compiler dependent #ifdef CMS_IS_WINDOWS_ -# if defined(CMS_DLL) || defined(CMS_DLL_BUILD) --# ifdef __BORLANDC__ --# define CMSEXPORT __stdcall _export --# define CMSAPI --# else --# define CMSEXPORT _stdcall --# ifdef CMS_DLL_BUILD +# if !defined(CMS_STATIC) -+# ifdef __BORLANDC__ -+# define CMSEXPORT __stdcall _export -+# define CMSAPI -+# else + # ifdef __BORLANDC__ + # define CMSEXPORT __stdcall _export + # define CMSAPI + # else +-# define CMSEXPORT __stdcall +# define CMSEXPORT -+# ifdef CMS_DLL_BUILD + # ifdef CMS_DLL_BUILD # define CMSAPI __declspec(dllexport) --# else --# define CMSAPI __declspec(dllimport) --# endif --# endif --# else --# define CMSEXPORT --# define CMSAPI --# endif -+# else -+# define CMSAPI __declspec(dllimport) -+# endif -+# endif -+# else -+# define CMSEXPORT -+# define CMSAPI -+# endif - #else --# define CMSEXPORT --# define CMSAPI -+# define CMSEXPORT -+# define CMSAPI - #endif - - // Some common definitions -diff -Nru -x '*~' lcms2-2.4.orig/src/CMakeLists.txt lcms2-2.4/src/CMakeLists.txt ---- lcms2-2.4.orig/src/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 -+++ lcms2-2.4/src/CMakeLists.txt 2013-01-24 11:42:39.515171300 +0100 -@@ -0,0 +1,63 @@ + # else +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +new file mode 100644 +index 0000000..ac575c7 +--- /dev/null ++++ b/src/CMakeLists.txt +@@ -0,0 +1,64 @@ +# some configure checks: +if(WIN32) + if(MSVC) + set(UINT8_T "unsigned char") + set(UINT16_T "unsigned short") + set(UINT32_T "unsigned long") + set(INT8_T "char") + set(INT16_T "short") + set(INT32_T "long") + else(MSVC) + set(UINT8_T "uint8_t") + set(UINT16_T "uint16_t") + set(UINT32_T "uint32_t") + set(INT8_T "int8_t") + set(INT16_T "int16_t") + set(INT32_T "int32_t") + endif(MSVC) +endif(WIN32) + +set(lcms_SRCS + cmscnvrt.c + cmserr.c + cmsgamma.c + cmsgmt.c + cmsintrp.c + cmsio0.c + cmsio1.c + cmslut.c + cmsplugin.c + cmssm.c + cmsmd5.c + cmsmtrx.c + cmspack.c + cmspcs.c + cmswtpnt.c + cmsxform.c + cmssamp.c + cmsnamed.c + cmscam02.c + cmsvirt.c + cmstypes.c + cmscgats.c + cmsps2.c + cmsopt.c + cmshalf.c ++ cmsalpha.c +) + +include_directories(${CMAKE_BINARY_DIR}) + +add_library(lcms SHARED ${lcms_SRCS}) +set_target_properties(lcms PROPERTIES OUTPUT_NAME "lcms2" + DEFINE_SYMBOL CMS_DLL_BUILD) + +if(BUILD_TESTS OR BUILD_UTILS OR BUILD_STATIC) + add_library(lcms_static ${lcms_SRCS}) + set_target_properties(lcms_static PROPERTIES COMPILE_FLAGS -DCMS_STATIC) + set(LCMS_STATIC lcms_static) +endif(BUILD_TESTS OR BUILD_UTILS OR BUILD_STATIC) + +install(TARGETS lcms ${LCMS_STATIC} RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../include/lcms2.h ${CMAKE_CURRENT_SOURCE_DIR}/../include/lcms2_plugin.h DESTINATION include) -diff -Nru -x '*~' lcms2-2.4.orig/testbed/CMakeLists.txt lcms2-2.4/testbed/CMakeLists.txt ---- lcms2-2.4.orig/testbed/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 -+++ lcms2-2.4/testbed/CMakeLists.txt 2013-01-24 11:35:17.033862800 +0100 +diff --git a/testbed/CMakeLists.txt b/testbed/CMakeLists.txt +new file mode 100644 +index 0000000..ca9008b +--- /dev/null ++++ b/testbed/CMakeLists.txt @@ -0,0 +1,5 @@ +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include ${CMAKE_CURRENT_SOURCE_DIR}/../src) + -+add_executable(testcms testcms2.c) ++add_executable(testcms testcms2.c testplugin.c zoo_icc.c) +target_link_libraries(testcms lcms_static) +set_target_properties(testcms PROPERTIES COMPILE_FLAGS -DCMS_STATIC) -diff -Nru -x '*~' lcms2-2.4.orig/testbed/testcms2.c lcms2-2.4/testbed/testcms2.c ---- lcms2-2.4.orig/testbed/testcms2.c 2012-09-10 18:01:51.000000000 +0200 -+++ lcms2-2.4/testbed/testcms2.c 2013-01-24 11:35:17.043863300 +0100 -@@ -31,7 +31,7 @@ - #include "lcms2_internal.h" +diff --git a/testbed/testcms2.c b/testbed/testcms2.c +index 203e53c..9b37774 100644 +--- a/testbed/testcms2.c ++++ b/testbed/testcms2.c +@@ -28,7 +28,7 @@ + #include "testcms2.h" // On Visual Studio, use debug CRT -#ifdef _MSC_VER +#ifdef _WIN32 # include "crtdbg.h" # include #endif -diff -Nru -x '*~' lcms2-2.4.orig/utils/CMakeLists.txt lcms2-2.4/utils/CMakeLists.txt ---- lcms2-2.4.orig/utils/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 -+++ lcms2-2.4/utils/CMakeLists.txt 2013-01-24 11:35:17.050863800 +0100 +diff --git a/testbed/zoo_icc.c b/testbed/zoo_icc.c +index b9e1efe..97e3294 100755 +--- a/testbed/zoo_icc.c ++++ b/testbed/zoo_icc.c +@@ -27,6 +27,11 @@ + + #include "testcms2.h" + ++#ifdef _WIN32 ++# include "crtdbg.h" ++# include ++#endif ++ + + // ZOO checks ------------------------------------------------------------------------------------------------------------ + +diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt +new file mode 100644 +index 0000000..c3be5bf +--- /dev/null ++++ b/utils/CMakeLists.txt @@ -0,0 +1,78 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/../include + ${CMAKE_CURRENT_SOURCE_DIR}/../src + ${CMAKE_CURRENT_SOURCE_DIR}/../utils/common +) + +find_package(JPEG) +find_package(TIFF) + +set(UTILS_EXECUTABLES ) +set(UTILS_MANPAGES ) + +############################################################################### +if(JPEG_FOUND) + include_directories(${JPEG_INCLUDE_DIR}) + set(JPGICC_SRCS + jpgicc/jpgicc.c + jpgicc/iccjpeg.c + common/xgetopt.c + common/vprf.c + ) + add_executable(jpgicc ${JPGICC_SRCS}) + target_link_libraries(jpgicc lcms ${JPEG_LIBRARIES}) + list(APPEND UTILS_EXECUTABLES jpgicc) + list(APPEND UTILS_MANPAGES jpgicc/jpgicc.1) +endif(JPEG_FOUND) + +############################################################################### +set(LINKICC_SRCS + linkicc/linkicc.c + common/xgetopt.c + common/vprf.c +) +add_executable(linkicc ${LINKICC_SRCS}) +target_link_libraries(linkicc lcms) +list(APPEND UTILS_EXECUTABLES linkicc) +list(APPEND UTILS_MANPAGES linkicc/linkicc.1) + +############################################################################### +set(PSICC_SRCS + psicc/psicc.c + common/xgetopt.c + common/vprf.c +) +add_executable(psicc ${PSICC_SRCS}) +target_link_libraries(psicc lcms) +list(APPEND UTILS_EXECUTABLES psicc) +list(APPEND UTILS_MANPAGES psicc/psicc.1) + +############################################################################### +if(TIFF_FOUND) + include_directories(${TIFF_INCLUDE_DIR}) + set(JPGICC_SRCS + tificc/tificc.c + common/xgetopt.c + common/vprf.c + ) + add_executable(tificc ${JPGICC_SRCS}) + target_link_libraries(tificc lcms ${TIFF_LIBRARIES}) + list(APPEND UTILS_EXECUTABLES tificc) + list(APPEND UTILS_MANPAGES tificc/tificc.1) +endif(TIFF_FOUND) + +############################################################################### +set(TRANSICC_SRCS + transicc/transicc.c + common/xgetopt.c + common/vprf.c +) +add_executable(transicc ${TRANSICC_SRCS}) +target_link_libraries(transicc lcms) +list(APPEND UTILS_EXECUTABLES transicc) +list(APPEND UTILS_MANPAGES transicc/transicc.1) + +install(TARGETS ${UTILS_EXECUTABLES} RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +install(FILES ${UTILS_MANPAGES} DESTINATION share/man/man1) diff --git a/3rdparty/ext_libxml2/CMakeLists.txt b/3rdparty/ext_libxml2/CMakeLists.txt index 9e05a22970..f5c023e0c6 100755 --- a/3rdparty/ext_libxml2/CMakeLists.txt +++ b/3rdparty/ext_libxml2/CMakeLists.txt @@ -1,31 +1,31 @@ SET(PREFIX_ext_libxml2 "${EXTPREFIX}" ) -if (MSVC) +if (MSVC OR MINGW) ExternalProject_Add( ext_libxml2 DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/libxml2-2.8.0.tar.gz - URL_MD5 c62106f02ee00b6437f0fb9d370c1093 + URL http://files.kde.org/krita/build/dependencies/libxml2-sources-2.9.3.tar.gz + URL_MD5 817ee2f5297e9763097074575903682d INSTALL_DIR ${PREFIX_ext_libxml2} PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/libxml2-2.8.0-20110105.diff CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_libxml2} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_patch ext_iconv ext_zlib ) -else (MSVC) +else (MSVC OR MINGW) ExternalProject_Add( ext_libxml2 DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/libxml2-2.8.0.tar.gz - URL_MD5 c62106f02ee00b6437f0fb9d370c1093 + URL http://files.kde.org/krita/build/dependencies/libxml2-sources-2.9.3.tar.gz + URL_MD5 817ee2f5297e9763097074575903682d INSTALL_DIR ${PREFIX_ext_libxml2} - CONFIGURE_COMMAND /configure --prefix=${PREFIX_ext_libxml2} ${GLOBAL_AUTOMAKE_PROFILE} + CONFIGURE_COMMAND /configure --prefix=${PREFIX_ext_libxml2} ${GLOBAL_AUTOMAKE_PROFILE} --with-python-install-dir=${PREFIX_ext_libxml2} BUILD_COMMAND make INSTALL_COMMAND make install UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_iconv ext_zlib ) -endif (MSVC) +endif (MSVC OR MINGW) diff --git a/3rdparty/ext_libxslt/CMakeLists.txt b/3rdparty/ext_libxslt/CMakeLists.txt index 770e8b7711..d31d2b5aed 100755 --- a/3rdparty/ext_libxslt/CMakeLists.txt +++ b/3rdparty/ext_libxslt/CMakeLists.txt @@ -1,30 +1,30 @@ SET(PREFIX_ext_libxslt "${EXTPREFIX}" ) -if (MSVC) +if (MSVC OR MINGW) ExternalProject_Add( ext_libxslt DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/libxslt-1.1.26.tar.gz - URL_MD5 e61d0364a30146aaa3001296f853b2b9 + URL http://files.kde.org/krita/build/dependencies/libxslt-1.1.29.tar.gz + URL_MD5 a129d3c44c022de3b9dcf6d6f288d72e PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/libxslt-1.1.26-20101102.diff INSTALL_DIR ${PREFIX_ext_libxslt} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_libxslt} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_patch ext_libxml2 ) -else (MSVC) +else (MSVC OR MINGW) ExternalProject_Add( ext_libxslt DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/libxslt-1.1.26.tar.gz - URL_MD5 e61d0364a30146aaa3001296f853b2b9 + URL http://files.kde.org/krita/build/dependencies/libxslt-1.1.29.tar.gz + URL_MD5 a129d3c44c022de3b9dcf6d6f288d72e CONFIGURE_COMMAND /configure --prefix=${PREFIX_ext_libxslt} ${GLOBAL_AUTOMAKE_PROFILE} BUILD_COMMAND make INSTALL_COMMAND make install UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_libxml2 ) -endif (MSVC) +endif (MSVC OR MINGW) diff --git a/3rdparty/ext_ocio/CMakeLists.txt b/3rdparty/ext_ocio/CMakeLists.txt index eb72328eb3..2b2e6703dd 100644 --- a/3rdparty/ext_ocio/CMakeLists.txt +++ b/3rdparty/ext_ocio/CMakeLists.txt @@ -1,35 +1,37 @@ # # The latest opencolorio doesn't build on Windows without using boost::ptr, but if you build # it with boost::ptr, you cannot link to it because of missing dll exports, so build an older # ocio on Windows. # SET(EXTPREFIX_ocio "${EXTPREFIX}" ) -if (MSVC) +if (MSVC OR MINGW) ExternalProject_Add( ext_ocio DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/ext_ocio.zip - URL_MD5 e0bc2c7177dc02bdc82e8f38f52b1058 + URL http://files.kde.org/krita/build/dependencies/OpenColorIO-master.zip + URL_MD5 7065faa41103ed27f5ea9b01b9e14c91 INSTALL_DIR ${EXTPREFIX_ocio} + PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/patch.diff + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_ocio} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} -DOCIO_BUILD_APPS=OFF -DOCIO_BUILD_TRUELIGHT=OFF -DOCIO_BUILD_NUKE=OFF -DOCIO_BUILD_DOCS=OFF -DOCIO_BUILD_TESTS=OFF -DOCIO_BUILD_PYGLUE=OFF -DOCIO_BUILD_STATIC_JNIGLUE=OFF UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_boost ) else() ExternalProject_Add( ext_ocio DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/opencolorio-a557a85454ee1ffa8cb66f8a96238e079c452f08.tgz - URL_MD5 c7db4cdcac40ab12870cdeb6bbd0b875 + URL http://files.kde.org/krita/build/dependencies/OpenColorIO-master.zip + URL_MD5 7065faa41103ed27f5ea9b01b9e14c91 INSTALL_DIR ${EXTPREFIX_ocio} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_ocio} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DOCIO_BUILD_APPS=OFF -DOCIO_BUILD_TRUELIGHT=OFF -DOCIO_BUILD_NUKE=OFF -DOCIO_BUILD_DOCS=OFF -DOCIO_BUILD_TESTS=OFF -DOCIO_BUILD_PYGLUE=OFF -DOCIO_BUILD_STATIC_JNIGLUE=OFF UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_boost ) endif() diff --git a/3rdparty/ext_ocio/patch.diff b/3rdparty/ext_ocio/patch.diff index a35798733c..62ad94dc9c 100644 --- a/3rdparty/ext_ocio/patch.diff +++ b/3rdparty/ext_ocio/patch.diff @@ -1,48 +1,83 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index b539ea1..ab47729 100644 +index b539ea1..2fc1034 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,12 @@ if(NOT DEFINED CMAKE_FIRST_RUN) SET(CMAKE_FIRST_RUN 1 CACHE INTERNAL "") endif() -+if (MSVC) ++if (WIN32) + set(PATCH myptch) +else() + set(PATCH patch) +endif () + ############################################################################### ### GLOBAL ### -@@ -183,7 +189,7 @@ else(USE_EXTERNAL_TINYXML) +@@ -183,12 +189,12 @@ else(USE_EXTERNAL_TINYXML) endif() ExternalProject_Add(tinyxml URL ${CMAKE_SOURCE_DIR}/ext/tinyxml_${TINYXML_VERSION}.tar.gz - PATCH_COMMAND patch -f -p1 < ${CMAKE_SOURCE_DIR}/ext/tinyxml_${TINYXML_VERSION}.patch + PATCH_COMMAND ${PATCH} --binary -f -p1 < ${CMAKE_SOURCE_DIR}/ext/tinyxml_${TINYXML_VERSION}.patch BINARY_DIR ext/build/tinyxml INSTALL_DIR ext/dist CMAKE_ARGS ${TINYXML_CMAKE_ARGS} -@@ -252,7 +258,7 @@ else(USE_EXTERNAL_YAML) + ) +- if(WIN32) ++ if(MSVC) + set(TINYXML_STATIC_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/tinyxml.lib) + else() + set(TINYXML_STATIC_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/libtinyxml.a) +@@ -252,13 +258,13 @@ else(USE_EXTERNAL_YAML) ExternalProject_Add(YAML_CPP_LOCAL URL ${CMAKE_SOURCE_DIR}/ext/yaml-cpp-${YAML_CPP_VERSION}.tar.gz BINARY_DIR ext/build/yaml-cpp - PATCH_COMMAND patch -p1 < ${CMAKE_SOURCE_DIR}/ext/yaml-cpp-${YAML_CPP_VERSION}.patch + PATCH_COMMAND ${PATCH} --binary -p1 < ${CMAKE_SOURCE_DIR}/ext/yaml-cpp-${YAML_CPP_VERSION}.patch INSTALL_DIR ext/dist CMAKE_ARGS ${YAML_CPP_CMAKE_ARGS} ) + set(YAML_CPP_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ext/dist/include) + set(YAML_CPP_LIBRARY_DIRS ${PROJECT_BINARY_DIR}/ext/dist/lib) +- if(WIN32) ++ if(MSVC) + set(YAML_CPP_STATIC_DEBUG_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/libyaml-cppmdd.lib) + set(YAML_CPP_STATIC_OPTIMIZED_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/libyaml-cppmd.lib) + else() +@@ -304,7 +310,7 @@ endif() + messageonce("SSE Optimizations: ${OCIO_USE_SSE}") + + if(OCIO_USE_SSE) +- if(WIN32) ++ if(MSVC) + # SSE instructions are automatically compiled into 64-bit applications so enabling the option is redundant and + # actually produces an unknown option warning in Visual Studio. + if(NOT CMAKE_CL_64) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt -index db42c2f..538b3a7 100644 +index db42c2f..dffb19e 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -55,7 +55,7 @@ set(SPHINX_VERSION 1.2b3) ExternalProject_Add(Sphinx DEPENDS setuptools docutils Jinja2 Pygments URL ${CMAKE_SOURCE_DIR}/ext/Sphinx-${SPHINX_VERSION}.tar.gz - PATCH_COMMAND patch -p1 < ${CMAKE_SOURCE_DIR}/ext/Sphinx-${SPHINX_VERSION}.patch -+ PATCH_COMMAND patch --binary -p1 < ${CMAKE_SOURCE_DIR}/ext/Sphinx-${SPHINX_VERSION}.patch ++ PATCH_COMMAND ${PATCH} --binary -p1 < ${CMAKE_SOURCE_DIR}/ext/Sphinx-${SPHINX_VERSION}.patch BUILD_IN_SOURCE 1 CONFIGURE_COMMAND ${CMAKE_COMMAND} -E make_directory ${EXTDIST_PYTHONPATH} BUILD_COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON} setup.py build +diff --git a/src/core/Platform.h b/src/core/Platform.h +index d2d3f30..e3afa19 100644 +--- a/src/core/Platform.h ++++ b/src/core/Platform.h +@@ -75,7 +75,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + #define NOMINMAX 1 + + // windows - defined for both Win32 and Win64 +-#include ++#include + #include + #include + #include diff --git a/3rdparty/ext_ocio/patch_mingw.patch b/3rdparty/ext_ocio/patch_mingw.patch new file mode 100644 index 0000000000..fb6147fa69 --- /dev/null +++ b/3rdparty/ext_ocio/patch_mingw.patch @@ -0,0 +1,44 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 13e2d64..47b5297 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -171,7 +171,7 @@ else(USE_EXTERNAL_TINYXML) + INSTALL_DIR ext/dist + CMAKE_ARGS ${TINYXML_CMAKE_ARGS} + ) +- if(WIN32) ++ if(MSVC) + set(TINYXML_STATIC_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/tinyxml.lib) + else() + set(TINYXML_STATIC_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/libtinyxml.a) +@@ -211,7 +211,7 @@ else(USE_EXTERNAL_YAML) + ) + set(YAML_CPP_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ext/dist/include) + set(YAML_CPP_LIBRARY_DIRS ${PROJECT_BINARY_DIR}/ext/dist/lib) +- if(WIN32) ++ if(MSVC) + set(YAML_CPP_STATIC_DEBUG_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/libyaml-cppmdd.lib) + set(YAML_CPP_STATIC_OPTIMIZED_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/libyaml-cppmd.lib) + else() +@@ -271,7 +271,7 @@ endif() + messageonce("SSE Optimizations: ${OCIO_USE_SSE}") + + if(OCIO_USE_SSE) +- if(WIN32) ++ if(MSVC) + # SSE instructions are automatically compiled into 64-bit applications so enabling the option is redundant and + # actually produces an unknown option warning in Visual Studio. + if(NOT CMAKE_CL_64) +diff --git a/src/core/Platform.h b/src/core/Platform.h +index d2d3f30..e3afa19 100644 +--- a/src/core/Platform.h ++++ b/src/core/Platform.h +@@ -75,7 +75,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + #define NOMINMAX 1 + + // windows - defined for both Win32 and Win64 +-#include ++#include + #include + #include + #include \ No newline at end of file diff --git a/3rdparty/ext_openexr/CMakeLists.txt b/3rdparty/ext_openexr/CMakeLists.txt index 8877773ec9..7b4f5c45a4 100755 --- a/3rdparty/ext_openexr/CMakeLists.txt +++ b/3rdparty/ext_openexr/CMakeLists.txt @@ -1,16 +1,33 @@ -SET(PREFIX_ext_openexr "${EXTPREFIX}" ) +SET(EXTPREFIX_openexr "${EXTPREFIX}" ) +if (MSVC OR MINGW) ExternalProject_Add( ext_openexr DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} URL http://files.kde.org/krita/build/dependencies/openexr-2.2.0.tar.gz URL_MD5 b64e931c82aa3790329c21418373db4e - + PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/openexr.diff + COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/patch_mingw.patch + + INSTALL_DIR ${EXTPREFIX_openexr} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_openexr} -DILMBASE_PACKAGE_PREFIX=${EXTPREFIX_openexr} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DNAMESPACE_VERSIONING=OFF - INSTALL_DIR ${PREFIX_ext_openexr} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_openexr} -DILMBASE_PACKAGE_PREFIX=${PREFIX_ext_openexr} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DNAMESPACE_VERSIONING=OFF - UPDATE_COMMAND "" ALWAYS 0 - DEPENDS ext_ilmbase + DEPENDS ext_ilmbase ext_zlib ) +else() +ExternalProject_Add(ext_openexr + DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} + URL http://files.kde.org/krita/build/dependencies/openexr-2.2.0.tar.gz + URL_MD5 b64e931c82aa3790329c21418373db4e + PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/openexr.diff + + INSTALL_DIR ${EXTPREFIX_openexr} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_openexr} -DILMBASE_PACKAGE_PREFIX=${EXTPREFIX_openexr} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DNAMESPACE_VERSIONING=OFF + + UPDATE_COMMAND "" + ALWAYS 0 + DEPENDS ext_ilmbase ext_zlib +) +endif() diff --git a/3rdparty/ext_openexr/patch_mingw.patch b/3rdparty/ext_openexr/patch_mingw.patch new file mode 100644 index 0000000000..fd4d8f3c09 --- /dev/null +++ b/3rdparty/ext_openexr/patch_mingw.patch @@ -0,0 +1,31 @@ +--- a/IlmImf/ImfSystemSpecific.h ++++ b/IlmImf/ImfSystemSpecific.h +@@ -54,7 +54,7 @@ + + #ifdef IMF_HAVE_SSE2 + +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__MINGW__) && !defined(__MINGW32__) && !defined(__MINGW64__) + // Causes issues on certain gcc versions + //#define EXR_FORCEINLINE inline __attribute__((always_inline)) + #define EXR_FORCEINLINE inline +@@ -73,7 +73,7 @@ + free(ptr); + } + +-#elif defined _MSC_VER ++#elif defined(_MSC_VER) || defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__) + + #define EXR_FORCEINLINE __forceinline + #define EXR_RESTRICT __restrict +--- a/IlmImf/ImfOptimizedPixelReading.h ++++ b/IlmImf/ImfOptimizedPixelReading.h +@@ -70,7 +70,7 @@ + bool + isPointerSSEAligned (const void* EXR_RESTRICT pPointer) + { +- unsigned long trailingBits = ((unsigned long)pPointer) & 15; ++ unsigned long trailingBits = ((unsigned size_t)pPointer) & 15; + return trailingBits == 0; + } + diff --git a/3rdparty/ext_openjpeg/CMakeLists.txt b/3rdparty/ext_openjpeg/CMakeLists.txt deleted file mode 100755 index 3e34540089..0000000000 --- a/3rdparty/ext_openjpeg/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -SET(PREFIX_ext_openjpeg "${EXTPREFIX}" ) -ExternalProject_Add( ext_openjpeg - DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/openjpeg-version.2.1.tar.gz - URL_MD5 3e1c451c087f8462955426da38aa3b3d - - INSTALL_DIR ${PREFIX_ext_openjpeg} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_openjpeg} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} - - UPDATE_COMMAND "" - ALWAYS 0 - DEPENDS ext_png ext_tiff ext_lcms2 ext_zlib -) - diff --git a/3rdparty/ext_png/CMakeLists.txt b/3rdparty/ext_png/CMakeLists.txt index 2b1a2d9397..bf67d146e3 100755 --- a/3rdparty/ext_png/CMakeLists.txt +++ b/3rdparty/ext_png/CMakeLists.txt @@ -1,13 +1,13 @@ SET(PREFIX_ext_png "${EXTPREFIX}" ) ExternalProject_Add( ext_png DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/libpng-1.6.19.tar.gz - URL_MD5 f852029626d399bea8e20008af377ee5 + URL http://files.kde.org/krita/build/dependencies/libpng-1.6.23.tar.gz + URL_MD5 3a8fb380b0fb39cb69efe47901917e38 INSTALL_DIR ${PREFIX_ext_png} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_png} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_zlib ) diff --git a/3rdparty/ext_poppler/CMakeLists.txt b/3rdparty/ext_poppler/CMakeLists.txt index 1badd51caf..444319b9c5 100755 --- a/3rdparty/ext_poppler/CMakeLists.txt +++ b/3rdparty/ext_poppler/CMakeLists.txt @@ -1,12 +1,12 @@ SET(PREFIX_ext_poppler "${EXTPREFIX}" ) ExternalProject_Add( ext_poppler DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/poppler-0.38.0.tar.gz - URL_MD5 4554b04eedfd56c3a65be9f108e306f5 + URL http://files.kde.org/krita/build/dependencies/poppler-0.45.0.tar.gz + URL_MD5 02a81a20e24849feb1a2af4db1aca865 INSTALL_DIR ${PREFIX_ext_poppler} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_poppler} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DBUILD_GTK_TESTS=OFF -DBUILD_QT5_TESTS=FALSE -BUILD_CPP_TESTS=FALSE -DENABLE_UTILS=FALSE -DENABLE_GLIB=FALSE + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_poppler} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DBUILD_GTK_TESTS=OFF -DBUILD_QT5_TESTS=FALSE -BUILD_CPP_TESTS=FALSE -DENABLE_UTILS=FALSE -DENABLE_GLIB=FALSE -DENABLE_LIBOPENJPEG=FALSE UPDATE_COMMAND "" ALWAYS 0 ) diff --git a/3rdparty/ext_pthreads/CMakeLists.txt b/3rdparty/ext_pthreads/CMakeLists.txt index b565fe787d..b80490d507 100755 --- a/3rdparty/ext_pthreads/CMakeLists.txt +++ b/3rdparty/ext_pthreads/CMakeLists.txt @@ -1,14 +1,14 @@ SET(PREFIX_ext_pthreads "${EXTPREFIX}" ) ExternalProject_Add( ext_pthreads - DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/pthreads-w32-2-8-0-release.tar.gz - URL_MD5 6d30c693233b1464ef8983fedd8ccb22 + DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} + URL http://files.kde.org/krita/build/dependencies/pthreads-w32-2-9-1-release.tar.gz + URL_MD5 36ba827d6aa0fa9f9ae740a35626e2e3 - INSTALL_DIR ${PREFIX_ext_pthreads} + INSTALL_DIR ${PREFIX_ext_pthreads} PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/pthreads-w32-2-8-0-release-20110729.diff - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_pthreads} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_pthreads} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} - UPDATE_COMMAND "" - ALWAYS 0 - DEPENDS ext_patch + UPDATE_COMMAND "" + ALWAYS 0 + DEPENDS ext_patch ) diff --git a/3rdparty/ext_pthreads/pthreads-w32-2-8-0-release-20110729.diff b/3rdparty/ext_pthreads/pthreads-w32-2-9-1-release-20130901.diff similarity index 80% rename from 3rdparty/ext_pthreads/pthreads-w32-2-8-0-release-20110729.diff rename to 3rdparty/ext_pthreads/pthreads-w32-2-9-1-release-20130901.diff index 8d09ee3dec..432f236c1a 100644 --- a/3rdparty/ext_pthreads/pthreads-w32-2-8-0-release-20110729.diff +++ b/3rdparty/ext_pthreads/pthreads-w32-2-9-1-release-20130901.diff @@ -1,560 +1,593 @@ -diff -Nru pthreads-w32-2-8-0-release.orig/CMakeLists.txt pthreads-w32-2-8-0-release/CMakeLists.txt ---- pthreads-w32-2-8-0-release.orig/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 -+++ pthreads-w32-2-8-0-release/CMakeLists.txt 2011-07-29 13:36:02.199191000 +0200 +diff -Nru -x '*~' pthreads-w32-2-9-1-release.orig/CMakeLists.txt pthreads-w32-2-9-1-release/CMakeLists.txt +--- pthreads-w32-2-9-1-release.orig/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 ++++ pthreads-w32-2-9-1-release/CMakeLists.txt 2013-09-01 13:00:26.055970400 +0200 @@ -0,0 +1,224 @@ +project(pthreads) + +cmake_minimum_required(VERSION 2.8) + +option(BUILD_STATIC "build pthreads as a static library" OFF) +option(BUILD_INLINED "build pthreads as with inlined functions" ON) -+option(BUILD_TESTS "build test executables for pthreads" OFF) ++option(BUILD_TESTS "build test executables for pthreads" ON) + +if(BUILD_TESTS) + enable_testing() +endif(BUILD_TESTS) + +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) +endif(MSVC) + +include(ConfigureChecks.cmake) + +set(pthreads_SRCS + attr.c + barrier.c + cancel.c + cleanup.c + condvar.c + create.c + dll.c + exit.c + global.c + misc.c + mutex.c + nonportable.c + private.c + rwlock.c + sched.c + semaphore.c + spin.c + sync.c + tsd.c +) + +if(MSVC) + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/version.rc COMMAND cl /EP ${CMAKE_SOURCE_DIR}/version.rc > ${CMAKE_BINARY_DIR}/version.rc) + list(APPEND ${pthreads_SRCS} ${CMAKE_BINARY_DIR}/version.rc) +endif(MSVC) +set(pthreads_HDRS + sched.h + pthread.h + semaphore.h +) +include_directories(${CMAKE_SOURCE_DIR}) + +if(BUILD_STATIC) + set(_SHARED STATIC) + add_definitions(-DPTW32_STATIC_LIB) +else(BUILD_STATIC) + set(_SHARED SHARED) +endif(BUILD_STATIC) + +add_library(pthreads ${_SHARED} ${pthreads_SRCS}) +if(BUILD_INLINED) + set_target_properties(pthreads PROPERTIES COMPILE_FLAGS -DPTW32_BUILD_INLINED) +endif(BUILD_INLINED) +target_link_libraries(pthreads ws2_32) + +############################################################################### +if(BUILD_TESTS) +set(pthreads_TESTS + loadfree + self1 + mutex5 + mutex1 + mutex1n + mutex1e + mutex1r + semaphore1 + semaphore2 + semaphore3 + mutex2 + mutex3 + mutex2r + mutex2e + mutex3r + mutex3e + condvar1 + condvar1_1 + condvar1_2 + condvar2 + condvar2_1 + exit1 + create1 + create2 + reuse1 + reuse2 + equal1 + kill1 + valid1 + valid2 + exit2 + exit3 + exit4 + exit5 + join0 + join1 + detach1 + join2 + join3 + mutex4 + mutex6 + mutex6n + mutex6e + mutex6r + mutex6s + mutex6es + mutex6rs + mutex7 + mutex7n + mutex7e + mutex7r + mutex8 + mutex8n + mutex8e + mutex8r + count1 + once1 + once2 + once3 + once4 + self2 + cancel1 + cancel2 + semaphore4 + semaphore4t +# semaphore5 + barrier1 + barrier2 + barrier3 + barrier4 + barrier5 + tsd1 + tsd2 + delay1 + delay2 + eyal1 + condvar3 + condvar3_1 + condvar3_2 + condvar3_3 + condvar4 + condvar5 + condvar6 + condvar7 + condvar8 + condvar9 + errno1 + rwlock1 + rwlock2 + rwlock3 + rwlock4 + rwlock5 + rwlock6 + rwlock7 + rwlock8 + rwlock2_t + rwlock3_t + rwlock4_t + rwlock5_t + rwlock6_t + rwlock6_t2 + context1 + cancel3 + cancel4 + cancel5 + cancel6a + cancel6d + cancel7 + cancel8 + cleanup0 + cleanup1 + cleanup2 + cleanup3 + priority1 + priority2 + inherit1 + spin1 + spin2 + spin3 + spin4 + exception1 + exception2 + exception3 + cancel9 + create3 + stress1 +) + +foreach(_test ${pthreads_TESTS}) + add_executable(${_test} tests/${_test}.c) + target_link_libraries(${_test} pthreads) + add_test(${_test} ${_test}) +endforeach(_test ${pthreads_TESTS}) + +set(pthreads_ADD_TESTS + benchtest1 + benchtest2 + benchtest3 + benchtest4 + benchtest5 +) + +add_library(bench STATIC tests/benchlib.c) +foreach(_test ${pthreads_ADD_TESTS}) + add_executable(${_test} tests/${_test}.c) + target_link_libraries(${_test} pthreads bench) + add_test(${_test} ${_test}) +endforeach(_test ${pthreads_ADD_TESTS}) + +endif(BUILD_TESTS) + +############################################################################### +install(TARGETS pthreads RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +install(FILES ${pthreads_HDRS} DESTINATION include) -\ No newline at end of file -diff -Nru pthreads-w32-2-8-0-release.orig/config.h pthreads-w32-2-8-0-release/config.h ---- pthreads-w32-2-8-0-release.orig/config.h 2005-04-25 04:18:00.000000000 +0200 -+++ pthreads-w32-2-8-0-release/config.h 1970-01-01 01:00:00.000000000 +0100 -@@ -1,134 +0,0 @@ +\ Kein Zeilenumbruch am Dateiende. +diff -Nru -x '*~' pthreads-w32-2-9-1-release.orig/config.h pthreads-w32-2-9-1-release/config.h +--- pthreads-w32-2-9-1-release.orig/config.h 2011-05-30 02:31:00.000000000 +0200 ++++ pthreads-w32-2-9-1-release/config.h 1970-01-01 01:00:00.000000000 +0100 +@@ -1,153 +0,0 @@ -/* config.h */ - -#ifndef PTW32_CONFIG_H -#define PTW32_CONFIG_H - -/********************************************************************* - * Defaults: see target specific redefinitions below. - *********************************************************************/ - -/* We're building the pthreads-win32 library */ -#define PTW32_BUILD - -/* Do we know about the C type sigset_t? */ -#undef HAVE_SIGSET_T - -/* Define if you have the header file. */ -#undef HAVE_SIGNAL_H - -/* Define if you have the Borland TASM32 or compatible assembler. */ -#undef HAVE_TASM32 - -/* Define if you don't have Win32 DuplicateHandle. (eg. WinCE) */ -#undef NEED_DUPLICATEHANDLE - -/* Define if you don't have Win32 _beginthreadex. (eg. WinCE) */ -#undef NEED_CREATETHREAD - -/* Define if you don't have Win32 errno. (eg. WinCE) */ -#undef NEED_ERRNO - -/* Define if you don't have Win32 calloc. (eg. WinCE) */ -#undef NEED_CALLOC - -/* Define if you don't have Win32 ftime. (eg. WinCE) */ -#undef NEED_FTIME - -/* Define if you don't have Win32 semaphores. (eg. WinCE 2.1 or earlier) */ -#undef NEED_SEM - -/* Define if you need to convert string parameters to unicode. (eg. WinCE) */ -#undef NEED_UNICODE_CONSTS - -/* Define if your C (not C++) compiler supports "inline" functions. */ -#undef HAVE_C_INLINE - -/* Do we know about type mode_t? */ -#undef HAVE_MODE_T - +-/* +- * Define if GCC has atomic builtins, i.e. __sync_* intrinsics +- * __sync_lock_* is implemented in mingw32 gcc 4.5.2 at least +- * so this define does not turn those on or off. If you get an +- * error from __sync_lock* then consider upgrading your gcc. +- */ +-#undef HAVE_GCC_ATOMIC_BUILTINS +- -/* Define if you have the timespec struct */ -#undef HAVE_STRUCT_TIMESPEC - -/* Define if you don't have the GetProcessAffinityMask() */ -#undef NEED_PROCESS_AFFINITY_MASK - +-/* Define if your version of Windows TLSGetValue() clears WSALastError +- * and calling SetLastError() isn't enough restore it. You'll also need to +- * link against wsock32.lib (or libwsock32.a for MinGW). +- */ +-#undef RETAIN_WSALASTERROR +- -/* -# ---------------------------------------------------------------------- -# The library can be built with some alternative behaviour to better -# facilitate development of applications on Win32 that will be ported -# to other POSIX systems. -# -# Nothing described here will make the library non-compliant and strictly -# compliant applications will not be affected in any way, but -# applications that make assumptions that POSIX does not guarantee are -# not strictly compliant and may fail or misbehave with some settings. -# -# PTW32_THREAD_ID_REUSE_INCREMENT -# Purpose: -# POSIX says that applications should assume that thread IDs can be -# recycled. However, Solaris (and some other systems) use a [very large] -# sequence number as the thread ID, which provides virtual uniqueness. -# This provides a very high but finite level of safety for applications -# that are not meticulous in tracking thread lifecycles e.g. applications -# that call functions which target detached threads without some form of -# thread exit synchronisation. -# -# Usage: -# Set to any value in the range: 0 <= value < 2^wordsize. -# Set to 0 to emulate reusable thread ID behaviour like Linux or *BSD. -# Set to 1 for unique thread IDs like Solaris (this is the default). -# Set to some factor of 2^wordsize to emulate smaller word size types -# (i.e. will wrap sooner). This might be useful to emulate some embedded -# systems. -# -# define PTW32_THREAD_ID_REUSE_INCREMENT 0 -# -# ---------------------------------------------------------------------- - */ -#undef PTW32_THREAD_ID_REUSE_INCREMENT - - -/********************************************************************* - * Target specific groups - * - * If you find that these are incorrect or incomplete please report it - * to the pthreads-win32 maintainer. Thanks. - *********************************************************************/ --#ifdef WINCE +-#if defined(WINCE) -#define NEED_DUPLICATEHANDLE -#define NEED_CREATETHREAD -#define NEED_ERRNO -#define NEED_CALLOC -#define NEED_FTIME --//#define NEED_SEM +-/* #define NEED_SEM */ -#define NEED_UNICODE_CONSTS -#define NEED_PROCESS_AFFINITY_MASK +-/* This may not be needed */ +-#define RETAIN_WSALASTERROR -#endif - --#ifdef _UWIN +-#if defined(_UWIN) -#define HAVE_MODE_T -#define HAVE_STRUCT_TIMESPEC -#endif - --#ifdef __GNUC__ +-#if defined(__GNUC__) -#define HAVE_C_INLINE -#endif - --#ifdef __MINGW32__ +-#if defined(__MINGW64__) +-#define HAVE_MODE_T +-#define HAVE_STRUCT_TIMESPEC +-#elif defined(__MINGW32__) -#define HAVE_MODE_T -#endif - --#ifdef __BORLANDC__ +-#if defined(__BORLANDC__) -#endif - --#ifdef __WATCOMC__ +-#if defined(__WATCOMC__) -#endif - --#ifdef __DMC__ +-#if defined(__DMC__) -#define HAVE_SIGNAL_H -#define HAVE_C_INLINE -#endif - - - -#endif -diff -Nru pthreads-w32-2-8-0-release.orig/config.h.cmake pthreads-w32-2-8-0-release/config.h.cmake ---- pthreads-w32-2-8-0-release.orig/config.h.cmake 1970-01-01 01:00:00.000000000 +0100 -+++ pthreads-w32-2-8-0-release/config.h.cmake 2011-07-29 13:30:02.140596800 +0200 -@@ -0,0 +1,134 @@ +diff -Nru -x '*~' pthreads-w32-2-9-1-release.orig/config.h.cmake pthreads-w32-2-9-1-release/config.h.cmake +--- pthreads-w32-2-9-1-release.orig/config.h.cmake 1970-01-01 01:00:00.000000000 +0100 ++++ pthreads-w32-2-9-1-release/config.h.cmake 2013-09-01 13:19:57.134952300 +0200 +@@ -0,0 +1,148 @@ +/* config.h */ + +#ifndef PTW32_CONFIG_H +#define PTW32_CONFIG_H + +/********************************************************************* + * Defaults: see target specific redefinitions below. + *********************************************************************/ + +/* We're building the pthreads-win32 library */ +#define PTW32_BUILD + +/* Do we know about the C type sigset_t? */ +#undef HAVE_SIGSET_T + +/* Define if you have the header file. */ +#undef HAVE_SIGNAL_H + +/* Define if you have the Borland TASM32 or compatible assembler. */ +#undef HAVE_TASM32 + +/* Define if you don't have Win32 DuplicateHandle. (eg. WinCE) */ +#undef NEED_DUPLICATEHANDLE + +/* Define if you don't have Win32 _beginthreadex. (eg. WinCE) */ +#undef NEED_CREATETHREAD + +/* Define if you don't have Win32 errno. (eg. WinCE) */ +#undef NEED_ERRNO + +/* Define if you don't have Win32 calloc. (eg. WinCE) */ +#undef NEED_CALLOC + +/* Define if you don't have Win32 ftime. (eg. WinCE) */ +#undef NEED_FTIME + +/* Define if you don't have Win32 semaphores. (eg. WinCE 2.1 or earlier) */ +#undef NEED_SEM + +/* Define if you need to convert string parameters to unicode. (eg. WinCE) */ +#undef NEED_UNICODE_CONSTS + +/* Define if your C (not C++) compiler supports "inline" functions. */ +#undef HAVE_C_INLINE + +/* Do we know about type mode_t? */ +#undef HAVE_MODE_T + ++/* ++ * Define if GCC has atomic builtins, i.e. __sync_* intrinsics ++ * __sync_lock_* is implemented in mingw32 gcc 4.5.2 at least ++ * so this define does not turn those on or off. If you get an ++ * error from __sync_lock* then consider upgrading your gcc. ++ */ ++#undef HAVE_GCC_ATOMIC_BUILTINS ++ +/* Define if you have the timespec struct */ +#cmakedefine HAVE_STRUCT_TIMESPEC + +/* Define if you don't have the GetProcessAffinityMask() */ +#undef NEED_PROCESS_AFFINITY_MASK + ++/* Define if your version of Windows TLSGetValue() clears WSALastError ++ * and calling SetLastError() isn't enough restore it. You'll also need to ++ * link against wsock32.lib (or libwsock32.a for MinGW). ++ */ ++#undef RETAIN_WSALASTERROR ++ +/* +# ---------------------------------------------------------------------- +# The library can be built with some alternative behaviour to better +# facilitate development of applications on Win32 that will be ported +# to other POSIX systems. +# +# Nothing described here will make the library non-compliant and strictly +# compliant applications will not be affected in any way, but +# applications that make assumptions that POSIX does not guarantee are +# not strictly compliant and may fail or misbehave with some settings. +# +# PTW32_THREAD_ID_REUSE_INCREMENT +# Purpose: +# POSIX says that applications should assume that thread IDs can be +# recycled. However, Solaris (and some other systems) use a [very large] +# sequence number as the thread ID, which provides virtual uniqueness. +# This provides a very high but finite level of safety for applications +# that are not meticulous in tracking thread lifecycles e.g. applications +# that call functions which target detached threads without some form of +# thread exit synchronisation. +# +# Usage: +# Set to any value in the range: 0 <= value < 2^wordsize. +# Set to 0 to emulate reusable thread ID behaviour like Linux or *BSD. +# Set to 1 for unique thread IDs like Solaris (this is the default). +# Set to some factor of 2^wordsize to emulate smaller word size types +# (i.e. will wrap sooner). This might be useful to emulate some embedded +# systems. +# +# define PTW32_THREAD_ID_REUSE_INCREMENT 0 +# +# ---------------------------------------------------------------------- + */ +#undef PTW32_THREAD_ID_REUSE_INCREMENT + + +/********************************************************************* + * Target specific groups + * + * If you find that these are incorrect or incomplete please report it + * to the pthreads-win32 maintainer. Thanks. + *********************************************************************/ +#ifdef WINCE +#define NEED_DUPLICATEHANDLE +#define NEED_CREATETHREAD +#define NEED_ERRNO +#define NEED_CALLOC +#define NEED_FTIME +//#define NEED_SEM +#define NEED_UNICODE_CONSTS +#define NEED_PROCESS_AFFINITY_MASK +#endif + +#ifdef _UWIN +#define HAVE_MODE_T +#define HAVE_STRUCT_TIMESPEC +#endif + +#ifdef __GNUC__ +#define HAVE_C_INLINE +#endif + +#ifdef __MINGW32__ +#define HAVE_MODE_T +#endif + +#ifdef __BORLANDC__ +#endif + +#ifdef __WATCOMC__ +#endif + +#ifdef __DMC__ +#define HAVE_SIGNAL_H +#define HAVE_C_INLINE +#endif + + + +#endif -diff -Nru pthreads-w32-2-8-0-release.orig/ConfigureChecks.cmake pthreads-w32-2-8-0-release/ConfigureChecks.cmake ---- pthreads-w32-2-8-0-release.orig/ConfigureChecks.cmake 1970-01-01 01:00:00.000000000 +0100 -+++ pthreads-w32-2-8-0-release/ConfigureChecks.cmake 2011-07-29 13:35:12.121326700 +0200 +diff -Nru -x '*~' pthreads-w32-2-9-1-release.orig/ConfigureChecks.cmake pthreads-w32-2-9-1-release/ConfigureChecks.cmake +--- pthreads-w32-2-9-1-release.orig/ConfigureChecks.cmake 1970-01-01 01:00:00.000000000 +0100 ++++ pthreads-w32-2-9-1-release/ConfigureChecks.cmake 2013-09-01 13:39:02.982491000 +0200 @@ -0,0 +1,16 @@ +# Configure checks for the config.h + +include(CheckIncludeFile) +include(CheckFunctionExists) +include(CheckSymbolExists) +INCLUDE (CheckTypeSize) + +SET(CMAKE_EXTRA_INCLUDE_FILES time.h) +CHECK_TYPE_SIZE("struct timespec" STRUCT_TIMESPEC) +SET(CMAKE_EXTRA_INCLUDE_FILES) + + -+add_definitions(-DHAVE_CONFIG_H) ++add_definitions(-DHAVE_PTW32_CONFIG_H) + +configure_file(config.h.cmake ${CMAKE_SOURCE_DIR}/config.h) + -diff -Nru pthreads-w32-2-8-0-release.orig/create.c pthreads-w32-2-8-0-release/create.c ---- pthreads-w32-2-8-0-release.orig/create.c 2005-05-06 09:31:31.000000000 +0200 -+++ pthreads-w32-2-8-0-release/create.c 2011-07-29 13:23:37.214580300 +0200 +diff -Nru -x '*~' pthreads-w32-2-9-1-release.orig/create.c pthreads-w32-2-9-1-release/create.c +--- pthreads-w32-2-9-1-release.orig/create.c 2012-03-18 06:11:43.000000000 +0100 ++++ pthreads-w32-2-9-1-release/create.c 2013-09-01 13:00:26.086972100 +0200 @@ -94,6 +94,11 @@ int priority; pthread_t self; + if(!tid) + { + result = EINVAL; + goto FAIL0; + } /* * Before doing anything, check that tid can be stored through * without invoking a memory protection error (segfault). -diff -Nru pthreads-w32-2-8-0-release.orig/implement.h pthreads-w32-2-8-0-release/implement.h ---- pthreads-w32-2-8-0-release.orig/implement.h 2005-06-03 10:36:27.000000000 +0200 -+++ pthreads-w32-2-8-0-release/implement.h 2011-07-29 13:23:37.224580900 +0200 -@@ -56,6 +56,7 @@ +diff -Nru -x '*~' pthreads-w32-2-9-1-release.orig/implement.h pthreads-w32-2-9-1-release/implement.h +--- pthreads-w32-2-9-1-release.orig/implement.h 2012-03-18 06:11:43.000000000 +0100 ++++ pthreads-w32-2-9-1-release/implement.h 2013-09-01 13:00:26.098972800 +0200 +@@ -55,6 +55,7 @@ * note: ETIMEDOUT is correctly defined in winsock.h */ #include +#include /* * In case ETIMEDOUT hasn't been defined above somehow. -@@ -75,6 +76,8 @@ +@@ -78,6 +79,8 @@ /* use local include files during development */ #include "semaphore.h" #include "sched.h" +#include "pthread.h" + #if defined(HAVE_C_INLINE) || defined(__cplusplus) #define INLINE inline diff --git a/3rdparty/ext_qt/0001-Don-t-request-the-MIME-image-every-time-Windows-asks.patch b/3rdparty/ext_qt/0001-Don-t-request-the-MIME-image-every-time-Windows-asks.patch index dcefedc992..b85a007d33 100644 --- a/3rdparty/ext_qt/0001-Don-t-request-the-MIME-image-every-time-Windows-asks.patch +++ b/3rdparty/ext_qt/0001-Don-t-request-the-MIME-image-every-time-Windows-asks.patch @@ -1,37 +1,37 @@ From 674cfce97c4972176d2bcb55d7013c0ac2190029 Mon Sep 17 00:00:00 2001 From: Dmitry Kazakov Date: Tue, 21 Jun 2016 14:50:07 +0300 Subject: [PATCH 1/2] Don't request the MIME image every time Windows asks for the list of supported types Change-Id: I05516d83dc4e0f192bc94f92cefc722f25dae4d4 --- - src/plugins/platforms/windows/qwindowsmime.cpp | 9 ++++++--- + qtbase/src/plugins/platforms/windows/qwindowsmime.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp +diff --git a/qtbase/src/plugins/platforms/windows/qwindowsmime.cpp b/qtbase/src/plugins/platforms/windows/qwindowsmime.cpp index a8264b5..90d646b 100644 ---- a/src/plugins/platforms/windows/qwindowsmime.cpp -+++ b/src/plugins/platforms/windows/qwindowsmime.cpp +--- a/qtbase/src/plugins/platforms/windows/qwindowsmime.cpp ++++ b/qtbase/src/plugins/platforms/windows/qwindowsmime.cpp @@ -1081,12 +1081,15 @@ bool QWindowsMimeImage::canConvertToMime(const QString &mimeType, IDataObject *p bool QWindowsMimeImage::canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const { int cf = getCf(formatetc); + + if (cf != CF_DIBV5 && cf != CF_DIB && cf != CF_PNG) + return false; + if (!mimeData->hasImage()) return false; + const QImage image = qvariant_cast(mimeData->imageData()); - if (image.isNull()) - return false; - return cf == CF_DIBV5 || (cf == CF_DIB) || cf == int(CF_PNG); + return !image.isNull(); } bool QWindowsMimeImage::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const -- 2.6.4 diff --git a/3rdparty/ext_qt/0002-Hack-always-return-we-support-DIBV5.patch b/3rdparty/ext_qt/0002-Hack-always-return-we-support-DIBV5.patch index 669cdc7a8e..77e57028bd 100644 --- a/3rdparty/ext_qt/0002-Hack-always-return-we-support-DIBV5.patch +++ b/3rdparty/ext_qt/0002-Hack-always-return-we-support-DIBV5.patch @@ -1,30 +1,30 @@ From 5e5026beb420018266d3d00fdb530bb714a841a6 Mon Sep 17 00:00:00 2001 From: Dmitry Kazakov Date: Tue, 21 Jun 2016 14:50:47 +0300 Subject: [PATCH 2/2] Hack: always return we support DIBV5 Asking for the entire image may be too expensive Change-Id: I44c38fad73f1bb5859eb58b941054eeb6c3c6b66 --- - src/plugins/platforms/windows/qwindowsmime.cpp | 4 +--- + qtbase/src/plugins/platforms/windows/qwindowsmime.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp +diff --git a/qtbase/src/plugins/platforms/windows/qwindowsmime.cpp b/qtbase/src/plugins/platforms/windows/qwindowsmime.cpp index 90d646b..ef97db7 100644 ---- a/src/plugins/platforms/windows/qwindowsmime.cpp -+++ b/src/plugins/platforms/windows/qwindowsmime.cpp +--- a/qtbase/src/plugins/platforms/windows/qwindowsmime.cpp ++++ b/qtbase/src/plugins/platforms/windows/qwindowsmime.cpp @@ -1052,9 +1052,7 @@ QVector QWindowsMimeImage::formatsForMime(const QString &mimeType, co QVector formatetcs; if (mimeData->hasImage() && mimeType == QLatin1String("application/x-qt-image")) { //add DIBV5 if image has alpha channel. Do not add CF_PNG here as it will confuse MS Office (QTBUG47656). - QImage image = qvariant_cast(mimeData->imageData()); - if (!image.isNull() && image.hasAlphaChannel()) - formatetcs += setCf(CF_DIBV5); + formatetcs += setCf(CF_DIBV5); formatetcs += setCf(CF_DIB); } if (!formatetcs.isEmpty()) -- 2.6.4 diff --git a/3rdparty/ext_qt/0003-Hack-for-fullscreen-workaround.patch b/3rdparty/ext_qt/0003-Hack-for-fullscreen-workaround.patch index bd8e7cfc66..d7c8bfb7ae 100644 --- a/3rdparty/ext_qt/0003-Hack-for-fullscreen-workaround.patch +++ b/3rdparty/ext_qt/0003-Hack-for-fullscreen-workaround.patch @@ -1,26 +1,26 @@ From 84a774e00e9d2535fdb8c798d7789130a9a008f6 Mon Sep 17 00:00:00 2001 From: Michael Abrahams Date: Wed, 22 Jun 2016 13:37:06 -0400 Subject: [PATCH 3/4] Hack for fullscreen workaround https://bugreports.qt.io/browse/QTBUG-41309 --- - src/plugins/platforms/windows/qwindowswindow.cpp | 2 +- + qtbase/src/plugins/platforms/windows/qwindowswindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp +diff --git a/qtbase/src/plugins/platforms/windows/qwindowswindow.cpp b/qtbase/src/plugins/platforms/windows/qwindowswindow.cpp index 9c6cb53..d0829e3 100644 ---- a/src/plugins/platforms/windows/qwindowswindow.cpp -+++ b/src/plugins/platforms/windows/qwindowswindow.cpp +--- a/qtbase/src/plugins/platforms/windows/qwindowswindow.cpp ++++ b/qtbase/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1769,7 +1769,7 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) const UINT swpf = SWP_FRAMECHANGED | SWP_NOACTIVATE; const bool wasSync = testFlag(SynchronousGeometryChangeEvent); setFlag(SynchronousGeometryChangeEvent); - SetWindowPos(m_data.hwnd, HWND_TOP, r.left(), r.top(), r.width(), r.height(), swpf); + SetWindowPos(m_data.hwnd, HWND_TOP, r.left()-1, r.top()-1, r.width()+2, r.height()+2, swpf); if (!wasSync) clearFlag(SynchronousGeometryChangeEvent); QWindowSystemInterface::handleGeometryChange(window(), r); -- 2.7.4.windows.1 diff --git a/3rdparty/ext_qt/CMakeLists.txt b/3rdparty/ext_qt/CMakeLists.txt index de01c52ded..d1a31f042b 100644 --- a/3rdparty/ext_qt/CMakeLists.txt +++ b/3rdparty/ext_qt/CMakeLists.txt @@ -1,66 +1,60 @@ SET(EXTPREFIX_qt "${EXTPREFIX}") if (WIN32) ExternalProject_Add( ext_qt DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://download.qt.io/official_releases/qt/5.6/5.6.0/single/qt-everywhere-opensource-src-5.6.0.zip - URL_MD5 03402708f260dcc917abae9bc559c1df + URL https://download.qt.io/official_releases/qt/5.6/5.6.1-1/single/qt-everywhere-opensource-src-5.6.1-1.zip + URL_MD5 9d7ea0cadcec7b5a63e8e83686756978 PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/disable-wintab.diff COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/qtgui-private-headers.diff COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0001-Don-t-request-the-MIME-image-every-time-Windows-asks.patch COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0002-Hack-always-return-we-support-DIBV5.patch COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0003-Hack-for-fullscreen-workaround.patch INSTALL_DIR ${EXTPREFIX_qt} - CONFIGURE_COMMAND /configure.bat -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdoc -skip qtenginio -skip qtgraphicaleffects -skip qtlocation -skip qtmultimedia -skip qtsensors -skip qtserialport -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtxmlpatterns -no-sql-sqlite -nomake examples -nomake tools -no-compile-examples -no-dbus -no-iconv -no-angle -no-ssl -no-openssl -no-wmf-backend -no-qml-debug -no-libproxy -no-system-proxies -no-nis -no-icu -no-mtdev -opensource -confirm-license -release -opengl desktop -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -prefix ${EXTPREFIX_qt} + CONFIGURE_COMMAND /configure.bat -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdoc -skip qtenginio -skip qtgraphicaleffects -skip qtlocation -skip qtmultimedia -skip qtsensors -skip qtserialport -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtxmlpatterns -no-sql-sqlite -nomake examples -nomake tools -no-compile-examples -no-dbus -no-iconv -no-angle -no-ssl -no-openssl -no-wmf-backend -no-qml-debug -no-libproxy -no-system-proxies -no-nis -no-icu -no-mtdev -opensource -confirm-license -release -opengl desktop -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -prefix ${EXTPREFIX_qt} -platform win32-g++ # use this line for building Qt with debugging info enabled - #CONFIGURE_COMMAND /configure.bat -release -force-debug-info -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdoc -skip qtenginio -skip qtgraphicaleffects -skip qtlocation -skip qtmultimedia -skip qtsensors -skip qtserialport -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtxmlpatterns -no-sql-sqlite -nomake examples -nomake tools -no-compile-examples -no-dbus -no-iconv -no-angle -no-ssl -no-openssl -no-wmf-backend -no-qml-debug -no-libproxy -no-system-proxies -no-nis -no-icu -no-mtdev -opensource -confirm-license -release -opengl desktop -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -prefix ${EXTPREFIX_qt} + #CONFIGURE_COMMAND /configure.bat -release -force-debug-info -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdoc -skip qtenginio -skip qtgraphicaleffects -skip qtlocation -skip qtmultimedia -skip qtsensors -skip qtserialport -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtxmlpatterns -no-sql-sqlite -nomake examples -nomake tools -no-compile-examples -no-dbus -no-iconv -no-angle -no-ssl -no-openssl -no-wmf-backend -no-qml-debug -no-libproxy -no-system-proxies -no-nis -no-icu -no-mtdev -opensource -confirm-license -release -opengl desktop -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -prefix ${EXTPREFIX_qt} -platform win32-g++ BUILD_COMMAND nmake INSTALL_COMMAND nmake install UPDATE_COMMAND "" BUILD_IN_SOURCE 1 ALWAYS 0 + DEPENDS ext_patch ) else() if (APPLE) ExternalProject_Add( ext_qt DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://download.qt.io/official_releases/qt/5.6/5.6.0/single/qt-everywhere-opensource-src-5.6.0.tar.gz - URL_MD5 7a2a867bc12384f4161809136d49d4be + URL https://download.qt.io/official_releases/qt/5.6/5.6.1-1/single/qt-everywhere-opensource-src-5.6.1-1.tar.gz + URL_MD5 8fdec6d657bc370bd3183d8fe8e9c47a + PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/macdeploy-qt.diff INSTALL_DIR ${EXTPREFIX_qt} - CONFIGURE_COMMAND "/configure -confirm-license -opensource -nomake examples \ - -no-openssl \ - -no-compile-examples -qt-freetype -qt-harfbuzz -opengl desktop \ - -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg - -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity \ - -skip qtenginio -skip qtgraphicaleffects -skip qtlocation -skip qtmultimedia \ - -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets \ - -skip qtwebview \ - -prefix ${EXTPREFIX_qt} " + CONFIGURE_COMMAND /configure -confirm-license -opensource -nomake examples -no-openssl -no-compile-examples -qt-freetype -qt-harfbuzz -opengl desktop -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtenginio -skip qtgraphicaleffects -skip qtlocation -skip qtmultimedia -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtxmlpatterns -prefix ${EXTPREFIX_qt} BUILD_COMMAND make INSTALL_COMMAND make install UPDATE_COMMAND "" BUILD_IN_SOURCE 1 ALWAYS 0 ) else() ExternalProject_Add( ext_qt DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://download.qt.io/official_releases/qt/5.6/5.6.0/single/qt-everywhere-opensource-src-5.6.0.tar.gz - URL_MD5 7a2a867bc12384f4161809136d49d4be + URL https://download.qt.io/official_releases/qt/5.6/5.6.1-1/single/qt-everywhere-opensource-src-5.6.1-1.tar.gz + URL_MD5 8fdec6d657bc370bd3183d8fe8e9c47a PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/qt-no-motion-compression.diff INSTALL_DIR ${EXTPREFIX_qt} CONFIGURE_COMMAND /configure -prefix ${EXTPREFIX_qt} -opensource -confirm-license -nomake examples -no-sql-sqlite -no-openssl -no-qml-debug -no-mtdev -no-journald -no-syslog -no-nis -no-cups -no-tslib -no-directfb -no-linuxfb -no-libproxy -no-pch -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-harfbuzz -qt-freetype -qt-xcb -qt-xkbcommon-x11 -optimized-qmake -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtenginio -skip qtgraphicaleffects -skip qtlocation -skip qtmultimedia -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview BUILD_COMMAND make INSTALL_COMMAND make install UPDATE_COMMAND "" BUILD_IN_SOURCE 1 ALWAYS 0 ) endif() endif() diff --git a/3rdparty/ext_qt/macdeploy-qt.diff b/3rdparty/ext_qt/macdeploy-qt.diff index 2a33785139..ebad0e8a58 100644 --- a/3rdparty/ext_qt/macdeploy-qt.diff +++ b/3rdparty/ext_qt/macdeploy-qt.diff @@ -1,127 +1,127 @@ -diff --git a/src/macdeployqt/macdeployqt/main.cpp b/src/macdeployqt/macdeployqt/main.cpp +diff --git a/qttools/src/macdeployqt/macdeployqt/main.cpp b/qttools/src/macdeployqt/macdeployqt/main.cpp index 81639f2..a7b28d1 100644 ---- a/src/macdeployqt/macdeployqt/main.cpp -+++ b/src/macdeployqt/macdeployqt/main.cpp +--- a/qttools/src/macdeployqt/macdeployqt/main.cpp ++++ b/qttools/src/macdeployqt/macdeployqt/main.cpp @@ -57,6 +57,7 @@ int main(int argc, char **argv) qDebug() << " -always-overwrite : Copy files even if the target file exists"; qDebug() << " -codesign= : Run codesign with the given identity on all executables"; qDebug() << " -appstore-compliant: Skip deployment of components that use private API"; + qDebug() << " -extra-plugins= : Deploy plugins from given extra directory"; qDebug() << ""; qDebug() << "macdeployqt takes an application bundle as input and makes it"; qDebug() << "self-contained by copying in the Qt frameworks and plugins that"; @@ -96,6 +97,7 @@ int main(int argc, char **argv) extern bool runCodesign; extern QString codesignIdentiy; extern bool appstoreCompliant; + QStringList extraPluginDirectories; for (int i = 2; i < argc; ++i) { QByteArray argument = QByteArray(argv[i]); @@ -151,6 +153,13 @@ int main(int argc, char **argv) } else if (argument == QByteArray("-appstore-compliant")) { LogDebug() << "Argument found:" << argument; appstoreCompliant = true; + } else if (argument.startsWith(QByteArray("-extra-plugins"))) { + LogDebug() << "Argument found:" << argument; + int index = argument.indexOf('='); + if (index == -1) + LogError() << "Missing extra plugins directory"; + else + extraPluginDirectories << argument.mid(index+1); } else if (argument.startsWith("-")) { LogError() << "Unknown argument" << argument << "\n"; return 1; @@ -178,10 +187,13 @@ int main(int argc, char **argv) deploymentInfo.deployedFrameworks = deploymentInfo.deployedFrameworks.toSet().toList(); } - if (plugins && !deploymentInfo.qtPath.isEmpty()) { + if ((plugins && !deploymentInfo.qtPath.isEmpty()) || !extraPluginDirectories.isEmpty()) { deploymentInfo.pluginPath = deploymentInfo.qtPath + "/plugins"; LogNormal(); - deployPlugins(appBundlePath, deploymentInfo, useDebugLibs); + if (plugins && !deploymentInfo.qtPath.isEmpty()) + deployPlugins(appBundlePath, deploymentInfo, useDebugLibs); + if (!extraPluginDirectories.isEmpty()) + deployExtraPlugins(appBundlePath, deploymentInfo, useDebugLibs, extraPluginDirectories); createQtConf(appBundlePath); } -diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp +diff --git a/qttools/src/macdeployqt/shared/shared.cpp b/qttools/src/macdeployqt/shared/shared.cpp index d20b219..4a9aa1f 100644 ---- a/src/macdeployqt/shared/shared.cpp -+++ b/src/macdeployqt/shared/shared.cpp +--- a/qttools/src/macdeployqt/shared/shared.cpp ++++ b/qttools/src/macdeployqt/shared/shared.cpp @@ -1020,6 +1020,43 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl } } +void deployExtraPlugins(const ApplicationBundleInfo &appBundleInfo, + const QString pluginDestinationPath, DeploymentInfo deploymentInfo, bool useDebugLibs, const QStringList &extraPluginDirectories) +{ + foreach (const QString &extraPluginDir, extraPluginDirectories) { + LogNormal() << "Deploying plugins from" << extraPluginDir; + + // search for dylib and so files, both work as plugins on mac os + QDir dir(extraPluginDir); + dir.setFilter(QDir::Files); + dir.setNameFilters(QStringList() << "*.dylib" << "*.so"); + QDirIterator dirIterator(dir, QDirIterator::Subdirectories); + QStringList pluginList; + while (dirIterator.hasNext()) { + dirIterator.next(); + if (!QFileInfo(dirIterator.filePath()).isFile()) + continue; + pluginList.append(dir.relativeFilePath(dirIterator.filePath())); + } + + // deploy all found plugins + foreach (const QString &plugin, pluginList) { + QString sourcePath = extraPluginDir + "/" + plugin; + const QString destinationPath = pluginDestinationPath + "/" + plugin; + QDir dir; + dir.mkpath(QFileInfo(destinationPath).path()); + + if (copyFilePrintStatus(sourcePath, destinationPath)) { + runStrip(destinationPath); + + QList frameworks = getQtFrameworks(destinationPath, appBundleInfo.path, deploymentInfo.rpathsUsed, useDebugLibs); + deployQtFrameworks(frameworks, appBundleInfo.path, QStringList() << destinationPath, useDebugLibs, deploymentInfo.useLoaderPath); + + } + } + } +} + void createQtConf(const QString &appBundlePath) { // Set Plugins and imports paths. These are relative to App.app/Contents. @@ -1061,6 +1098,16 @@ void deployPlugins(const QString &appBundlePath, DeploymentInfo deploymentInfo, deployPlugins(applicationBundle, deploymentInfo.pluginPath, pluginDestinationPath, deploymentInfo, useDebugLibs); } +void deployExtraPlugins(const QString &appBundlePath, DeploymentInfo deploymentInfo, bool useDebugLibs, const QStringList &extraPluginDirectories) +{ + ApplicationBundleInfo applicationBundle; + applicationBundle.path = appBundlePath; + applicationBundle.binaryPath = findAppBinary(appBundlePath); + + const QString pluginDestinationPath = appBundlePath + "/" + "Contents/PlugIns"; + deployExtraPlugins(applicationBundle, pluginDestinationPath, deploymentInfo, useDebugLibs, extraPluginDirectories); +} + void deployQmlImport(const QString &appBundlePath, const QSet &rpaths, const QString &importSourcePath, const QString &importName) { QString importDestinationPath = appBundlePath + "/Contents/Resources/qml/" + importName; -diff --git a/src/macdeployqt/shared/shared.h b/src/macdeployqt/shared/shared.h +diff --git a/qttools/src/macdeployqt/shared/shared.h b/qttools/src/macdeployqt/shared/shared.h index ea678c2..f10efd3 100644 ---- a/src/macdeployqt/shared/shared.h -+++ b/src/macdeployqt/shared/shared.h +--- a/qttools/src/macdeployqt/shared/shared.h ++++ b/qttools/src/macdeployqt/shared/shared.h @@ -100,6 +100,7 @@ DeploymentInfo deployQtFrameworks(const QString &appBundlePath, const QStringLis DeploymentInfo deployQtFrameworks(QList frameworks,const QString &bundlePath, const QStringList &binaryPaths, bool useDebugLibs, bool useLoaderPath); void createQtConf(const QString &appBundlePath); void deployPlugins(const QString &appBundlePath, DeploymentInfo deploymentInfo, bool useDebugLibs); +void deployExtraPlugins(const QString &appBundlePath, DeploymentInfo deploymentInfo, bool useDebugLibs, const QStringList &extraPluginDirectories); bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInfo, QStringList &qmlDirs); void changeIdentification(const QString &id, const QString &binaryPath); void changeInstallName(const QString &oldName, const QString &newName, const QString &binaryPath); diff --git a/3rdparty/ext_tiff/CMakeLists.txt b/3rdparty/ext_tiff/CMakeLists.txt index ff6a8feddb..32351b3987 100755 --- a/3rdparty/ext_tiff/CMakeLists.txt +++ b/3rdparty/ext_tiff/CMakeLists.txt @@ -1,30 +1,30 @@ SET(EXTPREFIX_tiff "${EXTPREFIX}" ) -if (MSVC) +if (MSVC OR MINGW) ExternalProject_Add( ext_tiff DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} URL http://files.kde.org/krita/build/dependencies/tiff-4.0.3.tar.gz URL_MD5 051c1068e6a0627f461948c365290410 PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/tiff-4.0.3-20130124.diff INSTALL_DIR ${EXTPREFIX_tiff} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_tiff} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_patch ext_zlib ext_jpeg ) -else (MSVC) +else (MSVC OR MINGW) ExternalProject_Add( ext_tiff DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/tiff-4.0.3.tar.gz - URL_MD5 051c1068e6a0627f461948c365290410 + URL http://files.kde.org/krita/build/dependencies/tiff-4.0.6.tar.gz + URL_MD5 d1d2e940dea0b5ad435f21f03d96dd72 CONFIGURE_COMMAND /configure -prefix ${EXTPREFIX_tiff} ${GLOBAL_AUTOMAKE_PROFILE} BUILD_COMMAND make INSTALL_COMMAND make install UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_zlib ext_jpeg ) -endif (MSVC) +endif (MSVC OR MINGW) diff --git a/3rdparty/ext_tiff/tiff-4.0.3-20130124.diff b/3rdparty/ext_tiff/tiff-4.0.3-20130124.diff index c03a002ef6..e72df951f9 100755 --- a/3rdparty/ext_tiff/tiff-4.0.3-20130124.diff +++ b/3rdparty/ext_tiff/tiff-4.0.3-20130124.diff @@ -1,1420 +1,1458 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..f4ef285 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,45 @@ +project(libtiff) + +cmake_minimum_required(VERSION 2.6) + +option(BUILD_TOOLS "build the tools" OFF) +option(BUILD_TESTS "build the tests" OFF) + +if(BUILD_TESTS) + enable_testing() +endif(BUILD_TESTS) + +include_directories( + ${CMAKE_SOURCE_DIR}/libtiff + ${CMAKE_SOURCE_DIR}/port + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/libtiff +) + +include(ConfigureChecks.cmake) + +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + if(NOT MSVC60) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996") + endif(NOT MSVC60) +endif(MSVC) + +include_directories( + ${CMAKE_SOURCE_DIR}/libtiff + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/libtiff +) + +add_subdirectory(libtiff) +add_subdirectory(man) +if(BUILD_TOOLS) + add_subdirectory(port) + add_subdirectory(tools) +endif(BUILD_TOOLS) + +if(BUILD_TESTS) + add_subdirectory(tests) +endif(BUILD_TESTS) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake new file mode 100644 index 0000000..ee25058 --- /dev/null +++ b/ConfigureChecks.cmake -@@ -0,0 +1,181 @@ +@@ -0,0 +1,199 @@ +# configure checks. +find_package(OpenGL) + +include_directories(${CMAKE_BINARY_DIR}) + +# options +if(APPLE) + set(AC_APPLE_UNIVERSAL_BUILD 1) +endif(APPLE) + +option(CCITT_SUPPORT "CCITT Group 3 & 4 algorithms" ON) +option(LOGLUV_SUPPORT "LogLuv high dynamic range encoding" ON) +option(CXX_SUPPORT "C++ stream API (requires C++ compiler)" OFF) +option(LZW_SUPPORT "LZW algorithm" ON) +option(JBIG_SUPPORT "ISO JBIG compression (requires JBIG-KIT library)" OFF) +option(MDI_SUPPORT "Microsoft Document Imaging format" OFF) +option(NEXT_SUPPORT "NeXT 2-bit RLE algorithm" ON) +option(SUBIFD_SUPPORT "SubIFD tag (330) support" ON) +option(THUNDER_SUPPORT "ThunderScan 4-bit RLE algorithm" ON) +option(OJPEG_SUPPORT "Old JPEG compresson (read-only)" OFF) +option(PACKBITS_SUPPORT "Macintosh PackBits algorithm" ON) + +option(CHECK_JPEG_YCBCR_SUBSAMPLING 1) +option(DEFAULT_EXTRASAMPLE_AS_ALPHA "Treat extra sample as alpha" ON) + + +if(WIN32) + set(X_DISPLAY_MISSING 1) +else(WIN32) + set(STDC_HEADERS 1) + set(HAVE_LIBC 1) + set(HAVE_LIBM 1) + set(HAVE_PTHREAD 1) +endif(WIN32) + +if(NOT WINCE) + set(HAVE_IEEEFP 1) +endif(NOT WINCE) + +if(MSVC) + set(inline "__inline") +else(MSVC) + set(inline "inline") +endif(MSVC) + +include(CheckIncludeFiles) +include(CheckFunctionExists) +include(CheckLibraryExists) +include(CheckSymbolExists) +include(CheckTypeSize) +include(TestBigEndian) + +test_big_endian(HOST_BIGENDIAN) + +if(HOST_BIGENDIAN) + set(HOST_FILLORDER "FILLORDER_MSB2LSB") +else(HOST_BIGENDIAN) + set(HOST_FILLORDER "FILLORDER_LSB2MSB") +endif(HOST_BIGENDIAN) + + + +check_include_files("assert.h" HAVE_ASSERT_H) +check_include_files("dlfcn.h" HAVE_DLFCN_H) +check_include_files("fcntl.h" HAVE_FCNTL_H) +check_include_files("inttypes.h" HAVE_INTTYPES_H) +check_include_files("io.h" HAVE_IO_H) +check_include_files("limits.h" HAVE_LIMITS_H) +check_include_files("malloc.h" HAVE_MALLOC_H) +check_include_files("memory.h" HAVE_MEMORY_H) +check_include_files("search.h" HAVE_SEARCH_H) +check_include_files("stdint.h" HAVE_STDINT_H) +check_include_files("stdlib.h" HAVE_STDLIB_H) +check_include_files("strings.h" HAVE_STRINGS_H) +check_include_files("string.h" HAVE_STRING_H) +check_include_files("sys/stat.h" HAVE_SYS_STAT_H) +check_include_files("sys/time.h" HAVE_SYS_TIME_H) +check_include_files("sys/types.h" HAVE_SYS_TYPES_H) +check_include_files("unistd.h" HAVE_UNISTD_H) +check_include_files("windows.h" HAVE_WINDOWS_H) + +check_function_exists("floor" HAVE_FLOOR) +check_function_exists("getopt" HAVE_GETOPT) +check_function_exists("isascii" HAVE_ISASCII) +check_function_exists("jbg_newlen" HAVE_JBG_NEWLEN) +check_function_exists("lfind" HAVE_LFIND) +check_function_exists("memmove" HAVE_MEMMOVE) +check_function_exists("memset" HAVE_MEMSET) +check_function_exists("mmap" HAVE_MMAP) +check_function_exists("pow" HAVE_POW) +check_function_exists("setmode" HAVE_SETMODE) +check_function_exists("sqrt" HAVE_SQRT) +check_function_exists("strcasecmp" HAVE_STRCASECMP) +check_function_exists("strchr" HAVE_STRCHR) +check_function_exists("strrchr" HAVE_STRRCHR) +check_function_exists("strstr" HAVE_STRSTR) +check_function_exists("strtol" HAVE_STRTOL) +check_function_exists("strtoul" HAVE_STRTOUL) + +check_symbol_exists("int8" "stdint.h" HAVE_INT8) +check_symbol_exists("int16" "stdint.h" HAVE_INT16) +check_symbol_exists("int32" "stdint.h" HAVE_INT32) ++check_symbol_exists("int64" "stdint.h" HAVE_INT64) + + +set(PACKAGE "tiff") +set(PACKAGE_BUGREPORT "kde-windows@kde.org") +set(PACKAGE_NAME "LibTIFF Software") +set(PACKAGE_STRING "LibTIFF Software 4.0.3") +set(PACKAGE_TARNAME "tiff") +set(PACKAGE_URL "http://www.libtiff.org/") +set(PACKAGE_VERSION "4.0.3") +set(VERSION "4.0.3") + + +find_package(JPEG) +find_package(ZLIB) + +if(HAVE_JPEG) + include_directories(${JPEG_INCLUDE_DIR}) + option(JPEG_SUPPORT "JPEG compression" ON) +endif(HAVE_JPEG) + +if(ZLIB_FOUND) + include_directories(${ZLIB_INCLUDE_DIR}) + option(PIXARLOG_SUPPORT "Deflate compression" ON) + option(ZIP_SUPPORT "Pixar log-format algorithm" ON) +endif(ZLIB_FOUND) + +CHECK_TYPE_SIZE("int" SIZEOF_INT) +CHECK_TYPE_SIZE("long" SIZEOF_LONG) +CHECK_TYPE_SIZE("signed long" SIZEOF_SIGNED_LONG) +CHECK_TYPE_SIZE("signed long long" SIZEOF_SIGNED_LONG_LONG) +CHECK_TYPE_SIZE("unsigned long" SIZEOF_UNSIGNED_LONG) +CHECK_TYPE_SIZE("unsigned long long" SIZEOF_UNSIGNED_LONG_LONG) + +set(STRIPCHOP_DEFAULT "TIFF_STRIPCHOP") + +if(STRIPCHOP_DEFAULT AND NOT WIN32) + set(STRIP_SIZE_DEFAULT 8192) +endif(STRIPCHOP_DEFAULT AND NOT WIN32) + -+if(WIN32) ++if(MSVC) ++ set(TIFF_INT8_T "signed char") ++ set(TIFF_UINT8_T "unsigned char") ++ set(TIFF_INT16_T "signed short") ++ set(TIFF_UINT16_T "unsigned short") ++ set(TIFF_INT32_T "signed int") ++ set(TIFF_UINT32_T "unsigned int") + set(TIFF_INT64_FORMAT "\"%I64d\"") + set(TIFF_INT64_T "signed __int64") + set(TIFF_UINT64_FORMAT "\"%I64u\"") + set(TIFF_UINT64_T "unsigned __int64") -+endif(WIN32) ++elseif(MINGW) ++ set(TIFF_INT8_T "signed char") ++ set(TIFF_UINT8_T "unsigned char") ++ set(TIFF_INT16_T "signed short") ++ set(TIFF_UINT16_T "unsigned short") ++ set(TIFF_INT32_T "signed int") ++ set(TIFF_UINT32_T "unsigned int") ++ set(TIFF_INT64_FORMAT "\"%lld\"") ++ set(TIFF_INT64_T "signed long long") ++ set(TIFF_UINT64_FORMAT "\"%llu\"") ++ set(TIFF_UINT64_T "unsigned long long") ++endif() + +check_symbol_exists("tm" "sys/time.h" TM_IN_SYS_TIME) + +check_symbol_exists("off_t" "sys/types.h" HAVE_OFF_T) +if(NOT HAVE_OFF_T) + set(OFF_T "long int") +endif(NOT HAVE_OFF_T) + +check_symbol_exists("size_t" "sys/types.h" HAVE_SIZE_T) +if(NOT HAVE_SIZE_T) + set(SIZE_T "unsigned int") +endif(NOT HAVE_SIZE_T) + +#*************************************************************************************** +# still to fix later +#/* Define to necessary symbol if this constant uses a non-standard name on +# your system. */ +#cmakedefine PTHREAD_CREATE_JOINABLE + +#/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#cmakedefine NO_MINUS_C_MINUS_O + +#/* Number of bits in a file offset, on hosts where this is settable. */ +#cmakedefine _FILE_OFFSET_BITS + +#/* Define for large files, on AIX-style hosts. */ +#cmakedefine _LARGE_FILES +#*************************************************************************************** + -+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libtiff/tif_config.vc.h ${CMAKE_CURRENT_BINARY_DIR}/tif_config.h @COPYONLY) -+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libtiff/tiffconf.vc.h ${CMAKE_CURRENT_BINARY_DIR}/tiffconf.h @COPYONLY) -+#configure_file(${CMAKE_SOURCE_DIR}/libtiff/tif_config.h.cmake ${CMAKE_BINARY_DIR}/tif_config.h) -+#configure_file(${CMAKE_SOURCE_DIR}/libtiff/tiffconf.h.cmake ${CMAKE_BINARY_DIR}/tiffconf.h) ++#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libtiff/tif_config.vc.h ${CMAKE_CURRENT_BINARY_DIR}/tif_config.h @COPYONLY) ++#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libtiff/tiffconf.vc.h ${CMAKE_CURRENT_BINARY_DIR}/tiffconf.h @COPYONLY) ++configure_file(${CMAKE_SOURCE_DIR}/libtiff/tif_config.h.cmake ${CMAKE_BINARY_DIR}/tif_config.h) ++configure_file(${CMAKE_SOURCE_DIR}/libtiff/tiffconf.h.cmake ${CMAKE_BINARY_DIR}/tiffconf.h) + diff --git a/libtiff/CMakeLists.txt b/libtiff/CMakeLists.txt new file mode 100644 index 0000000..6d27cb9 --- /dev/null +++ b/libtiff/CMakeLists.txt @@ -0,0 +1,63 @@ +set(tiff_SRCS + tif_aux.c + tif_close.c + tif_codec.c + tif_color.c + tif_compress.c + tif_dir.c + tif_dirinfo.c + tif_dirread.c + tif_dirwrite.c + tif_dumpmode.c + tif_error.c + tif_extension.c + tif_fax3.c + tif_fax3sm.c + tif_flush.c + tif_getimage.c + tif_jbig.c + tif_jpeg.c + tif_jpeg_12.c + tif_luv.c + tif_lzma.c + tif_lzw.c + tif_next.c + tif_ojpeg.c + tif_open.c + tif_packbits.c + tif_pixarlog.c + tif_predict.c + tif_print.c + tif_read.c + tif_strip.c + tif_swab.c + tif_thunder.c + tif_tile.c + tif_version.c + tif_warning.c + tif_write.c + tif_zip.c +) + +if(WIN32) + set(tiff_SRCS ${tiff_SRCS} tif_win32.c libtiff.def) +else(WIN32) + set(tiff_SRCS ${tiff_SRCS} tif_unix.c) +endif(WIN32) + +add_library(tiff SHARED ${tiff_SRCS}) +set_target_properties(tiff PROPERTIES OUTPUT_NAME "tiff3") + +if(JPEG_FOUND) + target_link_libraries(tiff ${JPEG_LIBRARIES}) +endif(JPEG_FOUND) + +if(ZLIB_FOUND) + target_link_libraries(tiff ${ZLIB_LIBRARY}) +endif(ZLIB_FOUND) + +install(TARGETS tiff RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +install(FILES tiffvers.h tiff.h ${CMAKE_BINARY_DIR}/tiffconf.h tiffio.h DESTINATION include) \ No newline at end of file diff --git a/libtiff/tif_config.h.cmake b/libtiff/tif_config.h.cmake new file mode 100644 index 0000000..d3e8f98 --- /dev/null +++ b/libtiff/tif_config.h.cmake -@@ -0,0 +1,320 @@ +@@ -0,0 +1,323 @@ +/* libtiff/tif_config.h.in. Generated from configure.ac by autoheader. */ +#ifndef TIF_CONFIG_H +#define TIF_CONFIG_H + +/* Define if building universal (internal helper macro) */ +#cmakedefine AC_APPLE_UNIVERSAL_BUILD + +/* Support CCITT Group 3 & 4 algorithms */ +#cmakedefine CCITT_SUPPORT + +/* Pick up YCbCr subsampling info from the JPEG data stream to support files + lacking the tag (default enabled). */ +#cmakedefine CHECK_JPEG_YCBCR_SUBSAMPLING + +/* Support C++ stream API (requires C++ compiler) */ +#cmakedefine CXX_SUPPORT + +/* Treat extra sample as alpha (default enabled). The RGBA interface will + treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many + packages produce RGBA files but don't mark the alpha properly. */ +#cmakedefine DEFAULT_EXTRASAMPLE_AS_ALPHA + +/* Use the Apple OpenGL framework. */ +#cmakedefine HAVE_APPLE_OPENGL_FRAMEWORK + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ASSERT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_FCNTL_H @HAVE_FCNTL_H@ + +/* Define to 1 if you have the `floor' function. */ +#cmakedefine HAVE_FLOOR + +/* Define to 1 if you have the `getopt' function. */ +#cmakedefine HAVE_GETOPT + +/* Define as 0 or 1 according to the floating point format suported by the + machine */ +#cmakedefine HAVE_IEEEFP + +/* Define to 1 if the system has the type `int16'. */ +#cmakedefine HAVE_INT16 + +/* Define to 1 if the system has the type `int32'. */ +#cmakedefine HAVE_INT32 + ++/* Define to 1 if the system has the type `int64'. */ ++#cmakedefine HAVE_INT64 ++ +/* Define to 1 if the system has the type `int8'. */ +#cmakedefine HAVE_INT8 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_IO_H @HAVE_IO_H@ + +/* Define to 1 if you have the `isascii' function. */ +#cmakedefine HAVE_ISASCII + +/* Define to 1 if you have the `jbg_newlen' function. */ +#cmakedefine HAVE_JBG_NEWLEN + +/* Define to 1 if you have the `lfind' function. */ +#cmakedefine HAVE_LFIND + +/* Define to 1 if you have the `c' library (-lc). */ +#cmakedefine HAVE_LIBC + +/* Define to 1 if you have the `m' library (-lm). */ +#cmakedefine HAVE_LIBM + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIMITS_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MALLOC_H + +/* Define to 1 if you have the `memmove' function. */ +#cmakedefine HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#cmakedefine HAVE_MEMSET + +/* Define to 1 if you have the `mmap' function. */ +#cmakedefine HAVE_MMAP + +/* Define to 1 if you have the `pow' function. */ +#cmakedefine HAVE_POW + +/* Define if you have POSIX threads libraries and header files. */ +#cmakedefine HAVE_PTHREAD + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SEARCH_H + +/* Define to 1 if you have the `setmode' function. */ +#cmakedefine HAVE_SETMODE + +/* Define to 1 if you have the `sqrt' function. */ +#cmakedefine HAVE_SQRT + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDLIB_H + +/* Define to 1 if you have the `strcasecmp' function. */ +#cmakedefine HAVE_STRCASECMP + +/* Define to 1 if you have the `strchr' function. */ +#cmakedefine HAVE_STRCHR + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRING_H + +/* Define to 1 if you have the `strrchr' function. */ +#cmakedefine HAVE_STRRCHR + +/* Define to 1 if you have the `strstr' function. */ +#cmakedefine HAVE_STRSTR + +/* Define to 1 if you have the `strtol' function. */ +#cmakedefine HAVE_STRTOL + +/* Define to 1 if you have the `strtoul' function. */ +#cmakedefine HAVE_STRTOUL + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_WINDOWS_H + +/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian + (Intel) */ +#cmakedefine01 HOST_BIGENDIAN + +/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ +#cmakedefine HOST_FILLORDER @HOST_FILLORDER@ + +/* Support ISO JBIG compression (requires JBIG-KIT library) */ +#cmakedefine JBIG_SUPPORT + +/* Support JPEG compression (requires IJG JPEG library) */ +#cmakedefine JPEG_SUPPORT + +/* Support LogLuv high dynamic range encoding */ +#cmakedefine LOGLUV_SUPPORT + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#cmakedefine LT_OBJDIR + +/* Support LZW algorithm */ +#cmakedefine LZW_SUPPORT + +/* Support Microsoft Document Imaging format */ +#cmakedefine MDI_SUPPORT + +/* Support NeXT 2-bit RLE algorithm */ +#cmakedefine NEXT_SUPPORT + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#cmakedefine NO_MINUS_C_MINUS_O + +/* Support Old JPEG compresson (read-only) */ +#cmakedefine OJPEG_SUPPORT + +/* Name of package */ +#cmakedefine PACKAGE @PACKAGE@ + +/* Define to the address where bug reports for this package should be sent. */ +#cmakedefine PACKAGE_BUGREPORT @PACKAGE_BUGREPORT@ + +/* Define to the full name of this package. */ +#cmakedefine PACKAGE_NAME @PACKAGE_NAME@ + +/* Define to the full name and version of this package. */ +#cmakedefine PACKAGE_STRING @PACKAGE_STRING@ + +/* Define to the one symbol short name of this package. */ +#cmakedefine PACKAGE_TARNAME @PACKAGE_TARNAME@ + +/* Define to the home page for this package. */ +#cmakedefine PACKAGE_URL @PACKAGE_URL@ + +/* Define to the version of this package. */ +#cmakedefine PACKAGE_VERSION @PACKAGE_VERSION@ + +/* Support Macintosh PackBits algorithm */ +#cmakedefine PACKBITS_SUPPORT + +/* Support Pixar log-format algorithm (requires Zlib) */ +#cmakedefine PIXARLOG_SUPPORT + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +#cmakedefine PTHREAD_CREATE_JOINABLE + +/* The size of `int', as computed by sizeof. */ +#cmakedefine SIZEOF_INT @SIZEOF_INT@ + +/* The size of `long', as computed by sizeof. */ +#cmakedefine SIZEOF_LONG @SIZEOF_LONG@ + +/* The size of `signed long', as computed by sizeof. */ +#cmakedefine SIZEOF_SIGNED_LONG @SIZEOF_SIGNED_LONG@ + +/* The size of `signed long long', as computed by sizeof. */ +#cmakedefine SIZEOF_SIGNED_LONG_LONG @SIZEOF_SIGNED_LONG_LONG@ + +/* The size of `unsigned long', as computed by sizeof. */ +#cmakedefine SIZEOF_UNSIGNED_LONG @SIZEOF_UNSIGNED_LONG@ + +/* The size of `unsigned long long', as computed by sizeof. */ +#cmakedefine SIZEOF_UNSIGNED_LONG_LONG @SIZEOF_UNSIGNED_LONG_LONG@ + +/* Define to 1 if you have the ANSI C header files. */ +#cmakedefine STDC_HEADERS + +/* Support strip chopping (whether or not to convert single-strip uncompressed + images to mutiple strips of specified size to reduce memory usage) */ +#cmakedefine STRIPCHOP_DEFAULT @STRIPCHOP_DEFAULT@ + +/* Default size of the strip in bytes (when strip chopping enabled) */ +#cmakedefine STRIP_SIZE_DEFAULT @STRIP_SIZE_DEFAULT@ + +/* Enable SubIFD tag (330) support */ +#cmakedefine SUBIFD_SUPPORT + +/* Support ThunderScan 4-bit RLE algorithm */ +#cmakedefine THUNDER_SUPPORT + +/* Signed 64-bit type formatter */ +#cmakedefine TIFF_INT64_FORMAT @TIFF_INT64_FORMAT@ + +/* Signed 64-bit type */ +#cmakedefine TIFF_INT64_T @TIFF_INT64_T@ + +/* Unsigned 64-bit type formatter */ +#cmakedefine TIFF_UINT64_FORMAT @TIFF_UINT64_FORMAT@ + +/* Unsigned 64-bit type */ +#cmakedefine TIFF_UINT64_T @TIFF_UINT64_T@ + +/* Define to 1 if you can safely include both and . */ +#cmakedefine TIME_WITH_SYS_TIME + +/* Define to 1 if your declares `struct tm'. */ +#cmakedefine TM_IN_SYS_TIME + +/* Version number of package */ +#cmakedefine VERSION @VERSION@ + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define to 1 if the X Window System is missing or not being used. */ +#cmakedefine X_DISPLAY_MISSING + +/* Support Deflate compression */ +#cmakedefine ZIP_SUPPORT + +/* Number of bits in a file offset, on hosts where this is settable. */ +#cmakedefine _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#cmakedefine _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#cmakedefine const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#cmakedefine inline @inline@ +#endif + +/* Define to `long int' if does not define. */ +#cmakedefine off_t @off_t@ + +/* Define to `unsigned int' if does not define. */ +#cmakedefine size_t @size_t@ + +#ifdef _MSC_VER +#define lfind _lfind +#endif + +#if !defined(HAVE_GETOPT) && !defined(HAVE_STRCASECMP) + #include "libport.h" +#endif +#endif \ No newline at end of file diff --git a/libtiff/tif_config.vc.h b/libtiff/tif_config.vc.h index c297cf3..2e10246 100644 --- a/libtiff/tif_config.vc.h +++ b/libtiff/tif_config.vc.h @@ -47,7 +47,7 @@ /* Set the native cpu bit order */ #define HOST_FILLORDER FILLORDER_LSB2MSB -#define snprintf _snprintf +//#define snprintf _snprintf /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ diff --git a/libtiff/tif_win32.c b/libtiff/tif_win32.c index 2cf1de9..e07ca59 100644 --- a/libtiff/tif_win32.c +++ b/libtiff/tif_win32.c @@ -365,7 +365,7 @@ _TIFFmemcmp(const void* p1, const void* p2, tmsize_t c) #ifndef _WIN32_WCE #if (_MSC_VER < 1500) -# define vsnprintf _vsnprintf +//# define vsnprintf _vsnprintf #endif static void -diff --git a/libtiff/tiff.h b/libtiff/tiff.h -index 19b4e79..718f9e9 100644 ---- a/libtiff/tiff.h -+++ b/libtiff/tiff.h -@@ -65,17 +65,17 @@ - * strings unsigned char* - */ - --typedef TIFF_INT8_T int8; --typedef TIFF_UINT8_T uint8; -+typedef __int8 int8; -+typedef unsigned __int8 uint8; - --typedef TIFF_INT16_T int16; --typedef TIFF_UINT16_T uint16; -+typedef __int16 int16; -+typedef unsigned __int16 uint16; - --typedef TIFF_INT32_T int32; --typedef TIFF_UINT32_T uint32; -+typedef __int32 int32; -+typedef unsigned __int32 uint32; - --typedef TIFF_INT64_T int64; --typedef TIFF_UINT64_T uint64; -+typedef __int64 int64; -+typedef unsigned __int64 uint64; - - /* - * Some types as promoted in a variable argument list diff --git a/libtiff/tiffconf.h.cmake b/libtiff/tiffconf.h.cmake new file mode 100644 index 0000000..aef040b --- /dev/null +++ b/libtiff/tiffconf.h.cmake -@@ -0,0 +1,103 @@ +@@ -0,0 +1,150 @@ +/* + Configuration defines for installed libtiff. + This file maintained for backward compatibility. Do not use definitions + from this file in your programs. +*/ + +#ifndef _TIFFCONF_ +#define _TIFFCONF_ + +/* Define to 1 if the system has the type `int16'. */ +#cmakedefine HAVE_INT16 + +/* Define to 1 if the system has the type `int32'. */ +#cmakedefine HAVE_INT32 + ++/* Define to 1 if the system has the type `int64'. */ ++#cmakedefine HAVE_INT64 ++ +/* Define to 1 if the system has the type `int8'. */ +#cmakedefine HAVE_INT8 + ++/* Signed 8-bit type */ ++#cmakedefine TIFF_INT8_T @TIFF_INT8_T@ ++ ++/* Unsigned 8-bit type */ ++#cmakedefine TIFF_UINT8_T @TIFF_UINT8_T@ ++ ++/* Signed 16-bit type */ ++#cmakedefine TIFF_INT16_T @TIFF_INT16_T@ ++ ++/* Unsigned 16-bit type */ ++#cmakedefine TIFF_UINT16_T @TIFF_UINT16_T@ ++ ++/* Signed 32-bit type */ ++#cmakedefine TIFF_INT32_T @TIFF_INT32_T@ ++ ++/* Unsigned 32-bit type */ ++#cmakedefine TIFF_UINT32_T @TIFF_UINT32_T@ ++ ++/* Signed 64-bit type formatter */ ++#cmakedefine TIFF_INT64_FORMAT @TIFF_INT64_FORMAT@ ++ ++/* Signed 64-bit type */ ++#cmakedefine TIFF_INT64_T @TIFF_INT64_T@ ++ ++/* Unsigned 64-bit type formatter */ ++#cmakedefine TIFF_UINT64_FORMAT @TIFF_UINT64_FORMAT@ ++ ++/* Unsigned 64-bit type */ ++#cmakedefine TIFF_UINT64_T @TIFF_UINT64_T@ ++ ++/* Signed size type */ ++#if defined(_WIN64) ++#define TIFF_SSIZE_T TIFF_INT64_T ++#else ++#define TIFF_SSIZE_T TIFF_INT32_T ++#endif ++ ++/* Signed size type formatter */ ++#if defined(_WIN64) ++#define TIFF_SSIZE_FORMAT TIFF_INT64_FORMAT ++#else ++#define TIFF_SSIZE_FORMAT "%ld" ++#endif ++ +/* The size of a `int', as computed by sizeof. */ +#cmakedefine SIZEOF_INT @SIZEOF_INT@ + +/* The size of a `long', as computed by sizeof. */ +#cmakedefine SIZEOF_LONG @SIZEOF_LONG@ + +/* Compatibility stuff. */ + +/* Define as 0 or 1 according to the floating point format suported by the + machine */ +#cmakedefine HAVE_IEEEFP + +/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ +#cmakedefine HOST_FILLORDER @HOST_FILLORDER@ + +/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian + (Intel) */ +#cmakedefine01 HOST_BIGENDIAN + +/* Support CCITT Group 3 & 4 algorithms */ +#cmakedefine CCITT_SUPPORT + +/* Support JPEG compression (requires IJG JPEG library) */ +#cmakedefine JPEG_SUPPORT + +/* Support JBIG compression (requires JBIG-KIT library) */ +#cmakedefine JBIG_SUPPORT + +/* Support LogLuv high dynamic range encoding */ +#cmakedefine LOGLUV_SUPPORT + +/* Support LZW algorithm */ +#cmakedefine LZW_SUPPORT + +/* Support NeXT 2-bit RLE algorithm */ +#cmakedefine NEXT_SUPPORT + +/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation + fails with unpatched IJG JPEG library) */ +#cmakedefine OJPEG_SUPPORT + +/* Support Macintosh PackBits algorithm */ +#cmakedefine PACKBITS_SUPPORT + +/* Support Pixar log-format algorithm (requires Zlib) */ +#cmakedefine PIXARLOG_SUPPORT + +/* Support ThunderScan 4-bit RLE algorithm */ +#cmakedefine THUNDER_SUPPORT + +/* Support Deflate compression */ +#cmakedefine ZIP_SUPPORT + +/* Support strip chopping (whether or not to convert single-strip uncompressed + images to mutiple strips of ~8Kb to reduce memory usage) */ +#cmakedefine STRIPCHOP_DEFAULT @STRIPCHOP_DEFAULT@ + +/* Enable SubIFD tag (330) support */ +#cmakedefine SUBIFD_SUPPORT + +/* Treat extra sample as alpha (default enabled). The RGBA interface will + treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many + packages produce RGBA files but don't mark the alpha properly. */ +#cmakedefine DEFAULT_EXTRASAMPLE_AS_ALPHA + +/* Pick up YCbCr subsampling info from the JPEG data stream to support files + lacking the tag (default enabled). */ +#cmakedefine CHECK_JPEG_YCBCR_SUBSAMPLING + +/* Support MS MDI magic number files as TIFF */ +#cmakedefine MDI_SUPPORT + +/* + * Feature support definitions. + * XXX: These macros are obsoleted. Don't use them in your apps! + * Macros stays here for backward compatibility and should be always defined. + */ +#define COLORIMETRY_SUPPORT +#define YCBCR_SUPPORT +#define CMYK_SUPPORT +#define ICC_SUPPORT +#define PHOTOSHOP_SUPPORT +#define IPTC_SUPPORT + +#endif /* _TIFFCONF_ */ diff --git a/libtiff/tiffconf.vc.h b/libtiff/tiffconf.vc.h index 680f839..1d72692 100644 --- a/libtiff/tiffconf.vc.h +++ b/libtiff/tiffconf.vc.h @@ -89,7 +89,7 @@ #define CCITT_SUPPORT 1 /* Support JPEG compression (requires IJG JPEG library) */ -/* #undef JPEG_SUPPORT */ +#define JPEG_SUPPORT 1 /* Support JBIG compression (requires JBIG-KIT library) */ /* #undef JBIG_SUPPORT */ @@ -117,7 +117,7 @@ #define THUNDER_SUPPORT 1 /* Support Deflate compression */ -/* #undef ZIP_SUPPORT */ +#define ZIP_SUPPORT /* Support strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of ~8Kb to reduce memory usage) */ diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt new file mode 100644 index 0000000..fe8f4c5 --- /dev/null +++ b/man/CMakeLists.txt @@ -0,0 +1,73 @@ +set(tiff1_FILES + bmp2tiff.1 + fax2ps.1 + fax2tiff.1 + gif2tiff.1 + pal2rgb.1 + ppm2tiff.1 + ras2tiff.1 + raw2tiff.1 + rgb2ycbcr.1 + sgi2tiff.1 + thumbnail.1 + tiff2bw.1 + tiff2pdf.1 + tiff2ps.1 + tiff2rgba.1 + tiffcmp.1 + tiffcp.1 + tiffcrop.1 + tiffdither.1 + tiffdump.1 + tiffgt.1 + tiffinfo.1 + tiffmedian.1 + tiffset.1 + tiffsplit.1 + tiffsv.1 +) +set(tiff3_FILES + libtiff.3tiff + TIFFbuffer.3tiff + TIFFClose.3tiff + TIFFcodec.3tiff + TIFFcolor.3tiff + TIFFDataWidth.3tiff + TIFFError.3tiff + TIFFFlush.3tiff + TIFFGetField.3tiff + TIFFmemory.3tiff + TIFFOpen.3tiff + TIFFPrintDirectory.3tiff + TIFFquery.3tiff + TIFFReadDirectory.3tiff + TIFFReadEncodedStrip.3tiff + TIFFReadEncodedTile.3tiff + TIFFReadRawStrip.3tiff + TIFFReadRawTile.3tiff + TIFFReadRGBAImage.3tiff + TIFFReadRGBAStrip.3tiff + TIFFReadRGBATile.3tiff + TIFFReadScanline.3tiff + TIFFReadTile.3tiff + TIFFRGBAImage.3tiff + TIFFSetDirectory.3tiff + TIFFSetField.3tiff + TIFFsize.3tiff + TIFFstrip.3tiff + TIFFswab.3tiff + TIFFtile.3tiff + TIFFWarning.3tiff + TIFFWriteDirectory.3tiff + TIFFWriteEncodedStrip.3tiff + TIFFWriteEncodedTile.3tiff + TIFFWriteRawStrip.3tiff + TIFFWriteRawTile.3tiff + TIFFWriteScanline.3tiff + TIFFWriteTile.3tiff +) + +if(BUILD_TOOLS) + install(FILES ${tiff1_FILES} DESTINATION share/man/man1) +endif(BUILD_TOOLS) +install(FILES ${tiff3_FILES} DESTINATION share/man/man3) \ No newline at end of file diff --git a/port/CMakeLists.txt b/port/CMakeLists.txt new file mode 100644 index 0000000..c3dca62 --- /dev/null +++ b/port/CMakeLists.txt @@ -0,0 +1,19 @@ +if(NOT WIN32) + set(port_SRCS + dummy.c + ) +else(NOT WIN32) + set(port_SRCS + strcasecmp.c + getopt.c + ) +endif(NOT WIN32) + +if(NOT HAVE_LFIND) + set(port_SRCS ${port_SRCS} lfind.c) +endif(NOT HAVE_LFIND) +if(NOT HAVE_STRTOUL) + set(port_SRCS ${port_SRCS} strtoul.c) +endif(NOT HAVE_STRTOUL) + +add_library(port ${port_SRCS}) \ No newline at end of file diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 0000000..4ecc0bf --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,137 @@ + +#EXTRA_PROGRAMS = sgi2tiff sgisv ycbcr + +#if HAVE_RPATH +#AM_LDFLAGS = $(LIBDIR) +#endif + +include_directories(${CMAKE_BINARY_DIR}/libtiff ${CMAKE_SOURCE_DIR}/libtiff) + +set(bmp2tiff_SRCS bmp2tiff.c) +add_executable(bmp2tiff ${bmp2tiff_SRCS}) +target_link_libraries(bmp2tiff tiff port) + +set(fax2ps_SRCS fax2ps.c) +add_executable(fax2ps ${fax2ps_SRCS}) +target_link_libraries(fax2ps tiff port) + +set(fax2tiff_SRCS fax2tiff.c) +add_executable(fax2tiff ${fax2tiff_SRCS}) +target_link_libraries(fax2tiff tiff port) + +set(gif2tiff_SRCS gif2tiff.c) +add_executable(gif2tiff ${gif2tiff_SRCS}) +target_link_libraries(gif2tiff tiff port) + +set(pal2rgb_SRCS pal2rgb.c) +add_executable(pal2rgb ${pal2rgb_SRCS}) +target_link_libraries(pal2rgb tiff port) + +set(ppm2tiff_SRCS ppm2tiff.c) +add_executable(ppm2tiff ${ppm2tiff_SRCS}) +target_link_libraries(ppm2tiff tiff port) + +set(ras2tiff_SRCS ras2tiff.c rasterfile.h) +add_executable(ras2tiff ${ras2tiff_SRCS}) +target_link_libraries(ras2tiff tiff port) + +set(raw2tiff_SRCS raw2tiff.c) +add_executable(raw2tiff ${raw2tiff_SRCS}) +target_link_libraries(raw2tiff tiff port) + +set(rgb2ycbcr_SRCS rgb2ycbcr.c ../libtiff/tif_aux.c) +add_executable(rgb2ycbcr ${rgb2ycbcr_SRCS}) +target_link_libraries(rgb2ycbcr tiff port) + +set(thumbnail_SRCS thumbnail.c) +add_executable(thumbnail ${thumbnail_SRCS}) +target_link_libraries(thumbnail tiff port) + +set(tiff2bw_SRCS tiff2bw.c) +add_executable(tiff2bw ${tiff2bw_SRCS}) +target_link_libraries(tiff2bw tiff port) + +set(tiff2pdf_SRCS tiff2pdf.c) +add_executable(tiff2pdf ${tiff2pdf_SRCS}) +target_link_libraries(tiff2pdf tiff port) + +set(tiff2ps_SRCS tiff2ps.c) +add_executable(tiff2ps ${tiff2ps_SRCS}) +target_link_libraries(tiff2ps tiff port) + +set(tiff2rgba_SRCS tiff2rgba.c ../libtiff/tif_aux.c) +add_executable(tiff2rgba ${tiff2rgba_SRCS}) +target_link_libraries(tiff2rgba tiff port) + +set(tiffcmp_SRCS tiffcmp.c) +add_executable(tiffcmp ${tiffcmp_SRCS}) +target_link_libraries(tiffcmp tiff port) + +set(tiffcp_SRCS tiffcp.c) +add_executable(tiffcp ${tiffcp_SRCS}) +target_link_libraries(tiffcp tiff port) + +set(tiffcrop_SRCS tiffcrop.c) +add_executable(tiffcrop ${tiffcrop_SRCS}) +target_link_libraries(tiffcrop tiff port) + +set(tiffdither_SRCS tiffdither.c) +add_executable(tiffdither ${tiffdither_SRCS}) +target_link_libraries(tiffdither tiff port) + +set(tiffdump_SRCS tiffdump.c) +add_executable(tiffdump ${tiffdump_SRCS}) +target_link_libraries(tiffdump tiff port) + +set(tiffinfo_SRCS tiffinfo.c) +add_executable(tiffinfo ${tiffinfo_SRCS}) +target_link_libraries(tiffinfo tiff port) + +set(tiffmedian_SRCS tiffmedian.c) +add_executable(tiffmedian ${tiffmedian_SRCS}) +target_link_libraries(tiffmedian tiff port) + +set(tiffset_SRCS tiffset.c) +add_executable(tiffset ${tiffset_SRCS}) +target_link_libraries(tiffset tiff port) + +set(tiffsplit_SRCS tiffsplit.c) +add_executable(tiffsplit ${tiffsplit_SRCS}) +target_link_libraries(tiffsplit tiff port) + +if(HAVE_OPENGL) + set(tiffgt_SRCS tiffgt.c) +# include_directories(${OpenGL_INCLUDE_DIR}) + add_executable(tiffgt ${tiffgt_SRCS}) + target_link_libraries(tiffgt tiff port ${OpenGL_LIBRARIES}) +endif(HAVE_OPENGL) + +set(tools +bmp2tiff +fax2ps +fax2tiff +gif2tiff +pal2rgb +ppm2tiff +ras2tiff +raw2tiff +rgb2ycbcr +thumbnail +tiff2bw +tiff2pdf +tiff2ps +tiff2rgba +tiffcmp +tiffcp +tiffcrop +tiffdither +tiffdump +tiffinfo +tiffmedian +tiffset +tiffsplit +) + +install(TARGETS ${tools} RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) \ No newline at end of file diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c index 9cd5d86..b1d9874 100644 --- a/tools/tiffcrop.c +++ b/tools/tiffcrop.c @@ -2931,9 +2931,9 @@ extractContigSamples24bits (uint8 *in, uint8 *out, uint32 cols, } else /* If we have a full buffer's worth, write it out */ { - bytebuff1 = (buff2 >> 24); + bytebuff1 = (uint8)(buff2 >> 24); *dst++ = bytebuff1; - bytebuff2 = (buff2 >> 16); + bytebuff2 = (uint8)(buff2 >> 16); *dst++ = bytebuff2; ready_bits -= 16; @@ -2947,7 +2947,7 @@ extractContigSamples24bits (uint8 *in, uint8 *out, uint32 cols, /* catch any trailing bits at the end of the line */ while (ready_bits > 0) { - bytebuff1 = (buff2 >> 24); + bytebuff1 = (uint8)(buff2 >> 24); *dst++ = bytebuff1; buff2 = (buff2 << 8); @@ -3031,13 +3031,13 @@ extractContigSamples32bits (uint8 *in, uint8 *out, uint32 cols, /* If we have a full buffer's worth, write it out */ if (ready_bits >= 32) { - bytebuff1 = (buff2 >> 56); + bytebuff1 = (uint8)(buff2 >> 56); *dst++ = bytebuff1; - bytebuff2 = (buff2 >> 48); + bytebuff2 = (uint8)(buff2 >> 48); *dst++ = bytebuff2; - bytebuff3 = (buff2 >> 40); + bytebuff3 = (uint8)(buff2 >> 40); *dst++ = bytebuff3; - bytebuff4 = (buff2 >> 32); + bytebuff4 = (uint8)(buff2 >> 32); *dst++ = bytebuff4; ready_bits -= 32; @@ -3054,7 +3054,7 @@ extractContigSamples32bits (uint8 *in, uint8 *out, uint32 cols, } while (ready_bits > 0) { - bytebuff1 = (buff2 >> 56); + bytebuff1 = (uint8)(buff2 >> 56); *dst++ = bytebuff1; buff2 = (buff2 << 8); ready_bits -= 8; @@ -3304,9 +3304,9 @@ extractContigSamplesShifted24bits (uint8 *in, uint8 *out, uint32 cols, } else /* If we have a full buffer's worth, write it out */ { - bytebuff1 = (buff2 >> 24); + bytebuff1 = (uint8)(buff2 >> 24); *dst++ = bytebuff1; - bytebuff2 = (buff2 >> 16); + bytebuff2 = (uint8)(buff2 >> 16); *dst++ = bytebuff2; ready_bits -= 16; @@ -3320,7 +3320,7 @@ extractContigSamplesShifted24bits (uint8 *in, uint8 *out, uint32 cols, /* catch any trailing bits at the end of the line */ while (ready_bits > 0) { - bytebuff1 = (buff2 >> 24); + bytebuff1 = (uint8)(buff2 >> 24); *dst++ = bytebuff1; buff2 = (buff2 << 8); @@ -3412,13 +3412,13 @@ extractContigSamplesShifted32bits (uint8 *in, uint8 *out, uint32 cols, } else /* If we have a full buffer's worth, write it out */ { - bytebuff1 = (buff2 >> 56); + bytebuff1 = (uint8)(buff2 >> 56); *dst++ = bytebuff1; - bytebuff2 = (buff2 >> 48); + bytebuff2 = (uint8)(buff2 >> 48); *dst++ = bytebuff2; - bytebuff3 = (buff2 >> 40); + bytebuff3 = (uint8)(buff2 >> 40); *dst++ = bytebuff3; - bytebuff4 = (buff2 >> 32); + bytebuff4 = (uint8)(buff2 >> 32); *dst++ = bytebuff4; ready_bits -= 32; @@ -3430,7 +3430,7 @@ extractContigSamplesShifted32bits (uint8 *in, uint8 *out, uint32 cols, } while (ready_bits > 0) { - bytebuff1 = (buff2 >> 56); + bytebuff1 = (uint8)(buff2 >> 56); *dst++ = bytebuff1; buff2 = (buff2 << 8); ready_bits -= 8; @@ -3944,9 +3944,9 @@ combineSeparateSamples24bits (uint8 *in[], uint8 *out, uint32 cols, /* If we have a full buffer's worth, write it out */ if (ready_bits >= 16) { - bytebuff1 = (buff2 >> 24); + bytebuff1 = (uint8)(buff2 >> 24); *dst++ = bytebuff1; - bytebuff2 = (buff2 >> 16); + bytebuff2 = (uint8)(buff2 >> 16); *dst++ = bytebuff2; ready_bits -= 16; @@ -3981,7 +3981,7 @@ combineSeparateSamples24bits (uint8 *in[], uint8 *out, uint32 cols, /* catch any trailing bits at the end of the line */ while (ready_bits > 0) { - bytebuff1 = (buff2 >> 24); + bytebuff1 = (uint8)(buff2 >> 24); *dst++ = bytebuff1; buff2 = (buff2 << 8); @@ -4077,13 +4077,13 @@ combineSeparateSamples32bits (uint8 *in[], uint8 *out, uint32 cols, /* If we have a full buffer's worth, write it out */ if (ready_bits >= 32) { - bytebuff1 = (buff2 >> 56); + bytebuff1 = (uint8)(buff2 >> 56); *dst++ = bytebuff1; - bytebuff2 = (buff2 >> 48); + bytebuff2 = (uint8)(buff2 >> 48); *dst++ = bytebuff2; - bytebuff3 = (buff2 >> 40); + bytebuff3 = (uint8)(buff2 >> 40); *dst++ = bytebuff3; - bytebuff4 = (buff2 >> 32); + bytebuff4 = (uint8)(buff2 >> 32); *dst++ = bytebuff4; ready_bits -= 32; @@ -4104,17 +4104,17 @@ combineSeparateSamples32bits (uint8 *in[], uint8 *out, uint32 cols, dump_info (dumpfile, format, "", "Row %3d, Col %3d, Sample %d, Src byte offset %3d bit offset %2d Dst offset %3d", row + 1, col + 1, s, src_byte, src_bit, dst - out); - dump_wide (dumpfile, format, "Match bits ", matchbits); + dump_wide (dumpfile, format, "Match bits ", (uint32)matchbits); dump_data (dumpfile, format, "Src bits ", src, 8); - dump_wide (dumpfile, format, "Buff1 bits ", buff1); - dump_wide (dumpfile, format, "Buff2 bits ", buff2); + dump_wide (dumpfile, format, "Buff1 bits ", (uint32)buff1); + dump_wide (dumpfile, format, "Buff2 bits ", (uint32)buff2); dump_info (dumpfile, format, "", "Ready bits: %d, %s", ready_bits, action); } } } while (ready_bits > 0) { - bytebuff1 = (buff2 >> 56); + bytebuff1 = (uint8)(buff2 >> 56); *dst++ = bytebuff1; buff2 = (buff2 << 8); ready_bits -= 8; @@ -4126,10 +4126,10 @@ combineSeparateSamples32bits (uint8 *in[], uint8 *out, uint32 cols, "Row %3d, Col %3d, Src byte offset %3d bit offset %2d Dst offset %3d", row + 1, col + 1, src_byte, src_bit, dst - out); - dump_long (dumpfile, format, "Match bits ", matchbits); + dump_long (dumpfile, format, "Match bits ", (uint32)matchbits); dump_data (dumpfile, format, "Src bits ", src, 4); - dump_long (dumpfile, format, "Buff1 bits ", buff1); - dump_long (dumpfile, format, "Buff2 bits ", buff2); + dump_long (dumpfile, format, "Buff1 bits ", (uint32)buff1); + dump_long (dumpfile, format, "Buff2 bits ", (uint32)buff2); dump_byte (dumpfile, format, "Write bits1", bytebuff1); dump_byte (dumpfile, format, "Write bits2", bytebuff2); dump_info (dumpfile, format, "", "Ready bits: %2d", ready_bits); @@ -4468,9 +4468,9 @@ combineSeparateTileSamples24bits (uint8 *in[], uint8 *out, uint32 cols, /* If we have a full buffer's worth, write it out */ if (ready_bits >= 16) { - bytebuff1 = (buff2 >> 24); + bytebuff1 = (uint8)(buff2 >> 24); *dst++ = bytebuff1; - bytebuff2 = (buff2 >> 16); + bytebuff2 = (uint8)(buff2 >> 16); *dst++ = bytebuff2; ready_bits -= 16; @@ -4505,7 +4505,7 @@ combineSeparateTileSamples24bits (uint8 *in[], uint8 *out, uint32 cols, /* catch any trailing bits at the end of the line */ while (ready_bits > 0) { - bytebuff1 = (buff2 >> 24); + bytebuff1 = (uint8)(buff2 >> 24); *dst++ = bytebuff1; buff2 = (buff2 << 8); @@ -4602,13 +4602,13 @@ combineSeparateTileSamples32bits (uint8 *in[], uint8 *out, uint32 cols, /* If we have a full buffer's worth, write it out */ if (ready_bits >= 32) { - bytebuff1 = (buff2 >> 56); + bytebuff1 = (uint8)(buff2 >> 56); *dst++ = bytebuff1; - bytebuff2 = (buff2 >> 48); + bytebuff2 = (uint8)(buff2 >> 48); *dst++ = bytebuff2; - bytebuff3 = (buff2 >> 40); + bytebuff3 = (uint8)(buff2 >> 40); *dst++ = bytebuff3; - bytebuff4 = (buff2 >> 32); + bytebuff4 = (uint8)(buff2 >> 32); *dst++ = bytebuff4; ready_bits -= 32; @@ -4639,7 +4639,7 @@ combineSeparateTileSamples32bits (uint8 *in[], uint8 *out, uint32 cols, } while (ready_bits > 0) { - bytebuff1 = (buff2 >> 56); + bytebuff1 = (uint8)(buff2 >> 56); *dst++ = bytebuff1; buff2 = (buff2 << 8); ready_bits -= 8; @@ -4651,10 +4651,10 @@ combineSeparateTileSamples32bits (uint8 *in[], uint8 *out, uint32 cols, "Row %3d, Col %3d, Src byte offset %3d bit offset %2d Dst offset %3d", row + 1, col + 1, src_byte, src_bit, dst - out); - dump_long (dumpfile, format, "Match bits ", matchbits); + dump_long (dumpfile, format, "Match bits ", (uint32)matchbits); dump_data (dumpfile, format, "Src bits ", src, 4); - dump_long (dumpfile, format, "Buff1 bits ", buff1); - dump_long (dumpfile, format, "Buff2 bits ", buff2); + dump_long (dumpfile, format, "Buff1 bits ", (uint32)buff1); + dump_long (dumpfile, format, "Buff2 bits ", (uint32)buff2); dump_byte (dumpfile, format, "Write bits1", bytebuff1); dump_byte (dumpfile, format, "Write bits2", bytebuff2); dump_info (dumpfile, format, "", "Ready bits: %2d", ready_bits); @@ -5548,12 +5548,12 @@ computeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image, if (page->width <= 0) pwidth = iwidth; else - pwidth = page->width; + pwidth = (uint32)page->width; if (page->length <= 0) plength = ilength; else - plength = page->length; + plength = (uint32)page->length; if (dump->debug) { @@ -8060,9 +8060,9 @@ rotateContigSamples24bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width, /* If we have a full buffer's worth, write it out */ if (ready_bits >= 16) { - bytebuff1 = (buff2 >> 24); + bytebuff1 = (uint8)(buff2 >> 24); *dst++ = bytebuff1; - bytebuff2 = (buff2 >> 16); + bytebuff2 = (uint8)(buff2 >> 16); *dst++ = bytebuff2; ready_bits -= 16; @@ -8081,7 +8081,7 @@ rotateContigSamples24bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width, /* catch any trailing bits at the end of the line */ while (ready_bits > 0) { - bytebuff1 = (buff2 >> 24); + bytebuff1 = (uint8)(buff2 >> 24); *dst++ = bytebuff1; buff2 = (buff2 << 8); @@ -8172,13 +8172,13 @@ rotateContigSamples32bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width, } else /* If we have a full buffer's worth, write it out */ { - bytebuff1 = (buff2 >> 56); + bytebuff1 = (uint8)(buff2 >> 56); *dst++ = bytebuff1; - bytebuff2 = (buff2 >> 48); + bytebuff2 = (uint8)(buff2 >> 48); *dst++ = bytebuff2; - bytebuff3 = (buff2 >> 40); + bytebuff3 = (uint8)(buff2 >> 40); *dst++ = bytebuff3; - bytebuff4 = (buff2 >> 32); + bytebuff4 = (uint8)(buff2 >> 32); *dst++ = bytebuff4; ready_bits -= 32; @@ -8190,7 +8190,7 @@ rotateContigSamples32bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width, } while (ready_bits > 0) { - bytebuff1 = (buff2 >> 56); + bytebuff1 = (uint8)(buff2 >> 56); *dst++ = bytebuff1; buff2 = (buff2 << 8); ready_bits -= 8; @@ -8679,9 +8679,9 @@ reverseSamples24bits (uint16 spp, uint16 bps, uint32 width, } else /* If we have a full buffer's worth, write it out */ { - bytebuff1 = (buff2 >> 24); + bytebuff1 = (uint8)(buff2 >> 24); *dst++ = bytebuff1; - bytebuff2 = (buff2 >> 16); + bytebuff2 = (uint8)(buff2 >> 16); *dst++ = bytebuff2; ready_bits -= 16; @@ -8695,7 +8695,7 @@ reverseSamples24bits (uint16 spp, uint16 bps, uint32 width, /* catch any trailing bits at the end of the line */ while (ready_bits > 0) { - bytebuff1 = (buff2 >> 24); + bytebuff1 = (uint8)(buff2 >> 24); *dst++ = bytebuff1; buff2 = (buff2 << 8); @@ -8780,13 +8780,13 @@ reverseSamples32bits (uint16 spp, uint16 bps, uint32 width, } else /* If we have a full buffer's worth, write it out */ { - bytebuff1 = (buff2 >> 56); + bytebuff1 = (uint8)(buff2 >> 56); *dst++ = bytebuff1; - bytebuff2 = (buff2 >> 48); + bytebuff2 = (uint8)(buff2 >> 48); *dst++ = bytebuff2; - bytebuff3 = (buff2 >> 40); + bytebuff3 = (uint8)(buff2 >> 40); *dst++ = bytebuff3; - bytebuff4 = (buff2 >> 32); + bytebuff4 = (uint8)(buff2 >> 32); *dst++ = bytebuff4; ready_bits -= 32; @@ -8798,7 +8798,7 @@ reverseSamples32bits (uint16 spp, uint16 bps, uint32 width, } while (ready_bits > 0) { - bytebuff1 = (buff2 >> 56); + bytebuff1 = (uint8)(buff2 >> 56); *dst++ = bytebuff1; buff2 = (buff2 << 8); ready_bits -= 8; diff --git a/3rdparty/ext_vc/CMakeLists.txt b/3rdparty/ext_vc/CMakeLists.txt index d6680211a3..203f4bcca9 100755 --- a/3rdparty/ext_vc/CMakeLists.txt +++ b/3rdparty/ext_vc/CMakeLists.txt @@ -1,13 +1,15 @@ SET(PREFIX_ext_vc "${EXTPREFIX}" ) ExternalProject_Add( ext_vc DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} URL http://files.kde.org/krita/build/dependencies/Vc-1.2.0.tar.gz URL_MD5 f2a213ae4bad0dcf4ec6469e4dad41c1 INSTALL_DIR ${PREFIX_ext_vc} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_vc} -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} + PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/vc1.2_malloc_free.patch + + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_vc} -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DCMAKE_SYSTEM_PROCESSOR=x86 UPDATE_COMMAND "" ALWAYS 0 ) diff --git a/3rdparty/ext_vc/vc1.2_malloc_free.patch b/3rdparty/ext_vc/vc1.2_malloc_free.patch new file mode 100644 index 0000000000..b257bd3dac --- /dev/null +++ b/3rdparty/ext_vc/vc1.2_malloc_free.patch @@ -0,0 +1,15 @@ +--- a/common/malloc.h ++++ b/common/malloc.h +@@ -90,6 +90,12 @@ + { + #ifdef __MIC__ + _mm_free(p); ++#elif defined(_WIN32) ++# ifdef __GNUC__ ++ return __mingw_aligned_free(p); ++# else ++ return _aligned_free(p); ++# endif + #else + std::free(p); + #endif diff --git a/3rdparty/ext_zlib/CMakeLists.txt b/3rdparty/ext_zlib/CMakeLists.txt index d2bea61c2c..2934bff647 100755 --- a/3rdparty/ext_zlib/CMakeLists.txt +++ b/3rdparty/ext_zlib/CMakeLists.txt @@ -1,30 +1,30 @@ SET(PREFIX_ext_zlib "${EXTPREFIX}" ) -if (MSVC) +if (MSVC OR MINGW) ExternalProject_Add( ext_zlib DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies/zlib-1.2.7.tar.gz - URL_MD5 60df6a37c56e7c1366cca812414f7b85 + URL http://files.kde.org/krita/build/dependencies/zlib-1.2.8.tar.gz + URL_MD5 44d667c142d7cda120332623eab69f40 INSTALL_DIR ${PREFIX_ext_zlib} - PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/zlib-1.2.7-20130123.diff + PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/zlib-1.2.8-20130901.diff CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_zlib} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} UPDATE_COMMAND "" ALWAYS 0 DEPENDS ext_patch ) else () ExternalProject_Add( ext_zlib DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL http://files.kde.org/krita/build/dependencies//zlib-1.2.7.tar.gz - URL_MD5 60df6a37c56e7c1366cca812414f7b85 + URL http://files.kde.org/krita/build/dependencies/zlib-1.2.8.tar.gz + URL_MD5 44d667c142d7cda120332623eab69f40 - INSTALL_DIR ${PREFIX_ext_zlib} - PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/zlib-1.2.7.diff + INSTALL_DIR ${PREFIX_ext_zlib} + PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/zlib-1.2.8-20130901.diff CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_zlib} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} UPDATE_COMMAND "" ALWAYS 0 ) endif () diff --git a/3rdparty/ext_zlib/zlib-1.2.7.diff b/3rdparty/ext_zlib/zlib-1.2.7.diff deleted file mode 100755 index 578bbe73b9..0000000000 --- a/3rdparty/ext_zlib/zlib-1.2.7.diff +++ /dev/null @@ -1,891 +0,0 @@ -diff -Naur zlib-1.2.7-orig/CMakeLists.txt zlib-1.2.7/CMakeLists.txt ---- zlib-1.2.7-orig/CMakeLists.txt 2012-04-30 06:20:45.000000000 +0200 -+++ zlib-1.2.7/CMakeLists.txt 2013-06-08 17:00:40.000000000 +0200 -@@ -1,8 +1,15 @@ --cmake_minimum_required(VERSION 2.4.4) -+cmake_minimum_required(VERSION 2.6) - set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) - -+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) -+ - project(zlib C) - -+if(WINCE) -+ find_package(Wcecompat REQUIRED) -+ include_directories(${WCECOMPAT_INCLUDE_DIR}) -+endif(WINCE) -+ - set(VERSION "1.2.7") - - set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") -@@ -11,6 +18,8 @@ - set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") - set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") - -+include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -+ - include(CheckTypeSize) - include(CheckFunctionExists) - include(CheckIncludeFile) -@@ -21,6 +30,7 @@ - check_include_file(stdint.h HAVE_STDINT_H) - check_include_file(stddef.h HAVE_STDDEF_H) - -+set(CMAKE_DEBUG_POSTFIX) - # - # Check to see if we have large file support - # -@@ -57,7 +67,7 @@ - check_include_file(unistd.h Z_HAVE_UNISTD_H) - - if(MSVC) -- set(CMAKE_DEBUG_POSTFIX "d") -+# set(CMAKE_DEBUG_POSTFIX "d") - add_definitions(-D_CRT_SECURE_NO_DEPRECATE) - add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -@@ -152,6 +162,10 @@ - set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) - set_target_properties(zlib PROPERTIES SOVERSION 1) - -+if(WINCE) -+ target_link_libraries(zlib ${WCECOMPAT_LIBRARIES}) -+endif(WINCE) -+ - if(NOT CYGWIN) - # This property causes shared libraries on Linux to have the full version - # encoded into their final filename. We disable this on Cygwin because -@@ -163,10 +177,12 @@ - set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) - endif() - --if(UNIX) -+if(UNIX OR MINGW) - # On unix-like platforms the library is almost always called libz - set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) -- set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/zlib.map") -+ if(NOT APPLE) -+ set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/zlib.map") -+ endif() - elseif(BUILD_SHARED_LIBS AND WIN32) - # Creates zlib1.dll when building shared library version - set_target_properties(zlib PROPERTIES SUFFIX "1.dll") -@@ -192,12 +208,14 @@ - # Example binaries - #============================================================================ - -+if(NOT WINCE) - add_executable(example test/example.c) - target_link_libraries(example zlib) - add_test(example example) - - add_executable(minigzip test/minigzip.c) - target_link_libraries(minigzip zlib) -+endif(NOT WINCE) - - if(HAVE_OFF64_T) - add_executable(example64 test/example.c) -@@ -209,3 +227,7 @@ - target_link_libraries(minigzip64 zlib) - set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") - endif() -+ -+ -+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc) -+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc DESTINATION lib/pkgconfig) -diff -Naur zlib-1.2.7-orig/CMakeLists.txt.orig zlib-1.2.7/CMakeLists.txt.orig ---- zlib-1.2.7-orig/CMakeLists.txt.orig 1970-01-01 01:00:00.000000000 +0100 -+++ zlib-1.2.7/CMakeLists.txt.orig 2013-06-08 16:58:50.000000000 +0200 -@@ -0,0 +1,213 @@ -+cmake_minimum_required(VERSION 2.4.4) -+set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) -+ -+project(zlib C) -+ -+set(VERSION "1.2.7") -+ -+set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") -+set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") -+set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") -+set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") -+set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") -+ -+include(CheckTypeSize) -+include(CheckFunctionExists) -+include(CheckIncludeFile) -+include(CheckCSourceCompiles) -+enable_testing() -+ -+check_include_file(sys/types.h HAVE_SYS_TYPES_H) -+check_include_file(stdint.h HAVE_STDINT_H) -+check_include_file(stddef.h HAVE_STDDEF_H) -+ -+# -+# Check to see if we have large file support -+# -+set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) -+# We add these other definitions here because CheckTypeSize.cmake -+# in CMake 2.4.x does not automatically do so and we want -+# compatibility with CMake 2.4.x. -+if(HAVE_SYS_TYPES_H) -+ list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H) -+endif() -+if(HAVE_STDINT_H) -+ list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H) -+endif() -+if(HAVE_STDDEF_H) -+ list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H) -+endif() -+check_type_size(off64_t OFF64_T) -+if(HAVE_OFF64_T) -+ add_definitions(-D_LARGEFILE64_SOURCE=1) -+endif() -+set(CMAKE_REQUIRED_DEFINITIONS) # clear variable -+ -+# -+# Check for fseeko -+# -+check_function_exists(fseeko HAVE_FSEEKO) -+if(NOT HAVE_FSEEKO) -+ add_definitions(-DNO_FSEEKO) -+endif() -+ -+# -+# Check for unistd.h -+# -+check_include_file(unistd.h Z_HAVE_UNISTD_H) -+ -+if(MSVC) -+ set(CMAKE_DEBUG_POSTFIX "d") -+ add_definitions(-D_CRT_SECURE_NO_DEPRECATE) -+ add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) -+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -+endif() -+ -+if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) -+ # If we're doing an out of source build and the user has a zconf.h -+ # in their source tree... -+ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h) -+ message(STATUS "Renaming") -+ message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h") -+ message(STATUS "to 'zconf.h.included' because this file is included with zlib") -+ message(STATUS "but CMake generates it automatically in the build directory.") -+ file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included) -+ endif() -+endif() -+ -+set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc) -+configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein -+ ${ZLIB_PC} @ONLY) -+configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein -+ ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) -+include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) -+ -+ -+#============================================================================ -+# zlib -+#============================================================================ -+ -+set(ZLIB_PUBLIC_HDRS -+ ${CMAKE_CURRENT_BINARY_DIR}/zconf.h -+ zlib.h -+) -+set(ZLIB_PRIVATE_HDRS -+ crc32.h -+ deflate.h -+ gzguts.h -+ inffast.h -+ inffixed.h -+ inflate.h -+ inftrees.h -+ trees.h -+ zutil.h -+) -+set(ZLIB_SRCS -+ adler32.c -+ compress.c -+ crc32.c -+ deflate.c -+ gzclose.c -+ gzlib.c -+ gzread.c -+ gzwrite.c -+ inflate.c -+ infback.c -+ inftrees.c -+ inffast.c -+ trees.c -+ uncompr.c -+ zutil.c -+) -+ -+if(NOT MINGW) -+ set(ZLIB_SRCS ${ZLIB_SRCS} -+ win32/zlib1.rc # If present will override custom build rule below. -+ ) -+endif() -+ -+# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION -+file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) -+string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" -+ "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) -+ -+if(MINGW) -+ # This gets us DLL resource information when compiling on MinGW. -+ if(NOT CMAKE_RC_COMPILER) -+ SET(CMAKE_RC_COMPILER windres.exe) -+ endif() -+ -+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj -+ COMMAND ${CMAKE_RC_COMPILER} -+ -D GCC_WINDRES -+ -I ${CMAKE_CURRENT_SOURCE_DIR} -+ -I ${CMAKE_CURRENT_BINARY_DIR} -+ -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj -+ -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) -+ set(ZLIB_SRCS ${ZLIB_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) -+endif(MINGW) -+ -+add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -+add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -+set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) -+set_target_properties(zlib PROPERTIES SOVERSION 1) -+ -+if(NOT CYGWIN) -+ # This property causes shared libraries on Linux to have the full version -+ # encoded into their final filename. We disable this on Cygwin because -+ # it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll -+ # seems to be the default. -+ # -+ # This has no effect with MSVC, on that platform the version info for -+ # the DLL comes from the resource file win32/zlib1.rc -+ set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) -+endif() -+ -+if(UNIX) -+ # On unix-like platforms the library is almost always called libz -+ set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) -+ if(NOT APPLE) -+ set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/zlib.map") -+ endif() -+elseif(BUILD_SHARED_LIBS AND WIN32) -+ # Creates zlib1.dll when building shared library version -+ set_target_properties(zlib PROPERTIES SUFFIX "1.dll") -+endif() -+ -+if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) -+ install(TARGETS zlib zlibstatic -+ RUNTIME DESTINATION "${INSTALL_BIN_DIR}" -+ ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" -+ LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) -+endif() -+if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) -+ install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}") -+endif() -+if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) -+ install(FILES zlib.3 DESTINATION "${INSTALL_MAN_DIR}/man3") -+endif() -+if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) -+ install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}") -+endif() -+ -+#============================================================================ -+# Example binaries -+#============================================================================ -+ -+add_executable(example test/example.c) -+target_link_libraries(example zlib) -+add_test(example example) -+ -+add_executable(minigzip test/minigzip.c) -+target_link_libraries(minigzip zlib) -+ -+if(HAVE_OFF64_T) -+ add_executable(example64 test/example.c) -+ target_link_libraries(example64 zlib) -+ set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") -+ add_test(example64 example64) -+ -+ add_executable(minigzip64 test/minigzip.c) -+ target_link_libraries(minigzip64 zlib) -+ set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") -+endif() -diff -Naur zlib-1.2.7-orig/cmake/modules/FindWcecompat.cmake zlib-1.2.7/cmake/modules/FindWcecompat.cmake ---- zlib-1.2.7-orig/cmake/modules/FindWcecompat.cmake 1970-01-01 01:00:00.000000000 +0100 -+++ zlib-1.2.7/cmake/modules/FindWcecompat.cmake 2013-06-08 17:00:40.000000000 +0200 -@@ -0,0 +1,33 @@ -+# Try to find Wcecompat functionality -+# Once done this will define -+# -+# WCECOMPAT_FOUND - system has Wcecompat -+# WCECOMPAT_INCLUDE_DIR - Wcecompat include directory -+# WCECOMPAT_LIBRARIES - Libraries needed to use Wcecompat -+# -+# Copyright (c) 2010, Andreas Holzammer, -+# -+# Redistribution and use is allowed according to the terms of the BSD license. -+ -+if(WCECOMPAT_INCLUDE_DIR AND WCECOMPAT_LIB_FOUND) -+ set(Wcecompat_FIND_QUIETLY TRUE) -+endif(WCECOMPAT_INCLUDE_DIR AND WCECOMPAT_LIB_FOUND) -+ -+find_path(WCECOMPAT_INCLUDE_DIR errno.h PATH_SUFFIXES wcecompat) -+ -+set(WCECOMPAT_LIB_FOUND FALSE) -+ -+if(WCECOMPAT_INCLUDE_DIR) -+ find_library(WCECOMPAT_LIBRARIES NAMES wcecompat wcecompatex ) -+ if(WCECOMPAT_LIBRARIES) -+ set(WCECOMPAT_LIB_FOUND TRUE) -+ endif(WCECOMPAT_LIBRARIES) -+endif(WCECOMPAT_INCLUDE_DIR) -+ -+# I have no idea what this is about, but it seems to be used quite often, so I add this here -+set(WCECOMPAT_CONST const) -+ -+include(FindPackageHandleStandardArgs) -+find_package_handle_standard_args(Wcecompat DEFAULT_MSG WCECOMPAT_LIBRARIES WCECOMPAT_LIB_FOUND) -+ -+mark_as_advanced(WCECOMPAT_INCLUDE_DIR WCECOMPAT_LIBRARIES WCECOMPAT_CONST WCECOMPAT_LIB_FOUND) -diff -Naur zlib-1.2.7-orig/win32/zlib1.rc zlib-1.2.7/win32/zlib1.rc ---- zlib-1.2.7-orig/win32/zlib1.rc 2006-05-21 05:55:00.000000000 +0200 -+++ zlib-1.2.7/win32/zlib1.rc 2013-06-08 17:00:40.000000000 +0200 -@@ -10,9 +10,9 @@ - PRODUCTVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - #ifdef _DEBUG -- FILEFLAGS 1 -+ FILEFLAGS 0x1L - #else -- FILEFLAGS 0 -+ FILEFLAGS 0x0L - #endif - FILEOS VOS__WINDOWS32 - FILETYPE VFT_DLL -diff -Naur zlib-1.2.7-orig/zconf.h zlib-1.2.7/zconf.h ---- zlib-1.2.7-orig/zconf.h 2012-04-30 01:18:12.000000000 +0200 -+++ zlib-1.2.7/zconf.h 1970-01-01 01:00:00.000000000 +0100 -@@ -1,506 +0,0 @@ --/* zconf.h -- configuration of the zlib compression library -- * Copyright (C) 1995-2012 Jean-loup Gailly. -- * For conditions of distribution and use, see copyright notice in zlib.h -- */ -- --/* @(#) $Id$ */ -- --#ifndef ZCONF_H --#define ZCONF_H -- --/* -- * If you *really* need a unique prefix for all types and library functions, -- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. -- * Even better than compiling with -DZ_PREFIX would be to use configure to set -- * this permanently in zconf.h using "./configure --zprefix". -- */ --#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ --# define Z_PREFIX_SET -- --/* all linked symbols */ --# define _dist_code z__dist_code --# define _length_code z__length_code --# define _tr_align z__tr_align --# define _tr_flush_block z__tr_flush_block --# define _tr_init z__tr_init --# define _tr_stored_block z__tr_stored_block --# define _tr_tally z__tr_tally --# define adler32 z_adler32 --# define adler32_combine z_adler32_combine --# define adler32_combine64 z_adler32_combine64 --# ifndef Z_SOLO --# define compress z_compress --# define compress2 z_compress2 --# define compressBound z_compressBound --# endif --# define crc32 z_crc32 --# define crc32_combine z_crc32_combine --# define crc32_combine64 z_crc32_combine64 --# define deflate z_deflate --# define deflateBound z_deflateBound --# define deflateCopy z_deflateCopy --# define deflateEnd z_deflateEnd --# define deflateInit2_ z_deflateInit2_ --# define deflateInit_ z_deflateInit_ --# define deflateParams z_deflateParams --# define deflatePending z_deflatePending --# define deflatePrime z_deflatePrime --# define deflateReset z_deflateReset --# define deflateResetKeep z_deflateResetKeep --# define deflateSetDictionary z_deflateSetDictionary --# define deflateSetHeader z_deflateSetHeader --# define deflateTune z_deflateTune --# define deflate_copyright z_deflate_copyright --# define get_crc_table z_get_crc_table --# ifndef Z_SOLO --# define gz_error z_gz_error --# define gz_intmax z_gz_intmax --# define gz_strwinerror z_gz_strwinerror --# define gzbuffer z_gzbuffer --# define gzclearerr z_gzclearerr --# define gzclose z_gzclose --# define gzclose_r z_gzclose_r --# define gzclose_w z_gzclose_w --# define gzdirect z_gzdirect --# define gzdopen z_gzdopen --# define gzeof z_gzeof --# define gzerror z_gzerror --# define gzflush z_gzflush --# define gzgetc z_gzgetc --# define gzgetc_ z_gzgetc_ --# define gzgets z_gzgets --# define gzoffset z_gzoffset --# define gzoffset64 z_gzoffset64 --# define gzopen z_gzopen --# define gzopen64 z_gzopen64 --# ifdef _WIN32 --# define gzopen_w z_gzopen_w --# endif --# define gzprintf z_gzprintf --# define gzputc z_gzputc --# define gzputs z_gzputs --# define gzread z_gzread --# define gzrewind z_gzrewind --# define gzseek z_gzseek --# define gzseek64 z_gzseek64 --# define gzsetparams z_gzsetparams --# define gztell z_gztell --# define gztell64 z_gztell64 --# define gzungetc z_gzungetc --# define gzwrite z_gzwrite --# endif --# define inflate z_inflate --# define inflateBack z_inflateBack --# define inflateBackEnd z_inflateBackEnd --# define inflateBackInit_ z_inflateBackInit_ --# define inflateCopy z_inflateCopy --# define inflateEnd z_inflateEnd --# define inflateGetHeader z_inflateGetHeader --# define inflateInit2_ z_inflateInit2_ --# define inflateInit_ z_inflateInit_ --# define inflateMark z_inflateMark --# define inflatePrime z_inflatePrime --# define inflateReset z_inflateReset --# define inflateReset2 z_inflateReset2 --# define inflateSetDictionary z_inflateSetDictionary --# define inflateSync z_inflateSync --# define inflateSyncPoint z_inflateSyncPoint --# define inflateUndermine z_inflateUndermine --# define inflateResetKeep z_inflateResetKeep --# define inflate_copyright z_inflate_copyright --# define inflate_fast z_inflate_fast --# define inflate_table z_inflate_table --# ifndef Z_SOLO --# define uncompress z_uncompress --# endif --# define zError z_zError --# ifndef Z_SOLO --# define zcalloc z_zcalloc --# define zcfree z_zcfree --# endif --# define zlibCompileFlags z_zlibCompileFlags --# define zlibVersion z_zlibVersion -- --/* all zlib typedefs in zlib.h and zconf.h */ --# define Byte z_Byte --# define Bytef z_Bytef --# define alloc_func z_alloc_func --# define charf z_charf --# define free_func z_free_func --# ifndef Z_SOLO --# define gzFile z_gzFile --# endif --# define gz_header z_gz_header --# define gz_headerp z_gz_headerp --# define in_func z_in_func --# define intf z_intf --# define out_func z_out_func --# define uInt z_uInt --# define uIntf z_uIntf --# define uLong z_uLong --# define uLongf z_uLongf --# define voidp z_voidp --# define voidpc z_voidpc --# define voidpf z_voidpf -- --/* all zlib structs in zlib.h and zconf.h */ --# define gz_header_s z_gz_header_s --# define internal_state z_internal_state -- --#endif -- --#if defined(__MSDOS__) && !defined(MSDOS) --# define MSDOS --#endif --#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) --# define OS2 --#endif --#if defined(_WINDOWS) && !defined(WINDOWS) --# define WINDOWS --#endif --#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) --# ifndef WIN32 --# define WIN32 --# endif --#endif --#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) --# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) --# ifndef SYS16BIT --# define SYS16BIT --# endif --# endif --#endif -- --/* -- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more -- * than 64k bytes at a time (needed on systems with 16-bit int). -- */ --#ifdef SYS16BIT --# define MAXSEG_64K --#endif --#ifdef MSDOS --# define UNALIGNED_OK --#endif -- --#ifdef __STDC_VERSION__ --# ifndef STDC --# define STDC --# endif --# if __STDC_VERSION__ >= 199901L --# ifndef STDC99 --# define STDC99 --# endif --# endif --#endif --#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) --# define STDC --#endif --#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) --# define STDC --#endif --#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) --# define STDC --#endif --#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) --# define STDC --#endif -- --#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ --# define STDC --#endif -- --#ifndef STDC --# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ --# define const /* note: need a more gentle solution here */ --# endif --#endif -- --#if defined(ZLIB_CONST) && !defined(z_const) --# define z_const const --#else --# define z_const --#endif -- --/* Some Mac compilers merge all .h files incorrectly: */ --#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) --# define NO_DUMMY_DECL --#endif -- --/* Maximum value for memLevel in deflateInit2 */ --#ifndef MAX_MEM_LEVEL --# ifdef MAXSEG_64K --# define MAX_MEM_LEVEL 8 --# else --# define MAX_MEM_LEVEL 9 --# endif --#endif -- --/* Maximum value for windowBits in deflateInit2 and inflateInit2. -- * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files -- * created by gzip. (Files created by minigzip can still be extracted by -- * gzip.) -- */ --#ifndef MAX_WBITS --# define MAX_WBITS 15 /* 32K LZ77 window */ --#endif -- --/* The memory requirements for deflate are (in bytes): -- (1 << (windowBits+2)) + (1 << (memLevel+9)) -- that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) -- plus a few kilobytes for small objects. For example, if you want to reduce -- the default memory requirements from 256K to 128K, compile with -- make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" -- Of course this will generally degrade compression (there's no free lunch). -- -- The memory requirements for inflate are (in bytes) 1 << windowBits -- that is, 32K for windowBits=15 (default value) plus a few kilobytes -- for small objects. --*/ -- -- /* Type declarations */ -- --#ifndef OF /* function prototypes */ --# ifdef STDC --# define OF(args) args --# else --# define OF(args) () --# endif --#endif -- --#ifndef Z_ARG /* function prototypes for stdarg */ --# if defined(STDC) || defined(Z_HAVE_STDARG_H) --# define Z_ARG(args) args --# else --# define Z_ARG(args) () --# endif --#endif -- --/* The following definitions for FAR are needed only for MSDOS mixed -- * model programming (small or medium model with some far allocations). -- * This was tested only with MSC; for other MSDOS compilers you may have -- * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, -- * just define FAR to be empty. -- */ --#ifdef SYS16BIT --# if defined(M_I86SM) || defined(M_I86MM) -- /* MSC small or medium model */ --# define SMALL_MEDIUM --# ifdef _MSC_VER --# define FAR _far --# else --# define FAR far --# endif --# endif --# if (defined(__SMALL__) || defined(__MEDIUM__)) -- /* Turbo C small or medium model */ --# define SMALL_MEDIUM --# ifdef __BORLANDC__ --# define FAR _far --# else --# define FAR far --# endif --# endif --#endif -- --#if defined(WINDOWS) || defined(WIN32) -- /* If building or using zlib as a DLL, define ZLIB_DLL. -- * This is not mandatory, but it offers a little performance increase. -- */ --# ifdef ZLIB_DLL --# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) --# ifdef ZLIB_INTERNAL --# define ZEXTERN extern __declspec(dllexport) --# else --# define ZEXTERN extern __declspec(dllimport) --# endif --# endif --# endif /* ZLIB_DLL */ -- /* If building or using zlib with the WINAPI/WINAPIV calling convention, -- * define ZLIB_WINAPI. -- * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. -- */ --# ifdef ZLIB_WINAPI --# ifdef FAR --# undef FAR --# endif --# include -- /* No need for _export, use ZLIB.DEF instead. */ -- /* For complete Windows compatibility, use WINAPI, not __stdcall. */ --# define ZEXPORT WINAPI --# ifdef WIN32 --# define ZEXPORTVA WINAPIV --# else --# define ZEXPORTVA FAR CDECL --# endif --# endif --#endif -- --#if defined (__BEOS__) --# ifdef ZLIB_DLL --# ifdef ZLIB_INTERNAL --# define ZEXPORT __declspec(dllexport) --# define ZEXPORTVA __declspec(dllexport) --# else --# define ZEXPORT __declspec(dllimport) --# define ZEXPORTVA __declspec(dllimport) --# endif --# endif --#endif -- --#ifndef ZEXTERN --# define ZEXTERN extern --#endif --#ifndef ZEXPORT --# define ZEXPORT --#endif --#ifndef ZEXPORTVA --# define ZEXPORTVA --#endif -- --#ifndef FAR --# define FAR --#endif -- --#if !defined(__MACTYPES__) --typedef unsigned char Byte; /* 8 bits */ --#endif --typedef unsigned int uInt; /* 16 bits or more */ --typedef unsigned long uLong; /* 32 bits or more */ -- --#ifdef SMALL_MEDIUM -- /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ --# define Bytef Byte FAR --#else -- typedef Byte FAR Bytef; --#endif --typedef char FAR charf; --typedef int FAR intf; --typedef uInt FAR uIntf; --typedef uLong FAR uLongf; -- --#ifdef STDC -- typedef void const *voidpc; -- typedef void FAR *voidpf; -- typedef void *voidp; --#else -- typedef Byte const *voidpc; -- typedef Byte FAR *voidpf; -- typedef Byte *voidp; --#endif -- --/* ./configure may #define Z_U4 here */ -- --#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) --# include --# if (UINT_MAX == 0xffffffffUL) --# define Z_U4 unsigned --# else --# if (ULONG_MAX == 0xffffffffUL) --# define Z_U4 unsigned long --# else --# if (USHRT_MAX == 0xffffffffUL) --# define Z_U4 unsigned short --# endif --# endif --# endif --#endif -- --#ifdef Z_U4 -- typedef Z_U4 z_crc_t; --#else -- typedef unsigned long z_crc_t; --#endif -- --#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ --# define Z_HAVE_UNISTD_H --#endif -- --#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ --# define Z_HAVE_STDARG_H --#endif -- --#ifdef STDC --# ifndef Z_SOLO --# include /* for off_t */ --# endif --#endif -- --#ifdef _WIN32 --# include /* for wchar_t */ --#endif -- --/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and -- * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even -- * though the former does not conform to the LFS document), but considering -- * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as -- * equivalently requesting no 64-bit operations -- */ --#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 --# undef _LARGEFILE64_SOURCE --#endif -- --#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) --# define Z_HAVE_UNISTD_H --#endif --#ifndef Z_SOLO --# if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) --# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ --# ifdef VMS --# include /* for off_t */ --# endif --# ifndef z_off_t --# define z_off_t off_t --# endif --# endif --#endif -- --#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 --# define Z_LFS64 --#endif -- --#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) --# define Z_LARGE64 --#endif -- --#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) --# define Z_WANT64 --#endif -- --#if !defined(SEEK_SET) && !defined(Z_SOLO) --# define SEEK_SET 0 /* Seek from beginning of file. */ --# define SEEK_CUR 1 /* Seek from current position. */ --# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ --#endif -- --#ifndef z_off_t --# define z_off_t long --#endif -- --#if !defined(_WIN32) && defined(Z_LARGE64) --# define z_off64_t off64_t --#else --# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) --# define z_off64_t __int64 --# else --# define z_off64_t z_off_t --# endif --#endif -- --/* MVS linker does not support external names larger than 8 bytes */ --#if defined(__MVS__) -- #pragma map(deflateInit_,"DEIN") -- #pragma map(deflateInit2_,"DEIN2") -- #pragma map(deflateEnd,"DEEND") -- #pragma map(deflateBound,"DEBND") -- #pragma map(inflateInit_,"ININ") -- #pragma map(inflateInit2_,"ININ2") -- #pragma map(inflateEnd,"INEND") -- #pragma map(inflateSync,"INSY") -- #pragma map(inflateSetDictionary,"INSEDI") -- #pragma map(compressBound,"CMBND") -- #pragma map(inflate_table,"INTABL") -- #pragma map(inflate_fast,"INFA") -- #pragma map(inflate_copyright,"INCOPY") --#endif -- --#endif /* ZCONF_H */ -diff -Naur zlib-1.2.7-orig/zlib.pc.cmake zlib-1.2.7/zlib.pc.cmake ---- zlib-1.2.7-orig/zlib.pc.cmake 1970-01-01 01:00:00.000000000 +0100 -+++ zlib-1.2.7/zlib.pc.cmake 2013-06-08 17:00:40.000000000 +0200 -@@ -0,0 +1,13 @@ -+prefix=@CMAKE_INSTALL_PREFIX@ -+exec_prefix=@CMAKE_INSTALL_PREFIX@ -+libdir=@CMAKE_INSTALL_PREFIX@/lib -+sharedlibdir=@CMAKE_INSTALL_PREFIX@/lib -+includedir=@CMAKE_INSTALL_PREFIX@/include -+ -+Name: zlib -+Description: zlib compression library -+Version: @ZLIB_FULL_VERSION@ -+ -+Requires: -+Libs: -L${libdir} -L${sharedlibdir} -lz -+Cflags: -I${includedir} diff --git a/3rdparty/ext_zlib/zlib-1.2.7-20130123.diff b/3rdparty/ext_zlib/zlib-1.2.8-20130901.diff similarity index 90% rename from 3rdparty/ext_zlib/zlib-1.2.7-20130123.diff rename to 3rdparty/ext_zlib/zlib-1.2.8-20130901.diff index e721016509..5000f4eee3 100644 --- a/3rdparty/ext_zlib/zlib-1.2.7-20130123.diff +++ b/3rdparty/ext_zlib/zlib-1.2.8-20130901.diff @@ -1,668 +1,673 @@ -diff -Nru -x '*~' zlib-1.2.7.orig/cmake/modules/FindWcecompat.cmake zlib-1.2.7/cmake/modules/FindWcecompat.cmake ---- zlib-1.2.7.orig/cmake/modules/FindWcecompat.cmake 1970-01-01 01:00:00.000000000 +0100 -+++ zlib-1.2.7/cmake/modules/FindWcecompat.cmake 2013-01-23 13:05:41.165165700 +0100 +diff -Nru -x '*~' zlib-1.2.8.orig/cmake/modules/FindWcecompat.cmake zlib-1.2.8/cmake/modules/FindWcecompat.cmake +--- zlib-1.2.8.orig/cmake/modules/FindWcecompat.cmake 1970-01-01 01:00:00.000000000 +0100 ++++ zlib-1.2.8/cmake/modules/FindWcecompat.cmake 2013-09-01 00:55:16.876062400 +0200 @@ -0,0 +1,33 @@ +# Try to find Wcecompat functionality +# Once done this will define +# +# WCECOMPAT_FOUND - system has Wcecompat +# WCECOMPAT_INCLUDE_DIR - Wcecompat include directory +# WCECOMPAT_LIBRARIES - Libraries needed to use Wcecompat +# +# Copyright (c) 2010, Andreas Holzammer, +# +# Redistribution and use is allowed according to the terms of the BSD license. + +if(WCECOMPAT_INCLUDE_DIR AND WCECOMPAT_LIB_FOUND) + set(Wcecompat_FIND_QUIETLY TRUE) +endif(WCECOMPAT_INCLUDE_DIR AND WCECOMPAT_LIB_FOUND) + +find_path(WCECOMPAT_INCLUDE_DIR errno.h PATH_SUFFIXES wcecompat) + +set(WCECOMPAT_LIB_FOUND FALSE) + +if(WCECOMPAT_INCLUDE_DIR) + find_library(WCECOMPAT_LIBRARIES NAMES wcecompat wcecompatex ) + if(WCECOMPAT_LIBRARIES) + set(WCECOMPAT_LIB_FOUND TRUE) + endif(WCECOMPAT_LIBRARIES) +endif(WCECOMPAT_INCLUDE_DIR) + +# I have no idea what this is about, but it seems to be used quite often, so I add this here +set(WCECOMPAT_CONST const) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Wcecompat DEFAULT_MSG WCECOMPAT_LIBRARIES WCECOMPAT_LIB_FOUND) + +mark_as_advanced(WCECOMPAT_INCLUDE_DIR WCECOMPAT_LIBRARIES WCECOMPAT_CONST WCECOMPAT_LIB_FOUND) -diff -Nru -x '*~' zlib-1.2.7.orig/CMakeLists.txt zlib-1.2.7/CMakeLists.txt ---- zlib-1.2.7.orig/CMakeLists.txt 2012-04-30 06:20:45.000000000 +0200 -+++ zlib-1.2.7/CMakeLists.txt 2013-01-23 14:27:12.151495800 +0100 +diff -Nru -x '*~' zlib-1.2.8.orig/CMakeLists.txt zlib-1.2.8/CMakeLists.txt +--- zlib-1.2.8.orig/CMakeLists.txt 2013-04-29 00:57:10.000000000 +0200 ++++ zlib-1.2.8/CMakeLists.txt 2013-09-01 00:58:02.253521400 +0200 @@ -1,8 +1,15 @@ -cmake_minimum_required(VERSION 2.4.4) +cmake_minimum_required(VERSION 2.6) set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) + project(zlib C) +if(WINCE) + find_package(Wcecompat REQUIRED) + include_directories(${WCECOMPAT_INCLUDE_DIR}) +endif(WINCE) + - set(VERSION "1.2.7") + set(VERSION "1.2.8") - set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") -@@ -11,6 +18,8 @@ + option(ASM686 "Enable building i686 assembly implementation") +@@ -14,6 +21,8 @@ set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + include(CheckTypeSize) include(CheckFunctionExists) include(CheckIncludeFile) -@@ -21,6 +30,7 @@ +@@ -24,6 +33,7 @@ check_include_file(stdint.h HAVE_STDINT_H) check_include_file(stddef.h HAVE_STDDEF_H) +set(CMAKE_DEBUG_POSTFIX) # # Check to see if we have large file support # -@@ -57,7 +67,7 @@ +@@ -60,7 +70,7 @@ check_include_file(unistd.h Z_HAVE_UNISTD_H) if(MSVC) - set(CMAKE_DEBUG_POSTFIX "d") +# set(CMAKE_DEBUG_POSTFIX "d") add_definitions(-D_CRT_SECURE_NO_DEPRECATE) add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -@@ -152,6 +162,10 @@ +@@ -188,6 +198,10 @@ set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) set_target_properties(zlib PROPERTIES SOVERSION 1) +if(WINCE) + target_link_libraries(zlib ${WCECOMPAT_LIBRARIES}) +endif(WINCE) + if(NOT CYGWIN) # This property causes shared libraries on Linux to have the full version # encoded into their final filename. We disable this on Cygwin because -@@ -163,7 +177,7 @@ +@@ -199,7 +213,7 @@ set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) endif() -if(UNIX) +if(UNIX OR MINGW) # On unix-like platforms the library is almost always called libz set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) - set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/zlib.map") -@@ -192,12 +206,14 @@ + if(NOT APPLE) +@@ -230,12 +244,14 @@ # Example binaries #============================================================================ +if(NOT WINCE) add_executable(example test/example.c) target_link_libraries(example zlib) add_test(example example) add_executable(minigzip test/minigzip.c) target_link_libraries(minigzip zlib) +endif(NOT WINCE) if(HAVE_OFF64_T) add_executable(example64 test/example.c) -@@ -209,3 +225,7 @@ +@@ -247,3 +263,7 @@ target_link_libraries(minigzip64 zlib) set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") endif() + + -+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc) ++configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc DESTINATION lib/pkgconfig) -diff -Nru -x '*~' zlib-1.2.7.orig/win32/zlib1.rc zlib-1.2.7/win32/zlib1.rc ---- zlib-1.2.7.orig/win32/zlib1.rc 2006-05-21 05:55:00.000000000 +0200 -+++ zlib-1.2.7/win32/zlib1.rc 2013-01-23 13:05:41.190165800 +0100 +diff -Nru -x '*~' zlib-1.2.8.orig/win32/zlib1.rc zlib-1.2.8/win32/zlib1.rc +--- zlib-1.2.8.orig/win32/zlib1.rc 2013-04-29 00:57:11.000000000 +0200 ++++ zlib-1.2.8/win32/zlib1.rc 2013-09-01 00:59:54.116919600 +0200 @@ -10,9 +10,9 @@ PRODUCTVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK #ifdef _DEBUG - FILEFLAGS 1 + FILEFLAGS 0x1L #else - FILEFLAGS 0 + FILEFLAGS 0x0L #endif FILEOS VOS__WINDOWS32 FILETYPE VFT_DLL -diff -Nru -x '*~' zlib-1.2.7.orig/zconf.h zlib-1.2.7/zconf.h ---- zlib-1.2.7.orig/zconf.h 2012-04-30 01:18:12.000000000 +0200 -+++ zlib-1.2.7/zconf.h 1970-01-01 01:00:00.000000000 +0100 -@@ -1,506 +0,0 @@ +diff -Nru -x '*~' zlib-1.2.8.orig/zconf.h zlib-1.2.8/zconf.h +--- zlib-1.2.8.orig/zconf.h 2013-04-29 00:57:11.000000000 +0200 ++++ zlib-1.2.8/zconf.h 1970-01-01 01:00:00.000000000 +0100 +@@ -1,511 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library -- * Copyright (C) 1995-2012 Jean-loup Gailly. +- * Copyright (C) 1995-2013 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef ZCONF_H -#define ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - * Even better than compiling with -DZ_PREFIX would be to use configure to set - * this permanently in zconf.h using "./configure --zprefix". - */ -#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ -# define Z_PREFIX_SET - -/* all linked symbols */ -# define _dist_code z__dist_code -# define _length_code z__length_code -# define _tr_align z__tr_align +-# define _tr_flush_bits z__tr_flush_bits -# define _tr_flush_block z__tr_flush_block -# define _tr_init z__tr_init -# define _tr_stored_block z__tr_stored_block -# define _tr_tally z__tr_tally -# define adler32 z_adler32 -# define adler32_combine z_adler32_combine -# define adler32_combine64 z_adler32_combine64 -# ifndef Z_SOLO -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# endif -# define crc32 z_crc32 -# define crc32_combine z_crc32_combine -# define crc32_combine64 z_crc32_combine64 -# define deflate z_deflate -# define deflateBound z_deflateBound -# define deflateCopy z_deflateCopy -# define deflateEnd z_deflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateInit_ z_deflateInit_ -# define deflateParams z_deflateParams -# define deflatePending z_deflatePending -# define deflatePrime z_deflatePrime -# define deflateReset z_deflateReset -# define deflateResetKeep z_deflateResetKeep -# define deflateSetDictionary z_deflateSetDictionary -# define deflateSetHeader z_deflateSetHeader -# define deflateTune z_deflateTune -# define deflate_copyright z_deflate_copyright -# define get_crc_table z_get_crc_table -# ifndef Z_SOLO -# define gz_error z_gz_error -# define gz_intmax z_gz_intmax -# define gz_strwinerror z_gz_strwinerror -# define gzbuffer z_gzbuffer -# define gzclearerr z_gzclearerr -# define gzclose z_gzclose -# define gzclose_r z_gzclose_r -# define gzclose_w z_gzclose_w -# define gzdirect z_gzdirect -# define gzdopen z_gzdopen -# define gzeof z_gzeof -# define gzerror z_gzerror -# define gzflush z_gzflush -# define gzgetc z_gzgetc -# define gzgetc_ z_gzgetc_ -# define gzgets z_gzgets -# define gzoffset z_gzoffset -# define gzoffset64 z_gzoffset64 -# define gzopen z_gzopen -# define gzopen64 z_gzopen64 -# ifdef _WIN32 -# define gzopen_w z_gzopen_w -# endif -# define gzprintf z_gzprintf +-# define gzvprintf z_gzvprintf -# define gzputc z_gzputc -# define gzputs z_gzputs -# define gzread z_gzread -# define gzrewind z_gzrewind -# define gzseek z_gzseek -# define gzseek64 z_gzseek64 -# define gzsetparams z_gzsetparams -# define gztell z_gztell -# define gztell64 z_gztell64 -# define gzungetc z_gzungetc -# define gzwrite z_gzwrite -# endif -# define inflate z_inflate -# define inflateBack z_inflateBack -# define inflateBackEnd z_inflateBackEnd -# define inflateBackInit_ z_inflateBackInit_ -# define inflateCopy z_inflateCopy -# define inflateEnd z_inflateEnd -# define inflateGetHeader z_inflateGetHeader -# define inflateInit2_ z_inflateInit2_ -# define inflateInit_ z_inflateInit_ -# define inflateMark z_inflateMark -# define inflatePrime z_inflatePrime -# define inflateReset z_inflateReset -# define inflateReset2 z_inflateReset2 -# define inflateSetDictionary z_inflateSetDictionary +-# define inflateGetDictionary z_inflateGetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateUndermine z_inflateUndermine -# define inflateResetKeep z_inflateResetKeep -# define inflate_copyright z_inflate_copyright -# define inflate_fast z_inflate_fast -# define inflate_table z_inflate_table -# ifndef Z_SOLO -# define uncompress z_uncompress -# endif -# define zError z_zError -# ifndef Z_SOLO -# define zcalloc z_zcalloc -# define zcfree z_zcfree -# endif -# define zlibCompileFlags z_zlibCompileFlags -# define zlibVersion z_zlibVersion - -/* all zlib typedefs in zlib.h and zconf.h */ -# define Byte z_Byte -# define Bytef z_Bytef -# define alloc_func z_alloc_func -# define charf z_charf -# define free_func z_free_func -# ifndef Z_SOLO -# define gzFile z_gzFile -# endif -# define gz_header z_gz_header -# define gz_headerp z_gz_headerp -# define in_func z_in_func -# define intf z_intf -# define out_func z_out_func -# define uInt z_uInt -# define uIntf z_uIntf -# define uLong z_uLong -# define uLongf z_uLongf -# define voidp z_voidp -# define voidpc z_voidpc -# define voidpf z_voidpf - -/* all zlib structs in zlib.h and zconf.h */ -# define gz_header_s z_gz_header_s -# define internal_state z_internal_state - -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) -# ifndef WIN32 -# define WIN32 -# endif -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -#if defined(ZLIB_CONST) && !defined(z_const) -# define z_const const -#else -# define z_const -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - --/* ./configure may #define Z_U4 here */ -- -#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) -# include -# if (UINT_MAX == 0xffffffffUL) -# define Z_U4 unsigned --# else --# if (ULONG_MAX == 0xffffffffUL) --# define Z_U4 unsigned long --# else --# if (USHRT_MAX == 0xffffffffUL) --# define Z_U4 unsigned short --# endif --# endif +-# elif (ULONG_MAX == 0xffffffffUL) +-# define Z_U4 unsigned long +-# elif (USHRT_MAX == 0xffffffffUL) +-# define Z_U4 unsigned short -# endif -#endif - -#ifdef Z_U4 - typedef Z_U4 z_crc_t; -#else - typedef unsigned long z_crc_t; -#endif - -#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ -# define Z_HAVE_UNISTD_H -#endif - -#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ -# define Z_HAVE_STDARG_H -#endif - -#ifdef STDC -# ifndef Z_SOLO -# include /* for off_t */ -# endif -#endif - +-#if defined(STDC) || defined(Z_HAVE_STDARG_H) +-# ifndef Z_SOLO +-# include /* for va_list */ +-# endif +-#endif +- -#ifdef _WIN32 --# include /* for wchar_t */ +-# ifndef Z_SOLO +-# include /* for wchar_t */ +-# endif -#endif - -/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and - * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even - * though the former does not conform to the LFS document), but considering - * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as - * equivalently requesting no 64-bit operations - */ --#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +-#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 -# undef _LARGEFILE64_SOURCE -#endif - -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H -#endif -#ifndef Z_SOLO --# if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) +-# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ -# ifdef VMS -# include /* for off_t */ -# endif -# ifndef z_off_t -# define z_off_t off_t -# endif -# endif -#endif - -#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 -# define Z_LFS64 -#endif - -#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) -# define Z_LARGE64 -#endif - -#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) -# define Z_WANT64 -#endif - -#if !defined(SEEK_SET) && !defined(Z_SOLO) -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif - -#ifndef z_off_t -# define z_off_t long -#endif - -#if !defined(_WIN32) && defined(Z_LARGE64) -# define z_off64_t off64_t -#else -# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) -# define z_off64_t __int64 -# else -# define z_off64_t z_off_t -# endif -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) - #pragma map(deflateInit_,"DEIN") - #pragma map(deflateInit2_,"DEIN2") - #pragma map(deflateEnd,"DEEND") - #pragma map(deflateBound,"DEBND") - #pragma map(inflateInit_,"ININ") - #pragma map(inflateInit2_,"ININ2") - #pragma map(inflateEnd,"INEND") - #pragma map(inflateSync,"INSY") - #pragma map(inflateSetDictionary,"INSEDI") - #pragma map(compressBound,"CMBND") - #pragma map(inflate_table,"INTABL") - #pragma map(inflate_fast,"INFA") - #pragma map(inflate_copyright,"INCOPY") -#endif - -#endif /* ZCONF_H */ -diff -Nru -x '*~' zlib-1.2.7.orig/zlib.pc.cmake zlib-1.2.7/zlib.pc.cmake ---- zlib-1.2.7.orig/zlib.pc.cmake 1970-01-01 01:00:00.000000000 +0100 -+++ zlib-1.2.7/zlib.pc.cmake 2013-01-23 13:05:44.130170400 +0100 +diff -Nru -x '*~' zlib-1.2.8.orig/zlib.pc.cmake zlib-1.2.8/zlib.pc.cmake +--- zlib-1.2.8.orig/zlib.pc.cmake 1970-01-01 01:00:00.000000000 +0100 ++++ zlib-1.2.8/zlib.pc.cmake 2013-09-01 00:55:16.932065600 +0200 @@ -0,0 +1,13 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_PREFIX@/lib +sharedlibdir=@CMAKE_INSTALL_PREFIX@/lib +includedir=@CMAKE_INSTALL_PREFIX@/include + +Name: zlib +Description: zlib compression library +Version: @ZLIB_FULL_VERSION@ + +Requires: +Libs: -L${libdir} -L${sharedlibdir} -lz +Cflags: -I${includedir} diff --git a/CMakeLists.txt b/CMakeLists.txt index 443fb72eda..0e18671288 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,673 +1,673 @@ project(krita) message(STATUS "Using CMake version: ${CMAKE_VERSION}") cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) if (WIN32) set(MIN_QT_VERSION 5.6.0) else() set(MIN_QT_VERSION 5.4.0) endif() set(MIN_FRAMEWORKS_VERSION 5.7.0) if (POLICY CMP0002) cmake_policy(SET CMP0002 OLD) endif() if (POLICY CMP0017) cmake_policy(SET CMP0017 NEW) endif () if (POLICY CMP0022) cmake_policy(SET CMP0022 OLD) endif () if (POLICY CMP0026) cmake_policy(SET CMP0026 OLD) endif() if (POLICY CMP0042) cmake_policy(SET CMP0042 NEW) endif() if (POLICY CMP0046) cmake_policy(SET CMP0046 OLD) endif () if (POLICY CMP0059) cmake_policy(SET CMP0059 OLD) endif() if (POLICY CMP0063) cmake_policy(SET CMP0063 OLD) endif() if (POLICY CMP0054) cmake_policy(SET CMP0054 OLD) endif() if (POLICY CMP0064) cmake_policy(SET CMP0064 OLD) endif() if (APPLE) set(APPLE_SUPPRESS_X11_WARNING TRUE) set(KDE_SKIP_RPATH_SETTINGS TRUE) set(CMAKE_MACOSX_RPATH 1) set(BUILD_WITH_INSTALL_RPATH 1) - add_definitions(-Wno-deprecated-register) + add_definitions(-mmacosx-version-min=10.9 -Wno-deprecated-register) endif() # QT5TODO: remove KDE4_BUILD_TESTS once all kde4_add_unit_test have been converted # transitional forward compatibility: # BUILD_TESTING is cmake standard, KDE4_BUILD_TESTS not used by ECM/KF5, but only # macros in cmake/transitional. Just, Macros from cmake/transitional, # incl. kde4_add_unit_test, are only picked up if no macros from kdelibs4 are installed, # because that transitional path is appended. Prepending instead might possibly unwantedly # mask ECM/KF5 macros. Not tested. # So have BUILD_TESTING define KDE4_BUILD_TESTS. if (BUILD_TESTING) set(KDE4_BUILD_TESTS TRUE) else() set(KDE4_BUILD_TESTS FALSE) endif() ###################### ####################### ## Constants defines ## ####################### ###################### # define common versions of Krita applications, used to generate kritaversion.h # update these version for every release: set(KRITA_VERSION_STRING "3.0.1 Alpha") set(KRITA_STABLE_VERSION_MAJOR 3) # 3 for 3.x, 4 for 4.x, etc. set(KRITA_STABLE_VERSION_MINOR 0) # 0 for 3.0, 1 for 3.1, etc. set(KRITA_VERSION_RELEASE 89) # 89 for Alpha, increase for next test releases, set 0 for first Stable, etc. set(KRITA_ALPHA 1) # uncomment only for Alpha #set(KRITA_BETA 1) # uncomment only for Beta #set(KRITA_RC 1) # uncomment only for RC set(KRITA_YEAR 2016) # update every year if(NOT DEFINED KRITA_ALPHA AND NOT DEFINED KRITA_BETA AND NOT DEFINED KRITA_RC) set(KRITA_STABLE 1) # do not edit endif() message(STATUS "Krita version: ${KRITA_VERSION_STRING}") # Define the generic version of the Krita libraries here # This makes it easy to advance it when the next Krita release comes. # 14 was the last GENERIC_KRITA_LIB_VERSION_MAJOR of the previous Krita series # (2.x) so we're starting with 15 in 3.x series. if(KRITA_STABLE_VERSION_MAJOR EQUAL 3) math(EXPR GENERIC_KRITA_LIB_VERSION_MAJOR "${KRITA_STABLE_VERSION_MINOR} + 15") else() # let's make sure we won't forget to update the "15" message(FATAL_ERROR "Reminder: please update offset == 15 used to compute GENERIC_KRITA_LIB_VERSION_MAJOR to something bigger") endif() set(GENERIC_KRITA_LIB_VERSION "${GENERIC_KRITA_LIB_VERSION_MAJOR}.0.0") set(GENERIC_KRITA_LIB_SOVERSION "${GENERIC_KRITA_LIB_VERSION_MAJOR}") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules") LIST (APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/kde_macro") message("Module path:" ${CMAKE_MODULE_PATH}) # fetch git revision for the current build set(KRITA_GIT_SHA1_STRING "") set(KRITA_GIT_BRANCH_STRING "") include(GetGitRevisionDescription) get_git_head_revision(GIT_REFSPEC GIT_SHA1) get_git_branch(GIT_BRANCH) if(GIT_SHA1 AND GIT_BRANCH) string(SUBSTRING ${GIT_SHA1} 0 7 GIT_SHA1) set(KRITA_GIT_SHA1_STRING ${GIT_SHA1}) set(KRITA_GIT_BRANCH_STRING ${GIT_BRANCH}) endif() if(NOT DEFINED RELEASE_BUILD) # estimate mode by CMAKE_BUILD_TYPE content if not set on cmdline string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER) set(RELEASE_BUILD_TYPES "release" "relwithdebinfo" "minsizerel") list(FIND RELEASE_BUILD_TYPES "${CMAKE_BUILD_TYPE_TOLOWER}" INDEX) if (INDEX EQUAL -1) set(RELEASE_BUILD FALSE) else() set(RELEASE_BUILD TRUE) endif() endif() message(STATUS "Release build: ${RELEASE_BUILD}") ############ ############# ## Options ## ############# ############ option(PACKAGERS_BUILD "Build support of multiple CPU architectures in one binary. Should be used by packagers only or Krita developers. Only switch off when you're an artist optimizing a build for your very own machine." ON) if (WIN32) option(USE_BREAKPAD "Build the crash handler for Krita (only on windows)" OFF) endif () option(HIDE_SAFE_ASSERTS "Don't show message box for \"safe\" asserts, just ignore them automatically and dump a message to the terminal." ON) configure_file(config-hide-safe-asserts.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-hide-safe-asserts.h) ####################### ######################## ## Productset setting ## ######################## ####################### # For predefined productsets see the definitions in KritaProducts.cmake and # in the files in the folder cmake/productsets. # Finding out the products & features to build is done in 5 steps: # 1. have the user define the products/features wanted, by giving a productset # 2. estimate all additional required products/features # 3. estimate which of the products/features can be build by external deps # 4. find which products/features have been temporarily disabled due to problems # 5. estimate which of the products/features can be build by internal deps # get the special macros include(CalligraProductSetMacros) include(MacroJPEG) include(GenerateTestExportHeader) # get the definitions of products, features and product sets include(KritaProducts.cmake) set(PRODUCTSET_DEFAULT "ALL") # temporary migration support if (CREATIVEONLY) set(WARN_ABOUT_CREATIVEONLY TRUE) set(PRODUCTSET_DEFAULT "CREATIVE") endif () if(NOT PRODUCTSET) set(PRODUCTSET ${PRODUCTSET_DEFAULT} CACHE STRING "Set of products/features to build" FORCE) endif() if (RELEASE_BUILD) set(CALLIGRA_SHOULD_BUILD_STAGING FALSE) else () set(CALLIGRA_SHOULD_BUILD_STAGING TRUE) endif () # finally choose products/features to build calligra_set_productset(${PRODUCTSET}) ######################## ######################### ## Look for KDE and Qt ## ######################### ######################## find_package(ECM 1.7.0 REQUIRED NOMODULE) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) include(ECMOptionalAddSubdirectory) include(ECMAddAppIcon) include(ECMSetupVersion) include(ECMMarkNonGuiExecutable) include(ECMGenerateHeaders) include(GenerateExportHeader) include(ECMMarkAsTest) include(ECMInstallIcons) include(CMakePackageConfigHelpers) include(WriteBasicConfigVersionFile) include(CheckFunctionExists) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings) include(FeatureSummary) include(KDE4Macros) # do not reorder to be alphabetical: this is the order in which the frameworks # depend on each other. find_package(KF5 ${MIN_FRAMEWORKS_VERSION} REQUIRED COMPONENTS Archive Config WidgetsAddons Completion CoreAddons GuiAddons I18n ItemModels ItemViews WindowSystem ) find_package(Qt5 ${MIN_QT_VERSION} REQUIRED COMPONENTS Core Gui Widgets Xml Network PrintSupport Svg Test Concurrent ) set(QT_QTTEST_LIBRARY Qt5::Test) include (MacroLibrary) include (MacroAdditionalCleanFiles) include (MacroAddFileDependencies) macro_ensure_out_of_source_build("Compiling Krita inside the source directory is not possible. Please refer to the build instruction https://community.kde.org/Krita#Build_Instructions") # Note: OPTIONAL_COMPONENTS does not seem to be reliable # (as of ECM 5.15.0, CMake 3.2) if (NOT WIN32 AND NOT APPLE) find_package(Qt5 ${MIN_QT_VERSION} REQUIRED X11Extras) find_package(Qt5DBus ${MIN_QT_VERSION} QUIET) set(HAVE_DBUS ${Qt5DBus_FOUND}) macro_log_feature(${Qt5DBus_FOUND} "dbus" "Qt DBUS integration" "http://www.qt.io/" FALSE "" "Optionally used to provide a dbus api on Linux") find_package(KF5KIO ${MIN_FRAMEWORKS_VERSION} QUIET) macro_bool_to_01(KF5KIO_FOUND HAVE_KIO) macro_log_feature(${KF5KIO_FOUND} "KIO" "KDE's KIO Framework" "http://api.kde.org/frameworks-api/frameworks5-apidocs/kio/html/index.html" FALSE "" "Optionally used for recent document handling") find_package(KF5Crash ${MIN_FRAMEWORKS_VERSION} QUIET) macro_bool_to_01(KF5Crash_FOUND HAVE_KCRASH) macro_log_feature(${KF5Crash_FOUND} "kcrash" "KDE's Crash Handler" "http://api.kde.org/frameworks-api/frameworks5-apidocs/kcrash/html/index.html" FALSE "" "Optionally used to provide crash reporting on Linux") find_package(X11) if(X11_FOUND) find_package(Qt5 ${MIN_QT_VERSION} REQUIRED NO_MODULE COMPONENTS X11Extras) set(HAVE_X11 TRUE) add_definitions(-DHAVE_X11) else() set(HAVE_X11 FALSE) endif() find_package(XCB COMPONENTS XCB ATOM) if(XCB_FOUND) set(HAVE_XCB TRUE) else() set(HAVE_XCB FALSE) endif() else() set(HAVE_DBUS FALSE) set(HAVE_X11 FALSE) set(HAVE_XCB FALSE) endif() add_definitions( -DTRANSLATION_DOMAIN=\"krita\" -DQT_USE_QSTRINGBUILDER -DQT_STRICT_ITERATORS -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_USE_FAST_OPERATOR_PLUS -DQT_USE_FAST_CONCATENATION -DQT_NO_URL_CAST_FROM_STRING -DQT_DISABLE_DEPRECATED_BEFORE=0 ) # # The reason for this mode is that the Debug mode disable inlining # if(CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS_KRITADEVS "-O3 -g" CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals") endif() if(UNIX) set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};m") endif() if(WIN32) if(MSVC) # C4522: 'class' : multiple assignment operators specified set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4522") endif() endif() # enable exceptions globally kde_enable_exceptions() # only with this definition will all the FOO_TEST_EXPORT macro do something # TODO: check if this can be moved to only those places which make use of it, # to reduce global compiler definitions that would trigger a recompile of # everything on a change (like adding/removing tests to/from the build) if(BUILD_TESTING) add_definitions(-DCOMPILING_TESTS) endif() set(KRITA_DEFAULT_TEST_DATA_DIR ${CMAKE_SOURCE_DIR}/sdk/tests/data/) macro(macro_add_unittest_definitions) add_definitions(-DFILES_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data/") add_definitions(-DFILES_OUTPUT_DIR="${CMAKE_CURRENT_BINARY_DIR}") add_definitions(-DFILES_DEFAULT_DATA_DIR="${KRITA_DEFAULT_TEST_DATA_DIR}") endmacro() # overcome some platform incompatibilities if(WIN32) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/winquirks) add_definitions(-D_USE_MATH_DEFINES) add_definitions(-DNOMINMAX) set(WIN32_PLATFORM_NET_LIBS ws2_32.lib netapi32.lib) endif() # set custom krita plugin installdir set(KRITA_PLUGIN_INSTALL_DIR ${LIB_INSTALL_DIR}/kritaplugins) ########################### ############################ ## Required dependencies ## ############################ ########################### find_package(PNG REQUIRED) if (APPLE) # this is not added correctly on OSX -- see http://forum.kde.org/viewtopic.php?f=139&t=101867&p=221242#p221242 include_directories(SYSTEM ${PNG_INCLUDE_DIR}) endif() add_definitions(-DBOOST_ALL_NO_LIB) find_package(Boost REQUIRED COMPONENTS system) # for pigment and stage ## ## Test for GNU Scientific Library ## macro_optional_find_package(GSL) macro_log_feature(GSL_FOUND "GSL" "GNU Scientific Library" "http://www.gnu.org/software/gsl" FALSE "1.7" "Required by Krita's Transform tool.") macro_bool_to_01(GSL_FOUND HAVE_GSL) configure_file(config-gsl.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-gsl.h ) ########################### ############################ ## Optional dependencies ## ############################ ########################### ## ## Check for OpenEXR ## macro_optional_find_package(ZLIB) macro_log_feature(ZLIB_FOUND "zlib" "Compression library" "http://www.zlib.net/" FALSE "" "Optionally used by the G'Mic and the PSD plugins") macro_bool_to_01(ZLIB_FOUND HAVE_ZLIB) macro_optional_find_package(OpenEXR) macro_log_feature(OPENEXR_FOUND "OpenEXR" "High dynamic-range (HDR) image file format" "http://www.openexr.com" FALSE "" "Required by the Krita OpenEXR filter") macro_bool_to_01(OPENEXR_FOUND HAVE_OPENEXR) set(LINK_OPENEXR_LIB) if(OPENEXR_FOUND) include_directories(SYSTEM ${OPENEXR_INCLUDE_DIR}) set(LINK_OPENEXR_LIB ${OPENEXR_LIBRARIES}) add_definitions(${OPENEXR_DEFINITIONS}) endif() macro_optional_find_package(TIFF) macro_log_feature(TIFF_FOUND "tiff" "TIFF Library and Utilities" "http://www.remotesensing.org/libtiff" FALSE "" "Required by the Krita TIFF filter") macro_optional_find_package(JPEG) macro_log_feature(JPEG_FOUND "jpeg" "Free library for JPEG image compression. Note: libjpeg8 is NOT supported." "http://www.libjpeg-turbo.org" FALSE "" "Required by the Krita JPEG filter") macro_optional_find_package(OpenJPEG) macro_log_feature(OPENJPEG_FOUND "openjpeg" "Free library for JPEG 2000 image compression" "http://www.openjpeg.org" FALSE "" "Required by the Krita JPEG 2000 filter") set(LIBRAW_MIN_VERSION "0.16") macro_optional_find_package(LibRaw ${LIBRAW_MIN_VERSION}) macro_log_feature(LIBRAW_FOUND "LibRaw" "Library to decode RAW images" "http://www.libraw.org" FALSE "" "Required to build the raw import plugin") macro_optional_find_package(FFTW3) macro_log_feature(FFTW3_FOUND "FFTW3" "A fast, free C FFT library" "http://www.fftw.org/" FALSE "" "Required by the Krita for fast convolution operators and some G'Mic features") macro_bool_to_01(FFTW3_FOUND HAVE_FFTW3) macro_optional_find_package(OCIO) macro_log_feature(OCIO_FOUND "OCIO" "The OpenColorIO Library" "http://www.opencolorio.org" FALSE "" "Required by the Krita LUT docker") macro_bool_to_01(OCIO_FOUND HAVE_OCIO) ## ## Look for OpenGL ## # TODO: see if there is a better check for QtGui being built with opengl support (and thus the QOpenGL* classes) if(Qt5Gui_OPENGL_IMPLEMENTATION) message(STATUS "Found QtGui OpenGL support") else() message(FATAL_ERROR "Did NOT find QtGui OpenGL support. Check your Qt configuration. You cannot build Krita without Qt OpenGL support.") endif() ## ## Test for eigen3 ## find_package(Eigen3 REQUIRED) macro_log_feature(EIGEN3_FOUND "Eigen" "C++ template library for linear algebra" "http://eigen.tuxfamily.org" FALSE "3.0" "Required by Krita") ## ## Test for exiv2 ## set(EXIV2_MIN_VERSION "0.16") find_package(Exiv2 REQUIRED) macro_log_feature(EXIV2_FOUND "Exiv2" "Image metadata library and tools" "http://www.exiv2.org" FALSE "0.16" "Required by Krita") ## ## Test for lcms ## find_package(LCMS2 REQUIRED) macro_log_feature(LCMS2_FOUND "LittleCMS" "Color management engine" "http://www.littlecms.com" FALSE "2.4" "Will be used for color management and is necessary for Krita") if(LCMS2_FOUND) if(NOT ${LCMS2_VERSION} VERSION_LESS 2040 ) set(HAVE_LCMS24 TRUE) endif() set(HAVE_REQUIRED_LCMS_VERSION TRUE) set(HAVE_LCMS2 TRUE) endif() ## ## Test for Vc ## set(OLD_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ) set(HAVE_VC FALSE) if( NOT MSVC) macro_optional_find_package(Vc 1.1.0) macro_log_feature(Vc_FOUND "Vc" "Portable, zero-overhead SIMD library for C++" "https://github.com/VcDevel/Vc" FALSE "" "Required by the Krita for vectorization") macro_bool_to_01(Vc_FOUND HAVE_VC) macro_bool_to_01(PACKAGERS_BUILD DO_PACKAGERS_BUILD) endif() configure_file(config-vc.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-vc.h ) if(HAVE_VC) message(STATUS "Vc found!") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/vc") include (VcMacros) if(Vc_COMPILER_IS_CLANG) set(ADDITIONAL_VC_FLAGS "-Wabi -ffp-contract=fast -fPIC") elseif (NOT MSVC) set(ADDITIONAL_VC_FLAGS "-Wabi -fabi-version=0 -ffp-contract=fast -fPIC") endif() #Handle Vc master if(Vc_COMPILER_IS_GCC OR Vc_COMPILER_IS_CLANG) AddCompilerFlag("-std=c++11" _ok) if(NOT _ok) AddCompilerFlag("-std=c++0x" _ok) endif() endif() macro(ko_compile_for_all_implementations_no_scalar _objs _src) if(PACKAGERS_BUILD) vc_compile_for_all_implementations(${_objs} ${_src} FLAGS ${ADDITIONAL_VC_FLAGS} ONLY SSE2 SSSE3 SSE4_1 AVX AVX2+FMA+BMI2) else() set(${_objs} ${_src}) endif() endmacro() macro(ko_compile_for_all_implementations _objs _src) if(PACKAGERS_BUILD) vc_compile_for_all_implementations(${_objs} ${_src} FLAGS ${ADDITIONAL_VC_FLAGS} ONLY Scalar SSE2 SSSE3 SSE4_1 AVX AVX2+FMA+BMI2) else() set(${_objs} ${_src}) endif() endmacro() if (NOT PACKAGERS_BUILD) # Optimize everything for the current architecture set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Vc_DEFINITIONS}") endif () endif() set(CMAKE_MODULE_PATH ${OLD_CMAKE_MODULE_PATH} ) ## ## Test for Xinput ## if(NOT WIN32 AND NOT APPLE) set(REQUIRED_Xinput_FOUND ${X11_Xinput_FOUND}) else() set(REQUIRED_Xinput_FOUND TRUE) endif() add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS}) if(WIN32) set(LIB_INSTALL_DIR ${LIB_INSTALL_DIR} RUNTIME DESTINATION ${BIN_INSTALL_DIR} LIBRARY ${INSTALL_TARGETS_DEFAULT_ARGS} ARCHIVE ${INSTALL_TARGETS_DEFAULT_ARGS} ) endif() ## ## Test endianess ## include (TestBigEndian) test_big_endian(CMAKE_WORDS_BIGENDIAN) ## ## Test for qt-poppler ## macro_optional_find_package(Poppler) macro_log_feature( POPPLER_FOUND "Poppler-Qt5" "A PDF rendering library" "http://poppler.freedesktop.org" FALSE "" "Required by the Krita PDF filter.") ## ## Test for pthreads (for G'Mic) ## macro_optional_find_package(Threads) macro_log_feature(Threads_FOUND "PThreads" "A low-level threading library" "" FALSE "" "Optionally used by the G'Mic plugin") ## ## Test for OpenMP (for G'Mic) ## macro_optional_find_package(OpenMP) macro_log_feature(OPENMP_FOUND "OpenMP" "A low-level parallel execution library" "http://openmp.org/wp/" FALSE "" "Optionally used by the G'Mic plugin") ## ## Test for Curl (for G'Mic) ## macro_optional_find_package(CURL) macro_log_feature(CURL_FOUND "CURL" "A tool to fetch remote data" "http://curl.haxx.se/" FALSE "" "Optionally used by the G'Mic plugin") ############################ ############################# ## Add Krita helper macros ## ############################# ############################ include(MacroKritaAddBenchmark) #################### ##################### ## Define includes ## ##################### #################### # for config.h and includes (if any?) include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/interfaces ) include_directories( ${CMAKE_SOURCE_DIR}/libs/version ${CMAKE_BINARY_DIR}/libs/version ) ################################################### #################################################### ## Detect which products/features can be compiled ## #################################################### ################################################### calligra_drop_product_on_bad_condition( APP_KRITA EIGEN3_FOUND "Eigen devel not found" EXIV2_FOUND "libexiv2 devel not found" HAVE_REQUIRED_LCMS_VERSION "lcms devel not found" Boost_SYSTEM_FOUND "boost-system devel not found" REQUIRED_Xinput_FOUND "Xinput devel not found " ) ############################################# #### Backward compatibility BUILD_x=off #### ############################################# # workaround: disable directly all products which might be activated by internal # dependencies, but belong to scope of old flag calligra_drop_products_on_old_flag(krita APP_KRITA) ############################################# #### Temporarily broken products #### ############################################# # If a product does not build due to some temporary brokeness disable it here, # by calling calligra_disable_product with the product id and the reason, # e.g.: # calligra_disable_product(APP_KEXI "isn't buildable at the moment") ############################################# #### Calculate buildable products #### ############################################# calligra_drop_unbuildable_products() ################### #################### ## Subdirectories ## #################### ################### if(SHOULD_BUILD_APP_KRITA) add_subdirectory(krita) endif() # non-app directories are moved here because they can depend on SHOULD_BUILD_{appname} variables set above add_subdirectory(libs) add_subdirectory(plugins) add_subdirectory( benchmarks ) macro_display_feature_log() calligra_product_deps_report("product_deps") calligra_log_should_build() configure_file(KoConfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/KoConfig.h ) configure_file(config_convolution.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config_convolution.h) configure_file(config-ocio.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-ocio.h ) check_function_exists(powf HAVE_POWF) configure_file(config-powf.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-powf.h) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index a92a669cc3..8054c22ed2 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -1,79 +1,83 @@ set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) include_directories( ${CMAKE_SOURCE_DIR}/sdk/tests ${CMAKE_SOURCE_DIR}/libs/pigment ${CMAKE_SOURCE_DIR}/libs/pigment/compositeops ) include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ) set(LINK_VC_LIB) if(HAVE_VC) include_directories(${Vc_INCLUDE_DIR}) # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Vc_DEFINITIONS}") set(LINK_VC_LIB ${Vc_LIBRARIES}) endif() macro_add_unittest_definitions() ########### next target ############### set(kis_datamanager_benchmark_SRCS kis_datamanager_benchmark.cpp) set(kis_hiterator_benchmark_SRCS kis_hline_iterator_benchmark.cpp) set(kis_viterator_benchmark_SRCS kis_vline_iterator_benchmark.cpp) set(kis_random_iterator_benchmark_SRCS kis_random_iterator_benchmark.cpp) set(kis_projection_benchmark_SRCS kis_projection_benchmark.cpp) set(kis_bcontrast_benchmark_SRCS kis_bcontrast_benchmark.cpp) set(kis_blur_benchmark_SRCS kis_blur_benchmark.cpp) set(kis_level_filter_benchmark_SRCS kis_level_filter_benchmark.cpp) set(kis_painter_benchmark_SRCS kis_painter_benchmark.cpp) set(kis_stroke_benchmark_SRCS kis_stroke_benchmark.cpp) set(kis_fast_math_benchmark_SRCS kis_fast_math_benchmark.cpp) set(kis_floodfill_benchmark_SRCS kis_floodfill_benchmark.cpp) set(kis_gradient_benchmark_SRCS kis_gradient_benchmark.cpp) set(kis_mask_generator_benchmark_SRCS kis_mask_generator_benchmark.cpp) set(kis_low_memory_benchmark_SRCS kis_low_memory_benchmark.cpp) set(kis_filter_selections_benchmark_SRCS kis_filter_selections_benchmark.cpp) set(kis_composition_benchmark_SRCS kis_composition_benchmark.cpp) +set(kis_thumbnail_benchmark_SRCS kis_thumbnail_benchmark.cpp) krita_add_benchmark(KisDatamanagerBenchmark TESTNAME krita-benchmarks-KisDataManager ${kis_datamanager_benchmark_SRCS}) krita_add_benchmark(KisHLineIteratorBenchmark TESTNAME krita-benchmarks-KisHLineIterator ${kis_hiterator_benchmark_SRCS}) krita_add_benchmark(KisVLineIteratorBenchmark TESTNAME krita-benchmarks-KisVLineIterator ${kis_viterator_benchmark_SRCS}) krita_add_benchmark(KisRandomIteratorBenchmark TESTNAME krita-benchmarks-KisRandomIterator ${kis_random_iterator_benchmark_SRCS}) krita_add_benchmark(KisProjectionBenchmark TESTNAME krita-benchmarks-KisProjectionBenchmark ${kis_projection_benchmark_SRCS}) krita_add_benchmark(KisBContrastBenchmark TESTNAME krita-benchmarks-KisBContrastBenchmark ${kis_bcontrast_benchmark_SRCS}) krita_add_benchmark(KisBlurBenchmark TESTNAME krita-benchmarks-KisBlurBenchmark ${kis_blur_benchmark_SRCS}) krita_add_benchmark(KisLevelFilterBenchmark TESTNAME krita-benchmarks-KisLevelFilterBenchmark ${kis_level_filter_benchmark_SRCS}) krita_add_benchmark(KisPainterBenchmark TESTNAME krita-benchmarks-KisPainterBenchmark ${kis_painter_benchmark_SRCS}) krita_add_benchmark(KisStrokeBenchmark TESTNAME krita-benchmarks-KisStrokeBenchmark ${kis_stroke_benchmark_SRCS}) krita_add_benchmark(KisFastMathBenchmark TESTNAME krita-benchmarks-KisFastMath ${kis_fast_math_benchmark_SRCS}) krita_add_benchmark(KisFloodfillBenchmark TESTNAME krita-benchmarks-KisFloodFill ${kis_floodfill_benchmark_SRCS}) krita_add_benchmark(KisGradientBenchmark TESTNAME krita-benchmarks-KisGradientFill ${kis_gradient_benchmark_SRCS}) krita_add_benchmark(KisMaskGeneratorBenchmark TESTNAME krita-benchmarks-KisMaskGenerator ${kis_mask_generator_benchmark_SRCS}) krita_add_benchmark(KisLowMemoryBenchmark TESTNAME krita-benchmarks-KisLowMemory ${kis_low_memory_benchmark_SRCS}) krita_add_benchmark(KisFilterSelectionsBenchmark TESTNAME krita-image-KisFilterSelectionsBenchmark ${kis_filter_selections_benchmark_SRCS}) krita_add_benchmark(KisCompositionBenchmark TESTNAME krita-benchmarks-KisComposition ${kis_composition_benchmark_SRCS}) +krita_add_benchmark(KisThumbnailBenchmark TESTNAME krita-benchmarks-KisThumbnail ${kis_thumbnail_benchmark_SRCS}) target_link_libraries(KisDatamanagerBenchmark kritaimage Qt5::Test) target_link_libraries(KisHLineIteratorBenchmark kritaimage Qt5::Test) target_link_libraries(KisVLineIteratorBenchmark kritaimage Qt5::Test) target_link_libraries(KisRandomIteratorBenchmark kritaimage Qt5::Test) target_link_libraries(KisProjectionBenchmark kritaimage kritaui Qt5::Test) target_link_libraries(KisBContrastBenchmark kritaimage Qt5::Test) target_link_libraries(KisBlurBenchmark kritaimage Qt5::Test) target_link_libraries(KisLevelFilterBenchmark kritaimage Qt5::Test) target_link_libraries(KisPainterBenchmark kritaimage Qt5::Test) target_link_libraries(KisStrokeBenchmark kritaimage Qt5::Test) target_link_libraries(KisFastMathBenchmark kritaimage Qt5::Test) target_link_libraries(KisFloodfillBenchmark kritaimage Qt5::Test) target_link_libraries(KisGradientBenchmark kritaimage Qt5::Test) target_link_libraries(KisLowMemoryBenchmark kritaimage Qt5::Test) target_link_libraries(KisFilterSelectionsBenchmark kritaimage Qt5::Test) target_link_libraries(KisCompositionBenchmark kritaimage Qt5::Test ${LINK_VC_LIB}) if(HAVE_VC) set_property(TARGET KisCompositionBenchmark APPEND PROPERTY COMPILE_OPTIONS "${Vc_ARCHITECTURE_FLAGS}") endif() target_link_libraries(KisMaskGeneratorBenchmark kritaimage Qt5::Test) +target_link_libraries(KisThumbnailBenchmark kritaimage Qt5::Test) + diff --git a/benchmarks/kis_thumbnail_benchmark.cpp b/benchmarks/kis_thumbnail_benchmark.cpp new file mode 100644 index 0000000000..99a080584f --- /dev/null +++ b/benchmarks/kis_thumbnail_benchmark.cpp @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2016 Eugene Ingerman geneing at gmail dot com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "kis_thumbnail_benchmark.h" +#include "kis_benchmark_values.h" + +#include +#include +#include "kis_iterator_ng.h" + +#include "kis_paint_device.h" +#include "KoColorSpace.h" +#include "KoColorSpaceRegistry.h" +#include "KoCompositeOpRegistry.h" +#include "KoColor.h" + +#include "kis_image.h" +#include "kis_painter.h" +#include "kis_types.h" +#include "kis_sequential_iterator.h" +#include "kis_transform_worker.h" + + + +#include + +#define SAVE_OUTPUT + +const int THUMBNAIL_WIDTH = 64; +const int THUMBNAIL_HEIGHT = 64; +const int IMAGE_WIDTH = 8000; +const int IMAGE_HEIGHT = 6000; +const int OVERSAMPLE = 4; + +void KisThumbnailBenchmark::initTestCase() +{ + m_colorSpace = KoColorSpaceRegistry::instance()->rgb8(); + + m_dev = new KisPaintDevice(m_colorSpace); + KoColor color(m_colorSpace); + color.fromQColor(Qt::white); + + m_dev->clear(); + m_dev->fill(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, color.data()); + + color.fromQColor(Qt::black); + + KisPainter painter(m_dev); + painter.setPaintColor(color); + float radius = std::min(IMAGE_WIDTH, IMAGE_HEIGHT); + const float angle = 2 * 3.1415926 / 360.; + const float endWidth = 30; + + for (float i = 0; i < 90; i += 5) { + painter.drawThickLine(QPointF(0, 0), QPointF(radius * std::sin(angle * i), radius * std::cos(angle * i)), 1, endWidth); + painter.drawThickLine(QPointF(IMAGE_WIDTH, IMAGE_HEIGHT), + QPointF(IMAGE_WIDTH - radius * std::sin(angle * i), IMAGE_HEIGHT - radius * std::cos(angle * i)), 1, endWidth); + } +#ifdef SAVE_OUTPUT + m_dev->convertToQImage(m_colorSpace->profile()).save("ThumbFullImage.png"); +#endif +} + +void KisThumbnailBenchmark::cleanupTestCase() +{ +} + +void KisThumbnailBenchmark::benchmarkCreateThumbnail() +{ + QImage image; + + QBENCHMARK{ + image = m_dev->createThumbnail(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, QRect() ); + //m_dev->setDirty(); + } + + image.save("createThumbnail.png"); +} + +void KisThumbnailBenchmark::benchmarkCreateThumbnailCached() +{ + QImage image; + + QBENCHMARK{ + image = m_dev->createThumbnail(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, 2. ); + } +} + + +void KisThumbnailBenchmark::benchmarkCreateThumbnailHiQ() +{ + QImage image; + + QBENCHMARK{ + image = m_dev->createThumbnail(OVERSAMPLE * THUMBNAIL_WIDTH, OVERSAMPLE * THUMBNAIL_HEIGHT); + image = image.scaled(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, Qt::KeepAspectRatio, Qt::SmoothTransformation); + m_dev->setDirty(); + } + + image.save("createThumbnailHiQ.png"); +} + +void KisThumbnailBenchmark::benchmarkCreateThumbnailHiQcreateThumbOversample2x() +{ + QImage image; + + QBENCHMARK{ + image = m_dev->createThumbnail(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, QRect(), 2, + KoColorConversionTransformation::internalRenderingIntent(), + KoColorConversionTransformation::internalConversionFlags()); + m_dev->setDirty(); + } + + image.save("createThumbnailHiQcreateThumbOversample2x.png"); +} + +void KisThumbnailBenchmark::benchmarkCreateThumbnailHiQcreateThumbOversample3x() +{ + QImage image; + + QBENCHMARK{ + image = m_dev->createThumbnail(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, QRect(), 3, + KoColorConversionTransformation::internalRenderingIntent(), + KoColorConversionTransformation::internalConversionFlags()); + m_dev->setDirty(); + } + + image.save("createThumbnailHiQcreateThumbOversample3x.png"); +} + +void KisThumbnailBenchmark::benchmarkCreateThumbnailHiQcreateThumbOversample4x() +{ + QImage image; + + QBENCHMARK{ + image = m_dev->createThumbnail(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, QRect(), 4, + KoColorConversionTransformation::internalRenderingIntent(), + KoColorConversionTransformation::internalConversionFlags()); + m_dev->setDirty(); + } + + image.save("createThumbnailHiQcreateThumbOversample4x.png"); +} + + +QTEST_MAIN(KisThumbnailBenchmark) diff --git a/benchmarks/kis_thumbnail_benchmark.h b/benchmarks/kis_thumbnail_benchmark.h new file mode 100644 index 0000000000..bde2f38591 --- /dev/null +++ b/benchmarks/kis_thumbnail_benchmark.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 Eugene Ingerman geneing at gmail dot com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef KIS_THUMBNAIL_BENCHMARK_H +#define KIS_THUMBNAIL_BENCHMARK_H + +#include +#include "kis_paint_device.h" + +class KoColor; +class KoColorSpace; + +class KisThumbnailBenchmark : public QObject +{ + Q_OBJECT + +private: + const KoColorSpace * m_colorSpace; + KisPaintDeviceSP m_dev; + QVector m_thumbnails; + QSize m_thumbnailSizeLimit; + int m_oversampleRatio; + int m_skipCount; + +private Q_SLOTS: + void initTestCase(); + void cleanupTestCase(); + + void benchmarkCreateThumbnail(); + void benchmarkCreateThumbnailCached(); + void benchmarkCreateThumbnailHiQ(); + + void benchmarkCreateThumbnailHiQcreateThumbOversample2x(); + void benchmarkCreateThumbnailHiQcreateThumbOversample3x(); + void benchmarkCreateThumbnailHiQcreateThumbOversample4x(); + +}; + + +#endif diff --git a/cmake/modules/FindOpenJPEG.cmake b/cmake/modules/FindOpenJPEG.cmake deleted file mode 100644 index ae859572e9..0000000000 --- a/cmake/modules/FindOpenJPEG.cmake +++ /dev/null @@ -1,56 +0,0 @@ -# -*- cmake -*- - -# - Find OpenJPEG -# Find the OpenJPEG includes and library -# This module defines -# OPENJPEG_INCLUDE_DIR, where to find openjpeg.h, etc. -# OPENJPEG_LIBRARIES, the libraries needed to use OpenJPEG. -# OPENJPEG_FOUND, If false, do not try to use OpenJPEG. -# also defined, but not for general use are -# OPENJPEG_LIBRARY, where to find the OpenJPEG library. - -find_path(OPENJPEG_INCLUDE_DIR openjpeg.h -PATHS - /usr/local/include/openjpeg - /usr/local/include - /usr/include/openjpeg - /usr/include/openjpeg-1.5 - /usr/include -PATH_SUFFIXES - openjpeg-1.5 - openjpeg -) - -set(OPENJPEG_NAMES ${OPENJPEG_NAMES} openjpeg) -find_library(OPENJPEG_LIBRARY - NAMES ${OPENJPEG_NAMES} - PATHS - /usr/lib /usr/local/lib -) - -if (OPENJPEG_LIBRARY AND OPENJPEG_INCLUDE_DIR) - set(OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARY}) - set(OPENJPEG_FOUND "YES") -else () - set(OPENJPEG_FOUND "NO") -endif () - - -if (OPENJPEG_FOUND) - if (NOT OPENJPEG_FIND_QUIETLY) - message(STATUS "Found OpenJPEG: ${OPENJPEG_LIBRARIES}") - endif () -else () - if (OPENJPEG_FIND_REQUIRED) - message(FATAL_ERROR "Could not find OpenJPEG library") - endif () -endif () - -# Deprecated declarations. -set (NATIVE_OPENJPEG_INCLUDE_PATH ${OPENJPEG_INCLUDE_DIR} ) -get_filename_component (NATIVE_OPENJPEG_LIB_PATH ${OPENJPEG_LIBRARY} PATH) - -mark_as_advanced( - OPENJPEG_LIBRARY - OPENJPEG_INCLUDE_DIR - ) diff --git a/krita/data/input/kritadefault.profile b/krita/data/input/kritadefault.profile index 2650ccaf0d..a1ce565a5d 100644 --- a/krita/data/input/kritadefault.profile +++ b/krita/data/input/kritadefault.profile @@ -1,66 +1,67 @@ [Alternate Invocation] 0={1;2;[1000023,1000020];1;0;0} 1={0;2;[1000021,1000020];1;0;0} 2={5;2;[1000021];2;0;0} 3={3;2;[1000021,1000023];2;0;0} 4={2;2;[1000023,1000021];1;0;0} 5={4;2;[1000021];1;0;0} [Change Primary Setting] 0={0;2;[1000020];1;0;0} [Exposure or Gamma] 0={0;2;[59];1;0;0} [General] name=Krita Default version=3 [Pan Canvas] 0={0;4;[];0;0;2} 1={0;2;[20];1;0;0} 2={0;2;[];4;0;0} 3={1;1;[];0;0;0} 4={2;1;[];0;0;0} 5={3;1;[];0;0;0} 6={4;1;[];0;0;0} [Rotate Canvas] 0={0;2;[1000020,20];1;0;0} 1={1;2;[1000020,1000023,20];1;0;0} 2={0;2;[1000020];4;0;0} 3={2;1;[34];0;0;0} 4={4;1;[35];0;0;0} 5={3;1;[36];0;0;0} [Select Layer] 0={1;2;[1000020,52];1;0;0} 1={0;2;[52];1;0;0} [Show Popup Palette] 0={0;2;[];2;0;0} [Switch Time] 0={0;1;[1000014];0;0;0} 1={1;1;[1000012];0;0;0} [Tool Invocation] 0={3;2;[56];1;0;0} 1={1;1;[1000005];0;0;0} 2={0;2;[];1;0;0} 3={1;1;[1000004];0;0;0} 4={2;1;[1000000];0;0;0} [Zoom Canvas] -0={0;4;[];0;0;1} -1={0;2;[1000021,20];1;0;0} -10={1;2;[1000021,1000023,20];1;0;0} -11={6;1;[33];0;0;0} -2={0;2;[1000021];4;0;0} -3={2;3;[];0;1;0} +0={2;1;[2b];0;0;0} +1={4;1;[31];0;0;0} +10={5;1;[32];0;0;0} +11={0;4;[];0;0;1} +12={8;2;[1000021,1000023];4;0;0} +2={3;1;[2d];0;0;0} +3={2;1;[3d];0;0;0} 4={3;3;[];0;2;0} -5={2;1;[3d];0;0;0} -6={3;1;[2d];0;0;0} -7={4;1;[31];0;0;0} -8={2;1;[2b];0;0;0} -9={5;1;[32];0;0;0} +5={2;3;[];0;1;0} +6={7;2;[1000021];4;0;0} +7={7;2;[1000021,20];1;0;0} +8={6;1;[33];0;0;0} +9={8;2;[1000021,1000023,20];1;0;0} diff --git a/krita/data/templates/animation/Anim-Jp-EN.desktop b/krita/data/templates/animation/Anim-Jp-EN.desktop index 93e3c95708..214850c305 100644 --- a/krita/data/templates/animation/Anim-Jp-EN.desktop +++ b/krita/data/templates/animation/Anim-Jp-EN.desktop @@ -1,17 +1,19 @@ [Desktop Entry] Type=Link URL=.source/Anim-Jp-EN.kra Icon=template_animation Name=Animation-Japanese-En Name[ca]=Animació-Japonès-EN Name[ca@valencia]=Animació-Japonés-EN Name[de]=Animation-Japanisch-En Name[en_GB]=Animation-Japanese-En Name[es]=Animación-Japonés-En +Name[et]=Animation-Japanese-En Name[it]=Animazione-Giapponese-EN Name[nl]=Animatie-Japans-En Name[pl]=Animacja-Japońska-En Name[pt]=Animação-Japonês-EN +Name[sk]=Animation-Japanese-En Name[sv]=Animering-japanska-en Name[uk]=Японська анімація (англійською) Name[x-test]=xxAnimation-Japanese-Enxx diff --git a/krita/data/templates/animation/Anim-Jp-JP.desktop b/krita/data/templates/animation/Anim-Jp-JP.desktop index 731c262b6b..e3b694daf8 100644 --- a/krita/data/templates/animation/Anim-Jp-JP.desktop +++ b/krita/data/templates/animation/Anim-Jp-JP.desktop @@ -1,17 +1,19 @@ [Desktop Entry] Type=Link URL=.source/Anim-Jp-JP.kra Icon=template_animation Name=Animation-Japanese-JP Name[ca]=Animació-Japonès-JP Name[ca@valencia]=Animació-Japonés-JP Name[de]=Animation-Japanisch-JP Name[en_GB]=Animation-Japanese-JP Name[es]=Animación-Japonés-JP +Name[et]=Animation-Japanese-JP Name[it]=Animazione-Giapponese-JP Name[nl]=Animatie-Japans-JP Name[pl]=Animacja-Japońska-JP Name[pt]=Animação-Japonês-JP +Name[sk]=Animation-Japanese-JP Name[sv]=Animering-japanska-jp Name[uk]=Японська анімація (японською) Name[x-test]=xxAnimation-Japanese-JPxx diff --git a/krita/main.cc b/krita/main.cc index 9b914b22e1..00b23e3238 100644 --- a/krita/main.cc +++ b/krita/main.cc @@ -1,234 +1,235 @@ /* * Copyright (c) 1999 Matthias Elter * Copyright (c) 2002 Patrick Julien * Copyright (c) 2015 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "data/splash/splash_screen.xpm" #include "data/splash/splash_holidays.xpm" #include "KisDocument.h" #include "kis_splash_screen.h" #include "KisPart.h" #include "KisApplicationArguments.h" #if defined Q_OS_WIN #include #include #include #elif defined HAVE_X11 #include #include #endif #if defined HAVE_KCRASH #include #elif defined USE_BREAKPAD #include "kis_crash_handler.h" #endif extern "C" int main(int argc, char **argv) { /** * Add a workaround for Qt 5.6, which implemented compression of the tablet events. * Since Qt 5.6.1 there will be this hacky environment variable option. After that, * Qt developers promised to give us better control for that. Please make sure the env * variable is set *before* the construction of QApplication! */ #if defined Q_OS_LINUX && QT_VERSION >= 0x050600 qputenv("QT_XCB_NO_EVENT_COMPRESSION", "1"); #endif bool runningInKDE = !qgetenv("KDE_FULL_SESSION").isEmpty(); /** * Disable debug output by default. (krita.input enables tablet debugging.) * Debug logs can be controlled by an environment variable QT_LOGGING_RULES. * * As an example, to get full debug output, run the following: * export QT_LOGGING_RULES="krita*=true"; krita * * See: http://doc.qt.io/qt-5/qloggingcategory.html */ QLoggingCategory::setFilterRules("krita*.debug=false\n" "krita*.warning=true\n" "krita.tabletlog=true"); // A per-user unique string, without /, because QLocalServer cannot use names with a / in it QString key = "Krita3" + QDesktopServices::storageLocation(QDesktopServices::HomeLocation).replace("/", "_"); key = key.replace(":", "_").replace("\\","_"); QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true); QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true); QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); #if QT_VERSION >= 0x050600 if (!qgetenv("KRITA_HIDPI").isEmpty()) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); } #endif KLocalizedString::setApplicationDomain("krita"); // first create the application so we can create a pixmap KisApplication app(key, argc, argv); #ifdef Q_OS_LINUX qputenv("XDG_DATA_DIRS", QFile::encodeName(KoResourcePaths::getApplicationRoot() + "share") + ":" + qgetenv("XDG_DATA_DIRS")); #else qputenv("XDG_DATA_DIRS", QFile::encodeName(KoResourcePaths::getApplicationRoot() + "share")); #endif qDebug() << "Setting XDG_DATA_DIRS" << qgetenv("XDG_DATA_DIRS"); qDebug() << "Available translations" << KLocalizedString::availableApplicationTranslations(); qDebug() << "Available domain translations" << KLocalizedString::availableDomainTranslations("krita"); // Now that the paths are set, set the language. First check the override from the langage // selection dialog. KLocalizedString::clearLanguages(); const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); QSettings languageoverride(configPath + QStringLiteral("/klanguageoverridesrc"), QSettings::IniFormat); languageoverride.beginGroup(QStringLiteral("Language")); QString language = languageoverride.value(qAppName(), "").toString(); qDebug() << "Override language:" << language; if (!language.isEmpty()) { KLocalizedString::setLanguages(language.split(":")); // And override Qt's locale, too qputenv("LANG", language.toLatin1()); QLocale locale(language.split(":").first()); QLocale::setDefault(locale); qDebug() << "Qt ui languages" << locale.uiLanguages(); } else { // And if there isn't one, check the one set by the system. // XXX: This doesn't work, for some !@#$% reason. QLocale locale = QLocale::system(); if (locale.bcp47Name() != QStringLiteral("en")) { KLocalizedString::setLanguages(QStringList() << locale.bcp47Name()); } } #ifdef Q_OS_WIN QDir appdir(KoResourcePaths::getApplicationRoot()); + QString path = qgetenv("PATH"); qputenv("PATH", QFile::encodeName(appdir.absolutePath() + "/bin" + ";" + appdir.absolutePath() + "/lib" + ";" - + appdir.absolutePath() + "/lib/kde4" + ";" + appdir.absolutePath() + "/Frameworks" + ";" - + appdir.absolutePath())); + + appdir.absolutePath() + ";" + + path)); qDebug() << "PATH" << qgetenv("PATH"); #endif if (qApp->applicationDirPath().contains(KRITA_BUILD_DIR)) { qFatal("FATAL: You're trying to run krita from the build location. You can only run Krita from the installation location."); } #if defined HAVE_KCRASH KCrash::initialize(); #elif defined USE_BREAKPAD qputenv("KDE_DEBUG", "1"); KisCrashHandler crashHandler; Q_UNUSED(crashHandler); #endif // If we should clear the config, it has to be done as soon as possible after // KisApplication has been created. Otherwise the config file may have been read // and stored in a KConfig object we have no control over. app.askClearConfig(); KisApplicationArguments args(app); if (app.isRunning()) { // only pass arguments to main instance if they are not for batch processing // any batch processing would be done in this separate instance const bool batchRun = (args.print() || args.exportAs() || args.exportAsPdf()); if (!batchRun) { QByteArray ba = args.serialize(); if (app.sendMessage(ba)) { return 0; } } } if (!runningInKDE) { // Icons in menus are ugly and distracting app.setAttribute(Qt::AA_DontShowIconsInMenus); } #if defined HAVE_X11 app.installNativeEventFilter(KisXi2EventFilter::instance()); #endif // then create the pixmap from an xpm: we cannot get the // location of our datadir before we've started our components, // so use an xpm. QDate currentDate = QDate::currentDate(); QWidget *splash = 0; if (currentDate > QDate(currentDate.year(), 12, 4) || currentDate < QDate(currentDate.year(), 1, 9)) { splash = new KisSplashScreen(app.applicationVersion(), QPixmap(splash_holidays_xpm)); } else { splash = new KisSplashScreen(app.applicationVersion(), QPixmap(splash_screen_xpm)); } app.setSplashScreen(splash); #if defined Q_OS_WIN KisTabletSupportWin::init(); // app.installNativeEventFilter(new KisTabletSupportWin()); #endif if (!app.start(args)) { return 1; } // Set up remote arguments. QObject::connect(&app, SIGNAL(messageReceived(QByteArray,QObject*)), &app, SLOT(remoteArguments(QByteArray,QObject*))); QObject::connect(&app, SIGNAL(fileOpenRequest(QString)), &app, SLOT(fileOpenRequested(QString))); int state = app.exec(); return state; } diff --git a/libs/basicflakes/tools/KoCreatePathTool.cpp b/libs/basicflakes/tools/KoCreatePathTool.cpp index f17cc2c1b9..c0355d2ecf 100644 --- a/libs/basicflakes/tools/KoCreatePathTool.cpp +++ b/libs/basicflakes/tools/KoCreatePathTool.cpp @@ -1,532 +1,533 @@ /* This file is part of the KDE project * * Copyright (C) 2006 Thorsten Zachmann * Copyright (C) 2008-2010 Jan Hambrecht * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "KoCreatePathTool.h" #include "KoCreatePathTool_p.h" #include "KoPointerEvent.h" #include "KoPathShape.h" #include "KoSelection.h" #include "KoDocumentResourceManager.h" #include "KoShapePaintingContext.h" #include "KoShapeStroke.h" #include "KoStrokeConfigWidget.h" #include "KoCanvasBase.h" +#include "kis_int_parse_spin_box.h" #include #include #include #include #include #include #include KoCreatePathTool::KoCreatePathTool(KoCanvasBase *canvas) : KoToolBase(*(new KoCreatePathToolPrivate(this, canvas))) { } KoCreatePathTool::~KoCreatePathTool() { } void KoCreatePathTool::paint(QPainter &painter, const KoViewConverter &converter) { Q_D(KoCreatePathTool); if (pathStarted()) { KoShapeStroke *stroke(createStroke()); if (stroke) { d->shape->setStroke(stroke); } painter.save(); paintPath(*(d->shape), painter, converter); painter.restore(); painter.save(); painter.setTransform(d->shape->absoluteTransformation(&converter) * painter.transform()); KoShape::applyConversion(painter, converter); QPen pen(QBrush(Qt::blue), 1); pen.setCosmetic(true); painter.setPen(pen); painter.setBrush(Qt::white); const bool firstPoint = (d->firstPoint == d->activePoint); if (d->pointIsDragged || firstPoint) { const bool onlyPaintActivePoints = false; KoPathPoint::PointTypes paintFlags = KoPathPoint::ControlPoint2; if (d->activePoint->activeControlPoint1()) { paintFlags |= KoPathPoint::ControlPoint1; } d->activePoint->paint(painter, d->handleRadius, paintFlags, onlyPaintActivePoints); } // check if we have to color the first point if (d->mouseOverFirstPoint) { painter.setBrush(Qt::red); } else { painter.setBrush(Qt::white); } d->firstPoint->paint(painter, d->handleRadius, KoPathPoint::Node); painter.restore(); } if (d->hoveredPoint) { painter.save(); painter.setTransform(d->hoveredPoint->parent()->absoluteTransformation(&converter), true); KoShape::applyConversion(painter, converter); QPen pen(QBrush(Qt::blue), 1); pen.setCosmetic(true); painter.setPen(pen); painter.setBrush(Qt::white); d->hoveredPoint->paint(painter, d->handleRadius, KoPathPoint::Node); painter.restore(); } painter.save(); KoShape::applyConversion(painter, converter); canvas()->snapGuide()->paint(painter, converter); painter.restore(); } void KoCreatePathTool::paintPath(KoPathShape& pathShape, QPainter &painter, const KoViewConverter &converter) { Q_D(KoCreatePathTool); painter.setTransform(pathShape.absoluteTransformation(&converter) * painter.transform()); painter.save(); KoShapePaintingContext paintContext; //FIXME pathShape.paint(painter, converter, paintContext); painter.restore(); if (pathShape.stroke()) { painter.save(); pathShape.stroke()->paint(d->shape, painter, converter); painter.restore(); } } void KoCreatePathTool::mousePressEvent(KoPointerEvent *event) { Q_D(KoCreatePathTool); //Right click removes last point if (event->button() == Qt::RightButton) { removeLastPoint(); return; } const bool isOverFirstPoint = d->shape && handleGrabRect(d->firstPoint->point()).contains(event->point); bool haveCloseModifier = (listeningToModifiers() && (event->modifiers() & Qt::ShiftModifier)); if ((event->button() == Qt::LeftButton) && haveCloseModifier && !isOverFirstPoint) { endPathWithoutLastPoint(); return; } d->finishAfterThisPoint = false; if (pathStarted()) { if (isOverFirstPoint) { d->activePoint->setPoint(d->firstPoint->point()); canvas()->updateCanvas(d->shape->boundingRect()); canvas()->updateCanvas(canvas()->snapGuide()->boundingRect()); if (haveCloseModifier) { d->shape->closeMerge(); // we are closing the path, so reset the existing start path point d->existingStartPoint = 0; // finish path endPath(); } else { // the path shape will get closed when the user releases // the mouse button d->finishAfterThisPoint = true; } } else { canvas()->updateCanvas(canvas()->snapGuide()->boundingRect()); QPointF point = canvas()->snapGuide()->snap(event->point, event->modifiers()); // check whether we hit an start/end node of an existing path d->existingEndPoint = d->endPointAtPosition(point); if (d->existingEndPoint.isValid() && d->existingEndPoint != d->existingStartPoint) { point = d->existingEndPoint.path->shapeToDocument(d->existingEndPoint.point->point()); d->activePoint->setPoint(point); // finish path endPath(); } else { d->activePoint->setPoint(point); canvas()->updateCanvas(d->shape->boundingRect()); canvas()->updateCanvas(canvas()->snapGuide()->boundingRect()); } } } else { KoPathShape *pathShape = new KoPathShape(); d->shape = pathShape; pathShape->setShapeId(KoPathShapeId); KoShapeStroke *stroke = new KoShapeStroke(canvas()->resourceManager()->activeStroke()); stroke->setColor(canvas()->resourceManager()->foregroundColor().toQColor()); pathShape->setStroke(stroke); canvas()->updateCanvas(canvas()->snapGuide()->boundingRect()); QPointF point = canvas()->snapGuide()->snap(event->point, event->modifiers()); // check whether we hit an start/end node of an existing path d->existingStartPoint = d->endPointAtPosition(point); if (d->existingStartPoint.isValid()) { point = d->existingStartPoint.path->shapeToDocument(d->existingStartPoint.point->point()); } d->activePoint = pathShape->moveTo(point); d->firstPoint = d->activePoint; canvas()->updateCanvas(handlePaintRect(point)); canvas()->updateCanvas(canvas()->snapGuide()->boundingRect()); canvas()->snapGuide()->setEditedShape(pathShape); d->angleSnapStrategy = new AngleSnapStrategy(d->angleSnappingDelta, d->angleSnapStatus); canvas()->snapGuide()->addCustomSnapStrategy(d->angleSnapStrategy); } if (d->angleSnapStrategy) d->angleSnapStrategy->setStartPoint(d->activePoint->point()); } bool KoCreatePathTool::listeningToModifiers() { Q_D(KoCreatePathTool); return d->listeningToModifiers; } bool KoCreatePathTool::pathStarted() { Q_D(KoCreatePathTool); return ((bool) d->shape); } void KoCreatePathTool::mouseDoubleClickEvent(KoPointerEvent *event) { //remove handle canvas()->updateCanvas(handlePaintRect(event->point)); endPathWithoutLastPoint(); } void KoCreatePathTool::mouseMoveEvent(KoPointerEvent *event) { Q_D(KoCreatePathTool); KoPathPoint *endPoint = d->endPointAtPosition(event->point); if (d->hoveredPoint != endPoint) { if (d->hoveredPoint) { QPointF nodePos = d->hoveredPoint->parent()->shapeToDocument(d->hoveredPoint->point()); canvas()->updateCanvas(handlePaintRect(nodePos)); } d->hoveredPoint = endPoint; if (d->hoveredPoint) { QPointF nodePos = d->hoveredPoint->parent()->shapeToDocument(d->hoveredPoint->point()); canvas()->updateCanvas(handlePaintRect(nodePos)); } } if (!pathStarted()) { canvas()->updateCanvas(canvas()->snapGuide()->boundingRect()); canvas()->snapGuide()->snap(event->point, event->modifiers()); canvas()->updateCanvas(canvas()->snapGuide()->boundingRect()); d->mouseOverFirstPoint = false; return; } d->mouseOverFirstPoint = handleGrabRect(d->firstPoint->point()).contains(event->point); canvas()->updateCanvas(d->shape->boundingRect()); canvas()->updateCanvas(canvas()->snapGuide()->boundingRect()); QPointF snappedPosition = canvas()->snapGuide()->snap(event->point, event->modifiers()); d->repaintActivePoint(); if (event->buttons() & Qt::LeftButton) { d->pointIsDragged = true; QPointF offset = snappedPosition - d->activePoint->point(); d->activePoint->setControlPoint2(d->activePoint->point() + offset); // pressing stops controls points moving symmetrically if ((event->modifiers() & Qt::AltModifier) == 0) { d->activePoint->setControlPoint1(d->activePoint->point() - offset); } d->repaintActivePoint(); } else { d->activePoint->setPoint(snappedPosition); } canvas()->updateCanvas(d->shape->boundingRect()); canvas()->updateCanvas(canvas()->snapGuide()->boundingRect()); } void KoCreatePathTool::mouseReleaseEvent(KoPointerEvent *event) { Q_D(KoCreatePathTool); if (! d->shape || (event->buttons() & Qt::RightButton)) return; d->listeningToModifiers = true; // After the first press-and-release d->repaintActivePoint(); d->pointIsDragged = false; KoPathPoint *lastActivePoint = d->activePoint; if (!d->finishAfterThisPoint) { d->activePoint = d->shape->lineTo(event->point); canvas()->snapGuide()->setIgnoredPathPoints((QList() << d->activePoint)); } // apply symmetric point property if applicable if (lastActivePoint->activeControlPoint1() && lastActivePoint->activeControlPoint2()) { QPointF diff1 = lastActivePoint->point() - lastActivePoint->controlPoint1(); QPointF diff2 = lastActivePoint->controlPoint2() - lastActivePoint->point(); if (qFuzzyCompare(diff1.x(), diff2.x()) && qFuzzyCompare(diff1.y(), diff2.y())) lastActivePoint->setProperty(KoPathPoint::IsSymmetric); } if (d->finishAfterThisPoint) { d->firstPoint->setControlPoint1(d->activePoint->controlPoint1()); delete d->shape->removePoint(d->shape->pathPointIndex(d->activePoint)); d->activePoint = d->firstPoint; d->shape->closeMerge(); // we are closing the path, so reset the existing start path point d->existingStartPoint = 0; // finish path endPath(); } if (d->angleSnapStrategy && lastActivePoint->activeControlPoint2()) { d->angleSnapStrategy->deactivate(); } } void KoCreatePathTool::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Escape) { emit done(); } else { event->ignore(); } } void KoCreatePathTool::endPath() { Q_D(KoCreatePathTool); d->addPathShape(); } void KoCreatePathTool::endPathWithoutLastPoint() { Q_D(KoCreatePathTool); if (d->shape) { QRectF dirtyRect = d->shape->boundingRect(); delete d->shape->removePoint(d->shape->pathPointIndex(d->activePoint)); canvas()->updateCanvas(dirtyRect); d->addPathShape(); } } void KoCreatePathTool::cancelPath() { Q_D(KoCreatePathTool); if (d->shape) { canvas()->updateCanvas(handlePaintRect(d->firstPoint->point())); canvas()->updateCanvas(d->shape->boundingRect()); d->firstPoint = 0; d->activePoint = 0; } d->cleanUp(); } void KoCreatePathTool::removeLastPoint() { Q_D(KoCreatePathTool); if ((d->shape)) { KoPathPointIndex lastPointIndex = d->shape->pathPointIndex(d->activePoint); if (lastPointIndex.second > 1) { lastPointIndex.second--; delete d->shape->removePoint(lastPointIndex); d->hoveredPoint = 0; d->repaintActivePoint(); canvas()->updateCanvas(d->shape->boundingRect()); } } } void KoCreatePathTool::activate(ToolActivation, const QSet &) { Q_D(KoCreatePathTool); useCursor(Qt::ArrowCursor); // retrieve the actual global handle radius d->handleRadius = handleRadius(); // reset snap guide canvas()->updateCanvas(canvas()->snapGuide()->boundingRect()); canvas()->snapGuide()->reset(); } void KoCreatePathTool::deactivate() { cancelPath(); } void KoCreatePathTool::documentResourceChanged(int key, const QVariant & res) { Q_D(KoCreatePathTool); switch (key) { case KoDocumentResourceManager::HandleRadius: { d->handleRadius = res.toUInt(); } break; default: return; } } void KoCreatePathTool::addPathShape(KoPathShape *pathShape) { Q_D(KoCreatePathTool); KoPathShape *startShape = 0; KoPathShape *endShape = 0; pathShape->normalize(); // check if existing start/end points are still valid d->existingStartPoint.validate(canvas()); d->existingEndPoint.validate(canvas()); pathShape->setStroke(createStroke()); if (d->connectPaths(pathShape, d->existingStartPoint, d->existingEndPoint)) { if (d->existingStartPoint.isValid()) { startShape = d->existingStartPoint.path; } if (d->existingEndPoint.isValid() && d->existingEndPoint != d->existingStartPoint) { endShape = d->existingEndPoint.path; } } KUndo2Command *cmd = canvas()->shapeController()->addShape(pathShape); if (cmd) { KoSelection *selection = canvas()->shapeManager()->selection(); selection->deselectAll(); selection->select(pathShape); if (startShape) { canvas()->shapeController()->removeShape(startShape, cmd); } if (endShape && startShape != endShape) { canvas()->shapeController()->removeShape(endShape, cmd); } canvas()->addCommand(cmd); } else { canvas()->updateCanvas(pathShape->boundingRect()); delete pathShape; } } QList > KoCreatePathTool::createOptionWidgets() { Q_D(KoCreatePathTool); QList > list; QWidget *angleWidget = new QWidget(); angleWidget->setObjectName("Angle Constraints"); QGridLayout *layout = new QGridLayout(angleWidget); layout->addWidget(new QLabel(i18n("Angle snapping delta:"), angleWidget), 0, 0); - QSpinBox *angleEdit = new QSpinBox(angleWidget); + QSpinBox *angleEdit = new KisIntParseSpinBox(angleWidget); angleEdit->setValue(d->angleSnappingDelta); angleEdit->setRange(1, 360); angleEdit->setSingleStep(1); angleEdit->setSuffix(QChar(Qt::Key_degree)); layout->addWidget(angleEdit, 0, 1); layout->addWidget(new QLabel(i18n("Activate angle snap:"), angleWidget), 1, 0); QCheckBox *angleSnap = new QCheckBox(angleWidget); angleSnap->setChecked(false); angleSnap->setCheckable(true); layout->addWidget(angleSnap, 1, 1); QWidget *specialSpacer = new QWidget(); specialSpacer->setObjectName("SpecialSpacer"); layout->addWidget(specialSpacer, 2, 1); angleWidget->setWindowTitle(i18n("Angle Constraints")); list.append(angleWidget); d->strokeWidget = new KoStrokeConfigWidget(0); d->strokeWidget->setWindowTitle(i18n("Line")); d->strokeWidget->setCanvas(canvas()); d->strokeWidget->setActive(false); list.append(d->strokeWidget); connect(angleEdit, SIGNAL(valueChanged(int)), this, SLOT(angleDeltaChanged(int))); connect(angleSnap, SIGNAL(stateChanged(int)), this, SLOT(angleSnapChanged(int))); return list; } KoShapeStroke *KoCreatePathTool::createStroke() { Q_D(KoCreatePathTool); KoShapeStroke *stroke = 0; if (d->strokeWidget) { stroke = d->strokeWidget->createShapeStroke(); } return stroke; } //have to include this because of Q_PRIVATE_SLOT #include diff --git a/libs/basicflakes/tools/KoPencilTool.cpp b/libs/basicflakes/tools/KoPencilTool.cpp index 7aff814107..4636e9c56b 100644 --- a/libs/basicflakes/tools/KoPencilTool.cpp +++ b/libs/basicflakes/tools/KoPencilTool.cpp @@ -1,558 +1,559 @@ /* This file is part of the KDE project * Copyright (C) 2007,2009,2011 Jan Hambrecht * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "KoPencilTool.h" #include "KoCurveFit.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "KoCreatePathTool_p.h" +#include "kis_double_parse_spin_box.h" KoPencilTool::KoPencilTool(KoCanvasBase *canvas) : KoToolBase(canvas) , m_mode(ModeCurve) , m_optimizeRaw(false) , m_optimizeCurve(false) , m_combineAngle(15.0) , m_fittingError(5.0) , m_close(false) , m_shape(0) , m_existingStartPoint(0) , m_existingEndPoint(0) , m_hoveredPoint(0) { } KoPencilTool::~KoPencilTool() { } void KoPencilTool::paint(QPainter &painter, const KoViewConverter &converter) { if (m_shape) { painter.save(); painter.setTransform(m_shape->absoluteTransformation(&converter) * painter.transform()); painter.save(); KoShapePaintingContext paintContext; //FIXME m_shape->paint(painter, converter, paintContext); painter.restore(); if (m_shape->stroke()) { painter.save(); m_shape->stroke()->paint(m_shape, painter, converter); painter.restore(); } painter.restore(); } if (m_hoveredPoint) { painter.save(); painter.setTransform(m_hoveredPoint->parent()->absoluteTransformation(&converter), true); KoShape::applyConversion(painter, converter); painter.setPen(Qt::blue); //TODO make configurable painter.setBrush(Qt::white); //TODO make configurable m_hoveredPoint->paint(painter, handleRadius(), KoPathPoint::Node); painter.restore(); } } void KoPencilTool::repaintDecorations() { } void KoPencilTool::mousePressEvent(KoPointerEvent *event) { if (! m_shape) { m_shape = new KoPathShape(); m_shape->setShapeId(KoPathShapeId); m_shape->setStroke(createStroke()); m_points.clear(); QPointF point = event->point; m_existingStartPoint = endPointAtPosition(point); if (m_existingStartPoint) point = m_existingStartPoint->parent()->shapeToDocument(m_existingStartPoint->point()); addPoint(point); } } void KoPencilTool::mouseMoveEvent(KoPointerEvent *event) { if (event->buttons() & Qt::LeftButton) addPoint(event->point); KoPathPoint * endPoint = endPointAtPosition(event->point); if (m_hoveredPoint != endPoint) { if (m_hoveredPoint) { QPointF nodePos = m_hoveredPoint->parent()->shapeToDocument(m_hoveredPoint->point()); canvas()->updateCanvas(handlePaintRect(nodePos)); } m_hoveredPoint = endPoint; if (m_hoveredPoint) { QPointF nodePos = m_hoveredPoint->parent()->shapeToDocument(m_hoveredPoint->point()); canvas()->updateCanvas(handlePaintRect(nodePos)); } } } void KoPencilTool::mouseReleaseEvent(KoPointerEvent *event) { if (! m_shape) return; QPointF point = event->point; m_existingEndPoint = endPointAtPosition(point); if (m_existingEndPoint) point = m_existingEndPoint->parent()->shapeToDocument(m_existingEndPoint->point()); addPoint(point); finish(event->modifiers() & Qt::ShiftModifier); m_existingStartPoint = 0; m_existingEndPoint = 0; m_hoveredPoint = 0; // the original path may be different from the one added canvas()->updateCanvas(m_shape->boundingRect()); delete m_shape; m_shape = 0; m_points.clear(); } void KoPencilTool::keyPressEvent(QKeyEvent *event) { if (m_shape) { event->accept(); } else { event->ignore(); } } void KoPencilTool::activate(ToolActivation, const QSet &) { m_points.clear(); m_close = false; useCursor(Qt::ArrowCursor); } void KoPencilTool::deactivate() { m_points.clear(); delete m_shape; m_shape = 0; m_existingStartPoint = 0; m_existingEndPoint = 0; m_hoveredPoint = 0; } void KoPencilTool::addPoint(const QPointF & point) { if (! m_shape) return; // do a moveTo for the first point added if (m_points.empty()) m_shape->moveTo(point); // do not allow coincident points else if (point != m_points.last()) m_shape->lineTo(point); else return; m_points.append(point); canvas()->updateCanvas(m_shape->boundingRect()); } qreal KoPencilTool::lineAngle(const QPointF &p1, const QPointF &p2) { qreal angle = atan2(p2.y() - p1.y(), p2.x() - p1.x()); if (angle < 0.0) angle += 2 * M_PI; return angle * 180.0 / M_PI; } void KoPencilTool::finish(bool closePath) { if (m_points.count() < 2) return; KoPathShape * path = 0; QList complete; QList *points = &m_points; if (m_mode == ModeStraight || m_optimizeRaw || m_optimizeCurve) { float combineAngle; if (m_mode == ModeStraight) combineAngle = m_combineAngle; else combineAngle = 0.50f; //Add the first two points complete.append(m_points[0]); complete.append(m_points[1]); //Now we need to get the angle of the first line float lastAngle = lineAngle(complete[0], complete[1]); uint pointCount = m_points.count(); for (uint i = 2; i < pointCount; ++i) { float angle = lineAngle(complete.last(), m_points[i]); if (qAbs(angle - lastAngle) < combineAngle) complete.removeLast(); complete.append(m_points[i]); lastAngle = angle; } m_points.clear(); points = &complete; } switch (m_mode) { case ModeCurve: { path = bezierFit(*points, m_fittingError); } break; case ModeStraight: case ModeRaw: { path = new KoPathShape(); uint pointCount = points->count(); path->moveTo(points->at(0)); for (uint i = 1; i < pointCount; ++i) path->lineTo(points->at(i)); } break; } if (! path) return; path->setShapeId(KoPathShapeId); path->setStroke(createStroke()); addPathShape(path, closePath); } QList > KoPencilTool::createOptionWidgets() { QList > widgets; QWidget *optionWidget = new QWidget(); QVBoxLayout * layout = new QVBoxLayout(optionWidget); QHBoxLayout *modeLayout = new QHBoxLayout; modeLayout->setSpacing(3); QLabel *modeLabel = new QLabel(i18n("Precision:"), optionWidget); QComboBox * modeBox = new QComboBox(optionWidget); modeBox->addItem(i18nc("The raw line data", "Raw")); modeBox->addItem(i18n("Curve")); modeBox->addItem(i18n("Straight")); modeLayout->addWidget(modeLabel); modeLayout->addWidget(modeBox, 1); layout->addLayout(modeLayout); QStackedWidget * stackedWidget = new QStackedWidget(optionWidget); QWidget * rawBox = new QWidget(stackedWidget); QVBoxLayout * rawLayout = new QVBoxLayout(rawBox); QCheckBox * optimizeRaw = new QCheckBox(i18n("Optimize"), rawBox); rawLayout->addWidget(optimizeRaw); rawLayout->setContentsMargins(0, 0, 0, 0); QWidget * curveBox = new QWidget(stackedWidget); QHBoxLayout * curveLayout = new QHBoxLayout(curveBox); QCheckBox * optimizeCurve = new QCheckBox(i18n("Optimize"), curveBox); - QDoubleSpinBox * fittingError = new QDoubleSpinBox(curveBox); + QDoubleSpinBox * fittingError = new KisDoubleParseSpinBox(curveBox); fittingError->setValue(0.50); fittingError->setMaximum(400.0); fittingError->setMinimum(0.0); fittingError->setSingleStep(m_fittingError); fittingError->setToolTip(i18n("Exactness:")); curveLayout->addWidget(optimizeCurve); curveLayout->addWidget(fittingError); curveLayout->setContentsMargins(0, 0, 0, 0); QWidget *straightBox = new QWidget(stackedWidget); QVBoxLayout *straightLayout = new QVBoxLayout(straightBox); - QDoubleSpinBox *combineAngle = new QDoubleSpinBox(straightBox); + QDoubleSpinBox *combineAngle = new KisDoubleParseSpinBox(straightBox); combineAngle->setValue(0.50); combineAngle->setMaximum(360.0); combineAngle->setMinimum(0.0); combineAngle->setSingleStep(m_combineAngle); combineAngle->setSuffix(" deg"); // QT5TODO //combineAngle->setLabel(i18n("Combine angle:"), Qt::AlignLeft | Qt::AlignVCenter); straightLayout->addWidget(combineAngle); straightLayout->setContentsMargins(0, 0, 0, 0); stackedWidget->addWidget(rawBox); stackedWidget->addWidget(curveBox); stackedWidget->addWidget(straightBox); layout->addWidget(stackedWidget); layout->addStretch(1); connect(modeBox, SIGNAL(activated(int)), stackedWidget, SLOT(setCurrentIndex(int))); connect(modeBox, SIGNAL(activated(int)), this, SLOT(selectMode(int))); connect(optimizeRaw, SIGNAL(stateChanged(int)), this, SLOT(setOptimize(int))); connect(optimizeCurve, SIGNAL(stateChanged(int)), this, SLOT(setOptimize(int))); connect(fittingError, SIGNAL(valueChanged(double)), this, SLOT(setDelta(double))); connect(combineAngle, SIGNAL(valueChanged(double)), this, SLOT(setDelta(double))); modeBox->setCurrentIndex(m_mode); stackedWidget->setCurrentIndex(m_mode); optionWidget->setObjectName(i18n("Pencil")); optionWidget->setWindowTitle(i18n("Pencil")); widgets.append(optionWidget); m_strokeWidget = new KoStrokeConfigWidget(0); m_strokeWidget->setWindowTitle(i18n("Line")); m_strokeWidget->setCanvas(canvas()); widgets.append(m_strokeWidget); return widgets; } void KoPencilTool::addPathShape(KoPathShape* path, bool closePath) { KoShape * startShape = 0; KoShape * endShape = 0; if (closePath) { path->close(); path->normalize(); } else { path->normalize(); if (connectPaths(path, m_existingStartPoint, m_existingEndPoint)) { if (m_existingStartPoint) startShape = m_existingStartPoint->parent(); if (m_existingEndPoint && m_existingEndPoint != m_existingStartPoint) endShape = m_existingEndPoint->parent(); } } KUndo2Command * cmd = canvas()->shapeController()->addShape(path); if (cmd) { KoSelection *selection = canvas()->shapeManager()->selection(); selection->deselectAll(); selection->select(path); if (startShape) canvas()->shapeController()->removeShape(startShape, cmd); if (endShape && startShape != endShape) canvas()->shapeController()->removeShape(endShape, cmd); canvas()->addCommand(cmd); } else { canvas()->updateCanvas(path->boundingRect()); delete path; } } void KoPencilTool::selectMode(int mode) { m_mode = static_cast(mode); } void KoPencilTool::setOptimize(int state) { if (m_mode == ModeRaw) m_optimizeRaw = state == Qt::Checked ? true : false; else m_optimizeCurve = state == Qt::Checked ? true : false; } void KoPencilTool::setDelta(double delta) { if (m_mode == ModeCurve) m_fittingError = delta; else if (m_mode == ModeStraight) m_combineAngle = delta; } KoShapeStroke* KoPencilTool::createStroke() { KoShapeStroke *stroke = 0; if (m_strokeWidget) { stroke = m_strokeWidget->createShapeStroke(); } return stroke; } KoPathPoint* KoPencilTool::endPointAtPosition(const QPointF &position) { QRectF roi = handleGrabRect(position); QList shapes = canvas()->shapeManager()->shapesAt(roi); KoPathPoint * nearestPoint = 0; qreal minDistance = HUGE_VAL; qreal maxDistance = canvas()->viewConverter()->viewToDocumentX(grabSensitivity()); Q_FOREACH(KoShape * shape, shapes) { KoPathShape * path = dynamic_cast(shape); if (!path) continue; KoParameterShape *paramShape = dynamic_cast(shape); if (paramShape && paramShape->isParametricShape()) continue; KoPathPoint * p = 0; uint subpathCount = path->subpathCount(); for (uint i = 0; i < subpathCount; ++i) { if (path->isClosedSubpath(i)) continue; p = path->pointByIndex(KoPathPointIndex(i, 0)); // check start of subpath qreal d = squareDistance(position, path->shapeToDocument(p->point())); if (d < minDistance && d < maxDistance) { nearestPoint = p; minDistance = d; } // check end of subpath p = path->pointByIndex(KoPathPointIndex(i, path->subpathPointCount(i) - 1)); d = squareDistance(position, path->shapeToDocument(p->point())); if (d < minDistance && d < maxDistance) { nearestPoint = p; minDistance = d; } } } return nearestPoint; } bool KoPencilTool::connectPaths(KoPathShape *pathShape, KoPathPoint *pointAtStart, KoPathPoint *pointAtEnd) { // at least one point must be valid if (!pointAtStart && !pointAtEnd) return false; // do not allow connecting to the same point twice if (pointAtStart == pointAtEnd) pointAtEnd = 0; // we have hit an existing path point on start/finish // what we now do is: // 1. combine the new created path with the ones we hit on start/finish // 2. merge the endpoints of the corresponding subpaths uint newPointCount = pathShape->subpathPointCount(0); KoPathPointIndex newStartPointIndex(0, 0); KoPathPointIndex newEndPointIndex(0, newPointCount - 1); KoPathPoint * newStartPoint = pathShape->pointByIndex(newStartPointIndex); KoPathPoint * newEndPoint = pathShape->pointByIndex(newEndPointIndex); KoPathShape * startShape = pointAtStart ? pointAtStart->parent() : 0; KoPathShape * endShape = pointAtEnd ? pointAtEnd->parent() : 0; // combine with the path we hit on start KoPathPointIndex startIndex(-1, -1); if (pointAtStart) { startIndex = startShape->pathPointIndex(pointAtStart); pathShape->combine(startShape); pathShape->moveSubpath(0, pathShape->subpathCount() - 1); } // combine with the path we hit on finish KoPathPointIndex endIndex(-1, -1); if (pointAtEnd) { endIndex = endShape->pathPointIndex(pointAtEnd); if (endShape != startShape) { endIndex.first += pathShape->subpathCount(); pathShape->combine(endShape); } } // do we connect twice to a single subpath ? bool connectToSingleSubpath = (startShape == endShape && startIndex.first == endIndex.first); if (startIndex.second == 0 && !connectToSingleSubpath) { pathShape->reverseSubpath(startIndex.first); startIndex.second = pathShape->subpathPointCount(startIndex.first) - 1; } if (endIndex.second > 0 && !connectToSingleSubpath) { pathShape->reverseSubpath(endIndex.first); endIndex.second = 0; } // after combining we have a path where with the subpaths in the following // order: // 1. the subpaths of the pathshape we started the new path at // 2. the subpath we just created // 3. the subpaths of the pathshape we finished the new path at // get the path points we want to merge, as these are not going to // change while merging KoPathPoint * existingStartPoint = pathShape->pointByIndex(startIndex); KoPathPoint * existingEndPoint = pathShape->pointByIndex(endIndex); // merge first two points if (existingStartPoint) { KoPathPointData pd1(pathShape, pathShape->pathPointIndex(existingStartPoint)); KoPathPointData pd2(pathShape, pathShape->pathPointIndex(newStartPoint)); KoPathPointMergeCommand cmd1(pd1, pd2); cmd1.redo(); } // merge last two points if (existingEndPoint) { KoPathPointData pd3(pathShape, pathShape->pathPointIndex(newEndPoint)); KoPathPointData pd4(pathShape, pathShape->pathPointIndex(existingEndPoint)); KoPathPointMergeCommand cmd2(pd3, pd4); cmd2.redo(); } return true; } qreal KoPencilTool::getFittingError() { return this->m_fittingError; } void KoPencilTool::setFittingError(qreal fittingError) { this->m_fittingError = fittingError; } diff --git a/libs/flake/CMakeLists.txt b/libs/flake/CMakeLists.txt index c63e0821b8..aef106e243 100644 --- a/libs/flake/CMakeLists.txt +++ b/libs/flake/CMakeLists.txt @@ -1,225 +1,226 @@ project(kritaflake) include_directories( ${CMAKE_SOURCE_DIR}/libs/flake/commands ${CMAKE_SOURCE_DIR}/libs/flake/tools ${CMAKE_SOURCE_DIR}/libs/flake/svg ${CMAKE_BINARY_DIR}/libs/flake ) add_subdirectory(styles) add_subdirectory(tests) set(kritaflake_SRCS KoGradientHelper.cpp KoFlake.cpp KoCanvasBase.cpp KoResourceManager_p.cpp KoDerivedResourceConverter.cpp + KoResourceUpdateMediator.cpp KoCanvasResourceManager.cpp KoDocumentResourceManager.cpp KoCanvasObserverBase.cpp KoCanvasSupervisor.cpp KoDockFactoryBase.cpp KoDockRegistry.cpp KoDataCenterBase.cpp KoInsets.cpp KoPathShape.cpp KoPathPoint.cpp KoPathSegment.cpp KoSelection.cpp KoShape.cpp KoShapeAnchor.cpp KoShapeBasedDocumentBase.cpp KoShapeApplicationData.cpp KoShapeContainer.cpp KoShapeContainerModel.cpp KoShapeContainerDefaultModel.cpp KoShapeGroup.cpp KoShapeManagerPaintingStrategy.cpp KoShapeManager.cpp KoShapePaintingContext.cpp KoFrameShape.cpp KoUnavailShape.cpp KoMarkerData.cpp KoMarker.cpp KoMarkerCollection.cpp KoMarkerSharedLoadingData.cpp KoToolBase.cpp KoCanvasController.cpp KoCanvasControllerWidget.cpp KoCanvasControllerWidgetViewport_p.cpp KoShapeRegistry.cpp KoDeferredShapeFactoryBase.cpp KoToolFactoryBase.cpp KoPathShapeFactory.cpp KoShapeFactoryBase.cpp KoShapeUserData.cpp KoParameterShape.cpp KoPointerEvent.cpp KoShapeController.cpp KoToolSelection.cpp KoShapeLayer.cpp KoPostscriptPaintDevice.cpp KoInputDevice.cpp KoToolManager_p.cpp KoToolManager.cpp KoToolRegistry.cpp KoToolProxy.cpp KoShapeSavingContext.cpp KoShapeLoadingContext.cpp KoLoadingShapeUpdater.cpp KoPathShapeLoader.cpp KoShapeStrokeModel.cpp KoShapeStroke.cpp KoShapeBackground.cpp KoColorBackground.cpp KoGradientBackground.cpp KoOdfGradientBackground.cpp KoHatchBackground.cpp KoPatternBackground.cpp KoShapeConfigWidgetBase.cpp KoDrag.cpp KoDragOdfSaveHelper.cpp KoShapeOdfSaveHelper.cpp KoShapePaste.cpp KoConnectionPoint.cpp KoConnectionShape.cpp KoConnectionShapeLoadingUpdater.cpp KoConnectionShapeFactory.cpp KoConnectionShapeConfigWidget.cpp KoSnapGuide.cpp KoSnapProxy.cpp KoSnapStrategy.cpp KoSnapData.cpp KoShapeShadow.cpp KoSharedLoadingData.cpp KoSharedSavingData.cpp KoViewConverter.cpp KoInputDeviceHandler.cpp KoInputDeviceHandlerEvent.cpp KoInputDeviceHandlerRegistry.cpp KoImageData.cpp KoImageData_p.cpp KoImageCollection.cpp KoOdfWorkaround.cpp KoFilterEffect.cpp KoFilterEffectStack.cpp KoFilterEffectFactoryBase.cpp KoFilterEffectRegistry.cpp KoFilterEffectConfigWidgetBase.cpp KoFilterEffectRenderContext.cpp KoFilterEffectLoadingContext.cpp KoTextShapeDataBase.cpp KoTosContainer.cpp KoTosContainerModel.cpp KoClipPath.cpp KoCurveFit.cpp commands/KoShapeGroupCommand.cpp commands/KoShapeAlignCommand.cpp commands/KoShapeBackgroundCommand.cpp commands/KoShapeCreateCommand.cpp commands/KoShapeDeleteCommand.cpp commands/KoShapeDistributeCommand.cpp commands/KoShapeLockCommand.cpp commands/KoShapeMoveCommand.cpp commands/KoShapeShearCommand.cpp commands/KoShapeSizeCommand.cpp commands/KoShapeStrokeCommand.cpp commands/KoShapeUngroupCommand.cpp commands/KoShapeReorderCommand.cpp commands/KoShapeKeepAspectRatioCommand.cpp commands/KoPathBaseCommand.cpp commands/KoPathPointMoveCommand.cpp commands/KoPathControlPointMoveCommand.cpp commands/KoPathPointTypeCommand.cpp commands/KoPathPointRemoveCommand.cpp commands/KoPathPointInsertCommand.cpp commands/KoPathSegmentBreakCommand.cpp commands/KoPathBreakAtPointCommand.cpp commands/KoPathSegmentTypeCommand.cpp commands/KoPathCombineCommand.cpp commands/KoSubpathRemoveCommand.cpp commands/KoSubpathJoinCommand.cpp commands/KoParameterHandleMoveCommand.cpp commands/KoParameterToPathCommand.cpp commands/KoShapeTransformCommand.cpp commands/KoPathFillRuleCommand.cpp commands/KoConnectionShapeTypeCommand.cpp commands/KoShapeShadowCommand.cpp commands/KoPathReverseCommand.cpp commands/KoShapeRenameCommand.cpp commands/KoShapeRunAroundCommand.cpp commands/KoPathPointMergeCommand.cpp commands/KoShapeTransparencyCommand.cpp commands/KoShapeClipCommand.cpp commands/KoShapeUnclipCommand.cpp commands/KoPathShapeMarkerCommand.cpp commands/KoShapeConnectionChangeCommand.cpp tools/KoCreateShapeStrategy.cpp tools/KoPathToolFactory.cpp tools/KoPathTool.cpp tools/KoPathToolSelection.cpp tools/KoPathToolHandle.cpp tools/PathToolOptionWidget.cpp tools/KoPathPointRubberSelectStrategy.cpp tools/KoPathPointMoveStrategy.cpp tools/KoPathConnectionPointStrategy.cpp tools/KoPathControlPointMoveStrategy.cpp tools/KoParameterChangeStrategy.cpp tools/KoZoomTool.cpp tools/KoZoomToolFactory.cpp tools/KoZoomToolWidget.cpp tools/KoZoomStrategy.cpp tools/KoPanTool.cpp tools/KoPanToolFactory.cpp tools/KoInteractionTool.cpp tools/KoInteractionStrategy.cpp tools/KoCreateShapesTool.cpp tools/KoCreateShapesToolFactory.cpp tools/KoShapeRubberSelectStrategy.cpp tools/KoPathSegmentChangeStrategy.cpp svg/KoShapePainter.cpp svg/SvgUtil.cpp svg/SvgGraphicContext.cpp svg/SvgSavingContext.cpp svg/SvgWriter.cpp svg/SvgStyleWriter.cpp svg/SvgShape.cpp svg/SvgParser.cpp svg/SvgStyleParser.cpp svg/SvgGradientHelper.cpp svg/SvgPatternHelper.cpp svg/SvgFilterHelper.cpp svg/SvgCssHelper.cpp svg/SvgClipPathHelper.cpp svg/SvgLoadingContext.cpp svg/SvgShapeFactory.cpp FlakeDebug.cpp ) ki18n_wrap_ui(kritaflake_SRCS tools/PathToolOptionWidgetBase.ui KoConnectionShapeConfigWidget.ui tools/KoZoomToolWidget.ui ) add_library(kritaflake SHARED ${kritaflake_SRCS}) generate_export_header(kritaflake BASE_NAME kritaflake) target_include_directories(kritaflake PUBLIC $ $ $ ) target_link_libraries(kritaflake kritapigment kritawidgetutils kritaodf kritaundo2 KF5::WidgetsAddons Qt5::Svg) target_link_libraries(kritaflake LINK_INTERFACE_LIBRARIES kritapigment kritawidgetutils kritaodf kritaundo2 KF5::WidgetsAddons ) set_target_properties(kritaflake PROPERTIES VERSION ${GENERIC_KRITA_LIB_VERSION} SOVERSION ${GENERIC_KRITA_LIB_SOVERSION} ) install(TARGETS kritaflake ${INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/libs/flake/KoCanvasResourceManager.cpp b/libs/flake/KoCanvasResourceManager.cpp index da7b047f2e..45f2189de4 100644 --- a/libs/flake/KoCanvasResourceManager.cpp +++ b/libs/flake/KoCanvasResourceManager.cpp @@ -1,182 +1,197 @@ /* Copyright (c) 2006 Boudewijn Rempt (boud@valdyas.org) Copyright (C) 2007, 2010 Thomas Zander Copyright (c) 2008 Carlos Licea Copyright (c) 2011 Jan Hambrecht This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "KoCanvasResourceManager.h" #include #include #include "KoShape.h" #include "KoShapeStroke.h" #include "KoResourceManager_p.h" #include class Q_DECL_HIDDEN KoCanvasResourceManager::Private { public: KoResourceManager manager; }; KoCanvasResourceManager::KoCanvasResourceManager(QObject *parent) : QObject(parent), d(new Private()) { const KoColorSpace* cs = KoColorSpaceRegistry::instance()->rgb8(); setForegroundColor(KoColor(Qt::black, cs)); setBackgroundColor(KoColor(Qt::white, cs)); setResource(ApplicationSpeciality, NoSpecial); connect(&d->manager, &KoResourceManager::resourceChanged, this, &KoCanvasResourceManager::canvasResourceChanged); } KoCanvasResourceManager::~KoCanvasResourceManager() { delete d; } void KoCanvasResourceManager::setResource(int key, const QVariant &value) { d->manager.setResource(key, value); } QVariant KoCanvasResourceManager::resource(int key) const { return d->manager.resource(key); } void KoCanvasResourceManager::setResource(int key, const KoColor &color) { QVariant v; v.setValue(color); setResource(key, v); } void KoCanvasResourceManager::setResource(int key, KoShape *shape) { QVariant v; v.setValue(shape); setResource(key, v); } void KoCanvasResourceManager::setResource(int key, const KoUnit &unit) { QVariant v; v.setValue(unit); setResource(key, v); } KoColor KoCanvasResourceManager::koColorResource(int key) const { return d->manager.koColorResource(key); } void KoCanvasResourceManager::setForegroundColor(const KoColor &color) { setResource(ForegroundColor, color); } KoColor KoCanvasResourceManager::foregroundColor() const { return koColorResource(ForegroundColor); } void KoCanvasResourceManager::setBackgroundColor(const KoColor &color) { setResource(BackgroundColor, color); } KoColor KoCanvasResourceManager::backgroundColor() const { return koColorResource(BackgroundColor); } KoShape *KoCanvasResourceManager::koShapeResource(int key) const { return d->manager.koShapeResource(key); } KoUnit KoCanvasResourceManager::unitResource(int key) const { return resource(key).value(); } void KoCanvasResourceManager::setActiveStroke(const KoShapeStroke &stroke) { QVariant v; v.setValue(stroke); setResource(ActiveStroke, v); } KoShapeStroke KoCanvasResourceManager::activeStroke() const { if (!d->manager.hasResource(ActiveStroke)) { KoShapeStroke empty; return empty; } return resource(ActiveStroke).value(); } bool KoCanvasResourceManager::boolResource(int key) const { return d->manager.boolResource(key); } int KoCanvasResourceManager::intResource(int key) const { return d->manager.intResource(key); } QString KoCanvasResourceManager::stringResource(int key) const { return d->manager.stringResource(key); } QSizeF KoCanvasResourceManager::sizeResource(int key) const { return d->manager.sizeResource(key); } bool KoCanvasResourceManager::hasResource(int key) const { return d->manager.hasResource(key); } void KoCanvasResourceManager::clearResource(int key) { d->manager.clearResource(key); } void KoCanvasResourceManager::addDerivedResourceConverter(KoDerivedResourceConverterSP converter) { d->manager.addDerivedResourceConverter(converter); } bool KoCanvasResourceManager::hasDerivedResourceConverter(int key) { return d->manager.hasDerivedResourceConverter(key); } void KoCanvasResourceManager::removeDerivedResourceConverter(int key) { d->manager.removeDerivedResourceConverter(key); } + +void KoCanvasResourceManager::addResourceUpdateMediator(KoResourceUpdateMediatorSP mediator) +{ + d->manager.addResourceUpdateMediator(mediator); +} + +bool KoCanvasResourceManager::hasResourceUpdateMediator(int key) +{ + return d->manager.hasResourceUpdateMediator(key); +} + +void KoCanvasResourceManager::removeResourceUpdateMediator(int key) +{ + d->manager.removeResourceUpdateMediator(key); +} diff --git a/libs/flake/KoCanvasResourceManager.h b/libs/flake/KoCanvasResourceManager.h index 96fc90bd03..9060cdb3d1 100644 --- a/libs/flake/KoCanvasResourceManager.h +++ b/libs/flake/KoCanvasResourceManager.h @@ -1,271 +1,288 @@ /* Copyright (c) 2006, 2011 Boudewijn Rempt (boud@valdyas.org) Copyright (C) 2007, 2009, 2010 Thomas Zander Copyright (c) 2008 Carlos Licea This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KO_CANVASRESOURCEMANAGER_H #define KO_CANVASRESOURCEMANAGER_H #include #include "kritaflake_export.h" #include "KoDerivedResourceConverter.h" +#include "KoResourceUpdateMediator.h" class KoShape; class KoShapeStroke; class KoColor; class KoUnit; class QVariant; class QSizeF; /** * The KoCanvasResourceManager contains a set of per-canvas * properties, like current foreground color, current background * color and more. All tools belonging to the current canvas are * notified when a Resource changes (is set). * * The manager can contain all sorts of variable types and there are accessors * for the most common ones. All variables are always stored inside a QVariant * instance internally and you can always just use the resource() method to get * that directly. * The way to store arbitairy data objects that are stored as pointers you can use * the following code snippets; * @code * QVariant variant; * variant.setValue(textShapeData->document()); * resourceManager->setResource(KoText::CurrentTextDocument, variant); * // and get it out again. * QVariant var = resourceManager->resource(KoText::CurrentTextDocument); * document = static_cast(var.value()); * @endcode */ class KRITAFLAKE_EXPORT KoCanvasResourceManager : public QObject { Q_OBJECT public: /** * This enum holds identifiers to the resources that can be stored in here. */ enum CanvasResource { ForegroundColor, ///< The active forground color selected for this canvas. BackgroundColor, ///< The active background color selected for this canvas. ActiveStroke, ///< The active stroke selected for this canvas PageSize, ///< The size of the (current) page in postscript points. Unit, ///< The unit of this canvas CurrentPage, ///< The current page number ActiveStyleType, ///< the actual active style type see KoFlake::StyleType for valid values ActiveRange, ///< The area where the rulers should show white ShowTextShapeOutlines, ///< Paint of text shape outlines ? ShowFormattingCharacters, ///< Paint of formatting characters ? ShowTableBorders, ///< Paint of table borders (when not really there) ? ShowSectionBounds, ///< Paint of sections bounds ? ShowInlineObjectVisualization, ///< paint a different background for inline objects ApplicationSpeciality, ///< Special features and limitations of the application KarbonStart = 1000, ///< Base number for Karbon specific values. KexiStart = 2000, ///< Base number for Kexi specific values. FlowStart = 3000, ///< Base number for Flow specific values. PlanStart = 4000, ///< Base number for Plan specific values. StageStart = 5000, ///< Base number for Stage specific values. KritaStart = 6000, ///< Base number for Krita specific values. SheetsStart = 7000, ///< Base number for Sheets specific values. WordsStart = 8000, ///< Base number for Words specific values. KoPageAppStart = 9000 ///< Base number for KoPageApp specific values. }; enum ApplicationSpecial { NoSpecial = 0, NoAdvancedText = 1 }; /** * Constructor. * @param parent the parent QObject, used for memory management. */ explicit KoCanvasResourceManager(QObject *parent = 0); virtual ~KoCanvasResourceManager(); public Q_SLOTS: /** * Set a resource of any type. * @param key the integer key * @param value the new value for the key. * @see KoCanvasResourceManager::CanvasResource */ void setResource(int key, const QVariant &value); /** * Set a resource of type KoColor. * @param key the integer key * @param color the new value for the key. * @see KoCanvasResourceManager::CanvasResource */ void setResource(int key, const KoColor &color); /** * Set a resource of type KoShape*. * @param key the integer key * @param id the new value for the key. * @see KoCanvasResourceManager::CanvasResource */ void setResource(int key, KoShape *shape); /** * Set a resource of type KoUnit * @param key the integer key * @param id the new value for the key. * @see KoCanvasResourceManager::CanvasResource */ void setResource(int key, const KoUnit &unit); public: /** * Returns a qvariant containing the specified resource or a standard one if the * specified resource does not exist. * @param key the key * @see KoCanvasResourceManager::CanvasResource */ QVariant resource(int key) const; /** * Set the foregroundColor resource. * @param color the new foreground color */ void setForegroundColor(const KoColor &color); /** * Return the foregroundColor */ KoColor foregroundColor() const; /** * Set the backgroundColor resource. * @param color the new background color */ void setBackgroundColor(const KoColor &color); /** * Return the backgroundColor */ KoColor backgroundColor() const; /// Sets the stroke resource void setActiveStroke(const KoShapeStroke &stroke); /// Returns the stroke resource KoShapeStroke activeStroke() const; /** * Return the resource determined by param key as a boolean. * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource */ bool boolResource(int key) const; /** * Return the resource determined by param key as an integer. * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource */ int intResource(int key) const; /** * Return the resource determined by param key as a KoColor. * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource */ KoColor koColorResource(int key) const; /** * Return the resource determined by param key as a pointer to a KoShape. * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource */ KoShape *koShapeResource(int key) const; /** * Return the resource determined by param key as a QString . * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource */ QString stringResource(int key) const; /** * Return the resource determined by param key as a QSizeF. * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource */ QSizeF sizeResource(int key) const; /** * Return the resource determined by param key as a KoUnit. * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource */ KoUnit unitResource(int key) const; /** * Returns true if there is a resource set with the requested key. * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource */ bool hasResource(int key) const; /** * Remove the resource with @p key from the provider. * @param key the key that will be used to remove the resource * There will be a signal emitted with a variable that will return true on QVariable::isNull(); * @see KoCanvasResourceManager::CanvasResource */ void clearResource(int key); /** * @see KoReosurceManager::addDerivedResourceConverter() */ void addDerivedResourceConverter(KoDerivedResourceConverterSP converter); /** * @see KoReosurceManager::hasDerivedResourceConverter() */ bool hasDerivedResourceConverter(int key); /** * @see KoReosurceManager::removeDerivedResourceConverter() */ void removeDerivedResourceConverter(int key); + /** + * @see KoReosurceManager::addResourceUpdateMediator + */ + void addResourceUpdateMediator(KoResourceUpdateMediatorSP mediator); + + /** + * @see KoReosurceManager::hasResourceUpdateMediator + */ + bool hasResourceUpdateMediator(int key); + + /** + + * @see KoReosurceManager::removeResourceUpdateMediator + */ + void removeResourceUpdateMediator(int key); + Q_SIGNALS: /** * This signal is emitted every time a resource is set that is either * new or different from the previous set value. * @param key the indentifying key for the resource * @param value the variants new value. * @see KoCanvasResourceManager::CanvasResource */ void canvasResourceChanged(int key, const QVariant &value); private: KoCanvasResourceManager(const KoCanvasResourceManager&); KoCanvasResourceManager& operator=(const KoCanvasResourceManager&); class Private; Private *const d; }; #endif diff --git a/libs/flake/KoDerivedResourceConverter.cpp b/libs/flake/KoDerivedResourceConverter.cpp index 1ae9f1c111..93b59c88d0 100644 --- a/libs/flake/KoDerivedResourceConverter.cpp +++ b/libs/flake/KoDerivedResourceConverter.cpp @@ -1,52 +1,93 @@ /* * Copyright (c) 2016 Dmitry Kazakov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "KoDerivedResourceConverter.h" #include "QVariant" - +#include "kis_assert.h" struct KoDerivedResourceConverter::Private { Private(int _key, int _sourceKey) : key(_key), sourceKey(_sourceKey) {} int key; int sourceKey; + + QVariant lastKnownValue; }; KoDerivedResourceConverter::KoDerivedResourceConverter(int key, int sourceKey) : m_d(new Private(key, sourceKey)) { } KoDerivedResourceConverter::~KoDerivedResourceConverter() { } int KoDerivedResourceConverter::key() const { return m_d->key; } int KoDerivedResourceConverter::sourceKey() const { return m_d->sourceKey; } +bool KoDerivedResourceConverter::notifySourceChanged(const QVariant &sourceValue) +{ + const QVariant newValue = fromSource(sourceValue); + + const bool valueChanged = m_d->lastKnownValue != newValue; + m_d->lastKnownValue = newValue; + + return valueChanged; +} + +QVariant KoDerivedResourceConverter::readFromSource(const QVariant &sourceValue) +{ + const QVariant result = fromSource(sourceValue); + + KIS_SAFE_ASSERT_RECOVER_NOOP(m_d->lastKnownValue.isNull() || + result == m_d->lastKnownValue); + + m_d->lastKnownValue = result; + + return m_d->lastKnownValue; +} + +QVariant KoDerivedResourceConverter::writeToSource(const QVariant &value, + const QVariant &sourceValue, + bool *changed) +{ + if (changed) { + *changed = m_d->lastKnownValue != value; + } + + QVariant newSourceValue = sourceValue; + + if (*changed || value != fromSource(sourceValue)) { + m_d->lastKnownValue = value; + newSourceValue = toSource(value, sourceValue); + } + + return newSourceValue; +} diff --git a/libs/flake/KoDerivedResourceConverter.h b/libs/flake/KoDerivedResourceConverter.h index ffffbc212d..8cf03b9f34 100644 --- a/libs/flake/KoDerivedResourceConverter.h +++ b/libs/flake/KoDerivedResourceConverter.h @@ -1,71 +1,79 @@ /* * Copyright (c) 2016 Dmitry Kazakov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __KO_DERIVED_RESOURCE_CONVERTER_H #define __KO_DERIVED_RESOURCE_CONVERTER_H #include #include #include "kritaflake_export.h" class QVariant; /** * \class KoDerivedResourceConverter * * Defines the abstraction of a derived resource. It should be * uploaded to the KoResourceManager during loading phase. The manager * will use it to convert values to/from the source resource. */ class KRITAFLAKE_EXPORT KoDerivedResourceConverter { public: /** * \param key the unique id of the resource defined by this * converter * * \param sourceKey the id of the parent resource, i.e. where the * values are really loaded/saved. */ KoDerivedResourceConverter(int key, int sourceKey); virtual ~KoDerivedResourceConverter(); int key() const; int sourceKey() const; + QVariant readFromSource(const QVariant &value); + QVariant writeToSource(const QVariant &value, + const QVariant &sourceValue, + bool *changed); + + virtual bool notifySourceChanged(const QVariant &sourceValue); + +protected: /** * Converts the \p value of the source resource into the space of * the "derived" resource. E.g. preset -> opacity. */ virtual QVariant fromSource(const QVariant &value) = 0; /** * Converts the value of the "derived" resource into the space of the * original ("source") resource. E.g. opacity -> preset. */ virtual QVariant toSource(const QVariant &value, const QVariant &sourceValue) = 0; private: struct Private; const QScopedPointer m_d; }; typedef QSharedPointer KoDerivedResourceConverterSP; #endif /* __KO_DERIVED_RESOURCE_CONVERTER_H */ diff --git a/libs/flake/KoResourceManager_p.cpp b/libs/flake/KoResourceManager_p.cpp index ad8b11d50f..eeca376054 100644 --- a/libs/flake/KoResourceManager_p.cpp +++ b/libs/flake/KoResourceManager_p.cpp @@ -1,196 +1,239 @@ /* Copyright (c) 2006, 2011 Boudewijn Rempt (boud@valdyas.org) Copyright (C) 2007, 2010 Thomas Zander Copyright (c) 2008 Carlos Licea Copyright (c) 2011 Jan Hambrecht This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "KoResourceManager_p.h" #include #include #include "KoShape.h" +#include "kis_assert.h" +#include "kis_debug.h" -void KoResourceManager::setResource(int key, const QVariant &value) +void KoResourceManager::slotResourceInternalsChanged(int key) { - QVariant realValue = value; - int realKey = key; - QVariant currentValue = m_resources.value(key, QVariant()); + KIS_SAFE_ASSERT_RECOVER_RETURN(m_resources.contains(key)); + notifyDerivedResourcesChanged(key, m_resources[key]); +} +void KoResourceManager::setResource(int key, const QVariant &value) +{ KoDerivedResourceConverterSP converter = m_derivedResources.value(key, KoDerivedResourceConverterSP()); if (converter) { - realKey = converter->sourceKey(); - currentValue = m_resources.value(realKey, QVariant()); - realValue = converter->toSource(value, currentValue); - } + const int sourceKey = converter->sourceKey(); + const QVariant oldSourceValue = m_resources.value(sourceKey, QVariant()); + + bool valueChanged = false; + const QVariant newSourceValue = converter->writeToSource(value, oldSourceValue, &valueChanged); + + if (valueChanged) { + notifyResourceChanged(key, value); + } + + if (oldSourceValue != newSourceValue) { + m_resources[sourceKey] = newSourceValue; + notifyResourceChanged(sourceKey, newSourceValue); + } - if (m_resources.contains(realKey)) { - if (!converter && currentValue == realValue) - return; - m_resources[realKey] = realValue; } else { - m_resources.insert(realKey, realValue); - } + const QVariant oldValue = m_resources.value(key, QVariant()); + m_resources[key] = value; - notifyResourceChanged(key, value); + if (m_updateMediators.contains(key)) { + m_updateMediators[key]->connectResource(value); + } + + if (oldValue != value) { + notifyResourceChanged(key, value); + } + } } void KoResourceManager::notifyResourceChanged(int key, const QVariant &value) { emit resourceChanged(key, value); + notifyDerivedResourcesChanged(key, value); +} +void KoResourceManager::notifyDerivedResourcesChanged(int key, const QVariant &value) +{ QMultiHash::const_iterator it = m_derivedFromSource.constFind(key); QMultiHash::const_iterator end = m_derivedFromSource.constEnd(); while (it != end && it.key() == key) { KoDerivedResourceConverterSP converter = it.value(); - notifyResourceChanged(converter->key(), converter->fromSource(value)); + + if (converter->notifySourceChanged(value)) { + notifyResourceChanged(converter->key(), converter->readFromSource(value)); + } + it++; } } QVariant KoResourceManager::resource(int key) const { KoDerivedResourceConverterSP converter = m_derivedResources.value(key, KoDerivedResourceConverterSP()); const int realKey = converter ? converter->sourceKey() : key; QVariant value = m_resources.value(realKey, QVariant()); - return converter ? converter->fromSource(value) : value; + return converter ? converter->readFromSource(value) : value; } void KoResourceManager::setResource(int key, const KoColor &color) { QVariant v; v.setValue(color); setResource(key, v); } void KoResourceManager::setResource(int key, KoShape *shape) { QVariant v; v.setValue(shape); setResource(key, v); } void KoResourceManager::setResource(int key, const KoUnit &unit) { QVariant v; v.setValue(unit); setResource(key, v); } KoColor KoResourceManager::koColorResource(int key) const { if (! m_resources.contains(key)) { KoColor empty; return empty; } return resource(key).value(); } KoShape *KoResourceManager::koShapeResource(int key) const { if (! m_resources.contains(key)) return 0; return resource(key).value(); } KoUnit KoResourceManager::unitResource(int key) const { return resource(key).value(); } bool KoResourceManager::boolResource(int key) const { if (! m_resources.contains(key)) return false; return m_resources[key].toBool(); } int KoResourceManager::intResource(int key) const { if (! m_resources.contains(key)) return 0; return m_resources[key].toInt(); } QString KoResourceManager::stringResource(int key) const { if (! m_resources.contains(key)) { QString empty; return empty; } return qvariant_cast(resource(key)); } QSizeF KoResourceManager::sizeResource(int key) const { if (! m_resources.contains(key)) { QSizeF empty; return empty; } return qvariant_cast(resource(key)); } bool KoResourceManager::hasResource(int key) const { KoDerivedResourceConverterSP converter = m_derivedResources.value(key, KoDerivedResourceConverterSP()); const int realKey = converter ? converter->sourceKey() : key; return m_resources.contains(realKey); } void KoResourceManager::clearResource(int key) { // we cannot remove a derived resource if (m_derivedResources.contains(key)) return; if (m_resources.contains(key)) { m_resources.remove(key); notifyResourceChanged(key, QVariant()); } } void KoResourceManager::addDerivedResourceConverter(KoDerivedResourceConverterSP converter) { - Q_ASSERT(!m_derivedResources.contains(converter->key())); + KIS_SAFE_ASSERT_RECOVER_NOOP(!m_derivedResources.contains(converter->key())); m_derivedResources.insert(converter->key(), converter); m_derivedFromSource.insertMulti(converter->sourceKey(), converter); } bool KoResourceManager::hasDerivedResourceConverter(int key) { return m_derivedResources.contains(key); } void KoResourceManager::removeDerivedResourceConverter(int key) { Q_ASSERT(m_derivedResources.contains(key)); KoDerivedResourceConverterSP converter = m_derivedResources.value(key); m_derivedResources.remove(key); m_derivedFromSource.remove(converter->sourceKey(), converter); } + +void KoResourceManager::addResourceUpdateMediator(KoResourceUpdateMediatorSP mediator) +{ + KIS_SAFE_ASSERT_RECOVER_NOOP(!m_updateMediators.contains(mediator->key())); + m_updateMediators.insert(mediator->key(), mediator); + connect(mediator.data(), SIGNAL(sigResourceChanged(int)), SLOT(slotResourceInternalsChanged(int))); +} + +bool KoResourceManager::hasResourceUpdateMediator(int key) +{ + return m_updateMediators.contains(key); +} + +void KoResourceManager::removeResourceUpdateMediator(int key) +{ + KIS_SAFE_ASSERT_RECOVER_RETURN(m_updateMediators.contains(key)); + m_updateMediators.remove(key); +} diff --git a/libs/flake/KoResourceManager_p.h b/libs/flake/KoResourceManager_p.h index d58fc52b9d..f29d3f82b0 100644 --- a/libs/flake/KoResourceManager_p.h +++ b/libs/flake/KoResourceManager_p.h @@ -1,192 +1,220 @@ /* Copyright (c) 2006, 2011 Boudewijn Rempt (boud@valdyas.org) Copyright (C) 2007, 2009, 2010 Thomas Zander Copyright (c) 2008 Carlos Licea This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KO_RESOURCEMANAGER_P_H #define KO_RESOURCEMANAGER_P_H #include #include #include #include "kritaflake_export.h" #include #include #include "KoDerivedResourceConverter.h" +#include "KoResourceUpdateMediator.h" + class KoShape; class QVariant; class KRITAFLAKE_EXPORT KoResourceManager : public QObject { Q_OBJECT public: KoResourceManager() {} /** * Set a resource of any type. * @param key the integer key * @param value the new value for the key. * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource */ void setResource(int key, const QVariant &value); /** * Set a resource of type KoColor. * @param key the integer key * @param color the new value for the key. * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource */ void setResource(int key, const KoColor &color); /** * Set a resource of type KoShape*. * @param key the integer key * @param id the new value for the key. * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource */ void setResource(int key, KoShape *shape); /** * Set a resource of type KoUnit * @param key the integer key * @param id the new value for the key. * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource */ void setResource(int key, const KoUnit &unit); /** * Returns a qvariant containing the specified resource or a standard one if the * specified resource does not exist. * @param key the key * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource */ QVariant resource(int key) const; /** * Return the resource determined by param key as a boolean. * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource */ bool boolResource(int key) const; /** * Return the resource determined by param key as an integer. * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource */ int intResource(int key) const; /** * Return the resource determined by param key as a KoColor. * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource */ KoColor koColorResource(int key) const; /** * Return the resource determined by param key as a pointer to a KoShape. * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource */ KoShape *koShapeResource(int key) const; /** * Return the resource determined by param key as a QString . * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource */ QString stringResource(int key) const; /** * Return the resource determined by param key as a QSizeF. * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource */ QSizeF sizeResource(int key) const; /** * Return the resource determined by param key as a KoUnit. * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource */ KoUnit unitResource(int key) const; /** * Returns true if there is a resource set with the requested key. * @param key the indentifying key for the resource * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource */ bool hasResource(int key) const; /** * Remove the resource with @p key from the provider. * @param key the key that will be used to remove the resource * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource */ void clearResource(int key); /** - * Some of the resources may be "derive" from the other. For + * Some of the resources may be "derived" from the others. For * example opacity, composite op and erase mode properties are * contained inside a paintop preset, so we need not create a * separate resource for them. Instead we created a derived resource, * that loads/saves values from/to another resource, but has its own * "resource changed" signal (via a different key). * * When a parent resource changes, the resource manager emits - * update signals for all its derived resources. + * update signals for all its derived resources. */ void addDerivedResourceConverter(KoDerivedResourceConverterSP converter); /** * @return true if the resource with \p key is a derived resource * (has a converter installed) * * @see addDerivedResourceConverter() */ bool hasDerivedResourceConverter(int key); /** * Removes a derived resource converter. If you rty to add a * resource with \p key it will be treated as a usual resource. * * @see addDerivedResourceConverter() */ void removeDerivedResourceConverter(int key); + /** + * Some resources can "mutate", that is their value doesn't change + * (a pointer), whereas the contents changes. But we should still + * notify all the derived resources subscribers that the resource + * has changed. For that purpose we use a special mediator class + * that connects the resource (which is not a QObject at all) and + * the resource manager controls that connection. + */ + void addResourceUpdateMediator(KoResourceUpdateMediatorSP mediator); + + /** + * \see addResourceUpdateMediator() + */ + bool hasResourceUpdateMediator(int key); + + /** + * \see addResourceUpdateMediator() + */ + void removeResourceUpdateMediator(int key); + Q_SIGNALS: void resourceChanged(int key, const QVariant &value); private: void notifyResourceChanged(int key, const QVariant &value); + void notifyDerivedResourcesChanged(int key, const QVariant &value); + +private Q_SLOTS: + void slotResourceInternalsChanged(int key); private: KoResourceManager(const KoResourceManager&); KoResourceManager& operator=(const KoResourceManager&); QHash m_resources; QHash m_derivedResources; QMultiHash m_derivedFromSource; + + QHash m_updateMediators; }; #endif diff --git a/plugins/paintops/particle/kis_particle_paintop_settings.h b/libs/flake/KoResourceUpdateMediator.cpp similarity index 64% copy from plugins/paintops/particle/kis_particle_paintop_settings.h copy to libs/flake/KoResourceUpdateMediator.cpp index bdc68793c8..1a641be458 100644 --- a/plugins/paintops/particle/kis_particle_paintop_settings.h +++ b/libs/flake/KoResourceUpdateMediator.cpp @@ -1,35 +1,41 @@ /* - * Copyright (c) 2010 Lukáš Tvrdý + * Copyright (c) 2016 Dmitry Kazakov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef KIS_PARTICLE_PAINTOP_SETTINGS_H_ -#define KIS_PARTICLE_PAINTOP_SETTINGS_H_ +#include "KoResourceUpdateMediator.h" -#include -#include -class KisParticlePaintOpSettings : public KisPaintOpSettings +struct KoResourceUpdateMediator::Private { + Private(int _key) : key(_key) {} + int key; +}; -public: - bool paintIncremental(); - bool isAirbrushing() const; - int rate() const; -}; +KoResourceUpdateMediator::KoResourceUpdateMediator(int key) + : m_d(new Private(key)) +{ +} -#endif +KoResourceUpdateMediator::~KoResourceUpdateMediator() +{ +} + +int KoResourceUpdateMediator::key() const +{ + return m_d->key; +} diff --git a/libs/flake/KoResourceUpdateMediator.h b/libs/flake/KoResourceUpdateMediator.h new file mode 100644 index 0000000000..602df7443d --- /dev/null +++ b/libs/flake/KoResourceUpdateMediator.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2016 Dmitry Kazakov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __KO_RESOURCE_UPDATE_MEDIATOR_H +#define __KO_RESOURCE_UPDATE_MEDIATOR_H + +#include +#include +#include "kritaflake_export.h" + +/** + * A special mediator class that connects the resource and the + * resource manager. The resource manager connects to a + * sigResourceChanged() changed and when a resource changes, the + * manager calls connectResource() for this resource. After that, the + * mediator should notify the manager about every change that happens + * to the resource by emitting the corresponding signal. + * + * There is only one mediator for one type (key) of the resource. + */ + +class KRITAFLAKE_EXPORT KoResourceUpdateMediator : public QObject +{ + Q_OBJECT +public: + KoResourceUpdateMediator(int key); + virtual ~KoResourceUpdateMediator(); + + int key() const; + virtual void connectResource(QVariant sourceResource) = 0; + +Q_SIGNALS: + void sigResourceChanged(int key); + +private: + struct Private; + const QScopedPointer m_d; +}; + +typedef QSharedPointer KoResourceUpdateMediatorSP; + +#endif /* __KO_RESOURCE_UPDATE_MEDIATOR_H */ diff --git a/libs/flake/tests/TestResourceManager.cpp b/libs/flake/tests/TestResourceManager.cpp index 9f9d2b5bf5..bd31773b43 100644 --- a/libs/flake/tests/TestResourceManager.cpp +++ b/libs/flake/tests/TestResourceManager.cpp @@ -1,144 +1,389 @@ /* This file is part of the KDE project Copyright (C) 2008 Thorsten Zachmann This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "TestResourceManager.h" #include "KoCanvasResourceManager.h" #include "KoResourceManager_p.h" #include "KoPathShape.h" #include "KoUnit.h" #include #include +#include "kis_debug.h" + void TestResourceManager::koShapeResource() { KoPathShape * shape = new KoPathShape(); int key = 9001; KoCanvasResourceManager rp( 0 ); rp.setResource( key, shape ); QVERIFY( shape == rp.koShapeResource( key ) ); } void TestResourceManager::testUnitChanged() { KoCanvasResourceManager rm(0); QSignalSpy spy(&rm, SIGNAL(canvasResourceChanged(int, const QVariant &))); KoUnit a; rm.setResource(KoCanvasResourceManager::Unit, a); QCOMPARE(spy.count(), 1); KoUnit b(KoUnit::Millimeter); rm.setResource(KoCanvasResourceManager::Unit, b); QCOMPARE(spy.count(), 2); } #include "kis_global.h" struct DerivedResource : public KoDerivedResourceConverter { DerivedResource(int key, int sourceKey) : KoDerivedResourceConverter(key, sourceKey) {} QVariant fromSource(const QVariant &value) { return value.toInt() + 10; } QVariant toSource(const QVariant &value, const QVariant &sourceValue) { Q_UNUSED(sourceValue); return value.toInt() - 10; } }; void TestResourceManager::testConverters() { KoResourceManager m; const int key1 = 1; const int key2 = 2; const int derivedKey = 3; m.setResource(key1, 1); m.setResource(key2, 2); QCOMPARE(m.resource(key1).toInt(), 1); QCOMPARE(m.resource(key2).toInt(), 2); QVERIFY(!m.hasResource(derivedKey)); m.addDerivedResourceConverter(toQShared(new DerivedResource(derivedKey, key2))); QCOMPARE(m.resource(derivedKey).toInt(), 12); QVERIFY(m.hasResource(derivedKey)); m.setResource(derivedKey, 15); QCOMPARE(m.resource(key2).toInt(), 5); QCOMPARE(m.resource(derivedKey).toInt(), 15); QVERIFY(m.hasResource(derivedKey)); m.clearResource(derivedKey); QVERIFY(m.hasResource(derivedKey)); m.clearResource(key2); QVERIFY(!m.hasResource(derivedKey)); } void TestResourceManager::testDerivedChanged() { // const int key1 = 1; const int key2 = 2; const int derivedKey = 3; const int otherDerivedKey = 4; KoCanvasResourceManager m(0); m.addDerivedResourceConverter(toQShared(new DerivedResource(derivedKey, key2))); m.addDerivedResourceConverter(toQShared(new DerivedResource(otherDerivedKey, key2))); m.setResource(derivedKey, 15); QCOMPARE(m.resource(key2).toInt(), 5); QCOMPARE(m.resource(derivedKey).toInt(), 15); QSignalSpy spy(&m, SIGNAL(canvasResourceChanged(int, const QVariant &))); m.setResource(derivedKey, 16); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.count(), 3); QList args; args = spy[0]; QCOMPARE(args[0].toInt(), derivedKey); QCOMPARE(args[1].toInt(), 16); + args = spy[1]; + QCOMPARE(args[0].toInt(), key2); + QCOMPARE(args[1].toInt(), 6); + + args = spy[2]; + QCOMPARE(args[0].toInt(), otherDerivedKey); + QCOMPARE(args[1].toInt(), 16); + + spy.clear(); + m.setResource(key2, 7); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.count(), 3); - args = spy[1]; + args = spy[0]; QCOMPARE(args[0].toInt(), key2); QCOMPARE(args[1].toInt(), 7); - args = spy[2]; + args = spy[1]; QCOMPARE(args[0].toInt(), otherDerivedKey); QCOMPARE(args[1].toInt(), 17); - args = spy[3]; + args = spy[2]; QCOMPARE(args[0].toInt(), derivedKey); QCOMPARE(args[1].toInt(), 17); } +struct ComplexResource { + QHash m_resources; +}; + +typedef QSharedPointer ComplexResourceSP; +Q_DECLARE_METATYPE(ComplexResourceSP); + +struct ComplexConverter : public KoDerivedResourceConverter +{ + ComplexConverter(int key, int sourceKey) : KoDerivedResourceConverter(key, sourceKey) {} + + QVariant fromSource(const QVariant &value) { + KIS_ASSERT(value.canConvert()); + ComplexResourceSP res = value.value(); + + return res->m_resources[key()]; + } + + QVariant toSource(const QVariant &value, const QVariant &sourceValue) { + KIS_ASSERT(sourceValue.canConvert()); + ComplexResourceSP res = sourceValue.value(); + + res->m_resources[key()] = value; + return QVariant::fromValue(res); + } +}; + +struct ComplexMediator : public KoResourceUpdateMediator +{ + ComplexMediator(int key) : KoResourceUpdateMediator(key) {} + + void connectResource(QVariant sourceResource) { + m_res = sourceResource; + } + + void forceNotify() { + emit sigResourceChanged(key()); + } + + QVariant m_res; +}; +typedef QSharedPointer ComplexMediatorSP; + +void TestResourceManager::testComplexResource() +{ + const int key = 2; + const int complex1 = 3; + const int complex2 = 4; + + KoCanvasResourceManager m(0); + m.addDerivedResourceConverter(toQShared(new ComplexConverter(complex1, key))); + m.addDerivedResourceConverter(toQShared(new ComplexConverter(complex2, key))); + + ComplexMediatorSP mediator(new ComplexMediator(key)); + m.addResourceUpdateMediator(mediator); + + QSignalSpy spy(&m, SIGNAL(canvasResourceChanged(int, const QVariant &))); + + ComplexResourceSP r1(new ComplexResource()); + r1->m_resources[complex1] = 10; + r1->m_resources[complex2] = 20; + + ComplexResourceSP r2(new ComplexResource()); + r2->m_resources[complex1] = 15; + r2->m_resources[complex2] = 25; + + + // #################################################### + // Initial assignment + // #################################################### + m.setResource(key, QVariant::fromValue(r1)); + + QCOMPARE(mediator->m_res.value(), r1); + QCOMPARE(m.resource(key).value(), r1); + QCOMPARE(m.resource(complex1).toInt(), 10); + QCOMPARE(m.resource(complex2).toInt(), 20); + + QCOMPARE(spy[0][0].toInt(), key); + QCOMPARE(spy[0][1].value(), r1); + QCOMPARE(spy[1][0].toInt(), complex2); + QCOMPARE(spy[1][1].toInt(), 20); + QCOMPARE(spy[2][0].toInt(), complex1); + QCOMPARE(spy[2][1].toInt(), 10); + spy.clear(); + + // #################################################### + // Change the whole resource + // #################################################### + m.setResource(key, QVariant::fromValue(r2)); + + QCOMPARE(mediator->m_res.value(), r2); + QCOMPARE(m.resource(key).value(), r2); + QCOMPARE(m.resource(complex1).toInt(), 15); + QCOMPARE(m.resource(complex2).toInt(), 25); + + QCOMPARE(spy[0][0].toInt(), key); + QCOMPARE(spy[0][1].value(), r2); + QCOMPARE(spy[1][0].toInt(), complex2); + QCOMPARE(spy[1][1].toInt(), 25); + QCOMPARE(spy[2][0].toInt(), complex1); + QCOMPARE(spy[2][1].toInt(), 15); + spy.clear(); + + // #################################################### + // Change a derived resource + // #################################################### + m.setResource(complex1, 16); + + QCOMPARE(mediator->m_res.value(), r2); + QCOMPARE(m.resource(key).value(), r2); + QCOMPARE(m.resource(complex1).toInt(), 16); + QCOMPARE(m.resource(complex2).toInt(), 25); + + QCOMPARE(spy[0][0].toInt(), complex1); + QCOMPARE(spy[0][1].toInt(), 16); + spy.clear(); + + // #################################################### + // Change another derived resource + // #################################################### + m.setResource(complex2, 26); + + QCOMPARE(mediator->m_res.value(), r2); + QCOMPARE(m.resource(key).value(), r2); + QCOMPARE(m.resource(complex1).toInt(), 16); + QCOMPARE(m.resource(complex2).toInt(), 26); + + QCOMPARE(spy[0][0].toInt(), complex2); + QCOMPARE(spy[0][1].toInt(), 26); + spy.clear(); + + // #################################################### + // Switch back the whole source resource + // #################################################### + m.setResource(key, QVariant::fromValue(r1)); + + QCOMPARE(mediator->m_res.value(), r1); + QCOMPARE(m.resource(key).value(), r1); + QCOMPARE(m.resource(complex1).toInt(), 10); + QCOMPARE(m.resource(complex2).toInt(), 20); + + QCOMPARE(spy[0][0].toInt(), key); + QCOMPARE(spy[0][1].value(), r1); + QCOMPARE(spy[1][0].toInt(), complex2); + QCOMPARE(spy[1][1].toInt(), 20); + QCOMPARE(spy[2][0].toInt(), complex1); + QCOMPARE(spy[2][1].toInt(), 10); + spy.clear(); + + // #################################################### + // The value keep unchanged case! + // #################################################### + m.setResource(complex1, 10); + + QCOMPARE(mediator->m_res.value(), r1); + QCOMPARE(m.resource(key).value(), r1); + QCOMPARE(m.resource(complex1).toInt(), 10); + QCOMPARE(m.resource(complex2).toInt(), 20); + + QCOMPARE(spy.size(), 0); + spy.clear(); + + // #################################################### + // While switching a complex resource one derived value + // is kept unchanged + // #################################################### + r2->m_resources[complex1] = 10; + m.setResource(key, QVariant::fromValue(r2)); + + QCOMPARE(mediator->m_res.value(), r2); + QCOMPARE(m.resource(key).value(), r2); + QCOMPARE(m.resource(complex1).toInt(), 10); + QCOMPARE(m.resource(complex2).toInt(), 26); + + QCOMPARE(spy[0][0].toInt(), key); + QCOMPARE(spy[0][1].value(), r2); + QCOMPARE(spy[1][0].toInt(), complex2); + QCOMPARE(spy[1][1].toInt(), 26); + spy.clear(); + + // #################################################### + // No devived values are changed! + // #################################################### + *r1 = *r2; + m.setResource(key, QVariant::fromValue(r1)); + + QCOMPARE(mediator->m_res.value(), r1); + QCOMPARE(m.resource(key).value(), r1); + QCOMPARE(m.resource(complex1).toInt(), 10); + QCOMPARE(m.resource(complex2).toInt(), 26); + + QCOMPARE(spy[0][0].toInt(), key); + QCOMPARE(spy[0][1].value(), r1); + spy.clear(); + + // #################################################### + // Try to set the same pointer. No signals emitted! + // #################################################### + m.setResource(key, QVariant::fromValue(r1)); + + QCOMPARE(mediator->m_res.value(), r1); + QCOMPARE(m.resource(key).value(), r1); + QCOMPARE(m.resource(complex1).toInt(), 10); + QCOMPARE(m.resource(complex2).toInt(), 26); + + QCOMPARE(spy.size(), 0); + spy.clear(); + + + // #################################################### + // Internals 'officially' changed, but the values not + // #################################################### + mediator->forceNotify(); + + QCOMPARE(spy.size(), 0); + spy.clear(); + + // #################################################### + // We changed the values, but didn't notify anyone :) + // #################################################### + r1->m_resources[complex1] = 11; + r1->m_resources[complex2] = 21; + + mediator->forceNotify(); + + QCOMPARE(spy[0][0].toInt(), complex2); + QCOMPARE(spy[0][1].toInt(), 21); + QCOMPARE(spy[1][0].toInt(), complex1); + QCOMPARE(spy[1][1].toInt(), 11); + spy.clear(); +} + + QTEST_MAIN(TestResourceManager) diff --git a/libs/flake/tests/TestResourceManager.h b/libs/flake/tests/TestResourceManager.h index a0ef6826ae..947361db43 100644 --- a/libs/flake/tests/TestResourceManager.h +++ b/libs/flake/tests/TestResourceManager.h @@ -1,35 +1,36 @@ /* This file is part of the KDE project Copyright (C) 2008 Thorsten Zachmann This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef TESTRESOURCEMANAGER_H #define TESTRESOURCEMANAGER_H #include class TestResourceManager : public QObject { Q_OBJECT private Q_SLOTS: void koShapeResource(); void testUnitChanged(); void testConverters(); void testDerivedChanged(); + void testComplexResource(); }; #endif // TESTRESOURCEMANAGER_H diff --git a/libs/global/kis_dom_utils.cpp b/libs/global/kis_dom_utils.cpp index e0e47e8c34..206afecbed 100644 --- a/libs/global/kis_dom_utils.cpp +++ b/libs/global/kis_dom_utils.cpp @@ -1,264 +1,275 @@ /* * Copyright (c) 2014 Dmitry Kazakov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kis_dom_utils.h" #include #include "kis_debug.h" namespace KisDomUtils { void saveValue(QDomElement *parent, const QString &tag, const QSize &size) { QDomDocument doc = parent->ownerDocument(); QDomElement e = doc.createElement(tag); parent->appendChild(e); e.setAttribute("type", "size"); e.setAttribute("w", toString(size.width())); e.setAttribute("h", toString(size.height())); } void saveValue(QDomElement *parent, const QString &tag, const QRect &rc) { QDomDocument doc = parent->ownerDocument(); QDomElement e = doc.createElement(tag); parent->appendChild(e); e.setAttribute("type", "rect"); e.setAttribute("x", toString(rc.x())); e.setAttribute("y", toString(rc.y())); e.setAttribute("w", toString(rc.width())); e.setAttribute("h", toString(rc.height())); } void saveValue(QDomElement *parent, const QString &tag, const QPoint &pt) { QDomDocument doc = parent->ownerDocument(); QDomElement e = doc.createElement(tag); parent->appendChild(e); e.setAttribute("type", "point"); e.setAttribute("x", toString(pt.x())); e.setAttribute("y", toString(pt.y())); } void saveValue(QDomElement *parent, const QString &tag, const QPointF &pt) { QDomDocument doc = parent->ownerDocument(); QDomElement e = doc.createElement(tag); parent->appendChild(e); e.setAttribute("type", "pointf"); e.setAttribute("x", toString(pt.x())); e.setAttribute("y", toString(pt.y())); } void saveValue(QDomElement *parent, const QString &tag, const QVector3D &pt) { QDomDocument doc = parent->ownerDocument(); QDomElement e = doc.createElement(tag); parent->appendChild(e); e.setAttribute("type", "vector3d"); e.setAttribute("x", toString(pt.x())); e.setAttribute("y", toString(pt.y())); e.setAttribute("z", toString(pt.z())); } void saveValue(QDomElement *parent, const QString &tag, const QTransform &t) { QDomDocument doc = parent->ownerDocument(); QDomElement e = doc.createElement(tag); parent->appendChild(e); e.setAttribute("type", "transform"); e.setAttribute("m11", toString(t.m11())); e.setAttribute("m12", toString(t.m12())); e.setAttribute("m13", toString(t.m13())); e.setAttribute("m21", toString(t.m21())); e.setAttribute("m22", toString(t.m22())); e.setAttribute("m23", toString(t.m23())); e.setAttribute("m31", toString(t.m31())); e.setAttribute("m32", toString(t.m32())); e.setAttribute("m33", toString(t.m33())); } bool findOnlyElement(const QDomElement &parent, const QString &tag, QDomElement *el, QStringList *errorMessages) { QDomNodeList list = parent.elementsByTagName(tag); if (list.size() != 1 || !list.at(0).isElement()) { QString msg = i18n("Could not find \"%1\" XML tag in \"%2\"", tag, parent.tagName()); if (errorMessages) { *errorMessages << msg; } else { warnKrita << msg; } return false; } *el = list.at(0).toElement(); return true; } +bool removeElements(QDomElement &parent, const QString &tag) { + QDomNodeList list = parent.elementsByTagName(tag); + KIS_SAFE_ASSERT_RECOVER_NOOP(list.size() <= 1); + + for (int i = 0; i < list.size(); i++) { + parent.removeChild(list.at(i)); + } + + return list.size() > 0; +} + namespace Private { bool checkType(const QDomElement &e, const QString &expectedType) { QString type = e.attribute("type", "unknown-type"); if (type != expectedType) { warnKrita << i18n("Error: incorrect type (%2) for value %1. Expected %3", e.tagName(), type, expectedType); return false; } return true; } } bool loadValue(const QDomElement &e, float *v) { if (!Private::checkType(e, "value")) return false; *v = toDouble(e.attribute("value", "0")); return true; } bool loadValue(const QDomElement &e, double *v) { if (!Private::checkType(e, "value")) return false; *v = toDouble(e.attribute("value", "0")); return true; } bool loadValue(const QDomElement &e, QSize *size) { if (!Private::checkType(e, "size")) return false; size->setWidth(toInt(e.attribute("w", "0"))); size->setHeight(toInt(e.attribute("h", "0"))); return true; } bool loadValue(const QDomElement &e, QRect *rc) { if (!Private::checkType(e, "rect")) return false; rc->setX(toInt(e.attribute("x", "0"))); rc->setY(toInt(e.attribute("y", "0"))); rc->setWidth(toInt(e.attribute("w", "0"))); rc->setHeight(toInt(e.attribute("h", "0"))); return true; } bool loadValue(const QDomElement &e, QPoint *pt) { if (!Private::checkType(e, "point")) return false; pt->setX(toInt(e.attribute("x", "0"))); pt->setY(toInt(e.attribute("y", "0"))); return true; } bool loadValue(const QDomElement &e, QPointF *pt) { if (!Private::checkType(e, "pointf")) return false; pt->setX(toDouble(e.attribute("x", "0"))); pt->setY(toDouble(e.attribute("y", "0"))); return true; } bool loadValue(const QDomElement &e, QVector3D *pt) { if (!Private::checkType(e, "vector3d")) return false; pt->setX(toDouble(e.attribute("x", "0"))); pt->setY(toDouble(e.attribute("y", "0"))); pt->setZ(toDouble(e.attribute("z", "0"))); return true; } bool loadValue(const QDomElement &e, QTransform *t) { if (!Private::checkType(e, "transform")) return false; qreal m11 = toDouble(e.attribute("m11", "1.0")); qreal m12 = toDouble(e.attribute("m12", "0.0")); qreal m13 = toDouble(e.attribute("m13", "0.0")); qreal m21 = toDouble(e.attribute("m21", "0.0")); qreal m22 = toDouble(e.attribute("m22", "1.0")); qreal m23 = toDouble(e.attribute("m23", "0.0")); qreal m31 = toDouble(e.attribute("m31", "0.0")); qreal m32 = toDouble(e.attribute("m32", "0.0")); qreal m33 = toDouble(e.attribute("m33", "1.0")); t->setMatrix( m11, m12, m13, m21, m22, m23, m31, m32, m33); return true; } bool loadValue(const QDomElement &e, QString *value) { if (!Private::checkType(e, "value")) return false; *value = e.attribute("value", "no-value"); return true; } QDomElement findElementByAttibute(QDomNode parent, const QString &tag, const QString &attribute, const QString &key) { QDomNode node = parent.firstChild(); while (!node.isNull()) { QDomElement el = node.toElement(); if (!el.isNull() && el.tagName() == tag) { QString value = el.attribute(attribute, ""); if (value == key) return el; } node = node.nextSibling(); } return QDomElement(); } } diff --git a/libs/global/kis_dom_utils.h b/libs/global/kis_dom_utils.h index e1e44fa158..92006ed6f8 100644 --- a/libs/global/kis_dom_utils.h +++ b/libs/global/kis_dom_utils.h @@ -1,239 +1,241 @@ /* * Copyright (c) 2014 Dmitry Kazakov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __KIS_DOM_UTILS_H #define __KIS_DOM_UTILS_H #include #include #include #include #include #include #include "kritaglobal_export.h" #include "kis_debug.h" namespace KisDomUtils { inline QString toString(const QString &value) { return value; } template inline QString toString(T value) { return QString::number(value); } inline int toInt(const QString &str) { bool ok = false; int value = 0; QLocale c(QLocale::German); value = str.toInt(&ok); if (!ok) { value = c.toInt(str, &ok); } if (!ok) { warnKrita << "WARNING: KisDomUtils::toInt failed:" << ppVar(str); value = 0; } return value; } inline double toDouble(const QString &str) { bool ok = false; double value = 0; QLocale c(QLocale::German); /** * A special workaround to handle ','/'.' decimal point * in different locales. Added for backward compatibility, * because we used to save qreals directly using * * e.setAttribute("w", (qreal)value), * * which did local-aware conversion. */ value = str.toDouble(&ok); if (!ok) { value = c.toDouble(str, &ok); } if (!ok) { warnKrita << "WARNING: KisDomUtils::toDouble failed:" << ppVar(str); value = 0; } return value; } /** * Save a value of type QRect into an XML tree. A child for \p parent * is created and assigned a tag \p tag. The corresponding value can * be fetched from the XML using loadValue() later. * * \see loadValue() */ void KRITAGLOBAL_EXPORT saveValue(QDomElement *parent, const QString &tag, const QRect &rc); void KRITAGLOBAL_EXPORT saveValue(QDomElement *parent, const QString &tag, const QSize &size); void KRITAGLOBAL_EXPORT saveValue(QDomElement *parent, const QString &tag, const QPoint &pt); void KRITAGLOBAL_EXPORT saveValue(QDomElement *parent, const QString &tag, const QPointF &pt); void KRITAGLOBAL_EXPORT saveValue(QDomElement *parent, const QString &tag, const QVector3D &pt); void KRITAGLOBAL_EXPORT saveValue(QDomElement *parent, const QString &tag, const QTransform &t); /** * Save a value of a scalar type into an XML tree. A child for \p parent * is created and assigned a tag \p tag. The corresponding value can * be fetched from the XML using loadValue() later. * * \see loadValue() */ template void saveValue(QDomElement *parent, const QString &tag, T value) { QDomDocument doc = parent->ownerDocument(); QDomElement e = doc.createElement(tag); parent->appendChild(e); e.setAttribute("type", "value"); e.setAttribute("value", toString(value)); } /** * Save a vector of values into an XML tree. A child for \p parent is * created and assigned a tag \p tag. The values in the array should * have a type supported by saveValue() overrides. The corresponding * vector can be fetched from the XML using loadValue() later. * * \see loadValue() */ -template -void saveValue(QDomElement *parent, const QString &tag, const QVector &array) +template