103 lines
3.0 KiB
CMake
103 lines
3.0 KiB
CMake
set(CMAKE_AUTOMOC ON)
|
|
set(CMAKE_AUTORCC ON)
|
|
set(CMAKE_AUTOUIC ON)
|
|
|
|
add_executable(${TG_APP}
|
|
src/main.cpp
|
|
src/wnd_main.cpp
|
|
src/wnd_main.h
|
|
src/resource.cpp
|
|
src/resource.h
|
|
src/wnd_resource.cpp
|
|
src/wnd_resource.h
|
|
src/wnd_inspector.cpp
|
|
src/wnd_inspector.h
|
|
src/wnd_hierachy.cpp
|
|
src/wnd_hierachy.h
|
|
src/wnd_debug.cpp
|
|
src/wnd_debug.h
|
|
src/states.h
|
|
src/states.cpp
|
|
src/wgt_listitem.cpp
|
|
src/wgt_listitem.h
|
|
src/wnd_create_mat.cpp
|
|
src/wnd_create_mat.h
|
|
src/wgt_prop_input.cpp
|
|
src/wgt_prop_input.h
|
|
src/wnd_add_tex.cpp
|
|
src/wnd_add_tex.h
|
|
)
|
|
|
|
set(INC_QTLIB
|
|
Qt::Core
|
|
Qt::Gui
|
|
Qt::Widgets
|
|
)
|
|
target_link_libraries(${TG_APP}
|
|
PUBLIC
|
|
${INC_QTLIB}
|
|
${TG_RENDER}
|
|
${TG_CORE}
|
|
${TG_ZASSIMP}
|
|
${TG_TOOL}
|
|
ole32
|
|
windowscodecs
|
|
)
|
|
|
|
set_target_properties(${TG_APP}
|
|
PROPERTIES
|
|
WIN32_EXECUTABLE FALSE
|
|
)
|
|
|
|
# 拷贝 assets 目录
|
|
add_custom_command(TARGET ${TG_APP} POST_BUILD
|
|
COMMAND "${CMAKE_COMMAND}"
|
|
"-DSRC_DIR=${CMAKE_SOURCE_DIR}/assets"
|
|
"-DDST_DIR=$<TARGET_FILE_DIR:${TG_APP}>/assets"
|
|
-P "${CMAKE_SOURCE_DIR}/cmake/copy_assets_to_output.cmake"
|
|
|
|
COMMENT "Copying assets..."
|
|
VERBATIM
|
|
)
|
|
|
|
# 拷贝 assimp相关依赖
|
|
add_custom_command(TARGET ${TG_APP} POST_BUILD
|
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
|
|
"$<TARGET_FILE:${TG_IMPORTED}>"
|
|
"$<TARGET_FILE_DIR:${TG_APP}>"
|
|
)
|
|
|
|
# 拷贝 QT相关依赖
|
|
#if (WIN32 AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
|
|
if (WIN32)
|
|
set(DEBUG_SUFFIX)
|
|
if (MSVC AND CMAKE_BUILD_TYPE MATCHES "Debug")
|
|
set(DEBUG_SUFFIX "d")
|
|
endif ()
|
|
set(QT_INSTALL_PATH "${PATH_QT}")
|
|
if (NOT EXISTS "${QT_INSTALL_PATH}/bin")
|
|
set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..")
|
|
if (NOT EXISTS "${QT_INSTALL_PATH}/bin")
|
|
set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..")
|
|
endif ()
|
|
endif ()
|
|
if (EXISTS "${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll")
|
|
add_custom_command(TARGET ${TG_APP} POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory
|
|
"$<TARGET_FILE_DIR:${TG_APP}>/plugins/platforms/")
|
|
add_custom_command(TARGET ${TG_APP} POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
"${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll"
|
|
"$<TARGET_FILE_DIR:${TG_APP}>/plugins/platforms/")
|
|
endif ()
|
|
foreach (QTLIB ${INC_QTLIB})
|
|
string(REPLACE "Qt::" "" VAR ${QTLIB})
|
|
list(APPEND _INC_QTLIB ${VAR})
|
|
endforeach (QTLIB)
|
|
foreach (QT_LIB ${_INC_QTLIB})
|
|
add_custom_command(TARGET ${TG_APP} POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
"${QT_INSTALL_PATH}/bin/Qt6${QT_LIB}${DEBUG_SUFFIX}.dll"
|
|
"$<TARGET_FILE_DIR:${TG_APP}>")
|
|
endforeach (QT_LIB)
|
|
endif () |