From a258edde9dab1c5863b7bb1164a4eb4260d12be6 Mon Sep 17 00:00:00 2001 From: jared Date: Thu, 11 May 2023 23:55:04 +0800 Subject: [PATCH] update ImportPath --- examples/TaoQuickShow/CMakeLists.txt | 3 ++- examples/TaoQuickShow/Src/main.cpp | 8 ++++---- examples/TaoQuickShow/TaoQuickShow.pro | 2 +- src/TaoQuick.pri | 4 ---- {cmake => src}/taoQuick.cmake | 11 ++++------- 5 files changed, 11 insertions(+), 17 deletions(-) rename {cmake => src}/taoQuick.cmake (57%) diff --git a/examples/TaoQuickShow/CMakeLists.txt b/examples/TaoQuickShow/CMakeLists.txt index b6e3228..3212be1 100644 --- a/examples/TaoQuickShow/CMakeLists.txt +++ b/examples/TaoQuickShow/CMakeLists.txt @@ -26,7 +26,8 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/3rdparty/TaoCommon/src/TaoCommon ${CMAKE_SO -include(taoQuick) +include(${PROJECT_SOURCE_DIR}/src/taoQuick.cmake) + message("TaoQuickRes ${TaoQuickRes}") set (Res Qml.qrc Contents.qrc Image.qrc) if (CMAKE_BUILD_TYPE MATCHES "Release") diff --git a/examples/TaoQuickShow/Src/main.cpp b/examples/TaoQuickShow/Src/main.cpp index aec2b15..bdfa3df 100644 --- a/examples/TaoQuickShow/Src/main.cpp +++ b/examples/TaoQuickShow/Src/main.cpp @@ -53,10 +53,10 @@ int main(int argc, char** argv) appInfo.beforeUiReady(view.rootContext()); view.engine()->addImportPath(qmlPath); -#ifdef TaoQuickImport - view.engine()->addImportPath(TaoQuickImport); - view.rootContext()->setContextProperty("taoQuickImportPath", TaoQuickImport); - qWarning() << "TaoQuickImportPath " << TaoQuickImport; +#ifdef TaoQuickImportPath + view.engine()->addImportPath(TaoQuickImportPath); + view.rootContext()->setContextProperty("taoQuickImportPath", TaoQuickImportPath); + qWarning() << "TaoQuickImportPath " << TaoQuickImportPath; #endif #ifdef TAODEBUG diff --git a/examples/TaoQuickShow/TaoQuickShow.pro b/examples/TaoQuickShow/TaoQuickShow.pro index 35075f7..01fde38 100644 --- a/examples/TaoQuickShow/TaoQuickShow.pro +++ b/examples/TaoQuickShow/TaoQuickShow.pro @@ -33,7 +33,7 @@ DEFINES += QMAKE_GEN_TAOMACRO !build_pass { headerContents = \ "$${LITERAL_HASH}pragma once" \ - "$${LITERAL_HASH}define TaoQuickImport $${TaoQuickImport}" \ + "$${LITERAL_HASH}define TaoQuickImportPath $${TaoQuickImportPath}" \ "$${LITERAL_HASH}define qmlPath $${qmlPath}" \ "$${LITERAL_HASH}define contentsPath $${contentsPath}" \ "$${LITERAL_HASH}define imgPath $${imgPath}" \ diff --git a/src/TaoQuick.pri b/src/TaoQuick.pri index 9cc120a..f9494dd 100644 --- a/src/TaoQuick.pri +++ b/src/TaoQuick.pri @@ -6,8 +6,6 @@ CONFIG(debug,debug|release){ } else { path=$$system("pwd") } - TaoQuickImport=\"file:///$$path/\" - TaoQuickImage=\"file:///$$path/TaoQuick/Images/\" DEFINES += TaoQuickImportPath=\\\"file:///$${path}/\\\" OTHER_FILES += $$files($$path/TaoQuick/Qml/*.qml, true) @@ -16,8 +14,6 @@ CONFIG(debug,debug|release){ # release mode use qrc file RESOURCES += $$PWD/TaoQuick/TaoQuick.qrc # release mode set importPath with 'qrc:///' - TaoQuickImport=\"qrc:/\" - TaoQuickImage=\"qrc:/TaoQuick/Images/\" DEFINES += TaoQuickImportPath=\\\"qrc:///\\\" } diff --git a/cmake/taoQuick.cmake b/src/taoQuick.cmake similarity index 57% rename from cmake/taoQuick.cmake rename to src/taoQuick.cmake index ad4eb04..1507817 100644 --- a/cmake/taoQuick.cmake +++ b/src/taoQuick.cmake @@ -1,16 +1,13 @@ -set(TaoQuickPath ${CMAKE_SOURCE_DIR}/src) +set(TaoQuickPath ${CMAKE_CURRENT_LIST_DIR}) if (CMAKE_BUILD_TYPE MATCHES "Release") set(TaoQuickRes ${TaoQuickPath}/TaoQuick/TaoQuick.qrc CACHE STRING "tao quick res path") - set(TaoQuickImport "qrc:///" CACHE STRING "tao quick import path") + set(TaoQuickImportPath "qrc:///" CACHE STRING "tao quick import path") else() - set(TaoQuickImport "file:///${TaoQuickPath}/" CACHE STRING "tao quick import path") + set(TaoQuickImportPath "file:///${TaoQuickPath}/" CACHE STRING "tao quick import path") endif() -add_compile_definitions(TaoQuickImport="${TaoQuickImport}") -add_compile_definitions(TaoQuickImage="${TaoQuickImage}") - -add_compile_definitions(TaoQuickImportPath="${TaoQuickImport}") +add_compile_definitions(TaoQuickImportPath="${TaoQuickImportPath}") #add_compile_definitions(QML_IMPORT_PATH="${TaoQuickPath}") #add_compile_definitions(QML2_IMPORT_PATH="${TaoQuickPath}")