allow for making a shared library (Ref: #137) (#152)

This commit is contained in:
Aaron France 2020-09-28 17:56:05 +02:00 committed by GitHub
parent ece7c94dac
commit 038a944155
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 2 deletions

View file

@ -71,6 +71,13 @@ If you want to turn on optimizations, do
cmake -DCMAKE_BUILD_TYPE=Release . && make cmake -DCMAKE_BUILD_TYPE=Release . && make
``` ```
If you want to build as a library, (necessary to build lsquic itself
as as shared library) do:
```
cmake -DBUILD_SHARED_LIBS=1 . && make
```
Building LSQUIC Library Building LSQUIC Library
----------------------- -----------------------
@ -89,6 +96,8 @@ git submodule update
2. Compile the library 2. Compile the library
Statically:
``` ```
# $BORINGSSL is the top-level BoringSSL directory from the previous step # $BORINGSSL is the top-level BoringSSL directory from the previous step
@ -96,6 +105,14 @@ cmake -DBORINGSSL_DIR=$BORINGSSL .
make make
``` ```
As a dynamic library:
```
cmake -DAS_SHARED_LIB=true .
make
```
3. Run tests 3. Run tests
``` ```

View file

@ -109,5 +109,9 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXXH_HEADER_NAME=\\\"lsquic_xxhash.h\\\"")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQPACK_ENC_LOGGER_HEADER=\\\"lsquic_qpack_enc_logger.h\\\"") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQPACK_ENC_LOGGER_HEADER=\\\"lsquic_qpack_enc_logger.h\\\"")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQPACK_DEC_LOGGER_HEADER=\\\"lsquic_qpack_dec_logger.h\\\"") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQPACK_DEC_LOGGER_HEADER=\\\"lsquic_qpack_dec_logger.h\\\"")
add_library(lsquic STATIC ${lsquic_STAT_SRCS} ) IF(DEFINED AS_SHARED_LIB)
add_library(lsquic SHARED ${lsquic_STAT_SRCS} )
TARGET_LINK_LIBRARIES(lsquic PRIVATE ${BORINGSSL_LIB_ssl} ${BORINGSSL_LIB_crypto} /usr/lib/libz.so)
ELSE()
add_library(lsquic STATIC ${lsquic_STAT_SRCS})
ENDIF()