Coder Social home page Coder Social logo

Hard to deal with shared library about units HOT 2 CLOSED

llnl avatar llnl commented on July 24, 2024
Hard to deal with shared library

from units.

Comments (2)

phlptp avatar phlptp commented on July 24, 2024

Thanks for the suggestions. None of our use cases ever use the shared library or install it, so it really hasn't gotten much attention.
We pretty much static link it as a submodule or just include the code directly. C++ shared libraries are always a bit dicey in my opinion. But regardless seems like it could be done better.

Would you propose disabling the ability to make both the static and shared libraries at the same time? If not how would you distinguish between them?

from units.

kerim371 avatar kerim371 commented on July 24, 2024

@phlptp thank you for a quick reply,

Would you propose disabling the ability to make both the static and shared libraries at the same time? If not how would you distinguish between them?

In my experience there were no necessarity to create both static and shared libs at the same time. But I have seen such option few times even in quite big libraries (as I remember VTK provides this but I may be mistaken)

I think that units can be built static by default (i.e. when UNITS_BUILD_SHARED_LIBRARY=OFF) and only if UNITS_BUILD_SHARED_LIBRARY=ON then units should be built in shared mode.

BUT regarding how UNITS_HEADER_ONLY var is working the above proposition can be modified in the following way:

if I understand correct UNITS_HEADER_ONLY makes units to build and install headers only (something like copy include directories to install folder). In this case I think if UNITS_BUILD_SHARED_LIBRARY=ON then there is no need to process UNITS_HEADER_ONLY var because include folder will be copied anyway.
If UNITS_HEADER_ONLY=ON and UNITS_BUILD_SHARED_LIBRARY=OFF then we don't want to build neither static nor shared library and we install only include folder.
If UNITS_HEADER_ONLY=OFF and UNITS_BUILD_SHARED_LIBRARY=OFF then we build static library because there is nothinh else user can expect from building.

Also I expect that if a library provides all the three header only/shared/static mode then I don't want to distinguish my cmake code and C++ code with thoughts like: "What if my user wants to build my library and link to shared units library then I need... Or if he wants to link to static units...". This is super annoying :)

from units.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.