CMakeLists.txt 5.59 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
project(krita)
Laurent Montel's avatar
Laurent Montel committed
2

Dmitry Kazakov's avatar
Dmitry Kazakov committed
3
set(KRITA_DEFAULT_TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/sdk/tests/data/)
4

Dmitry Kazakov's avatar
Dmitry Kazakov committed
5
6
7
8
9
10
11
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()

#
12
13
# The reason for this mode is that the Debug mode disable inlining
#
14
if(CMAKE_COMPILER_IS_GNUCXX)
15
    set(CMAKE_CXX_FLAGS_KRITADEVS "-O3 -g" CACHE STRING "" FORCE)
16
17
endif(CMAKE_COMPILER_IS_GNUCXX)

18
if(MSVC OR (WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"))
Halla Rempt's avatar
Halla Rempt committed
19
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
20
endif(MSVC OR (WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"))
Halla Rempt's avatar
Halla Rempt committed
21

22
23
24
25
26
27
28
29
include(CheckFunctionExists)

macro_optional_find_package(GLEW)
macro_bool_to_01(GLEW_FOUND HAVE_GLEW)
configure_file(config-glew.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-glew.h )
macro_log_feature(HAVE_GLEW "GLEW" "The OpenGL Extension Wrangler Library" "http://glew.sourceforge.net" FALSE "" "Required by the Krita shader filter plugin")

if(HAVE_GLEW)
30
    message(STATUS "GLEW found!")
31
else(HAVE_GLEW)
32
    message(STATUS "GLEW NOT found - krita will not be able to use OpenGL.")
33
endif(HAVE_GLEW)
34

35
36
37
38
39
40
if(HAVE_OPENGL)
    message(STATUS "OpenGL found -- krita will be able  to use OpenGL for hardware accelerated rendering.")
else(HAVE_OPENGL)
    message(STATUS "OpenGL NOT found - krita will not be able to use OpenGL for hardware accelerated rendering.")
endif(HAVE_OPENGL)

41
42
43
44
45
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)
configure_file(config-ocio.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-ocio.h )

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
if(UNIX)
    set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};m")
endif(UNIX)

check_function_exists(powf HAVE_POWF)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-powf.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-powf.h)

set(LINK_OPENEXR_LIB)
if(OPENEXR_FOUND)
    include_directories(${OPENEXR_INCLUDE_DIR})
    set(LINK_OPENEXR_LIB ${OPENEXR_LIBRARIES})
    add_definitions(${OPENEXR_DEFINITIONS})
endif(OPENEXR_FOUND)

if(WIN32)
    if(MSVC)
        # C4522: 'class' : multiple assignment operators specified
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4522")
    endif(MSVC)
endif(WIN32)

set(KRITA_INCLUDES
    # For config-*.h
    ${CMAKE_CURRENT_BINARY_DIR}

    ${CMAKE_SOURCE_DIR}/krita/image
    ${CMAKE_SOURCE_DIR}/krita/image/brushengine
    ${CMAKE_SOURCE_DIR}/krita/image/tiles
    ${CMAKE_SOURCE_DIR}/krita/ui
76
    ${CMAKE_SOURCE_DIR}/krita/ui/canvas
77
78
    ${CMAKE_SOURCE_DIR}/krita/ui/tool
    ${CMAKE_SOURCE_DIR}/krita/ui/flake
79
    ${CMAKE_SOURCE_DIR}/krita/ui/widgets
80
81
82
83
84
85
86

    # For generated files from .ui
    ${CMAKE_BINARY_DIR}/krita/ui
    
    ${PIGMENT_INCLUDES}
    ${KOTEXT_INCLUDES}
    ${KOMAIN_INCLUDES}
C. Boemann's avatar
C. Boemann committed
87
    ${BASICFLAKES_INCLUDES}
88
    ${CMAKE_SOURCE_DIR}/libs/widgets/resources
89
    ${CMAKE_SOURCE_DIR}/libs/widgets/colorwidgets
90
91
    ${CMAKE_SOURCE_DIR}/libs/widgetutils

92
    ${EIGEN2_INCLUDE_DIR}
93
    ${Vc_INCLUDE_DIR}
94

95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
    # 'Export' this for use by filters
    CACHE INTERNAL ""
)

include_directories(${KRITA_INCLUDES})

if(HAVE_OPENGL)
    include_directories(${OPENGL_INCLUDE_DIR})
    if(HAVE_GLEW)
        include_directories(${GLEW_INCLUDE_DIR})
    endif(HAVE_GLEW)
endif(HAVE_OPENGL)

add_subdirectory( image )
add_subdirectory( ui )
add_subdirectory( dtd )
add_subdirectory( plugins )
add_subdirectory( data )
add_subdirectory( pics )
114
if (NOT WIN32)
115
    add_subdirectory( benchmarks )
116
endif (NOT WIN32)
117
118

set(kritapart_PART_SRCS krita_part_init.cc)
119
kde4_add_plugin(kritapart ${kritapart_PART_SRCS})
120
121
122
123
target_link_libraries(kritapart kritaui)
install(TARGETS kritapart DESTINATION ${PLUGIN_INSTALL_DIR})

set(krita_KDEINIT_SRCS main.cc)
124
kde4_add_app_icon(krita_KDEINIT_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/pics/app/hi*-app-calligrakrita.png")
125
126
127
128
kde4_add_kdeinit_executable(krita ${krita_KDEINIT_SRCS})

if (Q_WS_MAC)
    set_target_properties(krita PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.template)
Halla Rempt's avatar
Halla Rempt committed
129
    set_target_properties(krita PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER "org.calligra.krita")
130
131
132
133
    set_target_properties(krita PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Krita 2")
endif (Q_WS_MAC)

target_link_libraries(kdeinit_krita kritaui)
134
target_link_libraries(krita kdeinit_krita)
135

136
137
138
139
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
    find_package(OpenCTL)
    find_package(OpenShiva)
    find_package(QtShiva )
140
141
    
    if(NOT ${OPENCTL_VERSION} VERSION_GREATER 0.9.15.1 )
142
143
144
145
146
147
148
149
150
151
152
153
154
155
        # Workaround for the following issues:
        # http://bugs.kde.org/274675 http://bugs.kde.org/248051
        # http://redmine.opengtl.org/issues/72
        message(status "Found OpenGTL < 0.9.15.1, on a 64 bits system, krita will be forced linked to the libraries to make sure opengtl symbols are available")
        if(HAVE_OPENSHIVA AND HAVE_QTSHIVA)
            target_link_libraries(krita ${OPENSHIVA_LDFLAGS})
        endif()

        if(OPENCTL_FOUND AND OPENEXR_FOUND)
            target_link_libraries(krita ${OPENCTL_LDFLAGS})
        endif()
    endif()
endif()

156
157
install(TARGETS krita ${INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS kdeinit_krita ${INSTALL_TARGETS_DEFAULT_ARGS})
158
159
160
161
install(PROGRAMS krita.desktop  DESTINATION ${XDG_APPS_INSTALL_DIR})
install(FILES  kritapart.desktop  DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES  krita.rc DESTINATION ${DATA_INSTALL_DIR}/krita)
install(FILES  krita.appdata.xml DESTINATION ${SHARE_INSTALL_PREFIX}/appdata/ )
162

163
add_subdirectory(tablettester)
164
165
add_subdirectory(sketch)
add_subdirectory(gemini)
166