FluentUI/example/CMakeLists.txt

97 lines
2.0 KiB
CMake
Raw Normal View History

2023-04-01 21:01:46 +08:00
cmake_minimum_required(VERSION 3.16)
project(example)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_CXX_STANDARD 17)
2023-04-09 17:59:00 +08:00
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
2023-04-03 22:45:18 +08:00
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(platform 64)
else()
set(platform 32)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../bin/debug)
else()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../bin/release)
endif()
2023-04-01 21:01:46 +08:00
find_package(Qt6 COMPONENTS Core Quick QuickControls2 Concurrent Network Multimedia REQUIRED)
set(SOURCES
ChatController.cpp
2023-04-20 23:37:51 +08:00
AppInfo.cpp
2023-04-01 21:01:46 +08:00
main.cpp
2023-04-20 23:37:51 +08:00
lang/Lang.cpp
lang/Zh.cpp
lang/En.cpp
2023-04-22 00:29:47 +08:00
IPC.cpp
2023-04-01 21:01:46 +08:00
)
set(HEADERS
ChatController.h
2023-04-20 23:37:51 +08:00
AppInfo.h
stdafx.h
lang/Lang.h
lang/Zh.h
lang/En.h
2023-04-22 00:29:47 +08:00
IPC.h
2023-04-01 21:01:46 +08:00
)
set(RESOURCES
qml.qrc
)
set(RC_ICONS
favicon.ico
)
qt_add_resources(QT_RESOURCES ${RESOURCES})
2023-04-03 22:45:18 +08:00
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${QT_RESOURCES} ${RC_ICONS})
2023-04-01 21:01:46 +08:00
if(WIN32)
2023-04-06 19:55:53 +08:00
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
2023-04-09 17:59:00 +08:00
set(DLLPATH ${CMAKE_CURRENT_SOURCE_DIR}/../third/msvc/*.dll)
2023-04-01 21:01:46 +08:00
else()
2023-04-09 17:59:00 +08:00
set(DLLPATH ${CMAKE_CURRENT_SOURCE_DIR}/../third/mingw/*.dll)
2023-04-01 21:01:46 +08:00
endif()
2023-04-09 17:59:00 +08:00
string(REPLACE "/" ${PATH_SEPARATOR} DLLPATH "${DLLPATH}")
file(GLOB DLL_FILES ${DLLPATH})
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${DLL_FILES}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
2023-04-01 21:01:46 +08:00
endif()
target_compile_definitions(${PROJECT_NAME} PRIVATE
QT_DEPRECATED_WARNINGS
QT_NO_WARNING_OUTPUT
)
target_link_libraries(${PROJECT_NAME} PRIVATE
Qt6::Core
Qt6::Quick
Qt6::QuickControls2
Qt6::Concurrent
Qt6::Network
Qt6::Multimedia
)
if(WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE UNICODE WIN32 _WINDOWS)
target_link_libraries(${PROJECT_NAME} PRIVATE dwmapi user32)
endif()
if(APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST Info.plist
)
endif()