cmake_minimum_required(VERSION 3.16)

set(PROJECT_VERSION 0.1.0.0)

set(LOTO VERSION ${PROJECT_VERSION} LANGUAGES CXX)

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../bin/${CMAKE_BUILD_TYPE})
set(ENV{QML_IMPORT_PATH} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
find_package(Qt6 COMPONENTS Core Gui Quick REQUIRED)
qt_standard_project_setup()

# 分类文件
FILE(GLOB LOTO_HTTPCLIENT_HPP ${CMAKE_CURRENT_SOURCE_DIR}/httpclient/*.h)
FILE(GLOB LOTO_HTTPCLIENT_CPP ${CMAKE_CURRENT_SOURCE_DIR}/httpclient/*.cpp)
source_group("httpclient/inc" FILES ${LOTO_HTTPCLIENT_HPP})
source_group("httpclient/src" FILES ${LOTO_HTTPCLIENT_CPP})

FILE(GLOB LOTO_INTERACTIVE_HPP ${CMAKE_CURRENT_SOURCE_DIR}/interactive/*.h)
FILE(GLOB LOTO_INTERACTIVE_CPP ${CMAKE_CURRENT_SOURCE_DIR}/interactive/*.cpp)
source_group("interactive/inc" FILES ${LOTO_INTERACTIVE_HPP})
source_group("interactive/src" FILES ${LOTO_INTERACTIVE_CPP})

FILE(GLOB LOTO_USR_HPP ${CMAKE_CURRENT_SOURCE_DIR}/usr/*.h)
FILE(GLOB LOTO_USR_CPP ${CMAKE_CURRENT_SOURCE_DIR}/usr/*.cpp)
source_group("usr/inc" FILES ${LOTO_USR_HPP})
source_group("usr/src" FILES ${LOTO_USR_CPP})

FILE(GLOB LOTO_QML_FILES ${CMAKE_CURRENT_SOURCE_DIR}/qml/*.qml)
list(APPEND ${LOTO_QML_FILES} main.qml)
source_group("qml" FILES ${LOTO_QML_FILES})

source_group("main" FILES main.cpp main.qml)

add_executable(${PROJECT_NAME} main.cpp)

qt_add_qml_module(${PROJECT_NAME}
    URI Loto
    VERSION 1.0
    OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
    QML_FILES
        main.qml
        qml/Login.qml
    SOURCES
        httpclient/HttpClient.h httpclient/HttpClient.cpp
    SOURCES
        interactive/InteractiveTask.h interactive/InteractiveTask.cpp
    SOURCES
        usr/config.h usr/config.cpp
        usr/define.h
)

qt_add_resources(${PROJECT_NAME} "resources"
    PREFIX "/"
    FILES
        resources/png/faceNotice.png
        resources/png/inspection.png
        resources/png/takeback.png
        resources/png/error.png
        resources/png/face.png
        resources/png/instructions.png
        resources/png/pdf_right.png
        resources/png/title_damage.png
        resources/png/min_button.png
        resources/png/title_normal.png
        resources/png/pdfImg.png
        resources/png/fingerNotice.png
        resources/png/finger.png
        resources/png/exception.png
        resources/png/user.png
        resources/png/unknown.png
        resources/png/backspace.png
        resources/png/title_expire.png
        resources/png/right.png
        resources/png/exception_handle.png
        resources/png/replacement.png
        resources/png/main.ico
        resources/png/metrial.png
        resources/png/down.png
        resources/png/pdf_left.png
        resources/png/play.png
        resources/png/user_title.png
        resources/png/card.png
        resources/png/cardNotice.png
        resources/png/videoImg.png
        resources/png/set.png
        resources/png/allsel.png
        resources/png/max_button.png
        resources/png/bozz.png
        resources/png/material.png

        resources/fonts/fonts.txt
)


target_include_directories(${PROJECT_NAME} PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/httpclient
    ${CMAKE_CURRENT_SOURCE_DIR}/interactive
    ${CMAKE_CURRENT_SOURCE_DIR}/usr
)

target_link_libraries(${PROJECT_NAME} PRIVATE
    Qt6::Core
    Qt6::Gui
    Qt6::Quick
)



















