cmake_minimum_required(VERSION 3.16)

project(lab-navigation-dynamic VERSION 0.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick Widgets QuickWidgets WebView WebEngineQuick)

qt_standard_project_setup(REQUIRES 6.5)

message("------1 ${PROJECT_NAME}")

include_directories(${CMAKE_SOURCE_DIR}
    ${CMAKE_SOURCE_DIR}/constant
    ${CMAKE_SOURCE_DIR}/router
    ${CMAKE_SOURCE_DIR}/entity
    ${CMAKE_SOURCE_DIR}/src
    ${CMAKE_SOURCE_DIR}/src/page/viewmodel
)

qt_add_executable(${PROJECT_NAME}
    src/main.cpp
    constant/page_constants.h
    constant/launch_constants.h
    constant/enum_helper.h

)

qt_add_qml_module(${PROJECT_NAME}
    URI com.dafay.qmlmodule
    VERSION 1.0
    QML_FILES
        res/page/MainContainerPage.qml
        res/page/HomeFirstPage.qml
        res/page/HomeSecondPage.qml
        res/page/HomeThirdPage.qml
        res/page/HomeTwinContainerPage.qml
        res/page/secondary/LeftFirstPage.qml
        res/page/secondary/LeftSecondPage.qml
        res/page/secondary/RightFirstPage.qml
        res/page/secondary/RightSecondPage.qml
        res/page/small/SmallContainerPage.qml
        res/page/small/SmallFirstPage.qml
        res/page/small/SmallSecondPage.qml
        res/page/test/TestPage.qml
        res/navigate_utils.js
       
    SOURCES
        constant/page_constants.h
        constant/launch_constants.h
        constant/enum_helper.h
        router/main_page_router.h
        router/main_page_router.cpp
        router/small_page_router.h
        router/small_page_router.cpp
        entity/QUserInfo.h
        entity/QUserInfo.cpp
        src/page/viewmodel/user_viewmodel.h
        src/page/viewmodel/user_viewmodel.cpp

)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
set_target_properties(${PROJECT_NAME} PROPERTIES
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)

target_link_libraries(${PROJECT_NAME}
    PRIVATE 
    Qt6::Core
    Qt6::Gui
    Qt6::Qml
    Qt6::Quick
    Qt6::Widgets
    Qt6::QuickWidgets
    Qt6::WebView
    Qt6::WebEngineQuick
)

include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
