Skip to content

Commit

Permalink
Finalized usage of libsexp shared library
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Jun 24, 2023
1 parent 9d79749 commit 0594598
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
13 changes: 10 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,20 @@ if (SYSTEM_LIBSEXP)
find_package(PkgConfig)
pkg_check_modules(REQUIRED sexp>=0.8.5)
else (SYSTEM_LIBSEXP)
set(SAVE_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF)
# cannot build shared lib(dll) with MSVC for now
if (MSVC)
set(SAVED_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF)
endif (MSVC)

set(WITH_SEXP_CLI OFF)
set(WITH_SEXP_TESTS OFF)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME development)
add_subdirectory(src/libsexp EXCLUDE_FROM_ALL)
set(BUILD_SHARED_LIBS ${SAVE_BUILD_SHARED_LIBS})

if (MSVC)
set(BUILD_SHARED_LIBS ${SAVED_BUILD_SHARED_LIBS})
endif (MSVC)
endif (SYSTEM_LIBSEXP)

add_subdirectory(src/lib)
Expand Down
2 changes: 2 additions & 0 deletions ci/tests/deb-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ DIR_CMAKE="$INSTALL_PREFIX/lib/x86_64-linux-gnu/cmake/rnp"

declare expected_libraries=(
"$DIR_LIB/librnp.so.0"
"$DIR_LIB/libsexp.so.0"
)

declare expected_devlibraries=(
"$DIR_LIB/librnp.so"
"$DIR_LIB/libsexp.so.0"
"$DIR_LIB/pkgconfig/librnp.pc"
)

Expand Down
2 changes: 2 additions & 0 deletions ci/tests/pkg-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ DIR_CMAKE="$INSTALL_PREFIX/lib/cmake/rnp"

declare expected_libraries=(
"$DIR_LIB/librnp.so.0"
"$DIR_LIB/libsexp.so.0"
)

declare expected_devlibraries=(
"$DIR_LIB/librnp.so"
"$DIR_LIB/libsexp.so.0"
"$DIR_LIB/pkgconfig/librnp.pc"
)

Expand Down
2 changes: 2 additions & 0 deletions ci/tests/rpm-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ DIR_CMAKE="$INSTALL_PREFIX/lib64/cmake/rnp"

declare expected_libraries=(
"$DIR_LIB/librnp.so.0"
"$DIR_LIB/libsexp.so.0"
)

declare expected_devlibraries=(
"$DIR_LIB/librnp.so"
"$DIR_LIB/libsexp.so.0"
"$DIR_LIB/pkgconfig/librnp.pc"
)

Expand Down
10 changes: 8 additions & 2 deletions src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,14 @@ endif()
# If a client application uses static rnp library, it still needs libsexp.a and it is installed

if (BUILD_SHARED_LIBS)
if (NOT SYSTEM_LIBSEXP AND NOT MSVC)
set (SEXP_INSTALL_TARGET "sexp")
else (NOT SYSTEM_LIBSEXP AND NOT MSVC)
set (SEXP_INSTALL_TARGET "")
endif (NOT SYSTEM_LIBSEXP AND NOT MSVC)

# both static and shared libraries
install(TARGETS librnp
install(TARGETS librnp ${SEXP_INSTALL_TARGET}
EXPORT rnp-targets
LIBRARY
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
Expand All @@ -449,7 +455,7 @@ install(TARGETS librnp

# install dll only for windows
if (WIN32)
install(TARGETS librnp
install(TARGETS librnp ${SEXP_INSTALL_TARGET}
RUNTIME
DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT runtime
Expand Down

0 comments on commit 0594598

Please sign in to comment.