main
朱子楚\zhuzi 2023-04-03 22:45:18 +08:00
parent 0d4477437f
commit 9d89328a43
3 changed files with 34 additions and 12 deletions

View File

@ -7,6 +7,18 @@ set(CMAKE_AUTOUIC ON)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
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()
find_package(Qt6 COMPONENTS Core Quick QuickControls2 Concurrent Network Multimedia REQUIRED) find_package(Qt6 COMPONENTS Core Quick QuickControls2 Concurrent Network Multimedia REQUIRED)
set(SOURCES set(SOURCES
@ -28,17 +40,26 @@ set(RC_ICONS
qt_add_resources(QT_RESOURCES ${RESOURCES}) qt_add_resources(QT_RESOURCES ${RESOURCES})
if(WIN32)
if(QT_ARCH EQUAL 32)
set(COPYDLL ${CMAKE_CURRENT_SOURCE_DIR}/../third/Win_x86/*.dll ${DESTDIR})
else()
set(COPYDLL ${CMAKE_CURRENT_SOURCE_DIR}/../third/Win_x64/*.dll ${DESTDIR})
endif()
set(QMAKE_PRE_LINK "${QMAKE_COPY} ${COPYDLL}")
endif()
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${QT_RESOURCES} ${RC_ICONS}) add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${QT_RESOURCES} ${RC_ICONS})
if(WIN32)
if(platform EQUAL 32)
file(GLOB DLL_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../third/Win_x86/*.dll)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${DLL_FILES}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
else()
file(GLOB DLL_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../third/Win_x64/*.dll)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${DLL_FILES}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
endif()
endif()
target_compile_definitions(${PROJECT_NAME} PRIVATE target_compile_definitions(${PROJECT_NAME} PRIVATE
QT_DEPRECATED_WARNINGS QT_DEPRECATED_WARNINGS
QT_NO_WARNING_OUTPUT QT_NO_WARNING_OUTPUT

View File

@ -45,12 +45,13 @@ else()
set(TARGET_SOURCES ${TARGET_SOURCES} FramelessView_unix.cpp) set(TARGET_SOURCES ${TARGET_SOURCES} FramelessView_unix.cpp)
endif() endif()
add_definitions(-DVERSION_IN="1.0.0")
add_definitions(-DVURI_STR="FluentUI")
add_library(${PROJECT_NAME} ${TARGET_TYPE} ${TARGET_SOURCES} ${TARGET_HEADERS} ${TARGET_RESOURCES}) add_library(${PROJECT_NAME} ${TARGET_TYPE} ${TARGET_SOURCES} ${TARGET_HEADERS} ${TARGET_RESOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/FluentUI) set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/FluentUI)
target_compile_definitions(${PROJECT_NAME} PRIVATE VERSION_IN=\\\"1.0.0\\\" URI_STR=\\\"FluentUI\\\")
if(WIN32) if(WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE dwmapi user32) target_link_libraries(${PROJECT_NAME} PRIVATE dwmapi user32)
else() else()

View File

@ -22,7 +22,7 @@ Fluent *Fluent::getInstance()
QString Fluent::version() const QString Fluent::version() const
{ {
return QStringLiteral("1.0.0"); return QStringLiteral(VERSION_IN);
} }
void Fluent::registerTypes(const char *uri){ void Fluent::registerTypes(const char *uri){