Skip to content

Commit

Permalink
Update conan asset gathering logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ViliusSutkus89 committed Aug 26, 2024
1 parent 2cbd1a2 commit 18dbfdd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
10 changes: 0 additions & 10 deletions wvWare/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,3 @@ project(wvWare-Android)
find_package(wvware 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("WVWARE_RES_DIR" "wv")
6 changes: 3 additions & 3 deletions wvWare/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
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"))
}
}

Expand Down
7 changes: 6 additions & 1 deletion wvWare/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMakeDeps

Expand All @@ -12,5 +14,8 @@ def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.variables["WVWARE_RES_DIR"] = self.dependencies['wvware'].cpp_info.resdirs[0]
tc.generate()

asset_dir = os.path.join(self.build_folder, 'assets')
os.mkdir(asset_dir)
os.symlink(self.dependencies['wvware'].cpp_info.resdirs[0], os.path.join(asset_dir, 'wv'))

0 comments on commit 18dbfdd

Please sign in to comment.