这是indexloc提供的服务,不要输入任何密码
Skip to content

[FR] [QUESTION] How to model optional dependencies? #160

@madebr

Description

@madebr

Is your feature request related to a problem? Please describe.

My application is able to dynamically load dependencies using dlopen + dladdr.
I have modeled every library using prefab json files.

But I don't know of any way, other then explicitly do target_link_libraries to add a dynamic dependency to the .apk.

Describe the solution you'd like

I have 2 suggestions:

  1. add every dependency of the target to the .apk.
    Doing add_dependencies(myexecutable dynamic_dependency), should add dynamic_dependency to the .apk as well
  2. add some function to the android cmake toolchain script that marks a target to be added to the .apk:
    add_target_to_apk(dynamic_dependency)

Describe alternatives you've considered

Right now, I'm simply doing

target_link_libraries(mygame PRIVATE dynamic_dependency)

This type of dependency is honored by android's cmake support,
but should not be necessary.

Additional context

I have encountered this issue while creating a prefab aar for SDL_image.
SDL_image provides decoders for various image formats.
Because not every applications needs every decoder, these are dynamically loaded.
Dynamically loading also reduces the file size of an .apk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions