From 29598b7b3601c3bf1781eb43b7b42955efc06b76 Mon Sep 17 00:00:00 2001 From: Vilius Sutkus '89 Date: Mon, 26 Aug 2024 14:27:44 +0300 Subject: [PATCH] Update asset gathering logic --- pdf2htmlEX/CMakeLists.txt | 14 -------------- pdf2htmlEX/build.gradle | 8 ++++---- pdf2htmlEX/conanfile.py | 12 +++++++----- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt index 273475f3..50acafa5 100644 --- a/pdf2htmlEX/CMakeLists.txt +++ b/pdf2htmlEX/CMakeLists.txt @@ -24,17 +24,3 @@ project(pdf2htmlEX-android) find_package(pdf2htmlEX REQUIRED CONFIG) add_subdirectory(src/main/cpp) - -FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/build/assets") -function(copy_assets sourcevar dstsubdir) - if(DEFINED "${sourcevar}") - FILE(REMOVE_RECURSE "${CMAKE_CURRENT_LIST_DIR}/build/assets/${dstsubdir}") - FILE(CREATE_LINK "${${sourcevar}}" "${CMAKE_CURRENT_LIST_DIR}/build/assets/${dstsubdir}" COPY_ON_ERROR SYMBOLIC) - endif() -endfunction() - -copy_assets("PDF2HTMLEX_RES_DIR" "pdf2htmlEX") -copy_assets("POPPLER_DATA_RES_DIR" "poppler-data") -copy_assets("FONTCONFIG_RES_DIR" "fontconfig") - -#@TODO: fontforge cidfiles diff --git a/pdf2htmlEX/build.gradle b/pdf2htmlEX/build.gradle index 2de20bf9..d03cf2dd 100644 --- a/pdf2htmlEX/build.gradle +++ b/pdf2htmlEX/build.gradle @@ -68,17 +68,17 @@ android { version '3.22.1' } ndkVersion '26.3.11579264' - sourceSets.main.assets.srcDirs += "build/assets" + sourceSets.main.assets.srcDirs += "build/conan/armv8/assets" sourceSets.androidTest.assets.srcDirs = [ getProject().parent.getLayout().getProjectDirectory().dir("test/androidTestAssets") ] } -// Assets delivered by conan are gathered by CMake +// Make sure the assets are installed and ready when needed afterEvaluate { tasks.named("generateDebugAssets").configure { - dependsOn(tasks.named("mergeDebugNativeLibs")) + dependsOn(tasks.named("conanInstall-armv8")) } tasks.named("generateReleaseAssets").configure { - dependsOn(tasks.named("mergeReleaseNativeLibs")) + dependsOn(tasks.named("conanInstall-armv8")) } } diff --git a/pdf2htmlEX/conanfile.py b/pdf2htmlEX/conanfile.py index 932a246e..ca65d05a 100644 --- a/pdf2htmlEX/conanfile.py +++ b/pdf2htmlEX/conanfile.py @@ -1,3 +1,5 @@ +import os + from conan import ConanFile from conan.tools.cmake import CMakeToolchain, CMakeDeps @@ -12,10 +14,10 @@ def generate(self): deps = CMakeDeps(self) deps.generate() tc = CMakeToolchain(self) - - # @TODO: figure out how to use POPPLER_DATA_DIR exported by poppler-data - tc.variables["POPPLER_DATA_RES_DIR"] = self.dependencies['poppler-data'].cpp_info.resdirs[0] - tc.variables["PDF2HTMLEX_RES_DIR"] = self.dependencies['pdf2htmlex'].cpp_info.resdirs[0] - tc.variables["FONTCONFIG_RES_DIR"] = self.dependencies['fontconfig'].cpp_info.resdirs[0] tc.generate() + asset_dir = os.path.join(self.build_folder, 'assets') + os.mkdir(asset_dir) + os.symlink(self.dependencies['pdf2htmlex'].cpp_info.resdirs[0], os.path.join(asset_dir, 'pdf2htmlEX')) + os.symlink(self.dependencies['poppler-data'].cpp_info.resdirs[0], os.path.join(asset_dir, 'poppler-data')) + os.symlink(self.dependencies['fontconfig'].cpp_info.resdirs[0], os.path.join(asset_dir, 'fontconfig'))