Включить несколько исходных каталогов в Qt для Android - PullRequest
1 голос
/ 21 октября 2019

Я хочу включить исходный код Java из нескольких каталогов (которые совместно используются проектами) в проект Qt для Android. На http://imaginativethinking.ca/what-the-heck-how-do-i-share-java-code-between-qt-android-projects/ описан подход, который копирует исходные файлы Java:

# This line makes sure my custom manifest file and project specific java code is copied to the android-build folder  
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android  

# This is a custom variable which holds the path to my common Java code  
# I use the $$system_path() qMake function to make sure that my directory separators are correct for the platform I'm compiling on as you need to use the correct separator in the Make file (i.e. \ for Windows and / for Linux)  
commonAndroidFilesPath = $$system_path( $$PWD/../CommonLib/android-sources/src )  

# This is a custom variable which holds the path to the src folder in the output directory. That is where they need to go for the ANT script to compile them.  
androidBuildOutputDir = $$system_path( $$OUT_PWD/../android-build/src )  

# Here is the magic, this is the actual copy command I want to run.  
# Make has a platform agnostic copy command macro you can use which substitutes the correct copy command for the platform you are on: $(COPY_DIR)  
copyCommonJavaFiles.commands = $(COPY_DIR) $${commonAndroidFilesPath} $${androidBuildOutputDir}  

# I tack it on to the 'first' target which exists by default just because I know this will happen before the ANT script gets run.  
first.depends = $(first) copyCommonJavaFiles  
export(first.depends)  
export(copyCommonJavaFiles.commands)  
QMAKE_EXTRA_TARGETS += first copyCommonJavaFiles 

В более поздних версиях Qt код должен быть изменен на:

commonAndroidFilesPath = $$system_path($$PWD/android/src)
androidBuildOutputDir = $$system_path($$OUT_PWD/../android-build)
createCommonJavaFilesDir.commands = $(MKDIR) $${androidBuildOutputDir}
copyCommonJavaFiles.commands = $(COPY_DIR) $${commonAndroidFilesPath} $${androidBuildOutputDir}
first.depends = $(first) createCommonJavaFilesDir copyCommonJavaFiles
export(first.depends)
export(createCommonJavaFilesDir.commands)
export(copyCommonJavaFiles.commands)
QMAKE_EXTRA_TARGETS += first createCommonJavaFilesDir copyCommonJavaFiles

Isэто стандартный путь или есть какие-то встроенные функции для включения нескольких исходных каталогов Java в проекты Qt для Android?

С уважением,

...