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

CMake build both static and dynamic library #83

Open
RSpliet opened this issue Apr 28, 2024 · 2 comments
Open

CMake build both static and dynamic library #83

RSpliet opened this issue Apr 28, 2024 · 2 comments

Comments

@RSpliet
Copy link

RSpliet commented Apr 28, 2024

For context: to support the work I used to do with SystemC as part of my PhD and since then as a "hobby", for a while now I've had a public Fedora/RedHat/CentOS COPR RPM build repository of SystemC [0]. To generate both the dynamic (.so) library as well as the static (.a) library from the same CMake build, I've always relied on a slightly hacked-up CMakeListst.txt. Unfortunately on every rebase I'd have to re-do the hack, which is why up until today I hadn't done so. On the plus-side, SystemC 3.0.0 makes it easier to perform this hack-up.
Attached to this issue I've attached the patch I've used to achieve both my output files. However, it has two main issues:

  1. I probably broke any build that isn't BUILD_SHARED_LIBS on Linux,
  2. It compiles all the source files twice. Which is "good enough" for my purposes but not ideal.

So, to support myself on future rebases as well as other (aspiring) distro packager maintainers, I want to request for the CMake builder to support a mode in which it outputs both the .a and the .so from the same build.

[0] https://copr.fedorainfracloud.org/coprs/rspliet/SystemC/
0001-CMakeLists-build-both-static-and-dynamic.zip

@lmailletcontoz
Copy link
Contributor

Thanks for the feedback. Could you propose a Pull Request for further consideration, keeping in mind that the CMake flow shall also support Windows.

@RSpliet
Copy link
Author

RSpliet commented May 25, 2024

@lmailletcontoz Thanks for your reply. Truthfully: I don't think I can. I'm afraid I neither have the operating systems (Windows, Mac OS X, various flavours of Linux/BSD?) to test such a change on, nor a good understanding of all the other requirements of the CMake build system to know whether any change I make is good or whether it breaks more than it fixes. This issue is best treated as a feature request. perhaps directed at @pah or anyone who is either better versed in the full SystemC CMake build or better placed to take a deep dive. And since I'm not putting my money where my mouth is, I of course won't be offended if this doesn't get picked up in the end.

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