# SPDX-License-Identifier: GPL-3.0-only
# MuseScore-CLA-applies
#
# MuseScore
# Music Composition & Notation
#
# Copyright (C) 2021 MuseScore Limited and others
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# 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, see <https://www.gnu.org/licenses/>.

muse_create_module(muse_dockwindow ALIAS muse::dockwindow)

target_sources(muse_dockwindow PRIVATE
    dockmodule.cpp
    dockmodule.h
    docktypes.h
    idockwindow.h
    idockwindowprovider.h

    internal/dockbase.cpp
    internal/dockbase.h
    internal/dockseparator.cpp
    internal/dockseparator.h
    internal/docktabbar.cpp
    internal/docktabbar.h
    internal/docktitlebar.cpp
    internal/docktitlebar.h
    internal/dockwindowactionscontroller.cpp
    internal/dockwindowactionscontroller.h
    internal/dockwindowprovider.cpp
    internal/dockwindowprovider.h
    internal/dropcontroller.cpp
    internal/dropcontroller.h
    )

###########################################
# Setup the KDDockWidgets lib
###########################################
if (NOT BUILD_SHARED_LIBS)
    set(KDDockWidgets_STATIC ON CACHE BOOL "Build static versions of the libraries" FORCE)
endif(NOT BUILD_SHARED_LIBS)

set(KDDockWidgets_QT6 ON CACHE BOOL "Build against Qt 6" FORCE)
set(KDDockWidgets_QTQUICK ON CACHE BOOL "Build for QtQuick instead of QtWidgets" FORCE)
set(KDDockWidgets_EXAMPLES OFF CACHE BOOL "Build the examples" FORCE)
add_subdirectory(thirdparty/KDDockWidgets EXCLUDE_FROM_ALL)

target_link_libraries(muse_dockwindow PRIVATE kddockwidgets)

target_no_warning(muse_dockwindow -WMSVC-no-unreachable) # workaround for a warning generated by Qt 5.9.1 code

if (MUSE_MODULE_DOCKWINDOW_QML)
    add_subdirectory(qml/Muse/Dock)
endif()
