Skip to content

Commit

Permalink
allow for making a shared library (Ref: #137) (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
AeroNotix authored Sep 28, 2020
1 parent ece7c94 commit 038a944
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ If you want to turn on optimizations, do
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
-----------------------

Expand All @@ -89,13 +96,23 @@ git submodule update

2. Compile the library

Statically:


```
# $BORINGSSL is the top-level BoringSSL directory from the previous step
cmake -DBORINGSSL_DIR=$BORINGSSL .
make
```

As a dynamic library:

```
cmake -DAS_SHARED_LIB=true .
make
```


3. Run tests

```
Expand Down
8 changes: 6 additions & 2 deletions src/liblsquic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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_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()

0 comments on commit 038a944

Please sign in to comment.