# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (C) 2026 Aether Contributors
#
# This file is part of Aether.
#
# Aether is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Aether 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 Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Aether. If not, see <https://www.gnu.org/licenses/>.

qt_add_executable(aether
    main.cpp
)

# Mark singletons BEFORE qt_add_qml_module so the generated qmldir
# contains the required "singleton" keyword for each type.
set_source_files_properties(
    qml/styles/Theme.qml
    PROPERTIES QT_QML_SINGLETON_TYPE TRUE
)

set_source_files_properties(
    qml/utils/Constants.qml
    PROPERTIES QT_QML_SINGLETON_TYPE TRUE
)

qt_add_qml_module(aether
    URI Aether
    VERSION 1.0
    QML_FILES
        qml/main.qml
        qml/MainWindow.qml
        qml/components/GuildList.qml
        qml/components/ChannelList.qml
        qml/components/ChatArea.qml
        qml/components/MessageList.qml
        qml/components/MessageInput.qml
        qml/components/MemberList.qml
        qml/components/VoiceBar.qml
        qml/styles/Theme.qml
        qml/utils/Constants.qml
)

target_link_libraries(aether PRIVATE
    Qt6::Core
    Qt6::Gui
    Qt6::Quick
    Qt6::QuickControls2
    Qt6::Multimedia
    Qt6::Svg
    Qt6::Network
)

set_target_properties(aether PROPERTIES
    WIN32_EXECUTABLE TRUE
    MACOSX_BUNDLE TRUE
    MACOSX_BUNDLE_GUI_IDENTIFIER "io.stoat.aether"
    MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}"
    MACOSX_BUNDLE_SHORT_VERSION_STRING
        "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
)

add_subdirectory(qml)
add_subdirectory(cpp)
