Skip to content

Commit

Permalink
Replaced(renamed) libsexp --> libsexpp
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Jun 26, 2023
1 parent 0594598 commit a416ef8
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 41 deletions.
41 changes: 38 additions & 3 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Release .
- name: Build
run: cmake --build build --config "Release" --parallel ${{ env.CORES }}
run: cmake --build build --parallel ${{ env.CORES }}

- name: Test
run: |
Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Release .
- name: Build
run: cmake --build build --config "Release" --parallel ${{ env.CORES }}
run: cmake --build build --parallel ${{ env.CORES }}

- name: Test
run: |
Expand Down Expand Up @@ -191,7 +191,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Release .
- name: Build
run: cmake --build build --config "Release" --parallel ${{ env.CORES }}
run: cmake --build build --parallel ${{ env.CORES }}

- name: Test
run: |
Expand All @@ -206,6 +206,41 @@ jobs:
[ ! -d "build/src/tests/googletest-build" ]
[ ! -d "build/src/tests/googletest-src" ]
cmake-system-sexpp:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true

- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install cmake libjson-c-dev libbotan-2-dev asciidoctor googletest
- name: Configure
run: |
echo CORES="$(nproc --all)" >> $GITHUB_ENV
cmake -B build -DBUILD_SHARED_LIBS=ON \
-DCRYPTO_BACKEND=botan \
-DDOWNLOAD_GTEST=OFF \
-DSYSTEM_SEXPP=ON \
-DCMAKE_BUILD_TYPE=Release .
- name: Build
run: cmake --build build --parallel ${{ env.CORES }}

- name: Test
run: |
mkdir -p "build/Testing/Temporary"
cp "cmake/CTestCostData.txt" "build/Testing/Temporary"
export PATH="$PWD/build/src/lib:$PATH"
ctest --parallel ${{ env.CORES }} --test-dir build -C Debug --output-on-failure
package-source:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "src/libsexp"]
path = src/libsexp
url = https://github.com/rnpgp/sexp.git
[submodule "src/libsexpp"]
path = src/libsexpp
url = https://github.com/rnpgp/sexpp.git
18 changes: 6 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,22 +186,16 @@ add_subdirectory(src/common)

if (SYSTEM_LIBSEXP)
find_package(PkgConfig)
pkg_check_modules(REQUIRED sexp>=0.8.5)
pkg_check_modules(REQUIRED sexpp>=0.8.5)
else (SYSTEM_LIBSEXP)
# 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)

# force static libsexpp
set(SAVED_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF)
set(WITH_SEXP_CLI OFF)
set(WITH_SEXP_TESTS OFF)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME development)
add_subdirectory(src/libsexp EXCLUDE_FROM_ALL)

if (MSVC)
set(BUILD_SHARED_LIBS ${SAVED_BUILD_SHARED_LIBS})
endif (MSVC)
add_subdirectory(src/libsexpp EXCLUDE_FROM_ALL)
set(BUILD_SHARED_LIBS ${SAVED_BUILD_SHARED_LIBS})
endif (SYSTEM_LIBSEXP)

add_subdirectory(src/lib)
Expand Down
2 changes: 0 additions & 2 deletions ci/tests/deb-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ 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: 0 additions & 2 deletions ci/tests/pkg-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ 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: 0 additions & 2 deletions ci/tests/rpm-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@ 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
19 changes: 6 additions & 13 deletions src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ elseif (CRYPTO_BACKEND_OPENSSL)
target_link_libraries(librnp-obj PRIVATE OpenSSL::Crypto)
endif()

target_link_libraries(librnp-obj PRIVATE sexp)
target_link_libraries(librnp-obj PRIVATE sexpp)

set_target_properties(librnp-obj PROPERTIES CXX_VISIBILITY_PRESET hidden)
if (TARGET BZip2::BZip2)
Expand Down Expand Up @@ -398,7 +398,7 @@ foreach (prop LINK_LIBRARIES INTERFACE_LINK_LIBRARIES INCLUDE_DIRECTORIES INTERF
get_target_property(val librnp-obj ${prop})
if (BUILD_SHARED_LIBS)
set_property(TARGET librnp-static PROPERTY ${prop} ${val})
list(REMOVE_ITEM val "$<LINK_ONLY:sexp>")
list(REMOVE_ITEM val "$<LINK_ONLY:sexpp>")
set_property(TARGET librnp PROPERTY ${prop} ${val})
else()
set_property(TARGET librnp PROPERTY ${prop} ${val})
Expand Down Expand Up @@ -435,14 +435,7 @@ 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 ${SEXP_INSTALL_TARGET}
install(TARGETS librnp
EXPORT rnp-targets
LIBRARY
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
Expand All @@ -455,20 +448,20 @@ install(TARGETS librnp ${SEXP_INSTALL_TARGET}

# install dll only for windows
if (WIN32)
install(TARGETS librnp ${SEXP_INSTALL_TARGET}
install(TARGETS librnp
RUNTIME
DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT runtime
)
endif(WIN32)
else(BUILD_SHARED_LIBS)
# static libraries only
install(TARGETS librnp sexp
install(TARGETS librnp sexpp
EXPORT rnp-targets
ARCHIVE
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
COMPONENT development
)
)
endif(BUILD_SHARED_LIBS)

# install headers
Expand Down
4 changes: 2 additions & 2 deletions src/librekey/g23_sexp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#ifndef RNP_G23_SEXP_HPP
#define RNP_G23_SEXP_HPP

#include "sexp/sexp.h"
#include "sexp/ext-key-format.h"
#include "sexpp/sexp.h"
#include "sexpp/ext-key-format.h"

#define SXP_MAX_DEPTH 30

Expand Down
1 change: 0 additions & 1 deletion src/libsexp
Submodule libsexp deleted from 47009c
1 change: 1 addition & 0 deletions src/libsexpp
Submodule libsexpp added at e265f6
2 changes: 1 addition & 1 deletion src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ target_link_libraries(rnp_tests
PRIVATE
librnp-static
JSON-C::JSON-C
sexp
sexpp
${GTestMain}
)
if (CRYPTO_BACKEND_LOWERCASE STREQUAL "openssl")
Expand Down

0 comments on commit a416ef8

Please sign in to comment.