project(flake)

include_directories(${FLAKE_INCLUDES} ${QT_INCLUDES})

if(KDE4_BUILD_TESTS)
    # only with this definition will the FLAKE_TEST_EXPORT macro do something
    add_definitions(-DCOMPILING_TESTS)
endif(KDE4_BUILD_TESTS)

add_subdirectory(tests)
add_subdirectory(pics)

set(flake_SRCS
    KoFlake.cpp
    KoCanvasBase.cpp
    KoResourceManager.cpp
    KoCanvasObserverBase.cpp
    KoCanvasSupervisor.cpp
    KoCutController.cpp
    KoCopyController.cpp
    KoDockFactoryBase.cpp
    KoDockRegistry.cpp
    KoDataCenterBase.cpp
    KoInsets.cpp
    KoPasteController.cpp
    KoGuidesData.cpp
    KoPathShape.cpp
    KoPathPoint.cpp
    KoPathSegment.cpp
    KoSelection.cpp
    KoShape.cpp
    KoShapeControllerBase.cpp
    KoShapeApplicationData.cpp
    KoShapeContainer.cpp
    KoShapeContainerModel.cpp
    KoShapeContainerDefaultModel.cpp
    KoShapeGroup.cpp
    KoShapeManagerPaintingStrategy.cpp
    KoShapeManager.cpp
    KoShapePainter.cpp
    KoFrameShape.cpp
    KoToolBase.cpp
    KoCanvasController.cpp
    KoCanvasControllerWidget.cpp
    KoCanvasControllerWidgetViewport_p.cpp
    KoShapeRegistry.cpp
    KoToolFactoryBase.cpp
    KoPathShapeFactory.cpp
    KoShapeFactoryBase.cpp
    KoShapeUserData.cpp
    KoPointGroup.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
    ShapeDeleter_p.cpp
    KoShapeBorderModel.cpp
    KoShapeBorderFactoryBase.cpp
    KoShapeBorderRegistry.cpp
    KoLineBorder.cpp
    KoLineBorderFactory.cpp
    KoShapeBackground.cpp
    KoColorBackground.cpp
    KoGradientBackground.cpp
    KoPatternBackground.cpp
    KoShapeConfigWidgetBase.cpp
    KoShapeConfigFactoryBase.cpp
    KoDrag.cpp
    KoDragOdfSaveHelper.cpp
    KoShapeOdfSaveHelper.cpp
    KoShapePaste.cpp
    KoConnectionShape.cpp
    KoConnectionShapeLoadingUpdater.cpp
    KoConnectionShapeFactory.cpp
    KoConnectionShapeConfigWidget.cpp
    KoSnapGuide.cpp
    KoSnapProxy.cpp
    KoSnapStrategy.cpp
    KoSnapData.cpp
    SnapGuideConfigWidget.cpp
    KoShapeShadow.cpp
    KoSharedSavingData.cpp
    KoViewConverter.cpp
    KoInputDeviceHandler.cpp
    KoInputDeviceHandlerEvent.cpp
    KoInputDeviceHandlerRegistry.cpp
    KoEventAction.cpp
    KoEventActionFactoryBase.cpp
    KoEventActionRegistry.cpp
    KoImageData.cpp
    KoImageData_p.cpp
    KoImageCollection.cpp
    KoOdfWorkaround.cpp
    KoFilterEffect.cpp
    KoFilterEffectStack.cpp
    KoFilterEffectFactoryBase.cpp
    KoFilterEffectRegistry.cpp
    KoFilterEffectConfigWidgetBase.cpp
    KoFilterEffectRenderContext.cpp
    KoFilterEffectLoadingContext.cpp
    KoTextOnShapeContainer.cpp
    KoTextShapeDataBase.cpp
    commands/KoShapeGroupCommand.cpp
    commands/KoShapeAlignCommand.cpp
    commands/KoShapeBackgroundCommand.cpp
    commands/KoShapeBorderCommand.cpp
    commands/KoShapeCreateCommand.cpp
    commands/KoShapeDeleteCommand.cpp
    commands/KoShapeDistributeCommand.cpp
    commands/KoShapeLockCommand.cpp
    commands/KoShapeMoveCommand.cpp
    commands/KoShapeShearCommand.cpp
    commands/KoShapeSizeCommand.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/KoPathSeparateCommand.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/KoEventActionAddCommand.cpp
    commands/KoEventActionRemoveCommand.cpp
    commands/KoShapeRenameCommand.cpp
    commands/KoPathPointMergeCommand.cpp
    commands/KoShapeTransparencyCommand.cpp
    tools/KoCreatePathTool.cpp
    tools/KoCreatePathToolFactory.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
)

kde4_add_ui_files(flake_SRCS
    tools/PathToolOptionWidgetBase.ui
    KoConnectionShapeConfigWidget.ui
    SnapGuideConfigWidget.ui
    tools/KoZoomToolWidget.ui
)

kde4_add_library(flake SHARED ${flake_SRCS})

target_link_libraries(flake ${KDE4_KDEUI_LIBS} pigmentcms koodf)

target_link_libraries(flake LINK_INTERFACE_LIBRARIES pigmentcms koodf)

if(HAVE_OPENGL)
    target_link_libraries(flake ${OPENGL_LIBRARIES} ${QT_QTOPENGL_LIBRARY})
endif(HAVE_OPENGL)

set_target_properties(flake PROPERTIES
    VERSION ${GENERIC_KOFFICE_LIB_VERSION} SOVERSION ${GENERIC_KOFFICE_LIB_SOVERSION}
)

########### install files ###############

install(TARGETS flake  ${INSTALL_TARGETS_DEFAULT_ARGS})
install( FILES 
    flake.desktop 
    flaketool.desktop 
    flakeshape.desktop 
    flakedevice.desktop 
    presentationeventaction.desktop 
    scripteventaction.desktop 
    filtereffect.desktop
    DESTINATION ${SERVICETYPES_INSTALL_DIR})

install(
    FILES
    flake_export.h
    KoCanvasBase.h
    KoCanvasController.h
    KoCanvasControllerWidget.h
    KoCanvasObserverBase.h
    KoCanvasSupervisor.h
    KoResourceManager.h
    KoCopyController.h
    KoCutController.h
    KoDataCenterBase.h
    KoDockFactoryBase.h
    KoDockRegistry.h
    KoDrag.h
    KoDragOdfSaveHelper.h
    KoFlake.h
    KoFrameShape.h
    KoGuidesData.h
    KoImageCollection.h
    KoImageData.h
    KoInputDevice.h
    KoInsets.h
    KoPathSegment.h
    KoPointerEvent.h
    KoSelection.h
    KoShape.h
    KoShapeBorderModel.h
    KoToolSelection.h
    KoShapeContainer.h
    KoShapeContainerModel.h
    KoShapeContainerDefaultModel.h
    KoShapeController.h
    KoShapeControllerBase.h
    KoShapeFactoryBase.h
    KoShapeGroup.h
    KoShapeLayer.h
    KoShapePainter.h
    KoShapeLoadingContext.h
    KoShapeOdfSaveHelper.h
    KoLoadingShapeUpdater.h
    KoShapeConfigWidgetBase.h
    KoShapeManager.h
    KoShapeRegistry.h
    KoShapeSavingContext.h
    KoShapeUserData.h
    KoShapeApplicationData.h
    KoSharedSavingData.h
    KoTextOnShapeContainer.h
    KoTextShapeDataBase.h
    KoToolBase.h
    KoToolManager.h
    KoToolFactoryBase.h
    KoToolProxy.h
    KoToolRegistry.h
    KoFilterEffect.h
    KoFilterEffectStack.h
    KoFilterEffectFactoryBase.h
    KoFilterEffectRegistry.h
    KoFilterEffectConfigWidgetBase.h
    KoFilterEffectRenderContext.h
    KoFilterEffectLoadingContext.h
    commands/KoEventActionAddCommand.h
    commands/KoEventActionRemoveCommand.h
    commands/KoParameterToPathCommand.h
    commands/KoPathCombineCommand.h
    commands/KoPathControlPointMoveCommand.h
    commands/KoPathFillRuleCommand.h
    commands/KoPathPointInsertCommand.h
    commands/KoPathPointMergeCommand.h
    commands/KoPathPointMoveCommand.h
    commands/KoPathPointRemoveCommand.h
    commands/KoPathPointTypeCommand.h
    commands/KoPathReverseCommand.h
    commands/KoPathSegmentTypeCommand.h
    commands/KoPathSeparateCommand.h
    commands/KoShapeAlignCommand.h
    commands/KoShapeBackgroundCommand.h
    commands/KoShapeBorderCommand.h
    commands/KoShapeCreateCommand.h
    commands/KoShapeDeleteCommand.h
    commands/KoShapeDistributeCommand.h
    commands/KoShapeGroupCommand.h
    commands/KoShapeMoveCommand.h
    commands/KoShapeRenameCommand.h
    commands/KoShapeReorderCommand.h
    commands/KoShapeShadowCommand.h
    commands/KoShapeShearCommand.h
    commands/KoShapeSizeCommand.h
    commands/KoShapeTransformCommand.h
    commands/KoShapeUngroupCommand.h
    commands/KoSubpathRemoveCommand.h
    tools/KoInteractionTool.h
    KoViewConverter.h
    DESTINATION
    ${INCLUDE_INSTALL_DIR} COMPONENT Devel
)
