CMakeLists.txt 4.77 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
# Copyright (C) 2012, 2013 Shaheed Haque <srhaque@theiet.org>
# Copyright (C) 2013 Alex Turbov <i.zaufi@gmail.com>
# Copyright (C) 2014-2016 Boudewijn Rempt <boud@valdyas.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

include(CMakeParseArguments)

#
# Simple helper function to install plugin and related files
# having only a name of the plugin...
# (just to reduce syntactic noise when a lot of plugins get installed)
#
function(install_pykrita_plugin name)
    set(_options)
    set(_one_value_args)
    set(_multi_value_args PATTERNS FILE)
    cmake_parse_arguments(install_pykrita_plugin "${_options}" "${_one_value_args}" "${_multi_value_args}" ${ARGN})
    if(NOT name)
        message(FATAL_ERROR "Plugin filename is not given")
    endif()
    if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.py)
        install(FILES kritapykrita_${name}.desktop DESTINATION ${DATA_INSTALL_DIR}/krita/pykrita)
        foreach(_f ${name}.py ${name}.ui ${install_pykrita_plugin_FILE})
            if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_f})
                install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${_f} DESTINATION ${DATA_INSTALL_DIR}/krita/pykrita)
            endif()
        endforeach()
    elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${name})
        install(FILES ${name}/kritapykrita_${name}.desktop DESTINATION ${DATA_INSTALL_DIR}/krita/pykrita)
        install(
            DIRECTORY ${name}
            DESTINATION ${DATA_INSTALL_DIR}/krita/pykrita
            FILES_MATCHING
                PATTERN "*.py"
                PATTERN "*.ui"
56 57
                PATTERN "*.txt"
                PATTERN "*.csv"
58
                PATTERN "*.html"
59
                PATTERN "__pycache__*" EXCLUDE
60
                PATTERN "tests*" EXCLUDE
61 62 63 64 65 66 67 68 69 70 71
           )
        # TODO Is there any way to form a long PATTERN options string
        # and use it in a single install() call?
        # NOTE Install specified patterns one-by-one...
        foreach(_pattern ${install_pykrita_plugin_PATTERNS})
            install(
                DIRECTORY ${name}
                DESTINATION ${DATA_INSTALL_DIR}/krita/pykrita
                FILES_MATCHING
                    PATTERN "${_pattern}"
                    PATTERN "__pycache__*" EXCLUDE
72
		    PATTERN "tests*" EXCLUDE
73 74 75 76 77 78 79
              )
        endforeach()
    else()
        message(FATAL_ERROR "Do not know what to do with ${name}")
    endif()
endfunction()

Boudewijn Rempt's avatar
Boudewijn Rempt committed
80
install_pykrita_plugin(hello)
81 82
install_pykrita_plugin(assignprofiledialog)
install_pykrita_plugin(scripter)
Eliakin Costa's avatar
Eliakin Costa committed
83
install_pykrita_plugin(colorspace)
84
install_pykrita_plugin(documenttools)
Eliakin Costa's avatar
Eliakin Costa committed
85
install_pykrita_plugin(filtermanager)
Eliakin Costa's avatar
Eliakin Costa committed
86
install_pykrita_plugin(exportlayers)
87 88
#install_pykrita_plugin(highpass)
install_pykrita_plugin(tenbrushes)
89
install_pykrita_plugin(tenscripts)
90
#install_pykrita_plugin(palette_docker)  # Needs fixing -> bug 405194
91
install_pykrita_plugin(quick_settings_docker)
92
install_pykrita_plugin(lastdocumentsdocker)
93
# install_pykrita_plugin(scriptdocker)
94
install_pykrita_plugin(comics_project_management_tools)
Brendan Bd's avatar
Brendan Bd committed
95
install_pykrita_plugin(krita_script_starter)
96
install_pykrita_plugin(plugin_importer)
97 98 99 100 101 102 103

# if(PYTHON_VERSION_MAJOR VERSION_EQUAL 3)
#     install_pykrita_plugin(cmake_utils)
#     install_pykrita_plugin(js_utils PATTERNS "*.json")
#     install_pykrita_plugin(expand PATTERNS "*.expand" "templates/*.tpl")
# endif()

104 105 106 107
install( FILES
    hello/hello.action
    tenbrushes/tenbrushes.action
    tenscripts/tenscripts.action
108
    plugin_importer/plugin_importer.action
109 110
DESTINATION  ${DATA_INSTALL_DIR}/krita/actions)

111 112 113 114 115 116 117
install(
    DIRECTORY libkritapykrita
    DESTINATION ${DATA_INSTALL_DIR}/krita/pykrita
    FILES_MATCHING
        PATTERN "*.py"
        PATTERN "__pycache__*" EXCLUDE
  )