cp2k / dbcsr

DBCSR: Distributed Block Compressed Sparse Row matrix library
https://cp2k.github.io/dbcsr/
GNU General Public License v2.0
135 stars 46 forks source link

Add the posibility to build dbcsr shared library #671

Closed mtaillefumier closed 1 year ago

mtaillefumier commented 1 year ago

trivial change needed when the shared version of libcp2k is needed. OFF by default

jenkins-cscs commented 1 year ago

Can one of the admins verify this patch?

hfp commented 1 year ago

@dev-zero Are all requests for change addressed? If so, let's merge this contribution.

dev-zero commented 1 year ago

https://cmake.org/cmake/help/latest/prop_tgt/POSITION_INDEPENDENT_CODE.html

So, setting it explicitly does not make sense.

mtaillefumier commented 1 year ago

it does as we often link static libraries and dynamic libraries together. Doing so results in potential errors during linking time which is due to the absence of -fPIC during compilation. We can leave it on all the time as the address resolution will happen at linking time if we use archive libraries instead of shared libraries. it has absolutely no influence on performance.

hfp commented 1 year ago

it has absolutely no influence on performance

Well, -fPIC can have an impact but that's nothing to worry about. Though, -fPIC is a necessity for shared libraries and indeed the risk of linking together non-PIC and PIC-objects is far more worrisome.