cmake_minimum_required(VERSION 3.5)

project(005ReadVis VERSION 0.1 LANGUAGES CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt5 REQUIRED COMPONENTS Widgets)

include(../cmake/pe.cmake)
include(../cmake/fbxsdk.cmake)
include(lib/simplelog/simplelog.cmake)

set(UI
    ui/mainwindow.h
    ui/mainwindow.cpp
    ui/mainwindow.ui
    ui/framelesswindow.h
    ui/framelesswindow.cpp
    ui/savepathwidget.h
    ui/savepathwidget.cpp
)
source_group(ui FILES ${UI})

set(UI_PEQT
    ui/peqt/peviewqt.h
    ui/peqt/peviewqt.cpp
    ui/peqt/peviewqtprivate.h
    ui/peqt/peviewqtprivate.cpp
)
source_group(ui/peqt FILES ${UI_PEQT})

set(UI_TREEMODEL
    ui/treemodel/treeitem.h
    ui/treemodel/treeitem.cpp
    ui/treemodel/treemodel.h
    ui/treemodel/treemodel.cpp
)
source_group(ui/treemodel FILES ${UI_TREEMODEL})


set(UI_COMMON
    ui/common/inittip.h
    ui/common/inittip.cpp
    ui/common/QWaitProgressBar.h
    ui/common/QWaitProgressBar.cpp
)
source_group(ui/common FILES ${UI_COMMON})

set(UI_COMMON_FRAMELESS
    ui/common/frameless/frameless_define.h
    ui/common/frameless/framelesshelper.cpp
    ui/common/frameless/framelesshelper.h
    ui/common/frameless/framelesstitlebar.cpp
    ui/common/frameless/framelesstitlebar.h
    ui/common/frameless/framelesstitlebar_p.h
    ui/common/frameless/titlebar.h
    ui/common/frameless/titlebar.cpp
)
source_group(ui/common/frameless FILES ${UI_COMMON_FRAMELESS})

set(MAIN
    main/main.cpp
    main/mainobject.h
    main/mainobject.cpp
)
source_group(main FILES ${MAIN})

set(COMMON
    common/global.h
    common/global.cpp
    common/strconv.h
    common/strconv.cpp
    common/my_utility.h
    common/my_utility.cpp
)
source_group(common FILES ${COMMON})

set(UTILITY
    utility/pesdkutiltiy.h
    utility/pesdkutiltiy.cpp
    utility/fbxsdkutility.h
    utility/fbxsdkutility.cpp
)
source_group(utility FILES ${UTILITY})

set(RES
    res/res.qrc
)
source_group(res FILES ${RES})

#set(CMAKE_AUTOUIC_SEARCH_PATHS "ui/common")
include_directories(
    ui
    ui/peqt
    ui/treemodel
    ui/common
    ui/common/frameless
    main
    common
    utility
    lib/stb
)

set(PROJECT_SOURCES
    ${UI}
    ${UI_PEQT}
    ${UI_TREEMODEL}
    ${MAIN}
    ${COMMON}
    ${UI_COMMON}
    ${UI_COMMON_FRAMELESS}
    ${UTILITY}
    ${RES}
)


set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../bin)

add_executable(${PROJECT_NAME}
    ${PROJECT_SOURCES}
)

target_link_libraries(${PROJECT_NAME} PRIVATE
    Qt5::Widgets
    ${PE_LIB_FILE}
    ${FBX_LIB}
    ${SIMPLELOG_LIBS}
)
