Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How add this library to application with vcpkg in manifest mode? #2689

Open
tarhan opened this issue Oct 25, 2024 · 1 comment
Open

How add this library to application with vcpkg in manifest mode? #2689

tarhan opened this issue Oct 25, 2024 · 1 comment
Assignees
Labels
building-system Related to building sytem question Questions about usage, configurations, or issues that don’t clearly classify as bugs

Comments

@tarhan
Copy link

tarhan commented Oct 25, 2024

I'm almost newbie in using vcpkg in manifest mode.

What I want is to compile Mega SDK as static library which I can use in CMake application

It would be good to receive instructions to compile it in isolated way (in devcontainer)

Previously I've compiled SDK using now obsolete Autotools way. As result artefact I received library and PkgConfig's libmega.pc file. Then I using library in CMake project using following commands:

include(FindPkgConfig)
pkg_check_modules(Mega REQUIRED IMPORTED_TARGET libmega)
...
target_link_libraries(megasdk_test1 PRIVATE
    PkgConfig::Mega
)

Now with new vcpkg.json manifest I can compile it in devcontainer using instructions from README.md file.
Then if I execute make install command with custom CMAKE_INSTALL_PREFIX path I've received only partial result. Resulting folder contains:

  • Main megaapi.h.
  • PkgConfig's file sdklib.pc file
  • Static library itself contains 8043 undefined symbols meaning that it needed to be linked with other static libs
  • CMake *Config.cmake and *Targets.cmake files where problems located
    Those CMake points MEGA::SDKlib target to include folders and libs using absolute paths of it dependencies like unofficial-sodium::sodium_config_public, libswresample.so and so on. In my example it looks like /workspaces/sdk-7.10.1/build/vcpkg_installed/x64-linux-mega/debug/lib/libavcodec.so

My guess is to create my application using vcpkg/CMake with somehow pointing to this library.
Maybe I need to include it as git submodule but in that case I need to tell vcpkg to include it as library and dependency of my application.

In some other libraries I saw usage instructions to add them as vcpkg git repository in vcpkg-configuration.json and then add port in dependencies section in vcpkg.json.
But in that cases libraries it self was standard CMake projects. And custom vcpkg was in separate git repository with compile instructions in portfile.cmake script.

Do anyone uses Mega SDK as library in own project using vcpkg?

Can you provide complete instructions to include it as dependency with passing features options like use-freeimage, use-ffmpeg or disabling some of them?

@sergiohs84 sergiohs84 added the question Questions about usage, configurations, or issues that don’t clearly classify as bugs label Nov 7, 2024
@sergiohs84
Copy link
Contributor

Hi @tarhan.

The SDK is used by our official apps, so it should be feasible for you to use it for your CMake app. I'd suggest to add the SDK as a dependency to your project, rather than as an external library. That's how our apps build right now, though you are right, we are not exporting everything that is required.

Let me invite @aabellagm, who can provide further guidance.

In the meantime, you can have a look to the MEGAsync or MEGAcmd projects, which could be used as reference for your app.

@sergiohs84 sergiohs84 added the building-system Related to building sytem label Nov 7, 2024
@sergiohs84 sergiohs84 pinned this issue Nov 15, 2024
@sergiohs84 sergiohs84 unpinned this issue Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
building-system Related to building sytem question Questions about usage, configurations, or issues that don’t clearly classify as bugs
Projects
None yet
Development

No branches or pull requests

3 participants