|
@@ -5884,3 +5884,21 @@ macro WITHOUT_VERSION() {
|
|
|
macro LINK_EXCLUDE_LIBRARIES(Libs...) {
|
|
|
SET_APPEND(_LINK_EXCLUDE_LIBRARIES_GLOBAL $Libs)
|
|
|
}
|
|
|
+
|
|
|
+### @usage: GENERATE_IMPLIB(Lib, Path, [SONAME Name])
|
|
|
+###
|
|
|
+### Generates a wrapper for external dynamic library using Implib.so and excludes the real library from linker command
|
|
|
+###
|
|
|
+### The wrapper loads the real library on the first call to any of its functions
|
|
|
+###
|
|
|
+### @example:
|
|
|
+###
|
|
|
+### PEERDIR(build/platform/cuda)
|
|
|
+###
|
|
|
+### GENERATE_IMPLIB(cuda $CUDA_TARGET_ROOT/lib64/stubs/libcuda.so SONAME libcuda.so.1)
|
|
|
+###
|
|
|
+macro GENERATE_IMPLIB(Lib, Path, SONAME="") {
|
|
|
+ .CMD=${tool:"contrib/tools/implib"} --target $HARDWARE_TYPE --outdir $BINDIR ${pre=--library-load-name :SONAME} $Path ${hide;output;nopath;suf=.init.c:Path} ${hide;output;nopath;suf=.tramp.S:Path}
|
|
|
+
|
|
|
+ LINK_EXCLUDE_LIBRARIES($Lib)
|
|
|
+}
|