#################################################################################
#   The MIT License
#   
#   Tempest Renderer
#   Copyright (c) 2015 Zdravko Velinov
#   
#   Permission is hereby granted, free of charge, to any person obtaining a copy
#   of this software and associated documentation files (the "Software"), to deal
#   in the Software without restriction, including without limitation the rights
#   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#   copies of the Software, and to permit persons to whom the Software is
#   furnished to do so, subject to the following conditions:
#
#   The above copyright notice and this permission notice shall be included in
#   all copies or substantial portions of the Software.
#
#   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#   THE SOFTWARE.
##################################################################################

SET(CMAKE_INCLUDE_CURRENT_DIR ON)

SET(CMAKE_AUTOMOC ON)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}
                    ${CMAKE_SOURCE_DIR}/include
                    ${CMAKE_BINARY_DIR}/include
                    ${CMAKE_SOURCE_DIR}/external
                    ${TEMPEST_NDA_INCLUDE_DIRS}
                    ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
                   )

SET(SCRATCH_EDITOR_UI scratch-editor.ui)

QT5_WRAP_UI(SCRATCH_EDITOR_UI_H ${SCRATCH_EDITOR_UI})

ADD_LIBRARY(scratch-generation OBJECT
            scratch-generation.cc
            scratch-generation.hh)

SET_PROPERTY(TARGET scratch-generation PROPERTY FOLDER "Tools/Scratch Editor")

SET(SCRATCH_EDITOR_SRC
    scratch-editor.cc
    scratch-editor-view.cc
    )

SET(SCRATCH_EDITOR_INC
    scratch-editor-view.hh
    )

TEMPEST_ADD_EXECUTABLE(scratch-editor WIN32 $<TARGET_OBJECTS:scratch-generation> ${SCRATCH_EDITOR_SRC} ${SCRATCH_EDITOR_INC} ${SCRATCH_EDITOR_UI} ${SCRATCH_EDITOR_UI_H})
SET_PROPERTY(TARGET scratch-editor PROPERTY FOLDER "Tools/Scratch Editor")

ADD_DEPENDENCIES(scratch-editor BuildAssets)

TARGET_LINK_LIBRARIES(scratch-editor tempest-qt-widgets tempest-main tempest-static)

#################################################################################

TEMPEST_ADD_EXECUTABLE(scratch-generation-test WIN32 $<TARGET_OBJECTS:scratch-generation> scratch-generation-test.cc)
TARGET_LINK_LIBRARIES(scratch-generation-test tempest-main tempest-static)

ADD_TEST(scratch-generation-test scratch-generation-test)

SET_PROPERTY(TARGET scratch-generation-test PROPERTY FOLDER "Tools/Scratch Editor/Tests")