EXTRA_LIB and EXTRA_LINK_FLAGS for shared library

Issue #153 resolved
djcj created an issue

Can you enable EXTRA_LIB and EXTRA_LINK_FLAGS for shared libraries? That would make it easier to build shared libraries with support for 8 bit and 10 bit output.

Comments (4)

  1. Steve Borho

    you want to build a single shared lib that exports multiple bit depths? yeah, that makes a lot of sense. I need to think this through

  2. Steve Borho

    it should be possible, in theory, to build 10bit and 12bit with EXPORT_C_API=OFF, but then build 8bit with EXPORT_C_API=ON, then make special API introspection functions for it.

  3. Steve Borho

    cmake: export C API from multilib, enables multibit shared libs (fixes #153)

    With these changes, one can add additional bit depths to any shared lib by compiling the other bit depths with EXPORT_C_API=OFF and then linking those libraries into the "default" build using EXTRA_LIB and then the appropriate LINKED_??BIT cmake options. The default build does export the C API and thus is a fully functional library even for applications which do not yet use the introspection methods.

    The batch files show an example of how to make an 8bit lib which includes 10 and 12bit libraries.

    Note this also closes #154 since users should be building a single combined shared lib which needs no additional link libraries specified in x265.pc

    → <<cset 0905ecb7d8b8>>

  4. djcj reporter

    Very nice. There's still two minor problems though:

    • running `x265 --help' shows "-D/--output-depth 8|10", should be "-D/--output-depth 8|10|12"

    • I need to build the shared library with -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-Bsymbolic" or linking will fail

    edit:

    And if I don't want a shared library I need to add libdl to the extra libs: -DEXTRA_LIB="x265_main10.a;x265_main12.a;-ldl"

  5. Log in to comment