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 to gradually transform an existing repo into BDE style? #35

Open
Scicomath opened this issue Jun 3, 2021 · 3 comments
Open

How to gradually transform an existing repo into BDE style? #35

Scicomath opened this issue Jun 3, 2021 · 3 comments

Comments

@Scicomath
Copy link

Hi, I currently try to transform an existing repo into BDE style gradually.
In the process, some BDE-style packages depend on some other existing code or third-party library. I read the bde-tools docs, but can't find explicit instructions on this topic.

Can someone help me with this problem?

@mversche
Copy link
Contributor

mversche commented Jun 3, 2021

So, you have a repository with packages that depend on external libraries, and you want to configure your repository so that you can build against it?

If you haven't read it already, here is some useful background on the organization of BDE style repositories.

Prerequesites:

  • The external code or third party library must be built. And there must be metadata describing how to build against it (include and library paths, etc). The most common piece of metadata would be a pkg-config (.pc) file. Many (but not all) 3rd party libraries and build systems (like CMake) can generate a .pc file automatically, one can also be created by hand (though that is obviously less than ideal.

  • The .pc file must be available in the PKG_CONFIG_PATH

I believe there is a CMake specific alternative to .pc files which can also be used, but I'm not personally familiar with it (someone more familiar might be able to give you a pointer). Assuming the 3rd party library is open-source, if you provided a link to it I could maybe give a more specific suggestion.

Assuming you now have metadata (a .pc file) for this external code that describes how to build and link against it, the rest is straight forward: For a package, or group of packages, to depend on a external library, that library should be added to the .dep metadata file for that package. As an example, the bdl library has dependencies on the 3rd party libraries pcre and inteldfp, so those libraries appear in its .dep file

The build system, when it sees an entry in a .dep file (like pcre), will first look to see if that dependency is in the current repository or workspace, and if not, will look for either a CMake or package-config file in the PKG_CONFIG_PATH (where hopefully it will find the .pc file for your external code). If you install the BDE libraries, you will see they deploy .pc files allowing other code to be built against them.

@mversche
Copy link
Contributor

mversche commented Jun 3, 2021

When working on this, I'd suggest using the very verbose option for cmake_build.py (which will provide more information about what is happening, in case the external dependency is not found).

 eval `bde_build_env.py`   # configure environment variables like CXX
 cmake_build.py configure -vv  # configure, with very verbose output

@Scicomath
Copy link
Author

@mversche Thanks for your reply!

I am not familiar with pkg-config and most of the code to integrate is not a third party library but legacy code. Our project's current build system is CMake, so I am really hoping a CMake solution to this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants