main
朱子楚 2023-04-01 21:37:07 +08:00
parent b2bfdd17da
commit 32c0b4ccd6
4 changed files with 14 additions and 17 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -8,7 +8,7 @@ set(CMAKE_AUTOUIC ON)
find_package(Qt6 COMPONENTS Core Quick Svg REQUIRED) find_package(Qt6 COMPONENTS Core Quick Svg REQUIRED)
set(QT_INSTALL_QML ${Qt6Core_DIR}/../../../qml) set(QT_INSTALL_QML ${Qt6Core_DIR}/../../../qml)
set(TARGET_TYPE SHARED) set(TARGET_TYPE SHARED)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/FluentUI)
set(TARGET_RESOURCES res.qrc) set(TARGET_RESOURCES res.qrc)
set(TARGET_SOURCES set(TARGET_SOURCES
Def.cpp Def.cpp
@ -46,6 +46,8 @@ endif()
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)
target_compile_definitions(${PROJECT_NAME} PRIVATE VERSION_IN=\\\"1.0.0\\\" URI_STR=\\\"FluentUI\\\") target_compile_definitions(${PROJECT_NAME} PRIVATE VERSION_IN=\\\"1.0.0\\\" URI_STR=\\\"FluentUI\\\")
if(WIN32) if(WIN32)

View File

@ -1,37 +1,32 @@
set(OUTP "${CMAKE_CURRENT_BINARY_DIR}/../bin/FluentUI/") set(OUTP ${CMAKE_BINARY_DIR}/bin/FluentUI/)
add_definitions(-DMACOS) add_definitions(-DMACOS)
# Set DESTDIR to the output directory
set(CMAKE_INSTALL_PREFIX ${OUTP}) set(CMAKE_INSTALL_PREFIX ${OUTP})
set(CMAKE_INSTALL_DESTDIR ${OUTP}) set(CMAKE_INSTALL_DESTDIR ${OUTP})
# Add the current source directory to the include path
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR})
# Set MOC options
set(QMAKE_MOC_OPTIONS -Muri=${uri}) set(QMAKE_MOC_OPTIONS -Muri=${uri})
# Set pre-link commands
add_custom_command( add_custom_command(
TARGET ${PROJECT_NAME} PRE_LINK TARGET ${PROJECT_NAME} POST_BUILD
COMMAND chmod -R 777 ${CMAKE_CURRENT_SOURCE_DIR}/macos_install.sh COMMAND chmod -R 777 ${CMAKE_CURRENT_SOURCE_DIR}/macos_install.sh
)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/macos_install.sh PRESET ${CMAKE_CURRENT_SOURCE_DIR}/ ${OUTP} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/macos_install.sh PRESET ${CMAKE_CURRENT_SOURCE_DIR}/ ${OUTP}
) )
# Set post-link commands for shared library
if(BUILD_SHARED_LIBS)
# Set INST_QMLPATH variable
set(INST_QMLPATH "${QT_INSTALL_QML}/${uri}" REPLACE "\\" "/")
# Set post-link command
if(${TARGET_TYPE} STREQUAL "SHARED")
set(INST_QMLPATH ${QT_INSTALL_QML}/FluentUI)
add_custom_command( add_custom_command(
TARGET ${PROJECT_NAME} POST_LINK TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/macos_install.sh INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/ ${OUTP} ${INST_QMLPATH} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/macos_install.sh INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/ ${OUTP} ${INST_QMLPATH}
) )
# Include dev.pri if it exists
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../../dev.pri)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../dev.pri)
endif()
endif() endif()

0
src/macos_install.sh Normal file → Executable file
View File